Fix many bugs in control layout in LDElementDialog
authorLaurent Bessard
Mon, 13 Aug 2012 10:41:27 +0200
changeset 740 b40ef1010140
parent 739 ed87f96c7c12
child 741 330f578e228d
Fix many bugs in control layout in LDElementDialog
dialogs/LDElementDialog.py
--- a/dialogs/LDElementDialog.py	Mon Aug 13 10:40:30 2012 +0200
+++ b/dialogs/LDElementDialog.py	Mon Aug 13 10:41:27 2012 +0200
@@ -34,10 +34,10 @@
     
     def __init__(self, parent, controller, type):
         if type == "contact":
-            wx.Dialog.__init__(self, parent, size=wx.Size(350, 310),
+            wx.Dialog.__init__(self, parent, size=wx.Size(350, 260),
                   title=_("Edit Contact Values"))
         else:
-            wx.Dialog.__init__(self, parent, size=wx.Size(350, 260),
+            wx.Dialog.__init__(self, parent, size=wx.Size(350, 310),
                   title=_("Edit Coil Values"))
         
         main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
@@ -49,15 +49,15 @@
               flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
         
         if type == "contact":
-            left_gridsizer = wx.FlexGridSizer(cols=1, hgap=0, rows=9, vgap=5)
+            left_gridsizer = wx.FlexGridSizer(cols=1, hgap=0, rows=7, vgap=0)
         else:
-            left_gridsizer = wx.FlexGridSizer(cols=1, hgap=0, rows=7, vgap=5)
+            left_gridsizer = wx.FlexGridSizer(cols=1, hgap=0, rows=9, vgap=0)
         left_gridsizer.AddGrowableCol(0)
         column_sizer.AddSizer(left_gridsizer, 1, border=5, 
               flag=wx.GROW|wx.RIGHT)
         
         modifier_label = wx.StaticText(self, label=_('Modifier:'))
-        left_gridsizer.AddWindow(modifier_label, flag=wx.GROW)
+        left_gridsizer.AddWindow(modifier_label, border=5, flag=wx.GROW|wx.BOTTOM)
         
         self.Normal = wx.RadioButton(self, label=_("Normal"), style=wx.RB_GROUP)
         self.Normal.SetValue(True)
@@ -68,7 +68,7 @@
         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, self.Negated)
         left_gridsizer.AddWindow(self.Negated, flag=wx.GROW)
         
-        if type == "contact":
+        if type != "contact":
             self.Set = wx.RadioButton(self, label=_("Set"))
             self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, self.Set)
             left_gridsizer.AddWindow(self.Set, flag=wx.GROW)
@@ -86,11 +86,11 @@
         left_gridsizer.AddWindow(self.FallingEdge, flag=wx.GROW)
         
         element_name_label = wx.StaticText(self, label=_('Name:'))
-        left_gridsizer.AddWindow(element_name_label, flag=wx.GROW)
+        left_gridsizer.AddWindow(element_name_label, border=5, flag=wx.GROW|wx.TOP)
         
         self.ElementName = wx.ComboBox(self, style=wx.CB_READONLY)
         self.Bind(wx.EVT_COMBOBOX, self.OnNameChanged, self.ElementName)
-        left_gridsizer.AddWindow(self.ElementName, flag=wx.GROW)
+        left_gridsizer.AddWindow(self.ElementName, border=5, flag=wx.GROW|wx.TOP)
         
         right_gridsizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
         right_gridsizer.AddGrowableCol(0)
@@ -98,8 +98,8 @@
         column_sizer.AddSizer(right_gridsizer, 1, border=5, 
               flag=wx.GROW|wx.LEFT)
         
-        preview_sizer = wx.StaticText(self, label=_('Preview:'))
-        right_gridsizer.AddWindow(preview_sizer, flag=wx.GROW)
+        preview_label = wx.StaticText(self, label=_('Preview:'))
+        right_gridsizer.AddWindow(preview_label, flag=wx.GROW)
 
         self.Preview = wx.Panel(self,
               style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
@@ -108,6 +108,7 @@
         setattr(self.Preview, "GetScaling", lambda:None)
         setattr(self.Preview, "IsOfType", controller.IsOfType)
         self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
+        right_gridsizer.AddWindow(self.Preview, flag=wx.GROW)
         
         button_sizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
         main_sizer.AddSizer(button_sizer, border=20,