Commit b4316cbd authored by Guillaume Seguin's avatar Guillaume Seguin

Use main window background color in temp graph (should fix #359)

parent 928458a5
...@@ -22,14 +22,12 @@ from bufferedcanvas import * ...@@ -22,14 +22,12 @@ from bufferedcanvas import *
class Graph(BufferedCanvas): class Graph(BufferedCanvas):
'''A class to show a Graph with Pronterface.''' '''A class to show a Graph with Pronterface.'''
def __init__(self, parent, id, pos = wx.DefaultPosition, def __init__(self, parent, id, root, pos = wx.DefaultPosition,
size = wx.Size(150, 80), style = 0): size = wx.Size(150, 80), style = 0):
# Forcing a no full repaint to stop flickering # Forcing a no full repaint to stop flickering
style = style | wx.NO_FULL_REPAINT_ON_RESIZE style = style | wx.NO_FULL_REPAINT_ON_RESIZE
#call super function
super(Graph, self).__init__(parent, id, pos, size, style) super(Graph, self).__init__(parent, id, pos, size, style)
#BufferedCanvas.__init__(self, parent, id) self.root = root
self.extruder0temps = [0] self.extruder0temps = [0]
self.extruder0targettemps = [0] self.extruder0targettemps = [0]
...@@ -50,18 +48,10 @@ class Graph(BufferedCanvas): ...@@ -50,18 +48,10 @@ class Graph(BufferedCanvas):
self._lastyvalue = 0 self._lastyvalue = 0
#self.sizer = wx.BoxSizer(wx.HORIZONTAL)
#self.sizer.Add(wx.Button(self, -1, "Button1", (0, 0)))
#self.SetSizer(self.sizer)
def OnPaint(self, evt): def OnPaint(self, evt):
dc = wx.PaintDC(self) dc = wx.PaintDC(self)
gc = wx.GraphicsContext.Create(dc) gc = wx.GraphicsContext.Create(dc)
def Destroy(self):
#call the super method
super(wx.Panel, self).Destroy()
def updateTemperatures(self, event): def updateTemperatures(self, event):
self.AddBedTemperature(self.bedtemps[-1]) self.AddBedTemperature(self.bedtemps[-1])
self.AddBedTargetTemperature(self.bedtargettemps[-1]) self.AddBedTargetTemperature(self.bedtargettemps[-1])
...@@ -236,7 +226,7 @@ class Graph(BufferedCanvas): ...@@ -236,7 +226,7 @@ class Graph(BufferedCanvas):
self.Refresh() self.Refresh()
def draw(self, dc, w, h): def draw(self, dc, w, h):
dc.SetBackground(wx.Brush(wx.Colour(0,0,0,0))) dc.SetBackground(wx.Brush(self.root.settings.bgcolor))
dc.Clear() dc.Clear()
gc = wx.GraphicsContext.Create(dc) gc = wx.GraphicsContext.Create(dc)
self.width = w self.width = w
......
...@@ -188,7 +188,7 @@ class LeftPane(wx.GridBagSizer): ...@@ -188,7 +188,7 @@ class LeftPane(wx.GridBagSizer):
else: else:
self.Add(root.tempdisp, pos = (6, 0), span = (1, 6)) self.Add(root.tempdisp, pos = (6, 0), span = (1, 6))
root.graph = Graph(root.panel, wx.ID_ANY) root.graph = Graph(root.panel, wx.ID_ANY, root)
self.Add(root.graph, pos = (4, 5), span = (2, 1)) self.Add(root.graph, pos = (4, 5), span = (2, 1))
class VizPane(wx.BoxSizer): class VizPane(wx.BoxSizer):
......
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