Fixed bugs in DebugVariablePanel
authorLaurent Bessard
Fri, 19 Apr 2013 01:44:25 +0200
changeset 1044 41bd726aa23c
parent 1043 b46e45e0afc7
child 1045 a220a27defe5
Fixed bugs in DebugVariablePanel
controls/DebugVariablePanel.py
--- a/controls/DebugVariablePanel.py	Fri Apr 19 00:24:15 2013 +0200
+++ b/controls/DebugVariablePanel.py	Fri Apr 19 01:44:25 2013 +0200
@@ -607,10 +607,9 @@
                     buttons = self.Buttons[:]
                     buttons.reverse()
                     for button in buttons:
-                        if button.IsShown() and button.IsEnabled():
-                            w, h = button.GetSize()
-                            button.SetPosition(width - 5 - w - offset, 5)
-                            offset += w + 2
+                        w, h = button.GetSize()
+                        button.SetPosition(width - 5 - w - offset, 5)
+                        offset += w + 2
                     self.ParentWindow.ForceRefresh()
         
         def DrawCommonElements(self, dc, buttons=None):
@@ -799,7 +798,7 @@
         def __init__(self, parent, window, items, graph_type):
             DebugVariableViewer.__init__(self, window, items)
             
-            self.CanvasSize = SIZE_MAXI
+            self.CanvasSize = SIZE_MINI
             self.GraphType = graph_type
             self.CursorTick = None
             self.MouseStartPos = None
@@ -886,9 +885,8 @@
                 if self.ContextualButtonsItem.IsForced():
                     self.ContextualButtons.append(
                         GraphButton(0, 0, GetBitmap("release"), self.OnReleaseButton))
-                else:
-                    self.ContextualButtons.append(
-                        GraphButton(0, 0, GetBitmap("force"), self.OnForceButton))
+                self.ContextualButtons.append(
+                    GraphButton(0, 0, GetBitmap("force"), self.OnForceButton))
                 self.ContextualButtons.append(
                     GraphButton(0, 0, GetBitmap("export_graph_mini"), self.OnExportItemGraphButton))
                 self.ContextualButtons.append(
@@ -962,29 +960,6 @@
                          self.ContextualButtonsItem)
             self.DismissContextualButtons()
         
-        def RefreshButtonsState(self, refresh_positions=False):
-            if self:
-                width, height = self.GetSize()
-                min_width, min_height = self.GetCanvasMinSize()
-                for button, size in zip(self.Buttons, 
-                                        [min_height, SIZE_MIDDLE, SIZE_MAXI]):
-                    if size == height and button.IsEnabled():
-                        button.Disable()
-                        refresh_positions = True
-                    elif not button.IsEnabled():
-                        button.Enable()
-                        refresh_positions = True
-                if refresh_positions:
-                    offset = 0
-                    buttons = self.Buttons[:]
-                    buttons.reverse()
-                    for button in buttons:
-                        if button.IsShown() and button.IsEnabled():
-                            w, h = button.GetSize()
-                            button.SetPosition(width - 5 - w - offset, 5)
-                            offset += w + 2
-                    self.ParentWindow.ForceRefresh()
-        
         def RefreshLabelsPosition(self, height):
             canvas_ratio = 1. / height
             graph_ratio = 1. / ((1.0 - (CANVAS_BORDER[0] + CANVAS_BORDER[1]) * canvas_ratio) * height)
@@ -1021,6 +996,7 @@
             height = max(height, self.GetCanvasMinSize()[1])
             self.SetMinSize(wx.Size(width, height))
             self.RefreshLabelsPosition(height)
+            self.RefreshButtonsState()
             self.ParentWindow.RefreshGraphicsSizer()
             
         def GetAxesBoundingBox(self, absolute=False):
@@ -1661,6 +1637,7 @@
             self.DraggingAxesPanel.SetCursorTick(self.CursorTick)
             width, height = panel.GetSize()
             self.DraggingAxesPanel.SetSize(wx.Size(width, height))
+            self.DraggingAxesPanel.ResetGraphics()
             self.DraggingAxesPanel.SetPosition(wx.Point(0, -height))
         else:
             self.DraggingAxesPanel = panel