Fixed bug on Windows with sizers on Windows in Master Editor panel when its size changed
authorLaurent Bessard
Wed, 24 Apr 2013 23:27:35 +0200
changeset 2134 6f4b08348a60
parent 2133 ba0b2ca7db26
child 2135 ca1c34ff6c10
child 2136 71fdfd4a12a3
Fixed bug on Windows with sizers on Windows in Master Editor panel when its size changed
etherlab/ConfigEditor.py
--- a/etherlab/ConfigEditor.py	Wed Apr 24 17:27:31 2013 +0200
+++ b/etherlab/ConfigEditor.py	Wed Apr 24 23:27:35 2013 +0200
@@ -561,7 +561,7 @@
             style=wx.TAB_TRAVERSAL|wx.HSCROLL|wx.VSCROLL)
         self.EthercatMasterEditor.Bind(wx.EVT_SIZE, self.OnResize)
         
-        main_sizer = wx.BoxSizer(wx.VERTICAL)
+        self.EthercatMasterEditorSizer = wx.BoxSizer(wx.VERTICAL)
         
         self.NodesFilter = wx.ComboBox(self.EthercatMasterEditor,
             style=wx.TE_PROCESS_ENTER)
@@ -620,15 +620,12 @@
         self.StartupCommandsGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN, 
               self.OnStartupCommandsGridEditorShow)
         
-        second_staticbox = wx.StaticBox(self.EthercatMasterEditor, label=_("Nodes variables filter:"))
-        second_staticbox_sizer = wx.StaticBoxSizer(second_staticbox, wx.VERTICAL)
-        
         self.NodesVariables = MasterNodesVariablesSizer(self.EthercatMasterEditor, self.Controler)
-        second_staticbox_sizer.AddSizer(self.NodesVariables, 1, border=5, flag=wx.GROW|wx.ALL)
         
         main_staticbox = wx.StaticBox(self.EthercatMasterEditor, label=_("Node filter:"))
         staticbox_sizer = wx.StaticBoxSizer(main_staticbox, wx.VERTICAL)
-        main_sizer.AddSizer(staticbox_sizer, 0, border=10, flag=wx.GROW|wx.ALL)
+        self.EthercatMasterEditorSizer.AddSizer(staticbox_sizer, 0, border=10, flag=wx.GROW|wx.ALL)
+        
         main_staticbox_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=6, vgap=0)
         main_staticbox_sizer.AddGrowableCol(0)
         main_staticbox_sizer.AddGrowableRow(2)
@@ -644,10 +641,15 @@
               border=5, flag=wx.GROW|wx.LEFT|wx.RIGHT|wx.BOTTOM)
         main_staticbox_sizer.AddWindow(self.StartupCommandsGrid, 1, 
               border=5, flag=wx.GROW|wx.LEFT|wx.RIGHT|wx.BOTTOM)
+        
+        second_staticbox = wx.StaticBox(self.EthercatMasterEditor, label=_("Nodes variables filter:"))
+        second_staticbox_sizer = wx.StaticBoxSizer(second_staticbox, wx.VERTICAL)
+        second_staticbox_sizer.AddSizer(self.NodesVariables, 1, border=5, flag=wx.GROW|wx.ALL)
+        
         main_staticbox_sizer.AddSizer(second_staticbox_sizer, 1, 
             border=5, flag=wx.GROW|wx.LEFT|wx.RIGHT|wx.BOTTOM)
         
-        self.EthercatMasterEditor.SetSizer(main_sizer)
+        self.EthercatMasterEditor.SetSizer(self.EthercatMasterEditorSizer)
         
         return self.EthercatMasterEditor
 
@@ -974,7 +976,7 @@
         self.EthercatMasterEditor.GetBestSize()
         xstart, ystart = self.EthercatMasterEditor.GetViewStart()
         window_size = self.EthercatMasterEditor.GetClientSize()
-        maxx, maxy = self.EthercatMasterEditor.GetMinSize()
+        maxx, maxy = self.EthercatMasterEditorSizer.GetMinSize()
         posx = max(0, min(xstart, (maxx - window_size[0]) / SCROLLBAR_UNIT))
         posy = max(0, min(ystart, (maxy - window_size[1]) / SCROLLBAR_UNIT))
         self.EthercatMasterEditor.Scroll(posx, posy)