Commit 261a09c4 authored by Duane Johnson's avatar Duane Johnson

Fixed that the background was repainted as white instead of transparent

parent 8b56bbe5
...@@ -111,6 +111,8 @@ class BufferedCanvas(wx.Panel): ...@@ -111,6 +111,8 @@ class BufferedCanvas(wx.Panel):
Causes the canvas to be updated. Causes the canvas to be updated.
""" """
dc = wx.MemoryDC() dc = wx.MemoryDC()
width,height = self.GetClientSizeTuple()
self.backbuffer = wx.EmptyBitmap(width,height)
dc.SelectObject(self.backbuffer) dc.SelectObject(self.backbuffer)
dc.BeginDrawing() dc.BeginDrawing()
self.draw(dc) self.draw(dc)
......
...@@ -60,6 +60,7 @@ class XYButtons(BufferedCanvas): ...@@ -60,6 +60,7 @@ class XYButtons(BufferedCanvas):
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDown) self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDown)
self.Bind(wx.EVT_MOTION, self.OnMotion) self.Bind(wx.EVT_MOTION, self.OnMotion)
self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow)
parent.Bind(wx.EVT_CHAR_HOOK, self.onKey) parent.Bind(wx.EVT_CHAR_HOOK, self.onKey)
def onKey(self, evt): def onKey(self, evt):
...@@ -156,6 +157,11 @@ class XYButtons(BufferedCanvas): ...@@ -156,6 +157,11 @@ class XYButtons(BufferedCanvas):
else: else:
self.setKeypadIndex(idx) self.setKeypadIndex(idx)
def OnLeaveWindow(self, evt):
self.quadrant = None
self.concentric = None
self.update()
def drawPartialPie(self, dc, center, r1, r2, angle1, angle2): def drawPartialPie(self, dc, center, r1, r2, angle1, angle2):
parts = 64 parts = 64
angle_dist = angle2 - angle1 angle_dist = angle2 - angle1
...@@ -205,7 +211,6 @@ class XYButtons(BufferedCanvas): ...@@ -205,7 +211,6 @@ class XYButtons(BufferedCanvas):
self.drawPartialPie(dc, center, r1-inner_ring_radius, r2-inner_ring_radius, a1+fudge, a2-fudge) self.drawPartialPie(dc, center, r1-inner_ring_radius, r2-inner_ring_radius, a1+fudge, a2-fudge)
def draw(self, dc): def draw(self, dc):
dc.Clear()
center = wx.Point(XYButtons.center[0], XYButtons.center[1]) center = wx.Point(XYButtons.center[0], XYButtons.center[1])
dc.SetPen(wx.Pen(wx.Colour(100,100,100,172), 4)) dc.SetPen(wx.Pen(wx.Colour(100,100,100,172), 4))
......
...@@ -29,6 +29,7 @@ class ZButtons(BufferedCanvas): ...@@ -29,6 +29,7 @@ class ZButtons(BufferedCanvas):
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDown) self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDown)
self.Bind(wx.EVT_MOTION, self.OnMotion) self.Bind(wx.EVT_MOTION, self.OnMotion)
self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow)
def lookupRange(self, ydist): def lookupRange(self, ydist):
idx = -1 idx = -1
...@@ -79,10 +80,12 @@ class ZButtons(BufferedCanvas): ...@@ -79,10 +80,12 @@ class ZButtons(BufferedCanvas):
if self.homeCallback: if self.homeCallback:
self.homeCallback() self.homeCallback()
def draw(self, dc): def OnLeaveWindow(self, evt):
dc.Clear() self.range = None
# center = wx.Point(XYButtons.center[0], XYButtons.center[1]) self.direction = None
self.update()
def draw(self, dc):
dc.SetPen(wx.Pen(wx.Colour(100,100,100,172), 4)) dc.SetPen(wx.Pen(wx.Colour(100,100,100,172), 4))
dc.SetBrush(wx.Brush(wx.Colour(0,0,0,128))) dc.SetBrush(wx.Brush(wx.Colour(0,0,0,128)))
......
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