Commit af37c07d authored by Stefanowicz's avatar Stefanowicz

Fixed using configured background to XYButtons ZButtons and TempGauge

parent d098a953
......@@ -592,9 +592,9 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
szbuttons=wx.GridBagSizer()
self.xyb = XYButtons(self.panel, self.moveXY, self.homeButtonClicked, self.spacebarAction)
self.xyb = XYButtons(self.panel, self.moveXY, self.homeButtonClicked, self.spacebarAction, self.settings.bgcolor)
szbuttons.Add(self.xyb,pos=(0,1),flag=wx.ALIGN_CENTER)
self.zb = ZButtons(self.panel, self.moveZ)
self.zb = ZButtons(self.panel, self.moveZ, self.settings.bgcolor)
szbuttons.Add(self.zb,pos=(0,2),flag=wx.ALIGN_CENTER)
#lls.Add(self.zb, pos=(2,6), span=(1,1), flag=wx.ALIGN_CENTER)
wx.CallAfter(self.xyb.SetFocus)
......
......@@ -47,7 +47,7 @@ class XYButtons(BufferedCanvas):
center = (124, 121)
spacer = 7
def __init__(self, parent, moveCallback=None, cornerCallback=None, spacebarCallback=None, ID=-1):
def __init__(self, parent, moveCallback=None, cornerCallback=None, spacebarCallback=None, bgcolor="#FFFFFF", ID=-1):
self.bg_bmp = wx.Image(imagefile("control_xy.png"),wx.BITMAP_TYPE_PNG).ConvertToBitmap()
self.keypad_bmp = wx.Image(imagefile("arrow_keys.png"),wx.BITMAP_TYPE_PNG).ConvertToBitmap()
self.keypad_idx = -1
......@@ -62,6 +62,10 @@ class XYButtons(BufferedCanvas):
self.lastMove = None
self.lastCorner = None
self.bgcolor = wx.Colour()
self.bgcolor.SetFromName(bgcolor)
self.bgcolormask = wx.Colour(self.bgcolor.Red(), self.bgcolor.Green(), self.bgcolor.Blue(), 128)
BufferedCanvas.__init__(self, parent, ID)
self.SetSize(self.bg_bmp.GetSize())
......@@ -220,6 +224,7 @@ class XYButtons(BufferedCanvas):
def draw(self, dc, w, h):
dc.SetBackground(wx.Brush(self.bgcolor))
dc.Clear()
gc = wx.GraphicsContext.Create(dc)
......@@ -254,8 +259,8 @@ class XYButtons(BufferedCanvas):
r = kpos[2]
gc.DrawEllipse(kpos[0]-r, kpos[1]-r, r*2, r*2)
else:
gc.SetPen(wx.Pen(wx.Colour(255,255,255,0), 4))
gc.SetBrush(wx.Brush(wx.Colour(255,255,255,128)))
gc.SetPen(wx.Pen(self.bgcolor, 0))
gc.SetBrush(wx.Brush(self.bgcolormask))
gc.DrawRectangle(0, 0, w, h)
......
......@@ -39,7 +39,7 @@ class ZButtons(BufferedCanvas):
3: None
}
def __init__(self, parent, moveCallback=None, ID=-1):
def __init__(self, parent, moveCallback=None, bgcolor="#FFFFFF", ID=-1):
self.bg_bmp = wx.Image(imagefile("control_z.png"),wx.BITMAP_TYPE_PNG).ConvertToBitmap()
self.range = None
self.direction = None
......@@ -49,6 +49,10 @@ class ZButtons(BufferedCanvas):
# Remember the last clicked value, so we can repeat when spacebar pressed
self.lastValue = None
self.bgcolor = wx.Colour()
self.bgcolor.SetFromName(bgcolor)
self.bgcolormask = wx.Colour(self.bgcolor.Red(), self.bgcolor.Green(), self.bgcolor.Blue(), 128)
BufferedCanvas.__init__(self, parent, ID)
self.SetSize(wx.Size(59, 244))
......@@ -102,6 +106,7 @@ class ZButtons(BufferedCanvas):
return (self.lookupRange(abs(ydelta)), sign(ydelta))
def draw(self, dc, w, h):
dc.SetBackground(wx.Brush(self.bgcolor))
dc.Clear()
gc = wx.GraphicsContext.Create(dc)
if self.bg_bmp:
......@@ -123,8 +128,8 @@ class ZButtons(BufferedCanvas):
if self.range != None and self.direction != None:
self.highlight(gc, self.range, self.direction)
else:
gc.SetPen(wx.Pen(wx.Colour(255,255,255,0), 4))
gc.SetBrush(wx.Brush(wx.Colour(255,255,255,128)))
gc.SetPen(wx.Pen(self.bgcolor, 0))
gc.SetBrush(wx.Brush(self.bgcolormask))
gc.DrawRectangle(0, 0, w, h)
## ------ ##
......
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