--- a/Dialogs.py Fri Aug 03 18:01:56 2007 +0200
+++ b/Dialogs.py Fri Aug 03 18:02:54 2007 +0200
@@ -593,7 +593,7 @@
# Create New Connection Dialog
#-------------------------------------------------------------------------------
-[wxID_CONNECTIONPROPERTIESDIALOG, wxID_CONNECTIONPROPERTIESDIALOGMAINPANEL,
+[wxID_CONNECTIONPROPERTIESDIALOG, wxID_CONNECTIONPROPERTIESDIALOGSPACER,
wxID_CONNECTIONPROPERTIESDIALOGNAME, wxID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1,
wxID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2, wxID_CONNECTIONPROPERTIESDIALOGPREVIEW,
wxID_CONNECTIONPROPERTIESDIALOGSTATICTEXT1, wxID_CONNECTIONPROPERTIESDIALOGSTATICTEXT2,
@@ -604,13 +604,63 @@
def _init_coll_flexGridSizer1_Items(self, parent):
# generated method, don't edit
- parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
+ parent.AddSizer(self.MainSizer, 0, border=20, flag=wxGROW|wxTOP|wxLEFT|wxRIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT)
+
+ def _init_coll_flexGridSizer1_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(0)
+
+ def _init_coll_MainSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddSizer(self.LeftGridSizer, 1, border=5, flag=wxGROW|wxRIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wxGROW|wxLEFT)
+
+ def _init_coll_LeftGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.radioButton1, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.radioButton2, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Spacer, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Name, 0, border=0, flag=wxGROW)
+
+ def _init_coll_LeftGridSizer_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(3)
+
+ def _init_coll_RightGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wxGROW)
+
+ def _init_coll_RightGridSizer_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(1)
def _init_sizers(self):
# generated method, don't edit
- self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+ self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
+ self.MainSizer = wx.BoxSizer(wxHORIZONTAL)
+ self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=6, vgap=5)
+ self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
+ self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
+ self._init_coll_MainSizer_Items(self.MainSizer)
+ self._init_coll_LeftGridSizer_Items(self.LeftGridSizer)
+ self._init_coll_LeftGridSizer_Growables(self.LeftGridSizer)
+ self._init_coll_RightGridSizer_Items(self.RightGridSizer)
+ self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
self.SetSizer(self.flexGridSizer1)
@@ -622,52 +672,51 @@
title='Connection Properties')
self.SetClientSize(wx.Size(350, 220))
- self.MainPanel = wx.Panel(id=wxID_CONNECTIONPROPERTIESDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(340, 360), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
self.staticText1 = wx.StaticText(id=wxID_CONNECTIONPROPERTIESDIALOGSTATICTEXT1,
- label='Type:', name='staticText1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(70, 17), style=0)
+ label='Type:', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText2 = wx.StaticText(id=wxID_CONNECTIONPROPERTIESDIALOGSTATICTEXT2,
- label='Name:', name='staticText2', parent=self.MainPanel,
- pos=wx.Point(24, 104), size=wx.Size(70, 17), style=0)
+ label='Name:', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText3 = wx.StaticText(id=wxID_CONNECTIONPROPERTIESDIALOGSTATICTEXT3,
- label='Preview:', name='staticText3', parent=self.MainPanel,
- pos=wx.Point(174, 24), size=wx.Size(100, 17), style=0)
+ label='Preview:', name='staticText3', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.radioButton1 = wx.RadioButton(id=wxID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1,
- label='Connector', name='radioButton1', parent=self.MainPanel,
- pos=wx.Point(24, 48), size=wx.Size(114, 24), style=0)
+ label='Connector', name='radioButton1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
EVT_RADIOBUTTON(self, wxID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1, self.OnTypeChanged)
self.radioButton1.SetValue(True)
self.radioButton2 = wx.RadioButton(id=wxID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2,
- label='Continuation', name='radioButton2', parent=self.MainPanel,
- pos=wx.Point(24, 72), size=wx.Size(128, 24), style=0)
+ label='Continuation', name='radioButton2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
EVT_RADIOBUTTON(self, wxID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2, self.OnTypeChanged)
self.radioButton2.SetValue(False)
self.Name = wx.TextCtrl(id=wxID_CONNECTIONPROPERTIESDIALOGNAME,
- name='Name', parent=self.MainPanel, pos=wx.Point(24, 130),
- size=wx.Size(145, 24), style=0)
+ name='Name', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
EVT_TEXT(self, wxID_CONNECTIONPROPERTIESDIALOGNAME, self.OnNameChanged)
self.Preview = wx.Panel(id=wxID_CONNECTIONPROPERTIESDIALOGPREVIEW,
- name='Preview', parent=self.MainPanel, pos=wx.Point(174, 48),
- size=wx.Size(150, 100), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
+ name='Preview', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
self.Preview.SetBackgroundColour(wxColour(255,255,255))
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
+ self.Spacer = wx.Panel(id=wxID_CONNECTIONPROPERTIESDIALOGSPACER,
+ name='Spacer', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+
+ self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
+
self._init_sizers()
def __init__(self, parent):
self._init_ctrls(parent)
- self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
- self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_RIGHT)
self.Connection = None
self.MinConnectionSize = None
@@ -731,7 +780,7 @@
#-------------------------------------------------------------------------------
-[wxID_LDELEMENTDIALOG, wxID_LDELEMENTDIALOGMAINPANEL,
+[wxID_LDELEMENTDIALOG, wxID_LDELEMENTDIALOGSPACER,
wxID_LDELEMENTDIALOGNAME, wxID_LDELEMENTDIALOGRADIOBUTTON1,
wxID_LDELEMENTDIALOGRADIOBUTTON2, wxID_LDELEMENTDIALOGRADIOBUTTON3,
wxID_LDELEMENTDIALOGRADIOBUTTON4, wxID_LDELEMENTDIALOGPREVIEW,
@@ -743,13 +792,65 @@
def _init_coll_flexGridSizer1_Items(self, parent):
# generated method, don't edit
- parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
+ parent.AddSizer(self.MainSizer, 0, border=20, flag=wxGROW|wxTOP|wxLEFT|wxRIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT)
+
+ def _init_coll_flexGridSizer1_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(0)
+
+ def _init_coll_MainSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddSizer(self.LeftGridSizer, 1, border=5, flag=wxGROW|wxRIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wxGROW|wxLEFT)
+
+ def _init_coll_LeftGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.radioButton1, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.radioButton2, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.radioButton3, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.radioButton4, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Spacer, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Name, 0, border=0, flag=wxGROW)
+
+ def _init_coll_LeftGridSizer_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(5)
+
+ def _init_coll_RightGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wxGROW)
+
+ def _init_coll_RightGridSizer_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(1)
def _init_sizers(self):
# generated method, don't edit
- self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+ self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
+ self.MainSizer = wx.BoxSizer(wxHORIZONTAL)
+ self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=8, vgap=5)
+ self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
+ self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
+ self._init_coll_MainSizer_Items(self.MainSizer)
+ self._init_coll_LeftGridSizer_Items(self.LeftGridSizer)
+ self._init_coll_LeftGridSizer_Growables(self.LeftGridSizer)
+ self._init_coll_RightGridSizer_Items(self.RightGridSizer)
+ self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
self.SetSizer(self.flexGridSizer1)
@@ -761,55 +862,56 @@
title=title)
self.SetClientSize(wx.Size(350, 260))
- self.MainPanel = wx.Panel(id=wxID_LDELEMENTDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(340, 200), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
self.staticText1 = wx.StaticText(id=wxID_LDELEMENTDIALOGSTATICTEXT1,
- label='Modifier:', name='staticText1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(70, 17), style=0)
+ label='Modifier:', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText2 = wx.StaticText(id=wxID_LDELEMENTDIALOGSTATICTEXT2,
- label='Name:', name='staticText2', parent=self.MainPanel,
- pos=wx.Point(24, 150), size=wx.Size(70, 17), style=0)
+ label='Name:', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText3 = wx.StaticText(id=wxID_LDELEMENTDIALOGSTATICTEXT3,
- label='Preview:', name='staticText3', parent=self.MainPanel,
- pos=wx.Point(174, 24), size=wx.Size(100, 17), style=0)
+ label='Preview:', name='staticText3', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.radioButton1 = wx.RadioButton(id=wxID_LDELEMENTDIALOGRADIOBUTTON1,
- label=labels[0], name='radioButton1', parent=self.MainPanel,
- pos=wx.Point(24, 48), size=wx.Size(114, 24), style=0)
+ label=labels[0], name='radioButton1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
EVT_RADIOBUTTON(self, wxID_LDELEMENTDIALOGRADIOBUTTON1, self.OnTypeChanged)
self.radioButton1.SetValue(True)
self.radioButton2 = wx.RadioButton(id=wxID_LDELEMENTDIALOGRADIOBUTTON2,
- label=labels[1], name='radioButton2', parent=self.MainPanel,
- pos=wx.Point(24, 72), size=wx.Size(128, 24), style=0)
+ label=labels[1], name='radioButton2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
EVT_RADIOBUTTON(self, wxID_LDELEMENTDIALOGRADIOBUTTON2, self.OnTypeChanged)
self.radioButton3 = wx.RadioButton(id=wxID_LDELEMENTDIALOGRADIOBUTTON3,
- label=labels[2], name='radioButton3', parent=self.MainPanel,
- pos=wx.Point(24, 96), size=wx.Size(114, 24), style=0)
+ label=labels[2], name='radioButton3', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
EVT_RADIOBUTTON(self, wxID_LDELEMENTDIALOGRADIOBUTTON3, self.OnTypeChanged)
self.radioButton4 = wx.RadioButton(id=wxID_LDELEMENTDIALOGRADIOBUTTON4,
- label=labels[3], name='radioButton4', parent=self.MainPanel,
- pos=wx.Point(24, 120), size=wx.Size(128, 24), style=0)
+ label=labels[3], name='radioButton4', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
EVT_RADIOBUTTON(self, wxID_LDELEMENTDIALOGRADIOBUTTON4, self.OnTypeChanged)
self.Name = wx.Choice(id=wxID_LDELEMENTDIALOGNAME,
- name='Name', parent=self.MainPanel, pos=wx.Point(24, 174),
- size=wx.Size(145, 24), style=0)
+ name='Name', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
EVT_CHOICE(self, wxID_LDELEMENTDIALOGNAME, self.OnNameChanged)
self.Preview = wx.Panel(id=wxID_LDELEMENTDIALOGPREVIEW,
- name='Preview', parent=self.MainPanel, pos=wx.Point(174, 48),
- size=wx.Size(150, 150), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
+ name='Preview', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
self.Preview.SetBackgroundColour(wxColour(255,255,255))
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
+ self.Spacer = wx.Panel(id=wxID_LDELEMENTDIALOGSPACER,
+ name='Spacer', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+
+ self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
+
self._init_sizers()
def __init__(self, parent, type):
@@ -822,9 +924,6 @@
self.Element = LD_Coil(self.Preview, COIL_NORMAL, "")
self.Element.SetPosition((150 - LD_ELEMENT_SIZE[0]) / 2, (150 - LD_ELEMENT_SIZE[1]) / 2)
- self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
- self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_RIGHT)
-
EVT_PAINT(self, self.OnPaint)
def SetElementSize(self, size):
@@ -902,6 +1001,9 @@
def RefreshPreview(self):
dc = wxClientDC(self.Preview)
dc.Clear()
+ clientsize = self.Preview.GetClientSize()
+ width, height = self.Element.GetSize()
+ self.Element.SetPosition((clientsize.width - width) / 2, (clientsize.height - height) / 2)
self.Element.Draw(dc)
def OnPaint(self, event):
@@ -914,7 +1016,7 @@
#-------------------------------------------------------------------------------
-[wxID_LDPOWERRAILDIALOG, wxID_LDPOWERRAILDIALOGMAINPANEL,
+[wxID_LDPOWERRAILDIALOG, wxID_LDPOWERRAILDIALOGSPACER,
wxID_LDPOWERRAILDIALOGTYPE, wxID_LDPOWERRAILDIALOGRADIOBUTTON1,
wxID_LDPOWERRAILDIALOGRADIOBUTTON2, wxID_LDPOWERRAILDIALOGPREVIEW,
wxID_LDPOWERRAILDIALOGSTATICTEXT1, wxID_LDPOWERRAILDIALOGSTATICTEXT2,
@@ -925,13 +1027,63 @@
def _init_coll_flexGridSizer1_Items(self, parent):
# generated method, don't edit
- parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
+ parent.AddSizer(self.MainSizer, 0, border=20, flag=wxGROW|wxTOP|wxLEFT|wxRIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT)
+
+ def _init_coll_flexGridSizer1_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(0)
+
+ def _init_coll_MainSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddSizer(self.LeftGridSizer, 1, border=5, flag=wxGROW|wxRIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wxGROW|wxLEFT)
+
+ def _init_coll_LeftGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.radioButton1, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.radioButton2, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Spacer, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.PinNumber, 0, border=0, flag=wxGROW)
+
+ def _init_coll_LeftGridSizer_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(3)
+
+ def _init_coll_RightGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wxGROW)
+
+ def _init_coll_RightGridSizer_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(1)
def _init_sizers(self):
# generated method, don't edit
- self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+ self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
+ self.MainSizer = wx.BoxSizer(wxHORIZONTAL)
+ self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=6, vgap=5)
+ self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
+ self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
+ self._init_coll_MainSizer_Items(self.MainSizer)
+ self._init_coll_LeftGridSizer_Items(self.LeftGridSizer)
+ self._init_coll_LeftGridSizer_Growables(self.LeftGridSizer)
+ self._init_coll_RightGridSizer_Items(self.RightGridSizer)
+ self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
self.SetSizer(self.flexGridSizer1)
@@ -943,45 +1095,46 @@
title='Power Rail Properties')
self.SetClientSize(wx.Size(350, 260))
- self.MainPanel = wx.Panel(id=wxID_LDPOWERRAILDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(340, 200), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
self.staticText1 = wx.StaticText(id=wxID_LDPOWERRAILDIALOGSTATICTEXT1,
- label='Type:', name='staticText1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(70, 17), style=0)
+ label='Type:', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText2 = wx.StaticText(id=wxID_LDPOWERRAILDIALOGSTATICTEXT2,
- label='Pin number:', name='staticText2', parent=self.MainPanel,
- pos=wx.Point(24, 100), size=wx.Size(70, 17), style=0)
+ label='Pin number:', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText3 = wx.StaticText(id=wxID_LDPOWERRAILDIALOGSTATICTEXT3,
- label='Preview:', name='staticText3', parent=self.MainPanel,
- pos=wx.Point(174, 24), size=wx.Size(100, 17), style=0)
+ label='Preview:', name='staticText3', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.radioButton1 = wx.RadioButton(id=wxID_LDPOWERRAILDIALOGRADIOBUTTON1,
- label='Left PowerRail', name='radioButton1', parent=self.MainPanel,
- pos=wx.Point(24, 48), size=wx.Size(114, 24), style=0)
+ label='Left PowerRail', name='radioButton1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
EVT_RADIOBUTTON(self, wxID_LDPOWERRAILDIALOGRADIOBUTTON1, self.OnTypeChanged)
self.radioButton1.SetValue(True)
self.radioButton2 = wx.RadioButton(id=wxID_LDPOWERRAILDIALOGRADIOBUTTON2,
- label='Right PowerRail', name='radioButton2', parent=self.MainPanel,
- pos=wx.Point(24, 72), size=wx.Size(128, 24), style=0)
+ label='Right PowerRail', name='radioButton2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
EVT_RADIOBUTTON(self, wxID_LDPOWERRAILDIALOGRADIOBUTTON2, self.OnTypeChanged)
self.PinNumber = wx.SpinCtrl(id=wxID_LDPOWERRAILDIALOGPINNUMBER,
- name='PinNumber', parent=self.MainPanel, pos=wx.Point(24, 124),
- size=wx.Size(145, 24), style=wxSP_ARROW_KEYS, min=1, max=20)
+ name='PinNumber', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=wxSP_ARROW_KEYS, min=1, max=20)
EVT_SPINCTRL(self, wxID_LDPOWERRAILDIALOGPINNUMBER, self.OnPinNumberChanged)
self.Preview = wx.Panel(id=wxID_LDPOWERRAILDIALOGPREVIEW,
- name='Preview', parent=self.MainPanel, pos=wx.Point(174, 48),
- size=wx.Size(150, 150), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
+ name='Preview', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
self.Preview.SetBackgroundColour(wxColour(255,255,255))
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
+ self.Spacer = wx.Panel(id=wxID_LDELEMENTDIALOGSPACER,
+ name='Spacer', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+
+ self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
+
self._init_sizers()
def __init__(self, parent, type = LEFTRAIL, number = 1):
@@ -993,9 +1146,6 @@
self.radioButton2.SetValue(True)
self.PinNumber.SetValue(number)
- self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
- self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_RIGHT)
-
self.PowerRailMinSize = (0, 0)
self.PowerRail = None
@@ -1031,8 +1181,8 @@
min_width, min_height = self.PowerRail.GetMinSize()
width, height = max(min_width, self.PowerRailMinSize[0]), max(min_height, self.PowerRailMinSize[1])
self.PowerRail.SetSize(width, height)
- self.PowerRail.RefreshConnectors()
- self.PowerRail.SetPosition((150 - width) / 2, (150 - height) / 2)
+ clientsize = self.Preview.GetClientSize()
+ self.PowerRail.SetPosition((clientsize.width - width) / 2, (clientsize.height - height) / 2)
self.PowerRail.Draw(dc)
def OnPaint(self, event):