From 8a2beac185a742f4b5f4f49ab5e6480baa64f3fe Mon Sep 17 00:00:00 2001 From: Sigma-One Date: Wed, 28 Jul 2021 11:22:08 +0300 Subject: Full graph colour configuration --- printrun/gui/graph.py | 27 +++++++++++++-------------- printrun/pronterface.py | 9 +++++++++ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/printrun/gui/graph.py b/printrun/gui/graph.py index cb09519..cff32af 100644 --- a/printrun/gui/graph.py +++ b/printrun/gui/graph.py @@ -140,10 +140,10 @@ class Graph(BufferedCanvas): # gc.DrawLines(wx.Point(0, 0), wx.Point(50, 10)) font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD) - gc.SetFont(font, wx.Colour(23, 44, 44)) + gc.SetFont(font, wx.Colour(self.root.settings.graph_color_text)) # draw vertical bars - dc.SetPen(wx.Pen(wx.Colour(225, 225, 225), 1)) + dc.SetPen(wx.Pen(wx.Colour(self.root.settings.graph_color_grid), 1)) xscale = float(self.width - 1) / (self.xbars - 1) for x in range(self.xbars + 1): x = x * xscale @@ -154,7 +154,7 @@ class Graph(BufferedCanvas): yspan = self.maxyvalue - self.minyvalue ybars = int(yspan / spacing) # Should be close to self.ybars firstbar = int(ceil(self.minyvalue / spacing)) # in degrees - dc.SetPen(wx.Pen(wx.Colour(225, 225, 225), 1)) + dc.SetPen(wx.Pen(wx.Colour(self.root.settings.graph_color_grid), 1)) for y in range(firstbar, firstbar + ybars + 1): # y_pos = y*(float(self.height)/self.ybars) degrees = y * spacing @@ -207,9 +207,8 @@ class Graph(BufferedCanvas): return 10 ** (exponent + 1) def drawtemperature(self, dc, gc, temperature_list, - text, text_xoffset, r, g, b, a): - color = self.timer.IsRunning() and (r, g, b, a) or [128] * 4 - dc.SetPen(wx.Pen(color, 1)) + text, text_xoffset, color): + dc.SetPen(wx.Pen(wx.Colour(color), 1)) x_add = float(self.width) / self.xsteps x_pos = 0.0 @@ -228,7 +227,7 @@ class Graph(BufferedCanvas): if text: font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD) # font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL) - gc.SetFont(font, color[:3]) + gc.SetFont(font, wx.Colour(color)) text_size = len(text) * text_xoffset + 1 pos = self.layoutText(text, lastxvalue, lastyvalue, gc) @@ -298,31 +297,31 @@ class Graph(BufferedCanvas): def drawfanpower(self, dc, gc): self.drawtemperature(dc, gc, self.fanpowers, - "Fan", 1, 0, 0, 0, 128) + "Fan", 1, self.root.settings.graph_color_fan) def drawbedtemp(self, dc, gc): self.drawtemperature(dc, gc, self.bedtemps, - "Bed", 2, 255, 0, 0, 128) + "Bed", 2, self.root.settings.graph_color_bedtemp) def drawbedtargettemp(self, dc, gc): self.drawtemperature(dc, gc, self.bedtargettemps, - "Bed Target", 2, 255, 120, 0, 128) + "Bed Target", 2, self.root.settings.graph_color_bedtarget) def drawextruder0temp(self, dc, gc): self.drawtemperature(dc, gc, self.extruder0temps, - "Ex0", 1, 0, 155, 255, 128) + "Ex0", 1, self.root.settings.graph_color_ex0temp) def drawextruder0targettemp(self, dc, gc): self.drawtemperature(dc, gc, self.extruder0targettemps, - "Ex0 Target", 2, 0, 5, 255, 128) + "Ex0 Target", 2, self.root.settings.graph_color_ex0target) def drawextruder1temp(self, dc, gc): self.drawtemperature(dc, gc, self.extruder1temps, - "Ex1", 3, 55, 55, 0, 128) + "Ex1", 3, self.root.settings.graph_color_ex1temp) def drawextruder1targettemp(self, dc, gc): self.drawtemperature(dc, gc, self.extruder1targettemps, - "Ex1 Target", 2, 55, 55, 0, 128) + "Ex1 Target", 2, self.root.settings.graph_color_ex1target) def SetFanPower(self, value): self.fanpowers.pop() diff --git a/printrun/pronterface.py b/printrun/pronterface.py index 6483761..9d3282b 100644 --- a/printrun/pronterface.py +++ b/printrun/pronterface.py @@ -992,6 +992,15 @@ Printrun. If not, see .""" self.settings._add(SpinSetting("preview_grid_step2", 50., 0, 200, _("Coarse grid spacing"), _("Coarse Grid Spacing"), "Viewer"), self.update_gviz_params) self.settings._add(ColorSetting("bgcolor", self._preferred_bgcolour_hex(), _("Background color"), _("Pronterface background color"), "Colors", isRGBA=False), self.reload_ui) self.settings._add(ColorSetting("graph_color_background", "#FAFAC7", _("Graph background color"), _("Color of the temperature graph background"), "Colors", isRGBA=False), self.reload_ui) + self.settings._add(ColorSetting("graph_color_text", "#172C2C", _("Graph text color"), _("Color of the temperature graph text"), "Colors", isRGBA=False), self.reload_ui) + self.settings._add(ColorSetting("graph_color_grid", "#5A5A5A", _("Graph grid color"), _("Color of the temperature graph grid"), "Colors", isRGBA=False), self.reload_ui) + self.settings._add(ColorSetting("graph_color_fan", "#000000", _("Graph fan line color"), _("Color of the temperature graph fan speed line"), "Colors", isRGBA=False), self.reload_ui) + self.settings._add(ColorSetting("graph_color_bedtemp", "#FF0000", _("Graph bed line color"), _("Color of the temperature graph bed temperature line"), "Colors", isRGBA=False), self.reload_ui) + self.settings._add(ColorSetting("graph_color_bedtarget", "#FF7800", _("Graph bed target line color"), _("Color of the temperature graph bed temperature target line"), "Colors", isRGBA=False), self.reload_ui) + self.settings._add(ColorSetting("graph_color_ex0temp", "#009BFF", _("Graph ex0 line color"), _("Color of the temperature graph extruder 0 temperature line"), "Colors", isRGBA=False), self.reload_ui) + self.settings._add(ColorSetting("graph_color_ex0target", "#0005FF", _("Graph ex0 target line color"), _("Color of the temperature graph extruder 0 target temperature line"), "Colors", isRGBA=False), self.reload_ui) + self.settings._add(ColorSetting("graph_color_ex1temp", "#373700", _("Graph ex1 line color color"), _("Color of the temperature graph extruder 1 temperature line"), "Colors", isRGBA=False), self.reload_ui) + self.settings._add(ColorSetting("graph_color_ex1target", "#373700", _("Graph ex1 target line color"), _("Color of the temperature graph extruder 1 temperature target line"), "Colors", isRGBA=False), self.reload_ui) self.settings._add(ColorSetting("gcview_color_background", "#FAFAC7FF", _("3D view background color"), _("Color of the 3D view background"), "Colors"), self.update_gcview_colors) self.settings._add(ColorSetting("gcview_color_travel", "#99999999", _("3D view travel moves color"), _("Color of travel moves in 3D view"), "Colors"), self.update_gcview_colors) self.settings._add(ColorSetting("gcview_color_tool0", "#FF000099", _("3D view print moves color"), _("Color of print moves with tool 0 in 3D view"), "Colors"), self.update_gcview_colors) -- cgit v1.2.3