Verified Commit 7a436160 authored by Roberto Leinardi's avatar Roberto Leinardi
Browse files

Fixed charts background being always white with latest matplotlib version

parent 06d2d162
......@@ -14,3 +14,5 @@
12. Make a PR to the Flathub repository master, test the build and, if OK, merge the PR (https://github.com/flathub/com.leinardi.gwe)
13. `git commit -am "Release X.X.X" && git push` (where X.Y.Z is the version you set in step 1)
14. Create a PR from [master](../../tree/master) to [release](../../tree/release)
15. Using the "Edit release note" button, add the changelog items to the newly created tag on GitLab to make it an official Release (https://gitlab.com/leinardi/gkraken/-/tags)
16. Announce the new release on the App's Discord channel
\ No newline at end of file
......@@ -19,6 +19,7 @@ from typing import Optional, Any, Dict, Tuple
from gi.repository import Gio, GLib, Gtk, Gdk
from matplotlib.axes import Axes
from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas
from matplotlib.colors import ColorConverter
from matplotlib.figure import Figure
from gwe.conf import MIN_TEMP, MAX_TEMP, FAN_MAX_DUTY, GRAPH_COLOR_HEX
......@@ -60,6 +61,14 @@ def init_plot_chart(scrolled_window: Gtk.ScrolledWindow,
figure: Figure,
canvas: FigureCanvas,
axis: Axes) -> Tuple:
axis.patch.set_visible(False)
temp_window = Gtk.Window()
style = temp_window.get_style_context()
bg_colour = style.get_background_color(Gtk.StateType.NORMAL).to_color().to_floats()
cc = ColorConverter()
cc.to_rgba(bg_colour)
figure.patch.set_facecolor(bg_colour)
axis.grid(True, linestyle=':')
axis.margins(x=0, y=0.05)
......@@ -68,7 +77,6 @@ def init_plot_chart(scrolled_window: Gtk.ScrolledWindow,
text_color = rgba_to_hex(temp_label.get_style_context().get_color(Gtk.StateType.NORMAL))
text_color_alpha = text_color[:-2] + '80'
scrolled_window.remove(temp_label)
axis.set_facecolor('#00000000')
axis.set_xlabel('Temperature [°C]', color=text_color)
axis.set_ylabel('Duty [%]', color=text_color)
axis.tick_params(colors=text_color, grid_color=text_color_alpha)
......
injector==0.18.4
matplotlib==3.3.2
peewee==3.14.0
matplotlib==3.4.1
peewee==3.14.4
py3nvml==0.2.6
PyGObject==3.38.0
python-xlib==0.29
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment