--- a/controls/DebugVariablePanel.py Wed Feb 20 19:35:48 2013 +0100
+++ b/controls/DebugVariablePanel.py Wed Feb 20 19:39:52 2013 +0100
@@ -306,7 +306,9 @@
def OnDragOver(self, x, y, d):
if self.ParentControl is not None:
- self.ParentControl.OnCanvasDragging(x, y)
+ self.ParentControl.OnCanvasMouseDragging(x, y) + self.ParentWindow.RefreshHighlight(x, y) return wx.TextDropTarget.OnDragOver(self, x, y, d)
def OnDropText(self, x, y, data):
@@ -351,10 +353,9 @@
self.ParentWindow.InsertValue(values[0], force=True)
- if self.ParentControl is not None:
- self.ParentControl.OnCanvasLeave()
+ self.ParentWindow.ResetHighlight() return wx.TextDropTarget.OnLeave(self)
def ShowMessage(self, message):
dialog = wx.MessageDialog(self.ParentWindow, message, _("Error"), wx.OK|wx.ICON_ERROR)
@@ -612,9 +613,11 @@
+ HIGHLIGHT_BEFORE_DOUBLE, + HIGHLIGHT_AFTER_DOUBLE, - HIGHLIGHT_RIGHT] = range(5)
+ HIGHLIGHT_RIGHT] = range(7) HIGHLIGHT_PEN = wx.Pen(wx.Colour(0, 128, 255))
HIGHLIGHT_BRUSH = wx.Brush(wx.Colour(0, 128, 255, 128))
@@ -719,9 +722,9 @@
destGC.SetPen(HIGHLIGHT_PEN)
destGC.SetBrush(HIGHLIGHT_BRUSH)
- if self.Highlight == HIGHLIGHT_BEFORE:
- destGC.DrawLine(0, 0, width - 1, 0)
- elif self.Highlight == HIGHLIGHT_AFTER:
+ if self.Highlight in [HIGHLIGHT_BEFORE]: + destGC.DrawLine(0, 1, width - 1, 1) + elif self.Highlight in [HIGHLIGHT_AFTER]: destGC.DrawLine(0, height - 1, width - 1, height - 1)
elif self.Highlight == HIGHLIGHT_LEFT:
destGC.DrawRectangle(bbox.x, bbox.y,
@@ -805,13 +808,13 @@
y = rect.y + rect.height + offset
- self.ParentWindow.ForceRefresh()
+ self.ParentWindow.ForceRefresh() def DismissContextualButtons(self):
if self.ContextualButtonsItem is not None:
self.ContextualButtonsItem = None
self.ContextualButtons = []
- self.ParentWindow.ForceRefresh()
+ self.ParentWindow.ForceRefresh() def IsOverButton(self, x, y):
for button in self.Buttons + self.ContextualButtons:
@@ -1038,7 +1041,11 @@
if not self.Canvas.IsOverContextualButton(event.x, height - event.y):
self.Canvas.DismissContextualButtons()
- def OnCanvasDragging(self, x, y, refresh=True):
+ def OnCanvasMouseDragging(self, x, y): + xw, yw = self.GetPosition() + self.ParentWindow.RefreshHighlight(x + xw, y + yw) + def OnCanvasDragging(self, x, y): width, height = self.Canvas.GetSize()
bbox = self.Canvas.GetAxesBoundingBox()
if bbox.InsideXY(x, y) and not self.Is3DCanvas():
@@ -1048,16 +1055,13 @@
self.Canvas.SetHighlight(HIGHLIGHT_RIGHT)
- self.Canvas.SetHighlight(HIGHLIGHT_BEFORE)
+ if self.ParentWindow.IsViewerFirst(self): + self.Canvas.SetHighlight(HIGHLIGHT_BEFORE) + self.Canvas.SetHighlight(HIGHLIGHT_NONE) + self.ParentWindow.HighlightPreviousViewer(self) self.Canvas.SetHighlight(HIGHLIGHT_AFTER)
- self.ParentWindow.ForceRefresh()
- def OnCanvasLeave(self, refresh=True):
- self.Canvas.SetHighlight(HIGHLIGHT_NONE)
- self.ParentWindow.ForceRefresh()
def OnCanvasScroll(self, event):
if event.inaxes is not None:
@@ -1072,6 +1076,9 @@
if self.ItemButtons is not None:
+ def HighlightCanvas(self, highlight): + self.Canvas.SetHighlight(highlight) def HandleCursorMove(self, event):
start_tick, end_tick = self.ParentWindow.GetRange()
@@ -1548,6 +1555,9 @@
def MoveDragNDrop(self, x_mouse, y_mouse):
self.DraggingAxesBoundingBox.x = x_mouse - self.DraggingAxesMousePos.x
self.DraggingAxesBoundingBox.y = y_mouse - self.DraggingAxesMousePos.y
+ self.RefreshHighlight(x_mouse, y_mouse) + def RefreshHighlight(self, x_mouse, y_mouse): for idx, panel in enumerate(self.GraphicPanels):
x, y = panel.GetPosition()
width, height = panel.Canvas.GetSize()
@@ -1555,9 +1565,14 @@
if (rect.InsideXY(x_mouse, y_mouse) or
idx == 0 and y_mouse < 0 or
idx == len(self.GraphicPanels) - 1 and y_mouse > panel.GetPosition()[1]):
- panel.OnCanvasDragging(x_mouse - x, y_mouse - y, False)
+ panel.OnCanvasDragging(x_mouse - x, y_mouse - y) - panel.OnCanvasLeave(False)
+ panel.HighlightCanvas(HIGHLIGHT_NONE) + def ResetHighlight(self): + for panel in self.GraphicPanels: + panel.HighlightCanvas(HIGHLIGHT_NONE) @@ -1577,7 +1592,7 @@
self.DraggingAxesBoundingBox = None
self.DraggingAxesMousePos = None
for idx, panel in enumerate(self.GraphicPanels):
- panel.OnCanvasLeave(False)
+ panel.HighlightCanvas(HIGHLIGHT_NONE) xw, yw = panel.GetPosition()
width, height = panel.Canvas.GetSize()
bbox = wx.Rect(xw, yw, width, height)
@@ -1635,7 +1650,7 @@
if self.DraggingAxesPanel is not None and self.DraggingAxesPanel not in self.GraphicPanels:
- self.DraggingAxesPanel.Refresh()
+ self.DraggingAxesPanel.Refresh(refresh_graphics) for panel in self.GraphicPanels:
if isinstance(panel, DebugVariableGraphic):
panel.Refresh(refresh_graphics)
@@ -1911,6 +1926,20 @@
return self.GraphicPanels.index(viewer)
+ def IsViewerFirst(self, viewer): + return viewer == self.GraphicPanels[0] + def IsViewerLast(self, viewer): + return viewer == self.GraphicPanels[-1] + def HighlightPreviousViewer(self, viewer): + if self.IsViewerFirst(viewer): + idx = self.GetViewerIndex(viewer) + self.GraphicPanels[idx-1].HighlightCanvas(HIGHLIGHT_AFTER) def ResetVariableNameMask(self):
for panel in self.GraphicPanels: