--- a/Dialogs.py Fri Jul 27 10:03:24 2007 +0200
+++ b/Dialogs.py Thu Aug 02 16:51:58 2007 +0200
@@ -4,7 +4,7 @@
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#
-#Copyright (C): Edouard TISSERANT and Laurent BESSARD
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#
#See COPYING file for copyrights details.
#
@@ -16,7 +16,7 @@
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#Lesser General Public License for more details.
+#General Public License for more details.
#
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
@@ -32,13 +32,12 @@
# Create New Block Dialog
#-------------------------------------------------------------------------------
-[wxID_BLOCKPROPERTIESDIALOG, wxID_BLOCKPROPERTIESDIALOGMAINPANEL,
- wxID_BLOCKPROPERTIESDIALOGNAME, wxID_BLOCKPROPERTIESDIALOGTYPETREE,
- wxID_BLOCKPROPERTIESDIALOGTYPEDESC, wxID_BLOCKPROPERTIESDIALOGINPUTS,
- wxID_BLOCKPROPERTIESDIALOGPREVIEW, wxID_BLOCKPROPERTIESDIALOGSTATICTEXT1,
- wxID_BLOCKPROPERTIESDIALOGSTATICTEXT2, wxID_BLOCKPROPERTIESDIALOGSTATICTEXT3,
- wxID_BLOCKPROPERTIESDIALOGSTATICTEXT4,
-] = [wx.NewId() for _init_ctrls in range(11)]
+[wxID_BLOCKPROPERTIESDIALOG, wxID_BLOCKPROPERTIESDIALOGNAME,
+ wxID_BLOCKPROPERTIESDIALOGTYPETREE, wxID_BLOCKPROPERTIESDIALOGTYPEDESC,
+ wxID_BLOCKPROPERTIESDIALOGINPUTS, wxID_BLOCKPROPERTIESDIALOGPREVIEW,
+ wxID_BLOCKPROPERTIESDIALOGSTATICTEXT1, wxID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
+ wxID_BLOCKPROPERTIESDIALOGSTATICTEXT3, wxID_BLOCKPROPERTIESDIALOGSTATICTEXT4,
+] = [wx.NewId() for _init_ctrls in range(10)]
[CATEGORY, BLOCK] = range(2)
@@ -46,76 +45,121 @@
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.LeftBoxSizer, 1, border=5, flag=wxGROW|wxRIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wxGROW|wxLEFT)
+
+ def _init_coll_LeftBoxSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.TypeTree, 3, border=5, flag=wxGROW|wxBOTTOM)
+ parent.AddWindow(self.TypeDesc, 1, border=0, flag=wxGROW)
+
+ def _init_coll_RightGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddSizer(self.RightUpGridSizer, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.staticText4, 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(2)
+
+ def _init_coll_RightUpGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wxGROW|wxALIGN_BOTTOM)
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wxGROW|wxALIGN_BOTTOM)
+ parent.AddWindow(self.Name, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Inputs, 0, border=0, flag=wxGROW)
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.LeftBoxSizer = wx.StaticBoxSizer(self.staticbox1, wxVERTICAL)
+ self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=5)
+ self.RightUpGridSizer = wx.GridSizer(cols=2, hgap=5, 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_LeftBoxSizer_Items(self.LeftBoxSizer)
+ self._init_coll_RightGridSizer_Items(self.RightGridSizer)
+ self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
+ self._init_coll_RightUpGridSizer_Items(self.RightUpGridSizer)
+
self.SetSizer(self.flexGridSizer1)
def _init_ctrls(self, prnt):
# generated method, don't edit
wx.Dialog.__init__(self, id=wxID_BLOCKPROPERTIESDIALOG,
name='BlockPropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
- size=wx.Size(600, 360), style=wx.DEFAULT_DIALOG_STYLE,
+ size=wx.Size(600, 360), style=wx.DEFAULT_DIALOG_STYLE|wxRESIZE_BORDER,
title='Block Properties')
self.SetClientSize(wx.Size(600, 360))
- self.MainPanel = wx.Panel(id=wxID_BLOCKPROPERTIESDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(600, 320), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
self.staticbox1 = wx.StaticBox(id=wxID_BLOCKPROPERTIESDIALOGSTATICTEXT1,
- label='Type:', name='staticBox1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(245, 280), style=0)
+ label='Type:', name='staticBox1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 0), style=0)
self.staticText2 = wx.StaticText(id=wxID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
- label='Name:', name='staticText2', parent=self.MainPanel,
- pos=wx.Point(274, 24), 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_BLOCKPROPERTIESDIALOGSTATICTEXT2,
- label='Inputs:', name='staticText4', parent=self.MainPanel,
- pos=wx.Point(424, 24), size=wx.Size(70, 17), style=0)
+ label='Inputs:', name='staticText4', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText4 = wx.StaticText(id=wxID_BLOCKPROPERTIESDIALOGSTATICTEXT4,
- label='Preview:', name='staticText4', parent=self.MainPanel,
- pos=wx.Point(274, 80), size=wx.Size(100, 17), style=0)
+ label='Preview:', name='staticText4', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.TypeTree = wx.TreeCtrl(id=wxID_BLOCKPROPERTIESDIALOGTYPETREE,
- name='TypeTree', parent=self.MainPanel, pos=wx.Point(34, 44),
- size=wx.Size(225, 180), style=wx.TR_HAS_BUTTONS|wx.TR_HIDE_ROOT|wx.TR_SINGLE|wx.SUNKEN_BORDER)
+ name='TypeTree', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TR_HAS_BUTTONS|wx.TR_HIDE_ROOT|wx.TR_SINGLE|wx.SUNKEN_BORDER)
EVT_TREE_SEL_CHANGED(self, wxID_BLOCKPROPERTIESDIALOGTYPETREE, self.OnTypeTreeItemSelected)
self.TypeDesc = wx.TextCtrl(id=wxID_BLOCKPROPERTIESDIALOGTYPEDESC,
- name='TypeDesc', parent=self.MainPanel, pos=wx.Point(34, 230),
- size=wx.Size(225, 65), style=wx.TE_READONLY|wx.TE_MULTILINE)
+ name='TypeDesc', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TE_READONLY|wx.TE_MULTILINE)
self.Name = wx.TextCtrl(id=wxID_BLOCKPROPERTIESDIALOGNAME, value='',
- name='Name', parent=self.MainPanel, pos=wx.Point(274, 48),
- 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_BLOCKPROPERTIESDIALOGNAME, self.OnNameChanged)
self.Inputs = wx.SpinCtrl(id=wxID_BLOCKPROPERTIESDIALOGINPUTS,
- name='Inputs', parent=self.MainPanel, pos=wx.Point(424, 48),
- size=wx.Size(145, 24), style=wxSP_ARROW_KEYS, min=2, max=20)
+ name='Inputs', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=wxSP_ARROW_KEYS, min=2, max=20)
EVT_SPINCTRL(self, wxID_BLOCKPROPERTIESDIALOGINPUTS, self.OnInputsChanged)
self.Preview = wx.Panel(id=wxID_BLOCKPROPERTIESDIALOGPREVIEW,
- name='Preview', parent=self.MainPanel, pos=wx.Point(274, 104),
- size=wx.Size(300, 200), 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.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.Name.SetValue("")
self.Name.Enable(False)
self.Inputs.Enable(False)
@@ -269,7 +313,7 @@
# Create New Variable Dialog
#-------------------------------------------------------------------------------
-[wxID_VARIABLEPROPERTIESDIALOG, wxID_VARIABLEPROPERTIESDIALOGMAINPANEL,
+[wxID_VARIABLEPROPERTIESDIALOG, wxID_VARIABLEPROPERTIESDIALOGSPACER,
wxID_VARIABLEPROPERTIESDIALOGNAME, wxID_VARIABLEPROPERTIESDIALOGCLASS,
wxID_VARIABLEPROPERTIESDIALOGPREVIEW, wxID_VARIABLEPROPERTIESDIALOGEXPRESSION,
wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT1, wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT2,
@@ -280,14 +324,79 @@
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.TopSizer, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.staticText4, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wxGROW)
+
+ def _init_coll_MainSizer_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(2)
+
+ def _init_coll_TopSizer_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.Class, 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.Expression, 0, border=0, flag=wxGROW)
+
+ def _init_coll_LeftGridSizer_Growables(self, parent):
+ # generated method, don't edit
+
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(2)
+
+ def _init_coll_RightGridSizer_Items(self, parent):
+ # generated method, don't edit
+
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Name, 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.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=5)
+ self.TopSizer = wx.BoxSizer(wxHORIZONTAL)
+ self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=5, 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_MainSizer_Growables(self.MainSizer)
+ self._init_coll_TopSizer_Items(self.TopSizer)
+ 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)
def _init_ctrls(self, prnt):
@@ -298,54 +407,53 @@
title='Variable Properties')
self.SetClientSize(wx.Size(400, 380))
- self.MainPanel = wx.Panel(id=wxID_VARIABLEPROPERTIESDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(400, 280), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
self.staticText1 = wx.StaticText(id=wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT1,
- label='Class:', name='staticText1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(70, 17), style=0)
+ label='Class:', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText2 = wx.StaticText(id=wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT2,
- label='Expression:', name='staticText2', parent=self.MainPanel,
- pos=wx.Point(24, 90), size=wx.Size(100, 17), style=0)
+ label='Expression:', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText3 = wx.StaticText(id=wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT3,
- label='Name:', name='staticText3', parent=self.MainPanel,
- pos=wx.Point(204, 24), size=wx.Size(70, 17), style=0)
+ label='Name:', name='staticText3', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.staticText4 = wx.StaticText(id=wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT4,
- label='Preview:', name='staticText4', parent=self.MainPanel,
- pos=wx.Point(24, 144), size=wx.Size(100, 17), style=0)
+ label='Preview:', name='staticText4', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.Class = wx.Choice(id=wxID_VARIABLEPROPERTIESDIALOGCLASS,
- name='Class', parent=self.MainPanel, pos=wx.Point(24, 48),
- size=wx.Size(145, 24), style=0)
+ name='Class', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
EVT_CHOICE(self, wxID_VARIABLEPROPERTIESDIALOGCLASS, self.OnClassChanged)
self.Name = wx.ListBox(id=wxID_VARIABLEPROPERTIESDIALOGNAME,
- name='Name', parent=self.MainPanel, pos=wx.Point(204, 48),
- size=wx.Size(145, 90), style=wx.LB_SINGLE)
+ name='Name', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 90), style=wx.LB_SINGLE)
EVT_LISTBOX(self, wxID_VARIABLEPROPERTIESDIALOGNAME, self.OnNameChanged)
self.Expression = wx.TextCtrl(id=wxID_VARIABLEPROPERTIESDIALOGEXPRESSION,
- name='Expression', parent=self.MainPanel, pos=wx.Point(24, 114),
- size=wx.Size(145, 24), style=0)
+ name='Expression', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
EVT_TEXT(self, wxID_VARIABLEPROPERTIESDIALOGEXPRESSION, self.OnExpressionChanged)
+ self.Spacer = wx.Panel(id=wxID_VARIABLEPROPERTIESDIALOGSPACER,
+ name='Spacer', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+
self.Preview = wx.Panel(id=wxID_VARIABLEPROPERTIESDIALOGPREVIEW,
- name='Preview', parent=self.MainPanel, pos=wx.Point(24, 170),
- size=wx.Size(350, 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.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.Variable = None
self.VarList = []
self.MinVariableSize = None