Fixed bugs in Debug Variable Panel
authorLaurent Bessard
Mon, 17 Jun 2013 10:42:53 +0200
changeset 1264 27c8578670c8
parent 1263 895605ccac70
child 1265 242512c56ea1
Fixed bugs in Debug Variable Panel
controls/DebugVariablePanel/DebugVariableGraphicPanel.py
controls/DebugVariablePanel/DebugVariableGraphicViewer.py
--- a/controls/DebugVariablePanel/DebugVariableGraphicPanel.py	Mon Jun 17 09:11:55 2013 +0200
+++ b/controls/DebugVariablePanel/DebugVariableGraphicPanel.py	Mon Jun 17 10:42:53 2013 +0200
@@ -797,7 +797,7 @@
                 source_size = source_panel.GetSize()
                 if item.IsNumVariable() and graph:
                     panel = DebugVariableGraphicViewer(self.GraphicsWindow, self, [item], GRAPH_PARALLEL)
-                    panel.SetCanvasSize(source_size.width, source_size.height)
+                    panel.SetCanvasHeight(source_size.height)
                     if self.CursorTick is not None:
                         panel.SetCursorTick(self.CursorTick)
                 
@@ -861,11 +861,9 @@
                 target_panel.GraphType = merge_type
                 size = target_panel.GetSize()
                 if merge_type == GRAPH_ORTHOGONAL:
-                    target_panel.SetCanvasSize(size.width, size.width)
-                elif source_size is not None:
-                    target_panel.SetCanvasSize(size.width, size.height + source_size.height)
-                else:
-                    target_panel.SetCanvasSize(size.width, size.height)
+                    target_panel.SetCanvasHeight(size.width)
+                elif source_size is not None and source_panel != target_panel:
+                    target_panel.SetCanvasHeight(size.height + source_size.height)
                 target_panel.ResetGraphics()
                 
                 self.ResetVariableNameMask()
@@ -941,7 +939,7 @@
             if (isinstance(panel, DebugVariableGraphicViewer) and 
                 panel.GraphType == GRAPH_ORTHOGONAL and 
                 panel_size.width == panel_size.height):
-                panel.SetCanvasSize(size.width, size.width)
+                panel.SetCanvasHeight(size.width)
         self.RefreshGraphicsWindowScrollbars()
         self.GraphicsSizer.Layout()
         event.Skip()
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Mon Jun 17 09:11:55 2013 +0200
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Mon Jun 17 10:42:53 2013 +0200
@@ -435,7 +435,7 @@
         @return: callback function
         """
         def OnChangeSizeButton():
-            self.SetCanvasSize(200, height)
+            self.SetCanvasHeight(height)
         return OnChangeSizeButton
     
     def OnExportGraphButton(self):
@@ -634,7 +634,7 @@
         # If a Viewer resize is in progress, change Viewer size 
         elif event.button == 1 and self.CanvasStartSize is not None:
             width, height = self.GetSize()
-            self.SetCanvasSize(width, 
+            self.SetCanvasHeight(
                 self.CanvasStartSize + height - event.y - self.MouseStartPos.y)
         
         # If no button is pressed, show or hide contextual buttons or resize
@@ -809,14 +809,14 @@
             CANVAS_BORDER[0] + CANVAS_BORDER[1] + 
             2 * CANVAS_PADDING + VALUE_LABEL_HEIGHT * len(self.Items))
     
-    def SetCanvasSize(self, width, height):
+    def SetCanvasHeight(self, height):
         """
         Set Viewer size checking that it respects Viewer minimum size
-        @param width: Viewer width
         @param height: Viewer height
         """
-        height = max(height, self.GetCanvasMinSize()[1])
-        self.SetMinSize(wx.Size(width, height))
+        min_width, min_height = self.GetCanvasMinSize()
+        height = max(height, min_height)
+        self.SetMinSize(wx.Size(min_width, height))
         self.RefreshLabelsPosition(height)
         self.ParentWindow.RefreshGraphicsSizer()
         
@@ -976,7 +976,8 @@
             
             # Y coordinate labels are vertical and in figure left side
             self.AxesLabels.append(
-                add_text_func(size='small', rotation='vertical'))
+                add_text_func(size='small', rotation='vertical',
+                              verticalalignment='bottom'))
             self.Labels.append(
                 add_text_func(size='large', rotation='vertical',
                               verticalalignment='top'))