Commit b3658bfe authored by Duane Johnson's avatar Duane Johnson

Added visual indication to highlight XY and Z increment values on mouse over

parent 4e1e71d9
...@@ -18,6 +18,12 @@ class XYButtons(BufferedCanvas): ...@@ -18,6 +18,12 @@ class XYButtons(BufferedCanvas):
} }
corner_size = (49, 49) corner_size = (49, 49)
corner_inset = (8, 6) corner_inset = (8, 6)
label_overlay_positions = {
0: (142, 105, 11),
1: (160, 85, 13),
2: (179, 65, 15),
3: (201, 42, 16)
}
concentric_circle_radii = [11, 45, 69, 94, 115] concentric_circle_radii = [11, 45, 69, 94, 115]
center = (124, 121) center = (124, 121)
spacer = 7 spacer = 7
...@@ -31,7 +37,7 @@ class XYButtons(BufferedCanvas): ...@@ -31,7 +37,7 @@ class XYButtons(BufferedCanvas):
self.corner = None self.corner = None
self.moveCallback = moveCallback self.moveCallback = moveCallback
self.cornerCallback = cornerCallback self.cornerCallback = cornerCallback
self.enabled = False self.enabled = True
BufferedCanvas.__init__(self, parent, ID) BufferedCanvas.__init__(self, parent, ID)
...@@ -206,14 +212,23 @@ class XYButtons(BufferedCanvas): ...@@ -206,14 +212,23 @@ class XYButtons(BufferedCanvas):
pos = XYButtons.keypad_positions[self.keypad_idx] pos = XYButtons.keypad_positions[self.keypad_idx]
pos = (pos[0] - padw/2 - 3, pos[1] - padh/2 - 3) pos = (pos[0] - padw/2 - 3, pos[1] - padh/2 - 3)
gc.DrawBitmap(self.keypad_bmp, pos[0], pos[1], padw, padh) gc.DrawBitmap(self.keypad_bmp, pos[0], pos[1], padw, padh)
# Draw label overlays
gc.SetPen(wx.Pen(wx.Colour(255,255,255,128), 1))
gc.SetBrush(wx.Brush(wx.Colour(255,255,255,128+64)))
for idx, kpos in XYButtons.label_overlay_positions.items():
if idx != self.concentric:
r = kpos[2]
gc.DrawEllipse(kpos[0]-r, kpos[1]-r, r*2, r*2)
else: else:
gc.SetPen(wx.Pen(wx.Colour(255,255,255,0), 4)) gc.SetPen(wx.Pen(wx.Colour(255,255,255,0), 4))
gc.SetBrush(wx.Brush(wx.Colour(255,255,255,128))) gc.SetBrush(wx.Brush(wx.Colour(255,255,255,128)))
gc.DrawRectangle(0, 0, w, h) gc.DrawRectangle(0, 0, w, h)
# Used to check exact position of keypad dots, should we ever resize the bg image # Used to check exact position of keypad dots, should we ever resize the bg image
# for idx, kpos in XYButtons.keypad_positions.items(): # for idx, kpos in XYButtons.label_overlay_positions.items():
# dc.DrawCircle(kpos[0], kpos[1], 6) # dc.DrawCircle(kpos[0], kpos[1], kpos[2])
## ------ ## ## ------ ##
## Events ## ## Events ##
......
...@@ -12,6 +12,12 @@ def sign(n): ...@@ -12,6 +12,12 @@ def sign(n):
class ZButtons(BufferedCanvas): class ZButtons(BufferedCanvas):
button_ydistances = [7, 30, 55, 83, 112] button_ydistances = [7, 30, 55, 83, 112]
center = (30, 118) center = (30, 118)
label_overlay_positions = {
0: (1, 18, 11),
1: (1, 41, 13),
2: (1, 67, 15),
3: None
}
def __init__(self, parent, moveCallback=None, ID=-1): def __init__(self, parent, moveCallback=None, ID=-1):
self.bg_bmp = wx.Image(imagefile("control_z.png"),wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.bg_bmp = wx.Image(imagefile("control_z.png"),wx.BITMAP_TYPE_PNG).ConvertToBitmap()
...@@ -74,9 +80,17 @@ class ZButtons(BufferedCanvas): ...@@ -74,9 +80,17 @@ class ZButtons(BufferedCanvas):
gc.DrawBitmap(self.bg_bmp, 0, 0, w, h) gc.DrawBitmap(self.bg_bmp, 0, 0, w, h)
if self.enabled: if self.enabled:
# Draw label overlays
gc.SetPen(wx.Pen(wx.Colour(255,255,255,128), 1))
gc.SetBrush(wx.Brush(wx.Colour(255,255,255,128+64)))
for idx, kpos in ZButtons.label_overlay_positions.items():
if kpos and idx != self.range:
r = kpos[2]
gc.DrawEllipse(ZButtons.center[0]-kpos[0]-r, ZButtons.center[1]-kpos[1]-r, r*2, r*2)
# Top 'layer' is the mouse-over highlights
gc.SetPen(wx.Pen(wx.Colour(100,100,100,172), 4)) gc.SetPen(wx.Pen(wx.Colour(100,100,100,172), 4))
gc.SetBrush(wx.Brush(wx.Colour(0,0,0,128))) gc.SetBrush(wx.Brush(wx.Colour(0,0,0,128)))
if self.range != None and self.direction != None: if self.range != None and self.direction != None:
self.highlight(gc, self.range, self.direction) self.highlight(gc, self.range, self.direction)
else: else:
......
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