--- a/Dialogs.py Tue Aug 07 17:37:38 2007 +0200
+++ b/Dialogs.py Tue Aug 07 17:38:48 2007 +0200
@@ -22,9 +22,8 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from wxPython.wx import *
-from wxPython.grid import *
import wx
+import wx.grid
from graphics import *
@@ -32,66 +31,51 @@
# Create New Block Dialog
#-------------------------------------------------------------------------------
-[wxID_BLOCKPROPERTIESDIALOG, wxID_BLOCKPROPERTIESDIALOGNAME,
- wxID_BLOCKPROPERTIESDIALOGTYPETREE, wxID_BLOCKPROPERTIESDIALOGTYPEDESC,
- wxID_BLOCKPROPERTIESDIALOGINPUTS, wxID_BLOCKPROPERTIESDIALOGPREVIEW,
- wxID_BLOCKPROPERTIESDIALOGSTATICTEXT1, wxID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
- wxID_BLOCKPROPERTIESDIALOGSTATICTEXT3, wxID_BLOCKPROPERTIESDIALOGSTATICTEXT4,
+[ID_BLOCKPROPERTIESDIALOG, ID_BLOCKPROPERTIESDIALOGNAME,
+ ID_BLOCKPROPERTIESDIALOGTYPETREE, ID_BLOCKPROPERTIESDIALOGTYPEDESC,
+ ID_BLOCKPROPERTIESDIALOGINPUTS, ID_BLOCKPROPERTIESDIALOGPREVIEW,
+ ID_BLOCKPROPERTIESDIALOGSTATICTEXT1, ID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
+ ID_BLOCKPROPERTIESDIALOGSTATICTEXT3, ID_BLOCKPROPERTIESDIALOGSTATICTEXT4,
] = [wx.NewId() for _init_ctrls in range(10)]
[CATEGORY, BLOCK] = range(2)
class BlockPropertiesDialog(wx.Dialog):
def _init_coll_flexGridSizer1_Items(self, parent):
- # generated method, don't edit
-
- 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)
+ parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
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)
+ parent.AddSizer(self.LeftBoxSizer, 1, border=5, flag=wx.GROW|wx.RIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wx.GROW|wx.LEFT)
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)
+ parent.AddWindow(self.TypeTree, 3, border=5, flag=wx.GROW|wx.BOTTOM)
+ parent.AddWindow(self.TypeDesc, 1, border=0, flag=wx.GROW)
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)
+ parent.AddSizer(self.RightUpGridSizer, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText4, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wx.GROW)
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)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW|wx.ALIGN_BOTTOM)
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW|wx.ALIGN_BOTTOM)
+ parent.AddWindow(self.Name, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Inputs, 0, border=0, flag=wx.GROW)
def _init_sizers(self):
- # generated method, don't edit
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.MainSizer = wx.BoxSizer(wx.HORIZONTAL)
+ self.LeftBoxSizer = wx.StaticBoxSizer(self.staticbox1, wx.VERTICAL)
self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=5)
self.RightUpGridSizer = wx.GridSizer(cols=2, hgap=5, rows=2, vgap=5)
@@ -106,55 +90,58 @@
self.SetSizer(self.flexGridSizer1)
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Dialog.__init__(self, id=wxID_BLOCKPROPERTIESDIALOG,
+ wx.Dialog.__init__(self, id=ID_BLOCKPROPERTIESDIALOG,
name='BlockPropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
- size=wx.Size(600, 360), style=wx.DEFAULT_DIALOG_STYLE|wxRESIZE_BORDER,
+ size=wx.Size(600, 360), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
title='Block Properties')
self.SetClientSize(wx.Size(600, 360))
- self.staticbox1 = wx.StaticBox(id=wxID_BLOCKPROPERTIESDIALOGSTATICTEXT1,
+ self.staticbox1 = wx.StaticBox(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT1,
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,
+ self.staticText2 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
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,
+ self.staticText3 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
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,
+ self.staticText4 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT4,
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,
+ self.TypeTree = wx.TreeCtrl(id=ID_BLOCKPROPERTIESDIALOGTYPETREE,
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,
+ self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTypeTreeItemSelected,
+ id=ID_BLOCKPROPERTIESDIALOGTYPETREE)
+
+ self.TypeDesc = wx.TextCtrl(id=ID_BLOCKPROPERTIESDIALOGTYPEDESC,
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='',
+ self.Name = wx.TextCtrl(id=ID_BLOCKPROPERTIESDIALOGNAME, value='',
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,
+ self.Bind(wx.EVT_TEXT, self.OnNameChanged, id=ID_BLOCKPROPERTIESDIALOGNAME)
+
+ self.Inputs = wx.SpinCtrl(id=ID_BLOCKPROPERTIESDIALOGINPUTS,
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,
+ size=wx.Size(0, 24), style=wx.SP_ARROW_KEYS, min=2, max=20)
+ self.Bind(wx.EVT_SPINCTRL, self.OnInputsChanged, id=ID_BLOCKPROPERTIESDIALOGINPUTS)
+
+ self.Preview = wx.Panel(id=ID_BLOCKPROPERTIESDIALOGPREVIEW,
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))
+ self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
- self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
+ self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
+
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
self._init_sizers()
@@ -165,9 +152,6 @@
self.Inputs.Enable(False)
self.Block = None
self.MinBlockSize = None
-
- EVT_PAINT(self, self.OnPaint)
- EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
def FindTreeItem(self, root, name, inputs = None):
if root.IsOk():
@@ -191,15 +175,15 @@
error = []
selected = self.TypeTree.GetSelection()
if not selected.IsOk() or self.TypeTree.GetItemParent(selected) == self.TypeTree.GetRootItem() or selected == self.TypeTree.GetRootItem():
- message = wxMessageDialog(self, "Form isn't complete. Valid block type must be selected!", "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "Form isn't complete. Valid block type must be selected!", "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
elif self.Name.IsEnabled() and self.Name.GetValue() == "":
- message = wxMessageDialog(self, "Form isn't complete. Name must be filled!", "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "Form isn't complete. Name must be filled!", "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
else:
- self.EndModal(wxID_OK)
+ self.EndModal(wx.ID_OK)
def SetBlockList(self, blocktypes):
root = self.TypeTree.AddRoot("")
@@ -251,19 +235,19 @@
self.Inputs.Enable(blocktype["extensible"])
self.Name.Enable(blocktype["type"] != "function")
self.TypeDesc.SetValue(blocktype["comment"])
- wxCallAfter(self.RefreshPreview)
+ wx.CallAfter(self.RefreshPreview)
else:
self.Name.Enable(False)
self.Inputs.Enable(False)
self.Inputs.SetValue(2)
self.TypeDesc.SetValue("")
- wxCallAfter(self.ErasePreview)
+ wx.CallAfter(self.ErasePreview)
else:
self.Name.Enable(False)
self.Inputs.Enable(False)
self.Inputs.SetValue(2)
self.TypeDesc.SetValue("")
- wxCallAfter(self.ErasePreview)
+ wx.CallAfter(self.ErasePreview)
event.Skip()
def OnNameChanged(self, event):
@@ -277,12 +261,12 @@
event.Skip()
def ErasePreview(self):
- dc = wxClientDC(self.Preview)
+ dc = wx.ClientDC(self.Preview)
dc.Clear()
self.Block = None
def RefreshPreview(self):
- dc = wxClientDC(self.Preview)
+ dc = wx.ClientDC(self.Preview)
dc.Clear()
item = self.TypeTree.GetSelection()
pydata = self.TypeTree.GetPyData(item)
@@ -313,77 +297,58 @@
# Create New Variable Dialog
#-------------------------------------------------------------------------------
-[wxID_VARIABLEPROPERTIESDIALOG, wxID_VARIABLEPROPERTIESDIALOGSPACER,
- wxID_VARIABLEPROPERTIESDIALOGNAME, wxID_VARIABLEPROPERTIESDIALOGCLASS,
- wxID_VARIABLEPROPERTIESDIALOGPREVIEW, wxID_VARIABLEPROPERTIESDIALOGEXPRESSION,
- wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT1, wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT2,
- wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT3, wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT4,
+[ID_VARIABLEPROPERTIESDIALOG, ID_VARIABLEPROPERTIESDIALOGSPACER,
+ ID_VARIABLEPROPERTIESDIALOGNAME, ID_VARIABLEPROPERTIESDIALOGCLASS,
+ ID_VARIABLEPROPERTIESDIALOGPREVIEW, ID_VARIABLEPROPERTIESDIALOGEXPRESSION,
+ ID_VARIABLEPROPERTIESDIALOGSTATICTEXT1, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT2,
+ ID_VARIABLEPROPERTIESDIALOGSTATICTEXT3, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT4,
] = [wx.NewId() for _init_ctrls in range(10)]
class VariablePropertiesDialog(wx.Dialog):
def _init_coll_flexGridSizer1_Items(self, parent):
- # generated method, don't edit
-
- 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)
+ parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
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)
+ parent.AddSizer(self.TopSizer, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText4, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wx.GROW)
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)
+ parent.AddSizer(self.LeftGridSizer, 1, border=5, flag=wx.GROW|wx.RIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wx.GROW|wx.LEFT)
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)
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Class, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Spacer, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Expression, 0, border=0, flag=wx.GROW)
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)
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Name, 0, border=0, flag=wx.GROW)
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=10)
self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=5)
- self.TopSizer = wx.BoxSizer(wxHORIZONTAL)
+ self.TopSizer = wx.BoxSizer(wx.HORIZONTAL)
self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=5, vgap=5)
self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
@@ -400,55 +365,56 @@
self.SetSizer(self.flexGridSizer1)
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Dialog.__init__(self, id=wxID_VARIABLEPROPERTIESDIALOG,
+ wx.Dialog.__init__(self, id=ID_VARIABLEPROPERTIESDIALOG,
name='VariablePropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
size=wx.Size(400, 380), style=wx.DEFAULT_DIALOG_STYLE,
title='Variable Properties')
self.SetClientSize(wx.Size(400, 380))
- self.staticText1 = wx.StaticText(id=wxID_VARIABLEPROPERTIESDIALOGSTATICTEXT1,
+ self.staticText1 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT1,
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,
+ self.staticText2 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT2,
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,
+ self.staticText3 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT3,
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,
+ self.staticText4 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT4,
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,
+ self.Class = wx.Choice(id=ID_VARIABLEPROPERTIESDIALOGCLASS,
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,
+ self.Bind(wx.EVT_CHOICE, self.OnClassChanged, id=ID_VARIABLEPROPERTIESDIALOGCLASS)
+
+ self.Name = wx.ListBox(id=ID_VARIABLEPROPERTIESDIALOGNAME,
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,
+ self.Bind(wx.EVT_LISTBOX, self.OnNameChanged, id=ID_VARIABLEPROPERTIESDIALOGNAME)
+
+ self.Expression = wx.TextCtrl(id=ID_VARIABLEPROPERTIESDIALOGEXPRESSION,
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,
+ self.Bind(wx.EVT_TEXT, self.OnExpressionChanged, id=ID_VARIABLEPROPERTIESDIALOGEXPRESSION)
+
+ self.Spacer = wx.Panel(id=ID_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,
+ self.Preview = wx.Panel(id=ID_VARIABLEPROPERTIESDIALOGPREVIEW,
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))
+ self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
- self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
+ self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
self._init_sizers()
@@ -462,8 +428,6 @@
for choice in ["Input", "Output", "InOut"]:
self.Class.Append(choice)
self.Class.SetStringSelection("Input")
-
- EVT_PAINT(self, self.OnPaint)
def RefreshNameList(self):
selected = self.Name.GetStringSelection()
@@ -478,7 +442,7 @@
self.Name.Append(name)
elif var_type == "InOut" and self.Class.GetStringSelection() == "InOut":
self.Name.Append(name)
- if self.Name.FindString(selected) != wxNOT_FOUND:
+ if self.Name.FindString(selected) != wx.NOT_FOUND:
self.Name.SetStringSelection(selected)
else:
self.Name.SetStringSelection("")
@@ -503,7 +467,7 @@
self.Class.SetStringSelection("InOut")
self.RefreshNameList()
if value_name:
- if self.Name.FindString(value_name) != wxNOT_FOUND:
+ if self.Name.FindString(value_name) != wx.NOT_FOUND:
self.Name.SetStringSelection(value_name)
self.Expression.Enable(False)
else:
@@ -558,7 +522,7 @@
event.Skip()
def RefreshPreview(self):
- dc = wxClientDC(self.Preview)
+ dc = wx.ClientDC(self.Preview)
dc.Clear()
expression = self.Expression.GetValue()
if self.Expression.IsEnabled() and expression != "":
@@ -593,64 +557,49 @@
# Create New Connection Dialog
#-------------------------------------------------------------------------------
-[wxID_CONNECTIONPROPERTIESDIALOG, wxID_CONNECTIONPROPERTIESDIALOGSPACER,
- wxID_CONNECTIONPROPERTIESDIALOGNAME, wxID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1,
- wxID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2, wxID_CONNECTIONPROPERTIESDIALOGPREVIEW,
- wxID_CONNECTIONPROPERTIESDIALOGSTATICTEXT1, wxID_CONNECTIONPROPERTIESDIALOGSTATICTEXT2,
- wxID_CONNECTIONPROPERTIESDIALOGSTATICTEXT3,
+[ID_CONNECTIONPROPERTIESDIALOG, ID_CONNECTIONPROPERTIESDIALOGSPACER,
+ ID_CONNECTIONPROPERTIESDIALOGNAME, ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1,
+ ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2, ID_CONNECTIONPROPERTIESDIALOGPREVIEW,
+ ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT1, ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT2,
+ ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT3,
] = [wx.NewId() for _init_ctrls in range(9)]
class ConnectionPropertiesDialog(wx.Dialog):
def _init_coll_flexGridSizer1_Items(self, parent):
- # generated method, don't edit
-
- 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)
+ parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
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)
+ parent.AddSizer(self.LeftGridSizer, 1, border=5, flag=wx.GROW|wx.RIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wx.GROW|wx.LEFT)
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)
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Name, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Spacer, 0, border=0, flag=wx.GROW)
def _init_coll_LeftGridSizer_Growables(self, parent):
- # generated method, don't edit
-
- parent.AddGrowableCol(0)
- parent.AddGrowableRow(3)
+ 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)
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wx.GROW)
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=10)
- self.MainSizer = wx.BoxSizer(wxHORIZONTAL)
+ self.MainSizer = wx.BoxSizer(wx.HORIZONTAL)
self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=6, vgap=5)
self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
@@ -665,53 +614,54 @@
self.SetSizer(self.flexGridSizer1)
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Dialog.__init__(self, id=wxID_CONNECTIONPROPERTIESDIALOG,
+ wx.Dialog.__init__(self, id=ID_CONNECTIONPROPERTIESDIALOG,
name='ConnectionPropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
size=wx.Size(350, 220), style=wx.DEFAULT_DIALOG_STYLE,
title='Connection Properties')
self.SetClientSize(wx.Size(350, 220))
- self.staticText1 = wx.StaticText(id=wxID_CONNECTIONPROPERTIESDIALOGSTATICTEXT1,
+ self.staticText1 = wx.StaticText(id=ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT1,
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,
+ self.staticText2 = wx.StaticText(id=ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT2,
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,
+ self.staticText3 = wx.StaticText(id=ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT3,
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,
+ self.radioButton1 = wx.RadioButton(id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1,
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.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1)
self.radioButton1.SetValue(True)
- self.radioButton2 = wx.RadioButton(id=wxID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2,
+ self.radioButton2 = wx.RadioButton(id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2,
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.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2)
self.radioButton2.SetValue(False)
- self.Name = wx.TextCtrl(id=wxID_CONNECTIONPROPERTIESDIALOGNAME,
+ self.Name = wx.TextCtrl(id=ID_CONNECTIONPROPERTIESDIALOGNAME,
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,
+ self.Bind(wx.EVT_TEXT, self.OnNameChanged, id=ID_CONNECTIONPROPERTIESDIALOGNAME)
+
+ self.Preview = wx.Panel(id=ID_CONNECTIONPROPERTIESDIALOGPREVIEW,
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))
+ self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
- self.Spacer = wx.Panel(id=wxID_CONNECTIONPROPERTIESDIALOGSPACER,
+ self.Spacer = wx.Panel(id=ID_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.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
self._init_sizers()
@@ -719,8 +669,6 @@
self._init_ctrls(parent)
self.Connection = None
self.MinConnectionSize = None
-
- EVT_PAINT(self, self.OnPaint)
def SetMinConnectionSize(self, size):
self.MinConnectionSize = size
@@ -755,7 +703,7 @@
event.Skip()
def RefreshPreview(self):
- dc = wxClientDC(self.Preview)
+ dc = wx.ClientDC(self.Preview)
dc.Clear()
if self.radioButton1.GetValue():
self.Connection = FBD_Connector(self.Preview, CONNECTOR, self.Name.GetValue())
@@ -780,67 +728,52 @@
#-------------------------------------------------------------------------------
-[wxID_LDELEMENTDIALOG, wxID_LDELEMENTDIALOGSPACER,
- wxID_LDELEMENTDIALOGNAME, wxID_LDELEMENTDIALOGRADIOBUTTON1,
- wxID_LDELEMENTDIALOGRADIOBUTTON2, wxID_LDELEMENTDIALOGRADIOBUTTON3,
- wxID_LDELEMENTDIALOGRADIOBUTTON4, wxID_LDELEMENTDIALOGPREVIEW,
- wxID_LDELEMENTDIALOGSTATICTEXT1, wxID_LDELEMENTDIALOGSTATICTEXT2,
- wxID_LDELEMENTDIALOGSTATICTEXT3,
+[ID_LDELEMENTDIALOG, ID_LDELEMENTDIALOGSPACER,
+ ID_LDELEMENTDIALOGNAME, ID_LDELEMENTDIALOGRADIOBUTTON1,
+ ID_LDELEMENTDIALOGRADIOBUTTON2, ID_LDELEMENTDIALOGRADIOBUTTON3,
+ ID_LDELEMENTDIALOGRADIOBUTTON4, ID_LDELEMENTDIALOGPREVIEW,
+ ID_LDELEMENTDIALOGSTATICTEXT1, ID_LDELEMENTDIALOGSTATICTEXT2,
+ ID_LDELEMENTDIALOGSTATICTEXT3,
] = [wx.NewId() for _init_ctrls in range(11)]
class LDElementDialog(wx.Dialog):
def _init_coll_flexGridSizer1_Items(self, parent):
- # generated method, don't edit
-
- 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)
+ parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
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)
+ parent.AddSizer(self.LeftGridSizer, 1, border=5, flag=wx.GROW|wx.RIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wx.GROW|wx.LEFT)
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)
-
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton3, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton4, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Name, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Spacer, 0, border=0, flag=wx.GROW)
+
def _init_coll_LeftGridSizer_Growables(self, parent):
- # generated method, don't edit
-
- parent.AddGrowableCol(0)
- parent.AddGrowableRow(5)
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(7)
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)
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wx.GROW)
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=10)
- self.MainSizer = wx.BoxSizer(wxHORIZONTAL)
+ self.MainSizer = wx.BoxSizer(wx.HORIZONTAL)
self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=8, vgap=5)
self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
@@ -855,63 +788,64 @@
self.SetSizer(self.flexGridSizer1)
def _init_ctrls(self, prnt, title, labels):
- # generated method, don't edit
- wx.Dialog.__init__(self, id=wxID_LDELEMENTDIALOG,
+ wx.Dialog.__init__(self, id=ID_LDELEMENTDIALOG,
name='VariablePropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
size=wx.Size(350, 260), style=wx.DEFAULT_DIALOG_STYLE,
title=title)
self.SetClientSize(wx.Size(350, 260))
- self.staticText1 = wx.StaticText(id=wxID_LDELEMENTDIALOGSTATICTEXT1,
+ self.staticText1 = wx.StaticText(id=ID_LDELEMENTDIALOGSTATICTEXT1,
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,
+ self.staticText2 = wx.StaticText(id=ID_LDELEMENTDIALOGSTATICTEXT2,
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,
+ self.staticText3 = wx.StaticText(id=ID_LDELEMENTDIALOGSTATICTEXT3,
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,
+ self.radioButton1 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON1,
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.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON1)
self.radioButton1.SetValue(True)
- self.radioButton2 = wx.RadioButton(id=wxID_LDELEMENTDIALOGRADIOBUTTON2,
+ self.radioButton2 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON2,
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,
+ self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON2)
+
+ self.radioButton3 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON3,
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,
+ self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON3)
+
+ self.radioButton4 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON4,
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,
+ self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON4)
+
+ self.Name = wx.Choice(id=ID_LDELEMENTDIALOGNAME,
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,
+ self.Bind(wx.EVT_CHOICE, self.OnNameChanged, id=ID_LDELEMENTDIALOGNAME)
+
+ self.Preview = wx.Panel(id=ID_LDELEMENTDIALOGPREVIEW,
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))
+ self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
- self.Spacer = wx.Panel(id=wxID_LDELEMENTDIALOGSPACER,
+ self.Spacer = wx.Panel(id=ID_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.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
+
self._init_sizers()
def __init__(self, parent, type):
@@ -922,16 +856,12 @@
elif type == "coil":
self._init_ctrls(parent, "Edit Coil Values", ['Normal','Negate','Set','Reset'])
self.Element = LD_Coil(self.Preview, COIL_NORMAL, "")
- self.Element.SetPosition((150 - LD_ELEMENT_SIZE[0]) / 2, (150 - LD_ELEMENT_SIZE[1]) / 2)
-
- EVT_PAINT(self, self.OnPaint)
-
+
def SetElementSize(self, size):
min_width, min_height = self.Element.GetMinSize()
width, height = max(min_width, size[0]), max(min_height, size[1])
self.Element.SetSize(width, height)
- self.Element.SetPosition((150 - width) / 2, (150 - height) / 2)
-
+
def SetVariables(self, vars):
self.Name.Clear()
for name in vars:
@@ -999,7 +929,7 @@
event.Skip()
def RefreshPreview(self):
- dc = wxClientDC(self.Preview)
+ dc = wx.ClientDC(self.Preview)
dc.Clear()
clientsize = self.Preview.GetClientSize()
width, height = self.Element.GetSize()
@@ -1016,64 +946,49 @@
#-------------------------------------------------------------------------------
-[wxID_LDPOWERRAILDIALOG, wxID_LDPOWERRAILDIALOGSPACER,
- wxID_LDPOWERRAILDIALOGTYPE, wxID_LDPOWERRAILDIALOGRADIOBUTTON1,
- wxID_LDPOWERRAILDIALOGRADIOBUTTON2, wxID_LDPOWERRAILDIALOGPREVIEW,
- wxID_LDPOWERRAILDIALOGSTATICTEXT1, wxID_LDPOWERRAILDIALOGSTATICTEXT2,
- wxID_LDPOWERRAILDIALOGSTATICTEXT3, wxID_LDPOWERRAILDIALOGPINNUMBER,
+[ID_LDPOWERRAILDIALOG, ID_LDPOWERRAILDIALOGSPACER,
+ ID_LDPOWERRAILDIALOGTYPE, ID_LDPOWERRAILDIALOGRADIOBUTTON1,
+ ID_LDPOWERRAILDIALOGRADIOBUTTON2, ID_LDPOWERRAILDIALOGPREVIEW,
+ ID_LDPOWERRAILDIALOGSTATICTEXT1, ID_LDPOWERRAILDIALOGSTATICTEXT2,
+ ID_LDPOWERRAILDIALOGSTATICTEXT3, ID_LDPOWERRAILDIALOGPINNUMBER,
] = [wx.NewId() for _init_ctrls in range(10)]
class LDPowerRailDialog(wx.Dialog):
def _init_coll_flexGridSizer1_Items(self, parent):
- # generated method, don't edit
-
- 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)
+ parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
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)
+ parent.AddSizer(self.LeftGridSizer, 1, border=5, flag=wx.GROW|wx.RIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wx.GROW|wx.LEFT)
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)
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.PinNumber, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Spacer, 0, border=0, flag=wx.GROW)
def _init_coll_LeftGridSizer_Growables(self, parent):
- # generated method, don't edit
-
- parent.AddGrowableCol(0)
- parent.AddGrowableRow(3)
+ 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)
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wx.GROW)
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=10)
- self.MainSizer = wx.BoxSizer(wxHORIZONTAL)
+ self.MainSizer = wx.BoxSizer(wx.HORIZONTAL)
self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=6, vgap=5)
self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
@@ -1088,53 +1003,54 @@
self.SetSizer(self.flexGridSizer1)
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Dialog.__init__(self, id=wxID_LDPOWERRAILDIALOG,
+ wx.Dialog.__init__(self, id=ID_LDPOWERRAILDIALOG,
name='PowerRailDialog', parent=prnt, pos=wx.Point(376, 223),
size=wx.Size(350, 260), style=wx.DEFAULT_DIALOG_STYLE,
title='Power Rail Properties')
self.SetClientSize(wx.Size(350, 260))
- self.staticText1 = wx.StaticText(id=wxID_LDPOWERRAILDIALOGSTATICTEXT1,
+ self.staticText1 = wx.StaticText(id=ID_LDPOWERRAILDIALOGSTATICTEXT1,
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,
+ self.staticText2 = wx.StaticText(id=ID_LDPOWERRAILDIALOGSTATICTEXT2,
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,
+ self.staticText3 = wx.StaticText(id=ID_LDPOWERRAILDIALOGSTATICTEXT3,
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,
+ self.radioButton1 = wx.RadioButton(id=ID_LDPOWERRAILDIALOGRADIOBUTTON1,
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.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDPOWERRAILDIALOGRADIOBUTTON1)
self.radioButton1.SetValue(True)
- self.radioButton2 = wx.RadioButton(id=wxID_LDPOWERRAILDIALOGRADIOBUTTON2,
+ self.radioButton2 = wx.RadioButton(id=ID_LDPOWERRAILDIALOGRADIOBUTTON2,
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,
+ self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDPOWERRAILDIALOGRADIOBUTTON2)
+
+ self.PinNumber = wx.SpinCtrl(id=ID_LDPOWERRAILDIALOGPINNUMBER,
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,
+ size=wx.Size(0, 24), style=wx.SP_ARROW_KEYS, min=1, max=20)
+ self.Bind(wx.EVT_SPINCTRL, self.OnPinNumberChanged, id=ID_LDPOWERRAILDIALOGPINNUMBER)
+
+ self.Preview = wx.Panel(id=ID_LDPOWERRAILDIALOGPREVIEW,
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))
+ self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
- self.Spacer = wx.Panel(id=wxID_LDELEMENTDIALOGSPACER,
+ self.Spacer = wx.Panel(id=ID_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.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
+
self._init_sizers()
def __init__(self, parent, type = LEFTRAIL, number = 1):
@@ -1149,8 +1065,6 @@
self.PowerRailMinSize = (0, 0)
self.PowerRail = None
- EVT_PAINT(self, self.OnPaint)
-
def SetMinSize(self, size):
self.PowerRailMinSize = size
self.RefreshPreview()
@@ -1175,7 +1089,7 @@
event.Skip()
def RefreshPreview(self):
- dc = wxClientDC(self.Preview)
+ dc = wx.ClientDC(self.Preview)
dc.Clear()
self.PowerRail = LD_PowerRail(self.Preview, self.Type, connectors = [True for i in xrange(self.PinNumber.GetValue())])
min_width, min_height = self.PowerRail.GetMinSize()
@@ -1194,66 +1108,138 @@
# Edit Transition Content Dialog
#-------------------------------------------------------------------------------
-[wxID_TRANSITIONCONTENTDIALOG, wxID_TRANSITIONCONTENTDIALOGMAINPANEL,
- wxID_TRANSITIONCONTENTDIALOGREFERENCE, wxID_TRANSITIONCONTENTDIALOGINLINE,
- wxID_TRANSITIONCONTENTDIALOGRADIOBUTTON1, wxID_TRANSITIONCONTENTDIALOGRADIOBUTTON2,
-] = [wx.NewId() for _init_ctrls in range(6)]
+[ID_TRANSITIONCONTENTDIALOG, ID_TRANSITIONCONTENTDIALOGSPACER,
+ ID_TRANSITIONCONTENTDIALOGREFERENCE, ID_TRANSITIONCONTENTDIALOGINLINE,
+ ID_TRANSITIONCONTENTDIALOGPREVIEW, ID_TRANSITIONCONTENTDIALOGRADIOBUTTON1,
+ ID_TRANSITIONCONTENTDIALOGRADIOBUTTON2, ID_TRANSITIONCONTENTDIALOGRADIOBUTTON3,
+ ID_TRANSITIONCONTENTDIALOGSTATICTEXT1, ID_TRANSITIONCONTENTDIALOGSTATICTEXT2,
+] = [wx.NewId() for _init_ctrls in range(10)]
class TransitionContentDialog(wx.Dialog):
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=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
+
+ def _init_coll_flexGridSizer1_Growables(self, parent):
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(0)
+
+ def _init_coll_MainSizer_Items(self, parent):
+ parent.AddSizer(self.LeftGridSizer, 1, border=5, flag=wx.GROW|wx.RIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wx.GROW|wx.LEFT)
+
+ def _init_coll_LeftGridSizer_Items(self, parent):
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Reference, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Inline, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton3, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Spacer, 0, border=0, flag=wx.GROW)
+
+ def _init_coll_LeftGridSizer_Growables(self, parent):
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(6)
+
+ def _init_coll_RightGridSizer_Items(self, parent):
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wx.GROW)
+
+ def _init_coll_RightGridSizer_Growables(self, parent):
+ 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(wx.HORIZONTAL)
+ self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=7, 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)
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Dialog.__init__(self, id=wxID_TRANSITIONCONTENTDIALOG,
+ wx.Dialog.__init__(self, id=ID_TRANSITIONCONTENTDIALOG,
name='ProjectDialog', parent=prnt, pos=wx.Point(376, 223),
- size=wx.Size(300, 200), style=wx.DEFAULT_DIALOG_STYLE,
+ size=wx.Size(350, 260), style=wx.DEFAULT_DIALOG_STYLE,
title='Edit transition')
- self.SetClientSize(wx.Size(300, 200))
-
- self.MainPanel = wx.Panel(id=wxID_TRANSITIONCONTENTDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(300, 200), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
- self.radioButton1 = wx.RadioButton(id=wxID_TRANSITIONCONTENTDIALOGRADIOBUTTON1,
- label='Reference', name='radioButton1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(114, 24), style=0)
- EVT_RADIOBUTTON(self, wxID_TRANSITIONCONTENTDIALOGRADIOBUTTON1, self.OnTypeChanged)
+ self.SetClientSize(wx.Size(350, 260))
+
+ self.staticText1 = wx.StaticText(id=ID_TRANSITIONCONTENTDIALOGSTATICTEXT1,
+ label='Type:', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
+
+ self.staticText2 = wx.StaticText(id=ID_TRANSITIONCONTENTDIALOGSTATICTEXT2,
+ label='Preview:', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
+
+ self.radioButton1 = wx.RadioButton(id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON1,
+ label='Reference', name='radioButton1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
+ self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON1)
self.radioButton1.SetValue(True)
- self.Reference = wx.Choice(id=wxID_TRANSITIONCONTENTDIALOGREFERENCE,
- name='Reference', parent=self.MainPanel, pos=wx.Point(48, 48),
- size=wx.Size(200, 24), style=0)
-
- self.radioButton2 = wx.RadioButton(id=wxID_TRANSITIONCONTENTDIALOGRADIOBUTTON2,
- label='Inline', name='radioButton2', parent=self.MainPanel,
- pos=wx.Point(24, 72), size=wx.Size(114, 24), style=0)
- EVT_RADIOBUTTON(self, wxID_TRANSITIONCONTENTDIALOGRADIOBUTTON2, self.OnTypeChanged)
+ self.Reference = wx.Choice(id=ID_TRANSITIONCONTENTDIALOGREFERENCE,
+ name='Reference', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+ self.Bind(wx.EVT_CHOICE, self.OnReferenceChanged, id=ID_TRANSITIONCONTENTDIALOGREFERENCE)
+
+ self.radioButton2 = wx.RadioButton(id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON2,
+ label='Inline', name='radioButton2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
+ self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON2)
self.radioButton2.SetValue(False)
- self.Inline = wx.TextCtrl(id=wxID_TRANSITIONCONTENTDIALOGINLINE,
- name='Inline', parent=self.MainPanel, pos=wx.Point(48, 96),
- size=wx.Size(200, 24), style=0)
-
+ self.Inline = wx.TextCtrl(id=ID_TRANSITIONCONTENTDIALOGINLINE,
+ name='Inline', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+ self.Bind(wx.EVT_TEXT, self.OnInlineChanged, id=ID_TRANSITIONCONTENTDIALOGINLINE)
+
+ self.radioButton3 = wx.RadioButton(id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON3,
+ label='Connection', name='radioButton3', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
+ self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON3)
+ self.radioButton3.SetValue(False)
+ if not self.Connection:
+ self.radioButton3.Hide()
+
+ self.Preview = wx.Panel(id=ID_TRANSITIONCONTENTDIALOGPREVIEW,
+ name='Preview', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
+ self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
+ setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
+ setattr(self.Preview, "RefreshTransitionModel", lambda x:None)
+
+ self.Spacer = wx.Panel(id=ID_TRANSITIONCONTENTDIALOGSPACER,
+ name='Spacer', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+
+ self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
+
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
+
self._init_sizers()
- def __init__(self, parent):
+ def __init__(self, parent, connection):
+ self.Connection = connection
self._init_ctrls(parent)
- self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
- self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_RIGHT)
-
- EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
+ self.Transition = None
+ self.MinTransitionSize = None
+
+ self.Element = SFC_Transition(self.Preview)
+
+ def SetElementSize(self, size):
+ min_width, min_height = self.Element.GetMinSize()
+ width, height = max(min_width, size[0]), max(min_height, size[1])
+ self.Element.SetSize(width, height)
def OnOK(self, event):
error = []
@@ -1270,22 +1256,40 @@
text += " and %s"%item
else:
text += ", %s"%item
- message = wxMessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
else:
- self.EndModal(wxID_OK)
+ self.EndModal(wx.ID_OK)
def OnTypeChanged(self, event):
if self.radioButton1.GetValue():
+ self.Element.SetType("reference", self.Reference.GetStringSelection())
self.Reference.Enable(True)
self.Inline.Enable(False)
- else:
+ elif self.radioButton2.GetValue():
+ self.Element.SetType("inline", self.Inline.GetValue())
self.Reference.Enable(False)
self.Inline.Enable(True)
+ else:
+ self.Element.SetType("connection")
+ self.Reference.Enable(False)
+ self.Inline.Enable(False)
+ self.RefreshPreview()
+ event.Skip()
+
+ def OnReferenceChanged(self, event):
+ self.Element.SetType("reference", self.Reference.GetStringSelection())
+ self.RefreshPreview()
+ event.Skip()
+
+ def OnInlineChanged(self, event):
+ self.Element.SetType("inline", self.Inline.GetValue())
+ self.RefreshPreview()
event.Skip()
def SetTransitions(self, transitions):
+ self.Reference.Append("")
for transition in transitions:
self.Reference.Append(transition)
@@ -1293,124 +1297,187 @@
if values["type"] == "reference":
self.radioButton1.SetValue(True)
self.radioButton2.SetValue(False)
+ self.radioButton3.SetValue(False)
self.Reference.Enable(True)
self.Inline.Enable(False)
self.Reference.SetStringSelection(values["value"])
+ self.Element.SetType("reference", values["value"])
elif values["type"] == "inline":
self.radioButton1.SetValue(False)
self.radioButton2.SetValue(True)
+ self.radioButton3.SetValue(False)
self.Reference.Enable(False)
self.Inline.Enable(True)
self.Inline.SetValue(values["value"])
-
+ self.Element.SetType("inline", values["value"])
+ elif values["type"] == "connection" and self.Connection:
+ self.radioButton1.SetValue(False)
+ self.radioButton2.SetValue(False)
+ self.radioButton3.SetValue(True)
+ self.Reference.Enable(False)
+ self.Inline.Enable(False)
+ self.Element.SetType("connection")
+ self.RefreshPreview()
+
def GetValues(self):
values = {}
if self.radioButton1.GetValue():
values["type"] = "reference"
values["value"] = self.Reference.GetStringSelection()
- else:
+ elif self.radioButton2.GetValue():
values["type"] = "inline"
values["value"] = self.Inline.GetValue()
+ else:
+ values["type"] = "connection"
+ values["value"] = None
return values
+ def RefreshPreview(self):
+ dc = wx.ClientDC(self.Preview)
+ dc.Clear()
+ clientsize = self.Preview.GetClientSize()
+ posx, posy = self.Element.GetPosition()
+ rect = self.Element.GetBoundingBox()
+ diffx, diffy = posx - rect.x, posy - rect.y
+ self.Element.SetPosition((clientsize.width - rect.width) / 2 + diffx, (clientsize.height - rect.height) / 2 + diffy)
+ self.Element.Draw(dc)
+
+ def OnPaint(self, event):
+ self.RefreshPreview()
+
#-------------------------------------------------------------------------------
# Create New Divergence Dialog
#-------------------------------------------------------------------------------
-[wxID_DIVERGENCECREATEDIALOG, wxID_DIVERGENCECREATEDIALOGMAINPANEL,
- wxID_DIVERGENCECREATEDIALOGRADIOBUTTON1, wxID_DIVERGENCECREATEDIALOGRADIOBUTTON2,
- wxID_DIVERGENCECREATEDIALOGRADIOBUTTON3, wxID_DIVERGENCECREATEDIALOGRADIOBUTTON4,
- wxID_DIVERGENCECREATEDIALOGSEQUENCES, wxID_DIVERGENCECREATEDIALOGPREVIEW,
- wxID_DIVERGENCECREATEDIALOGSTATICTEXT1, wxID_DIVERGENCECREATEDIALOGSTATICTEXT2,
- wxID_DIVERGENCECREATEDIALOGSTATICTEXT3,
+[ID_DIVERGENCECREATEDIALOG, ID_DIVERGENCECREATEDIALOGSPACER,
+ ID_DIVERGENCECREATEDIALOGRADIOBUTTON1, ID_DIVERGENCECREATEDIALOGRADIOBUTTON2,
+ ID_DIVERGENCECREATEDIALOGRADIOBUTTON3, ID_DIVERGENCECREATEDIALOGRADIOBUTTON4,
+ ID_DIVERGENCECREATEDIALOGSEQUENCES, ID_DIVERGENCECREATEDIALOGPREVIEW,
+ ID_DIVERGENCECREATEDIALOGSTATICTEXT1, ID_DIVERGENCECREATEDIALOGSTATICTEXT2,
+ ID_DIVERGENCECREATEDIALOGSTATICTEXT3,
] = [wx.NewId() for _init_ctrls in range(11)]
class DivergenceCreateDialog(wx.Dialog):
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=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
+
+ def _init_coll_flexGridSizer1_Growables(self, parent):
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(0)
+
+ def _init_coll_MainSizer_Items(self, parent):
+ parent.AddSizer(self.LeftGridSizer, 1, border=5, flag=wx.GROW|wx.RIGHT)
+ parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wx.GROW|wx.LEFT)
+
+ def _init_coll_LeftGridSizer_Items(self, parent):
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton3, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.radioButton4, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Sequences, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Spacer, 0, border=0, flag=wx.GROW)
+
+ def _init_coll_LeftGridSizer_Growables(self, parent):
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(7)
+
+ def _init_coll_RightGridSizer_Items(self, parent):
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Preview, 0, border=0, flag=wx.GROW)
+
+ def _init_coll_RightGridSizer_Growables(self, parent):
+ 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(wx.HORIZONTAL)
+ 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)
-
+
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Dialog.__init__(self, id=wxID_DIVERGENCECREATEDIALOG,
+ wx.Dialog.__init__(self, id=ID_DIVERGENCECREATEDIALOG,
name='DivergencePropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE,
title='Create a new divergence or convergence')
- self.SetClientSize(wx.Size(500, 260))
-
- self.MainPanel = wx.Panel(id=wxID_DIVERGENCECREATEDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(600, 220), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
- self.staticText1 = wx.StaticText(id=wxID_DIVERGENCECREATEDIALOGSTATICTEXT1,
- label='Type:', name='staticText1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(200, 17), style=0)
-
- self.radioButton1 = wx.RadioButton(id=wxID_DIVERGENCECREATEDIALOGRADIOBUTTON1,
- label='Selection Divergence', name='radioButton1', parent=self.MainPanel,
- pos=wx.Point(24, 48), size=wx.Size(200, 24), style=0)
- EVT_RADIOBUTTON(self, wxID_DIVERGENCECREATEDIALOGRADIOBUTTON1, self.OnTypeChanged)
+ self.SetClientSize(wx.Size(500, 300))
+
+ self.staticText1 = wx.StaticText(id=ID_DIVERGENCECREATEDIALOGSTATICTEXT1,
+ label='Type:', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
+
+ self.radioButton1 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON1,
+ label='Selection Divergence', name='radioButton1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
+ self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON1)
self.radioButton1.SetValue(True)
- self.radioButton2 = wx.RadioButton(id=wxID_DIVERGENCECREATEDIALOGRADIOBUTTON2,
- label='Selection Convergence', name='radioButton2', parent=self.MainPanel,
- pos=wx.Point(24, 72), size=wx.Size(200, 24), style=0)
- EVT_RADIOBUTTON(self, wxID_DIVERGENCECREATEDIALOGRADIOBUTTON2, self.OnTypeChanged)
+ self.radioButton2 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON2,
+ label='Selection Convergence', name='radioButton2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
+ self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON2)
self.radioButton2.SetValue(False)
- self.radioButton3 = wx.RadioButton(id=wxID_DIVERGENCECREATEDIALOGRADIOBUTTON3,
- label='Simultaneous Divergence', name='radioButton3', parent=self.MainPanel,
- pos=wx.Point(24, 96), size=wx.Size(200, 24), style=0)
- EVT_RADIOBUTTON(self, wxID_DIVERGENCECREATEDIALOGRADIOBUTTON3, self.OnTypeChanged)
+ self.radioButton3 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON3,
+ label='Simultaneous Divergence', name='radioButton3', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
+ self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON3)
self.radioButton3.SetValue(False)
- self.radioButton4 = wx.RadioButton(id=wxID_DIVERGENCECREATEDIALOGRADIOBUTTON4,
- label='Simultaneous Convergence', name='radioButton4', parent=self.MainPanel,
- pos=wx.Point(24, 120), size=wx.Size(200, 24), style=0)
- EVT_RADIOBUTTON(self, wxID_DIVERGENCECREATEDIALOGRADIOBUTTON4, self.OnTypeChanged)
+ self.radioButton4 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON4,
+ label='Simultaneous Convergence', name='radioButton4', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
+ self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON4)
self.radioButton4.SetValue(False)
- self.staticText2 = wx.StaticText(id=wxID_DIVERGENCECREATEDIALOGSTATICTEXT2,
- label='Number of sequences:', name='staticText2', parent=self.MainPanel,
- pos=wx.Point(24, 150), size=wx.Size(200, 17), style=0)
-
- self.Sequences = wx.SpinCtrl(id=wxID_DIVERGENCECREATEDIALOGSEQUENCES,
- name='Sequences', parent=self.MainPanel, pos=wx.Point(24, 174),
- size=wx.Size(200, 24), style=0, min=2, max=20)
- EVT_SPINCTRL(self, wxID_DIVERGENCECREATEDIALOGSEQUENCES, self.OnSequencesChanged)
-
- self.staticText3 = wx.StaticText(id=wxID_DIVERGENCECREATEDIALOGSTATICTEXT3,
- label='Preview:', name='staticText3', parent=self.MainPanel,
- pos=wx.Point(250, 24), size=wx.Size(100, 17), style=0)
-
- self.Preview = wx.Panel(id=wxID_DIVERGENCECREATEDIALOGPREVIEW,
- name='Preview', parent=self.MainPanel, pos=wx.Point(250, 48),
- size=wx.Size(225, 150), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
- self.Preview.SetBackgroundColour(wxColour(255,255,255))
+ self.staticText2 = wx.StaticText(id=ID_DIVERGENCECREATEDIALOGSTATICTEXT2,
+ label='Number of sequences:', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
+
+ self.Sequences = wx.SpinCtrl(id=ID_DIVERGENCECREATEDIALOGSEQUENCES,
+ name='Sequences', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0, min=2, max=20)
+ self.Bind(wx.EVT_SPINCTRL, self.OnSequencesChanged, id=ID_DIVERGENCECREATEDIALOGSEQUENCES)
+
+ self.staticText3 = wx.StaticText(id=ID_DIVERGENCECREATEDIALOGSTATICTEXT3,
+ label='Preview:', name='staticText3', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
+
+ self.Preview = wx.Panel(id=ID_DIVERGENCECREATEDIALOGPREVIEW,
+ name='Preview', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
+ self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
+ self.Spacer = wx.Panel(id=ID_TRANSITIONCONTENTDIALOGSPACER,
+ name='Spacer', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+
+ self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
+
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.Divergence = None
self.MinSize = (0, 0)
- EVT_PAINT(self, self.OnPaint)
-
def GetValues(self):
values = {}
if self.radioButton1.GetValue():
@@ -1436,7 +1503,7 @@
event.Skip()
def RefreshPreview(self):
- dc = wxClientDC(self.Preview)
+ dc = wx.ClientDC(self.Preview)
dc.Clear()
if self.radioButton1.GetValue():
self.Divergence = SFC_Divergence(self.Preview, SELECTION_DIVERGENCE, self.Sequences.GetValue())
@@ -1463,14 +1530,14 @@
# Action Block Dialog
#-------------------------------------------------------------------------------
-class ActionTable(wxPyGridTableBase):
+class ActionTable(wx.grid.PyGridTableBase):
"""
- A custom wxGrid Table using user supplied data
+ A custom wx.Grid Table using user supplied data
"""
def __init__(self, parent, data, colnames):
# The base class must be initialized *first*
- wxPyGridTableBase.__init__(self)
+ wx.grid.PyGridTableBase.__init__(self)
self.data = data
self.colnames = colnames
self.Parent = parent
@@ -1507,19 +1574,19 @@
def ResetView(self, grid):
"""
- (wxGrid) -> Reset the grid view. Call this to
+ (wx.Grid) -> Reset the grid view. Call this to
update the grid if rows and columns have been added or deleted
"""
grid.BeginBatch()
for current, new, delmsg, addmsg in [
- (self._rows, self.GetNumberRows(), wxGRIDTABLE_NOTIFY_ROWS_DELETED, wxGRIDTABLE_NOTIFY_ROWS_APPENDED),
- (self._cols, self.GetNumberCols(), wxGRIDTABLE_NOTIFY_COLS_DELETED, wxGRIDTABLE_NOTIFY_COLS_APPENDED),
+ (self._rows, self.GetNumberRows(), wx.grid.GRIDTABLE_NOTIFY_ROWS_DELETED, wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED),
+ (self._cols, self.GetNumberCols(), wx.grid.GRIDTABLE_NOTIFY_COLS_DELETED, wx.grid.GRIDTABLE_NOTIFY_COLS_APPENDED),
]:
if new < current:
- msg = wxGridTableMessage(self,delmsg,new,current-new)
+ msg = wx.grid.GridTableMessage(self,delmsg,new,current-new)
grid.ProcessTableMessage(msg)
elif new > current:
- msg = wxGridTableMessage(self,addmsg,new-current)
+ msg = wx.grid.GridTableMessage(self,addmsg,new-current)
grid.ProcessTableMessage(msg)
self.UpdateValues(grid)
grid.EndBatch()
@@ -1536,20 +1603,20 @@
def UpdateValues(self, grid):
"""Update all displayed values"""
# This sends an event to the grid table to update all of the values
- msg = wxGridTableMessage(self, wxGRIDTABLE_REQUEST_VIEW_GET_VALUES)
+ msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
grid.ProcessTableMessage(msg)
def _updateColAttrs(self, grid):
"""
- wxGrid -> update the column attributes to add the
+ wx.Grid -> update the column attributes to add the
appropriate renderer given the column name.
Otherwise default to the default renderer.
"""
for col in range(self.GetNumberCols()):
- attr = wxGridCellAttr()
- attr.SetAlignment(self.Parent.ColAlignements[col], wxALIGN_CENTRE)
+ attr = wx.grid.GridCellAttr()
+ attr.SetAlignment(self.Parent.ColAlignements[col], wx.ALIGN_CENTRE)
grid.SetColAttr(col, attr)
grid.SetColSize(col, self.Parent.ColSizes[col])
@@ -1562,39 +1629,39 @@
readonly = False
colname = self.GetColLabelValue(col)
if colname == "Qualifier":
- editor = wxGridCellChoiceEditor()
+ editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.QualifierList)
if colname == "Duration":
- editor = wxGridCellTextEditor()
- renderer = wxGridCellStringRenderer()
+ editor = wx.grid.GridCellTextEditor()
+ renderer = wx.grid.GridCellStringRenderer()
if self.Parent.DurationList[self.data[row]["Qualifier"]]:
readonly = False
else:
readonly = True
self.data[row]["Duration"] = ""
elif colname == "Type":
- editor = wxGridCellChoiceEditor()
+ editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.TypeList)
elif colname == "Value":
type = self.data[row]["Type"]
if type == "Action":
- editor = wxGridCellChoiceEditor()
+ editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.ActionList)
elif type == "Variable":
- editor = wxGridCellChoiceEditor()
+ editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.VariableList)
elif type == "Inline":
- editor = wxGridCellTextEditor()
- renderer = wxGridCellStringRenderer()
+ editor = wx.grid.GridCellTextEditor()
+ renderer = wx.grid.GridCellStringRenderer()
elif colname == "Indicator":
- editor = wxGridCellChoiceEditor()
+ editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.VariableList)
grid.SetCellEditor(row, col, editor)
grid.SetCellRenderer(row, col, renderer)
grid.SetReadOnly(row, col, readonly)
- grid.SetCellBackgroundColour(row, col, wxWHITE)
+ grid.SetCellBackgroundColour(row, col, wx.WHITE)
def SetData(self, data):
self.data = data
@@ -1624,86 +1691,103 @@
self.data = []
self.editors = []
-[wxID_ACTIONBLOCKDIALOG, wxID_ACTIONBLOCKDIALOGMAINPANEL,
- wxID_ACTIONBLOCKDIALOGVARIABLESGRID, wxID_ACTIONBLOCKDIALOGSTATICTEXT1,
- wxID_ACTIONBLOCKDIALOGADDBUTTON,wxID_ACTIONBLOCKDIALOGDELETEBUTTON,
- wxID_ACTIONBLOCKDIALOGUPBUTTON, wxID_ACTIONBLOCKDIALOGDOWNBUTTON,
-] = [wx.NewId() for _init_ctrls in range(8)]
+[ID_ACTIONBLOCKDIALOG, ID_ACTIONBLOCKDIALOGVARIABLESGRID,
+ ID_ACTIONBLOCKDIALOGSTATICTEXT1, ID_ACTIONBLOCKDIALOGADDBUTTON,
+ ID_ACTIONBLOCKDIALOGDELETEBUTTON, ID_ACTIONBLOCKDIALOGUPBUTTON,
+ ID_ACTIONBLOCKDIALOGDOWNBUTTON,
+] = [wx.NewId() for _init_ctrls in range(7)]
class ActionBlockDialog(wx.Dialog):
def _init_coll_flexGridSizer1_Items(self, parent):
- # generated method, don't edit
-
- parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
+ parent.AddSizer(self.TopSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.GridButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
+
+ def _init_coll_flexGridSizer1_Growables(self, parent):
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(0)
+
+ def _init_coll_TopSizer_Items(self, parent):
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.ActionsGrid, 0, border=0, flag=wx.GROW)
+
+ def _init_coll_TopSizer_Growables(self, parent):
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(1)
+
+ def _init_coll_GridButtonSizer_Items(self, parent):
+ parent.AddWindow(self.AddButton, 0, border=10, flag=wx.GROW|wx.LEFT)
+ parent.AddWindow(self.DeleteButton, 0, border=10, flag=wx.GROW|wx.LEFT)
+ parent.AddWindow(self.UpButton, 0, border=10, flag=wx.GROW|wx.LEFT)
+ parent.AddWindow(self.DownButton, 0, border=10, flag=wx.GROW|wx.LEFT)
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=3, vgap=10)
+ self.TopSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
+ self.GridButtonSizer = wx.BoxSizer(wx.HORIZONTAL)
+
self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
-
+ self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
+ self._init_coll_TopSizer_Items(self.TopSizer)
+ self._init_coll_TopSizer_Growables(self.TopSizer)
+ self._init_coll_GridButtonSizer_Items(self.GridButtonSizer)
+
self.SetSizer(self.flexGridSizer1)
-
+
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Dialog.__init__(self, id=wxID_ACTIONBLOCKDIALOG,
+ wx.Dialog.__init__(self, id=ID_ACTIONBLOCKDIALOG,
name='ActionBlockDialog', parent=prnt, pos=wx.Point(376, 223),
- size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE,
+ size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
title='Edit action block properties')
self.SetClientSize(wx.Size(500, 300))
- self.MainPanel = wx.Panel(id=wxID_ACTIONBLOCKDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(500, 300), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
- self.staticText1 = wx.StaticText(id=wxID_ACTIONBLOCKDIALOGSTATICTEXT1,
- label='Actions:', name='staticText1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(95, 17), style=0)
-
- self.ActionsGrid = wx.grid.Grid(id=wxID_ACTIONBLOCKDIALOGVARIABLESGRID,
- name='ActionsGrid', parent=self.MainPanel, pos=wx.Point(24, 44),
- size=wx.Size(450, 150), style=wxVSCROLL)
+ self.staticText1 = wx.StaticText(id=ID_ACTIONBLOCKDIALOGSTATICTEXT1,
+ label='Actions:', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
+
+ self.ActionsGrid = wx.grid.Grid(id=ID_ACTIONBLOCKDIALOGVARIABLESGRID,
+ name='ActionsGrid', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 0), style=wx.VSCROLL)
self.ActionsGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
'Sans'))
self.ActionsGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
False, 'Sans'))
self.ActionsGrid.DisableDragGridSize()
self.ActionsGrid.EnableScrolling(False, True)
- EVT_GRID_CELL_CHANGE(self.ActionsGrid, self.OnActionsGridCellChange)
-
- self.AddButton = wx.Button(id=wxID_ACTIONBLOCKDIALOGADDBUTTON, label='Add',
- name='AddButton', parent=self.MainPanel, pos=wx.Point(245, 204),
+ self.ActionsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnActionsGridCellChange)
+
+ self.AddButton = wx.Button(id=ID_ACTIONBLOCKDIALOGADDBUTTON, label='Add',
+ name='AddButton', parent=self, pos=wx.Point(0, 0),
size=wx.Size(72, 32), style=0)
- EVT_BUTTON(self, wxID_ACTIONBLOCKDIALOGADDBUTTON, self.OnAddButton)
-
- self.DeleteButton = wx.Button(id=wxID_ACTIONBLOCKDIALOGDELETEBUTTON, label='Delete',
- name='DeleteButton', parent=self.MainPanel, pos=wx.Point(325, 204),
+ self.Bind(wx.EVT_BUTTON, self.OnAddButton, id=ID_ACTIONBLOCKDIALOGADDBUTTON)
+
+ self.DeleteButton = wx.Button(id=ID_ACTIONBLOCKDIALOGDELETEBUTTON, label='Delete',
+ name='DeleteButton', parent=self, pos=wx.Point(0, 0),
size=wx.Size(72, 32), style=0)
- EVT_BUTTON(self, wxID_ACTIONBLOCKDIALOGDELETEBUTTON, self.OnDeleteButton)
-
- self.UpButton = wx.Button(id=wxID_ACTIONBLOCKDIALOGUPBUTTON, label='^',
- name='UpButton', parent=self.MainPanel, pos=wx.Point(405, 204),
+ self.Bind(wx.EVT_BUTTON, self.OnDeleteButton, id=ID_ACTIONBLOCKDIALOGDELETEBUTTON)
+
+ self.UpButton = wx.Button(id=ID_ACTIONBLOCKDIALOGUPBUTTON, label='^',
+ name='UpButton', parent=self, pos=wx.Point(0, 0),
size=wx.Size(32, 32), style=0)
- EVT_BUTTON(self, wxID_ACTIONBLOCKDIALOGUPBUTTON, self.OnUpButton)
-
- self.DownButton = wx.Button(id=wxID_ACTIONBLOCKDIALOGDOWNBUTTON, label='v',
- name='DownButton', parent=self.MainPanel, pos=wx.Point(445, 204),
+ self.Bind(wx.EVT_BUTTON, self.OnUpButton, id=ID_ACTIONBLOCKDIALOGUPBUTTON)
+
+ self.DownButton = wx.Button(id=ID_ACTIONBLOCKDIALOGDOWNBUTTON, label='v',
+ name='DownButton', parent=self, pos=wx.Point(0, 0),
size=wx.Size(32, 32), style=0)
- EVT_BUTTON(self, wxID_ACTIONBLOCKDIALOGDOWNBUTTON, self.OnDownButton)
+ self.Bind(wx.EVT_BUTTON, self.OnDownButton, id=ID_ACTIONBLOCKDIALOGDOWNBUTTON)
+
+ self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
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.DefaultValue = {"Qualifier" : "N", "Duration" : "", "Type" : "Action", "Value" : "", "Indicator" : ""}
self.Table = ActionTable(self, [], ["Qualifier","Duration","Type","Value","Indicator"])
self.TypeList = "Action,Variable,Inline"
self.ColSizes = [60, 90, 80, 110, 80]
- self.ColAlignements = [wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT]
+ self.ColAlignements = [wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT]
self.ActionsGrid.SetTable(self.Table)
self.ActionsGrid.SetRowLabelSize(0)
@@ -1802,46 +1886,46 @@
# Edit Step Name Dialog
#-------------------------------------------------------------------------------
-class StepNameDialog(wxTextEntryDialog):
+class StepNameDialog(wx.TextEntryDialog):
def __init__(self, parent, message, caption = "Please enter text", defaultValue = "",
- style = wxOK|wxCANCEL|wxCENTRE, pos = wxDefaultPosition):
+ style = wx.OK|wx.CANCEL|wx.CENTRE, pos = wx.DefaultPosition):
wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos)
self.PouNames = []
self.Variables = []
self.StepNames = []
- EVT_BUTTON(self, self.GetSizer().GetItem(3).GetSizer().GetAffirmativeButton().GetId(), self.OnOK)
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetAffirmativeButton().GetId())
def OnOK(self, event):
step_name = self.GetSizer().GetItem(1).GetWindow().GetValue()
if step_name == "":
- message = wxMessageDialog(self, "You must type a name!", "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "You must type a name!", "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
elif not TestIdentifier(step_name):
- message = wxMessageDialog(self, "\"%s\" is not a valid identifier!"%step_name, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
elif step_name.upper() in IEC_KEYWORDS:
- message = wxMessageDialog(self, "\"%s\" is a keyword. It can't be used!"%step_name, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
elif step_name.upper() in self.PouNames:
- message = wxMessageDialog(self, "A pou with \"%s\" as name exists!"%step_name, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "A pou with \"%s\" as name exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
elif step_name.upper() in self.Variables:
- message = wxMessageDialog(self, "A variable with \"%s\" as name exists!"%step_name, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "A variable with \"%s\" as name exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
elif step_name.upper() in self.StepNames:
- message = wxMessageDialog(self, "\"%s\" step already exists!"%step_name, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "\"%s\" step already exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
else:
- self.EndModal(wxID_OK)
+ self.EndModal(wx.ID_OK)
def SetPouNames(self, pou_names):
self.PouNames = [pou_name.upper() for pou_name in pou_names]
--- a/LDViewer.py Tue Aug 07 17:37:38 2007 +0200
+++ b/LDViewer.py Tue Aug 07 17:38:48 2007 +0200
@@ -22,7 +22,6 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from wxPython.wx import *
import wx
from types import *
@@ -348,7 +347,7 @@
element.SetSelectedSegment(result[0])
else:
element.OnLeftUp(event, dc, self.Scaling)
- wxCallAfter(self.SetCursor, wxNullCursor)
+ wx.CallAfter(self.SetCursor, wx.NullCursor)
self.ReleaseMouse()
self.Refresh()
event.Skip()
@@ -369,7 +368,7 @@
else:
self.SelectedElement.SetSelected(True)
self.SelectedElement.OnRightUp(event, dc, self.Scaling)
- wxCallAfter(self.SetCursor, wxNullCursor)
+ wx.CallAfter(self.SetCursor, wx.NullCursor)
self.ReleaseMouse()
self.Refresh()
event.Skip()
@@ -397,8 +396,11 @@
if self.GetDrawingMode() == FREEDRAWING_MODE:
Viewer.OnChar(self, event)
else:
+ xpos, ypos = self.GetScrollPos(wx.HORIZONTAL), self.GetScrollPos(wx.VERTICAL)
+ xmax = self.GetScrollRange(wx.HORIZONTAL) - self.GetScrollThumb(wx.HORIZONTAL)
+ ymax = self.GetScrollRange(wx.VERTICAL) - self.GetScrollThumb(wx.VERTICAL)
keycode = event.GetKeyCode()
- if keycode == WXK_DELETE and self.SelectedElement:
+ if keycode == wx.WXK_DELETE and self.SelectedElement:
if self.IsBlock(self.SelectedElement):
self.SelectedElement.Delete()
elif self.IsWire(self.SelectedElement):
@@ -414,22 +416,22 @@
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh()
- elif keycode == WXK_LEFT:
+ elif keycode == wx.WXK_LEFT:
if event.ControlDown() and event.ShiftDown():
self.Scroll(0, ypos)
elif event.ControlDown():
self.Scroll(max(0, xpos - 1), ypos)
- elif keycode == WXK_RIGHT:
+ elif keycode == wx.WXK_RIGHT:
if event.ControlDown() and event.ShiftDown():
self.Scroll(xmax, ypos)
elif event.ControlDown():
self.Scroll(min(xpos + 1, xmax), ypos)
- elif keycode == WXK_UP:
+ elif keycode == wx.WXK_UP:
if event.ControlDown() and event.ShiftDown():
self.Scroll(xpos, 0)
elif event.ControlDown():
self.Scroll(xpos, max(0, ypos - 1))
- elif keycode == WXK_DOWN:
+ elif keycode == wx.WXK_DOWN:
if event.ControlDown() and event.ShiftDown():
self.Scroll(xpos, ymax)
elif event.ControlDown():
@@ -453,7 +455,7 @@
varlist.append(self.Controler.GetCurrentElementEditingName())
dialog.SetVariables(varlist)
dialog.SetValues({"name":"","type":COIL_NORMAL})
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
startx, starty = LD_OFFSET[0], 0
if len(self.Rungs) > 0:
@@ -539,7 +541,7 @@
varlist.append(var["Name"])
dialog.SetVariables(varlist)
dialog.SetValues({"name":"","type":CONTACT_NORMAL})
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
points = wires[0].GetSelectedSegmentPoints()
id = self.GetNewId()
@@ -612,7 +614,7 @@
self.RefreshScrollBars()
self.Refresh()
else:
- message = wxMessageDialog(self, "You must select the wire where a contact should be added!", "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "You must select the wire where a contact should be added!", "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
@@ -763,7 +765,7 @@
varlist.append(self.Controler.GetCurrentElementEditingName())
dialog.SetVariables(varlist)
dialog.SetValues({"name":"","type":COIL_NORMAL})
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
powerrail = right_elements[0].GetParentBlock()
index = 0
@@ -833,16 +835,16 @@
self.RefreshScrollBars()
self.Refresh()
else:
- message = wxMessageDialog(self, "The group of block must be coherent!", "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "The group of block must be coherent!", "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
else:
- message = wxMessageDialog(self, "You must select the block or group of blocks around which a branch should be added!", "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "You must select the block or group of blocks around which a branch should be added!", "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
def AddLadderBlock(self):
- message = wxMessageDialog(self, "This option isn't available yet!", "Warning", wxOK|wxICON_EXCLAMATION)
+ message = wx.MessageDialog(self, "This option isn't available yet!", "Warning", wx.OK|wx.ICON_EXCLAMATION)
message.ShowModal()
message.Destroy()
@@ -1113,10 +1115,10 @@
if block in block_list:
wires = wire.EndConnected.GetWires()
endmiddlepoint = wires[0][0].StartConnected.GetPosition(False)[0] - LD_WIRE_SIZE
- points = [startpoint, wxPoint(middlepoint, startpoint.y),
- wxPoint(middlepoint, startpoint.y + offset),
- wxPoint(endmiddlepoint, startpoint.y + offset),
- wxPoint(endmiddlepoint, endpoint.y), endpoint]
+ points = [startpoint, wx.Point(middlepoint, startpoint.y),
+ wx.Point(middlepoint, startpoint.y + offset),
+ wx.Point(endmiddlepoint, startpoint.y + offset),
+ wx.Point(endmiddlepoint, endpoint.y), endpoint]
else:
if startpoint.y + offset != endpoint.y:
if isinstance(element, LD_PowerRail):
@@ -1140,8 +1142,8 @@
self.RefreshPosition(block, False)
endpoint = wire.EndConnected.GetPosition(False)
if not onlyone[i]:
- points = [startpoint, wxPoint(middlepoint, startpoint.y),
- wxPoint(middlepoint, endpoint.y), endpoint]
+ points = [startpoint, wx.Point(middlepoint, startpoint.y),
+ wx.Point(middlepoint, endpoint.y), endpoint]
else:
points = [startpoint, endpoint]
wire.SetPoints(points)
@@ -1181,7 +1183,7 @@
varlist.append(var["Name"])
dialog.SetVariables(varlist)
dialog.SetValues({"name":contact.GetName(),"type":contact.GetType()})
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
contact.SetName(values["name"])
contact.SetType(values["type"])
@@ -1207,7 +1209,7 @@
varlist.append(self.Controler.GetCurrentElementEditingName())
dialog.SetVariables(varlist)
dialog.SetValues({"name":coil.GetName(),"type":coil.GetType()})
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
coil.SetName(values["name"])
coil.SetType(values["type"])
--- a/PLCOpenEditor.py Tue Aug 07 17:37:38 2007 +0200
+++ b/PLCOpenEditor.py Tue Aug 07 17:38:48 2007 +0200
@@ -22,11 +22,10 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from wxPython.wx import *
-from wxPython.grid import *
from time import localtime
from datetime import datetime
import wx
+import wx.grid
from SFCViewer import *
from LDViewer import *
@@ -70,43 +69,43 @@
if os.path.isfile(os.path.join(path, "PLCOpenEditor.py")):
CWD = path
-[wxID_PLCOPENEDITOR, wxID_PLCOPENEDITORPROJECTTREE,
- wxID_PLCOPENEDITORSPLITTERWINDOW1, wxID_PLCOPENEDITOREDITORPANEL,
- wxID_PLCOPENEDITORTABSOPENED, wxID_PLCOPENEDITORTOOLBAR,
- wxID_PLCOPENEDITORDEFAULTTOOLBAR, wxID_PLCOPENEDITORSFCTOOLBAR,
- wxID_PLCOPENEDITORFBDTOOLBAR, wxID_PLCOPENEDITORLDTOOLBAR,
+[ID_PLCOPENEDITOR, ID_PLCOPENEDITORPROJECTTREE,
+ ID_PLCOPENEDITORSPLITTERWINDOW1, ID_PLCOPENEDITOREDITORPANEL,
+ ID_PLCOPENEDITORTABSOPENED, ID_PLCOPENEDITORTOOLBAR,
+ ID_PLCOPENEDITORDEFAULTTOOLBAR, ID_PLCOPENEDITORSFCTOOLBAR,
+ ID_PLCOPENEDITORFBDTOOLBAR, ID_PLCOPENEDITORLDTOOLBAR,
] = [wx.NewId() for _init_ctrls in range(10)]
-[wxID_PLCOPENEDITORFILEMENUITEMS0, wxID_PLCOPENEDITORFILEMENUITEMS1,
- wxID_PLCOPENEDITORFILEMENUITEMS2, wxID_PLCOPENEDITORFILEMENUITEMS3,
- wxID_PLCOPENEDITORFILEMENUITEMS5, wxID_PLCOPENEDITORFILEMENUITEMS6,
- wxID_PLCOPENEDITORFILEMENUITEMS7, wxID_PLCOPENEDITORFILEMENUITEMS9,
- wxID_PLCOPENEDITORFILEMENUITEMS11,
+[ID_PLCOPENEDITORFILEMENUITEMS0, ID_PLCOPENEDITORFILEMENUITEMS1,
+ ID_PLCOPENEDITORFILEMENUITEMS2, ID_PLCOPENEDITORFILEMENUITEMS3,
+ ID_PLCOPENEDITORFILEMENUITEMS5, ID_PLCOPENEDITORFILEMENUITEMS6,
+ ID_PLCOPENEDITORFILEMENUITEMS7, ID_PLCOPENEDITORFILEMENUITEMS9,
+ ID_PLCOPENEDITORFILEMENUITEMS11,
] = [wx.NewId() for _init_coll_FileMenu_Items in range(9)]
-[wxID_PLCOPENEDITORHELPMENUITEMS0, wxID_PLCOPENEDITORHELPMENUITEMS1,
- wxID_PLCOPENEDITORHELPMENUITEMS2, wxID_PLCOPENEDITORHELPMENUITEMS3,
+[ID_PLCOPENEDITORHELPMENUITEMS0, ID_PLCOPENEDITORHELPMENUITEMS1,
+ ID_PLCOPENEDITORHELPMENUITEMS2, ID_PLCOPENEDITORHELPMENUITEMS3,
] = [wx.NewId() for _init_coll_HelpMenu_Items in range(4)]
-[wxID_PLCOPENEDITORSFCMENUITEMS0, wxID_PLCOPENEDITORSFCMENUITEMS1,
- wxID_PLCOPENEDITORSFCMENUITEMS2, wxID_PLCOPENEDITORSFCMENUITEMS3,
+[ID_PLCOPENEDITORSFCMENUITEMS0, ID_PLCOPENEDITORSFCMENUITEMS1,
+ ID_PLCOPENEDITORSFCMENUITEMS2, ID_PLCOPENEDITORSFCMENUITEMS3,
] = [wx.NewId() for _init_coll_HelpMenu_Items in range(4)]
-[wxID_PLCOPENEDITORCONFIGMENUITEMS0, wxID_PLCOPENEDITORCONFIGMENUITEMS1,
+[ID_PLCOPENEDITORCONFIGMENUITEMS0, ID_PLCOPENEDITORCONFIGMENUITEMS1,
] = [wx.NewId() for _init_coll_HelpMenu_Items in range(2)]
-[wxID_PLCOPENEDITOREDITMENUITEMS0, wxID_PLCOPENEDITOREDITMENUITEMS1,
- wxID_PLCOPENEDITOREDITMENUITEMS11, wxID_PLCOPENEDITOREDITMENUITEMS12,
- wxID_PLCOPENEDITOREDITMENUITEMS2, wxID_PLCOPENEDITOREDITMENUITEMS4,
- wxID_PLCOPENEDITOREDITMENUITEMS5, wxID_PLCOPENEDITOREDITMENUITEMS6,
- wxID_PLCOPENEDITOREDITMENUITEMS8, wxID_PLCOPENEDITOREDITMENUITEMS9,
+[ID_PLCOPENEDITOREDITMENUITEMS0, ID_PLCOPENEDITOREDITMENUITEMS1,
+ ID_PLCOPENEDITOREDITMENUITEMS11, ID_PLCOPENEDITOREDITMENUITEMS12,
+ ID_PLCOPENEDITOREDITMENUITEMS2, ID_PLCOPENEDITOREDITMENUITEMS4,
+ ID_PLCOPENEDITOREDITMENUITEMS5, ID_PLCOPENEDITOREDITMENUITEMS6,
+ ID_PLCOPENEDITOREDITMENUITEMS8, ID_PLCOPENEDITOREDITMENUITEMS9,
] = [wx.NewId() for _init_coll_EditMenu_Items in range(10)]
-[wxID_PLCOPENEDITORSFCMENUITEMS0, wxID_PLCOPENEDITORSFCMENUITEMS1,
- wxID_PLCOPENEDITORSFCMENUITEMS2, wxID_PLCOPENEDITORSFCMENUITEMS3,
+[ID_PLCOPENEDITORSFCMENUITEMS0, ID_PLCOPENEDITORSFCMENUITEMS1,
+ ID_PLCOPENEDITORSFCMENUITEMS2, ID_PLCOPENEDITORSFCMENUITEMS3,
] = [wx.NewId() for _init_coll_SFCMenu_Items in range(4)]
-[wxID_PLCOPENEDITORCONFIGMENUITEMS0, wxID_PLCOPENEDITORCONFIGMENUITEMS1,
+[ID_PLCOPENEDITORCONFIGMENUITEMS0, ID_PLCOPENEDITORCONFIGMENUITEMS1,
] = [wx.NewId() for _init_coll_ConfigMenu_Items in range(2)]
@@ -115,46 +114,46 @@
#-------------------------------------------------------------------------------
-[wxID_PLCOPENEDITORTOOLBARSELECTION, wxID_PLCOPENEDITORTOOLBARCOMMENT,
- wxID_PLCOPENEDITORTOOLBARVARIABLE, wxID_PLCOPENEDITORTOOLBARBLOCK,
- wxID_PLCOPENEDITORTOOLBARCONNECTION, wxID_PLCOPENEDITORTOOLBARWIRE,
- wxID_PLCOPENEDITORTOOLBARPOWERRAIL, wxID_PLCOPENEDITORTOOLBARRUNG,
- wxID_PLCOPENEDITORTOOLBARCOIL, wxID_PLCOPENEDITORTOOLBARCONTACT,
- wxID_PLCOPENEDITORTOOLBARBRANCH, wxID_PLCOPENEDITORTOOLBARINITIALSTEP,
- wxID_PLCOPENEDITORTOOLBARSTEP, wxID_PLCOPENEDITORTOOLBARTRANSITION,
- wxID_PLCOPENEDITORTOOLBARACTIONBLOCK, wxID_PLCOPENEDITORTOOLBARDIVERGENCE,
- wxID_PLCOPENEDITORTOOLBARJUMP,
+[ID_PLCOPENEDITORTOOLBARSELECTION, ID_PLCOPENEDITORTOOLBARCOMMENT,
+ ID_PLCOPENEDITORTOOLBARVARIABLE, ID_PLCOPENEDITORTOOLBARBLOCK,
+ ID_PLCOPENEDITORTOOLBARCONNECTION, ID_PLCOPENEDITORTOOLBARWIRE,
+ ID_PLCOPENEDITORTOOLBARPOWERRAIL, ID_PLCOPENEDITORTOOLBARRUNG,
+ ID_PLCOPENEDITORTOOLBARCOIL, ID_PLCOPENEDITORTOOLBARCONTACT,
+ ID_PLCOPENEDITORTOOLBARBRANCH, ID_PLCOPENEDITORTOOLBARINITIALSTEP,
+ ID_PLCOPENEDITORTOOLBARSTEP, ID_PLCOPENEDITORTOOLBARTRANSITION,
+ ID_PLCOPENEDITORTOOLBARACTIONBLOCK, ID_PLCOPENEDITORTOOLBARDIVERGENCE,
+ ID_PLCOPENEDITORTOOLBARJUMP,
] = [wx.NewId() for _init_coll_DefaultToolBar_Items in range(17)]
ToolBarItems = {
- "FBD" : [(True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARCOMMENT, "OnCommentTool", "Images/comment.png", "Create a new comment"),
- (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARVARIABLE, "OnVariableTool", "Images/variable.png", "Create a new variable"),
- (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARBLOCK, "OnBlockTool", "Images/block.png", "Create a new block"),
- (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARCONNECTION, "OnConnectionTool", "Images/connection.png", "Create a new connection"),
- (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARWIRE, "OnWireTool", "Images/wire.png", "Create a new wire")],
- "LD" : [(True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARCOMMENT, "OnCommentTool", "Images/comment.png", "Create a new comment"),
- (True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARPOWERRAIL, "OnPowerRailTool", "Images/powerrail.png", "Create a new power rail"),
- (False, DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARRUNG, "OnRungTool", "Images/rung.png", "Create a new rung"),
- (True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARCOIL, "OnCoilTool", "Images/coil.png", "Create a new coil"),
- (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARCONTACT, "OnContactTool", "Images/contact.png", "Create a new contact"),
- (False, DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARBRANCH, "OnBranchTool", "Images/branch.png", "Create a new branch"),
- (True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARVARIABLE, "OnVariableTool", "Images/variable.png", "Create a new variable"),
- (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARBLOCK, "OnBlockTool", "Images/block.png", "Create a new block"),
- (True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARCONNECTION, "OnConnectionTool", "Images/connection.png", "Create a new connection"),
- (True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARWIRE, "OnWireTool", "Images/wire.png", "Create a new wire")],
- "SFC" : [(True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARCOMMENT, "OnCommentTool", "Images/comment.png", "Create a new comment"),
- (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARINITIALSTEP, "OnInitialStepTool", "Images/initial_step.png", "Create a new initial step"),
- (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARSTEP, "OnStepTool", "Images/step.png", "Create a new step"),
- (True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARTRANSITION, "OnTransitionTool", "Images/transition.png", "Create a new transition"),
- (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARACTIONBLOCK, "OnActionBlockTool", "Images/action.png", "Create a new action block"),
- (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARDIVERGENCE, "OnDivergenceTool", "Images/divergence.png", "Create a new divergence"),
- (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARJUMP, "OnJumpTool", "Images/jump.png", "Create a new jump"),
- (True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARVARIABLE, "OnVariableTool", "Images/variable.png", "Create a new variable"),
- (True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARBLOCK, "OnBlockTool", "Images/block.png", "Create a new block"),
- (True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARCONNECTION, "OnConnectionTool", "Images/connection.png", "Create a new connection"),
- (True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARPOWERRAIL, "OnPowerRailTool", "Images/powerrail.png", "Create a new power rail"),
- (True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARCONTACT, "OnContactTool", "Images/contact.png", "Create a new contact"),
- (True, FREEDRAWING_MODE, wxID_PLCOPENEDITORTOOLBARWIRE, "OnWireTool", "Images/wire.png", "Create a new wire")],
+ "FBD" : [(True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCOMMENT, "OnCommentTool", "Images/comment.png", "Create a new comment"),
+ (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARVARIABLE, "OnVariableTool", "Images/variable.png", "Create a new variable"),
+ (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARBLOCK, "OnBlockTool", "Images/block.png", "Create a new block"),
+ (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCONNECTION, "OnConnectionTool", "Images/connection.png", "Create a new connection"),
+ (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARWIRE, "OnWireTool", "Images/wire.png", "Create a new wire")],
+ "LD" : [(True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCOMMENT, "OnCommentTool", "Images/comment.png", "Create a new comment"),
+ (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARPOWERRAIL, "OnPowerRailTool", "Images/powerrail.png", "Create a new power rail"),
+ (False, DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARRUNG, "OnRungTool", "Images/rung.png", "Create a new rung"),
+ (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCOIL, "OnCoilTool", "Images/coil.png", "Create a new coil"),
+ (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCONTACT, "OnContactTool", "Images/contact.png", "Create a new contact"),
+ (False, DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARBRANCH, "OnBranchTool", "Images/branch.png", "Create a new branch"),
+ (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARVARIABLE, "OnVariableTool", "Images/variable.png", "Create a new variable"),
+ (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARBLOCK, "OnBlockTool", "Images/block.png", "Create a new block"),
+ (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCONNECTION, "OnConnectionTool", "Images/connection.png", "Create a new connection"),
+ (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARWIRE, "OnWireTool", "Images/wire.png", "Create a new wire")],
+ "SFC" : [(True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCOMMENT, "OnCommentTool", "Images/comment.png", "Create a new comment"),
+ (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARINITIALSTEP, "OnInitialStepTool", "Images/initial_step.png", "Create a new initial step"),
+ (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARSTEP, "OnStepTool", "Images/step.png", "Create a new step"),
+ (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARTRANSITION, "OnTransitionTool", "Images/transition.png", "Create a new transition"),
+ (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARACTIONBLOCK, "OnActionBlockTool", "Images/action.png", "Create a new action block"),
+ (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARDIVERGENCE, "OnDivergenceTool", "Images/divergence.png", "Create a new divergence"),
+ (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARJUMP, "OnJumpTool", "Images/jump.png", "Create a new jump"),
+ (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARVARIABLE, "OnVariableTool", "Images/variable.png", "Create a new variable"),
+ (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARBLOCK, "OnBlockTool", "Images/block.png", "Create a new block"),
+ (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCONNECTION, "OnConnectionTool", "Images/connection.png", "Create a new connection"),
+ (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARPOWERRAIL, "OnPowerRailTool", "Images/powerrail.png", "Create a new power rail"),
+ (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCONTACT, "OnContactTool", "Images/contact.png", "Create a new contact"),
+ (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARWIRE, "OnWireTool", "Images/wire.png", "Create a new wire")],
"ST" : [],
"IL" : []
}
@@ -163,152 +162,139 @@
_custom_classes = {'wx.SashWindow' : ['Viewer']}
def _init_coll_EditMenu_Items(self, parent):
- # generated method, don't edit
-
- parent.Append(help='', id=wxID_PLCOPENEDITOREDITMENUITEMS0,
+ parent.Append(help='', id=ID_PLCOPENEDITOREDITMENUITEMS0,
kind=wx.ITEM_NORMAL, text=u'Refresh\tCTRL+R')
- parent.Append(help='', id=wxID_PLCOPENEDITOREDITMENUITEMS1,
+ parent.Append(help='', id=ID_PLCOPENEDITOREDITMENUITEMS1,
kind=wx.ITEM_NORMAL, text=u'Undo\tCTRL+Z')
- parent.Append(help='', id=wxID_PLCOPENEDITOREDITMENUITEMS2,
+ parent.Append(help='', id=ID_PLCOPENEDITOREDITMENUITEMS2,
kind=wx.ITEM_NORMAL, text=u'Redo\tCTRL+Y')
parent.AppendSeparator()
- parent.Append(help='', id=wxID_PLCOPENEDITOREDITMENUITEMS4,
+ parent.Append(help='', id=ID_PLCOPENEDITOREDITMENUITEMS4,
kind=wx.ITEM_NORMAL, text=u'Cut\tCTRL+X')
- parent.Append(help='', id=wxID_PLCOPENEDITOREDITMENUITEMS5,
+ parent.Append(help='', id=ID_PLCOPENEDITOREDITMENUITEMS5,
kind=wx.ITEM_NORMAL, text=u'Copy\tCTRL+C')
- parent.Append(help='', id=wxID_PLCOPENEDITOREDITMENUITEMS6,
+ parent.Append(help='', id=ID_PLCOPENEDITOREDITMENUITEMS6,
kind=wx.ITEM_NORMAL, text=u'Paste\tCTRL+V')
parent.AppendSeparator()
- parent.Append(help='', id=wxID_PLCOPENEDITOREDITMENUITEMS8,
+ parent.Append(help='', id=ID_PLCOPENEDITOREDITMENUITEMS8,
kind=wx.ITEM_NORMAL, text=u'Add POU')
- parent.Append(help='', id=wxID_PLCOPENEDITOREDITMENUITEMS9,
+ parent.Append(help='', id=ID_PLCOPENEDITOREDITMENUITEMS9,
kind=wx.ITEM_NORMAL, text=u'Remove POU')
parent.AppendSeparator()
- parent.Append(help='', id=wxID_PLCOPENEDITOREDITMENUITEMS11,
+ parent.Append(help='', id=ID_PLCOPENEDITOREDITMENUITEMS11,
kind=wx.ITEM_NORMAL, text=u'Add Configuration')
- parent.Append(help='', id=wxID_PLCOPENEDITOREDITMENUITEMS12,
+ parent.Append(help='', id=ID_PLCOPENEDITOREDITMENUITEMS12,
kind=wx.ITEM_NORMAL, text=u'Remove Configuration')
self.Bind(wx.EVT_MENU, self.OnRefreshMenu,
- id=wxID_PLCOPENEDITOREDITMENUITEMS0)
+ id=ID_PLCOPENEDITOREDITMENUITEMS0)
self.Bind(wx.EVT_MENU, self.OnUndoMenu,
- id=wxID_PLCOPENEDITOREDITMENUITEMS1)
+ id=ID_PLCOPENEDITOREDITMENUITEMS1)
self.Bind(wx.EVT_MENU, self.OnRedoMenu,
- id=wxID_PLCOPENEDITOREDITMENUITEMS2)
+ id=ID_PLCOPENEDITOREDITMENUITEMS2)
self.Bind(wx.EVT_MENU, self.OnCutMenu,
- id=wxID_PLCOPENEDITOREDITMENUITEMS4)
+ id=ID_PLCOPENEDITOREDITMENUITEMS4)
self.Bind(wx.EVT_MENU, self.OnCopyMenu,
- id=wxID_PLCOPENEDITOREDITMENUITEMS5)
+ id=ID_PLCOPENEDITOREDITMENUITEMS5)
self.Bind(wx.EVT_MENU, self.OnPasteMenu,
- id=wxID_PLCOPENEDITOREDITMENUITEMS6)
+ id=ID_PLCOPENEDITOREDITMENUITEMS6)
self.Bind(wx.EVT_MENU, self.OnAddPouMenu,
- id=wxID_PLCOPENEDITOREDITMENUITEMS8)
+ id=ID_PLCOPENEDITOREDITMENUITEMS8)
self.Bind(wx.EVT_MENU, self.OnRemovePouMenu,
- id=wxID_PLCOPENEDITOREDITMENUITEMS9)
+ id=ID_PLCOPENEDITOREDITMENUITEMS9)
self.Bind(wx.EVT_MENU, self.OnAddConfigurationMenu,
- id=wxID_PLCOPENEDITOREDITMENUITEMS11)
+ id=ID_PLCOPENEDITOREDITMENUITEMS11)
self.Bind(wx.EVT_MENU, self.OnRemoveConfigurationMenu,
- id=wxID_PLCOPENEDITOREDITMENUITEMS12)
+ id=ID_PLCOPENEDITOREDITMENUITEMS12)
def _init_coll_menuBar1_Menus(self, parent):
- # generated method, don't edit
-
if self.ModeSolo:
parent.Append(menu=self.FileMenu, title=u'File')
parent.Append(menu=self.EditMenu, title=u'Edit')
parent.Append(menu=self.HelpMenu, title=u'Help')
def _init_coll_ConfigMenu_Items(self, parent):
- # generated method, don't edit
-
- parent.Append(help='', id=wxID_PLCOPENEDITORCONFIGMENUITEMS0,
+ parent.Append(help='', id=ID_PLCOPENEDITORCONFIGMENUITEMS0,
kind=wx.ITEM_NORMAL, text=u'Add Resource')
- parent.Append(help='', id=wxID_PLCOPENEDITORCONFIGMENUITEMS1,
+ parent.Append(help='', id=ID_PLCOPENEDITORCONFIGMENUITEMS1,
kind=wx.ITEM_NORMAL, text=u'Remove Resource')
self.Bind(wx.EVT_MENU, self.OnAddResourceMenu,
- id=wxID_PLCOPENEDITORCONFIGMENUITEMS0)
+ id=ID_PLCOPENEDITORCONFIGMENUITEMS0)
self.Bind(wx.EVT_MENU, self.OnRemoveResourceMenu,
- id=wxID_PLCOPENEDITORCONFIGMENUITEMS1)
+ id=ID_PLCOPENEDITORCONFIGMENUITEMS1)
def _init_coll_HelpMenu_Items(self, parent):
- # generated method, don't edit
-
- parent.Append(help='', id=wxID_PLCOPENEDITORHELPMENUITEMS0,
+ parent.Append(help='', id=ID_PLCOPENEDITORHELPMENUITEMS0,
kind=wx.ITEM_NORMAL, text=u'PLCOpenEditor\tF1')
- parent.Append(help='', id=wxID_PLCOPENEDITORHELPMENUITEMS1,
+ parent.Append(help='', id=ID_PLCOPENEDITORHELPMENUITEMS1,
kind=wx.ITEM_NORMAL, text=u'PLCOpen\tF2')
- parent.Append(help='', id=wxID_PLCOPENEDITORHELPMENUITEMS2,
+ parent.Append(help='', id=ID_PLCOPENEDITORHELPMENUITEMS2,
kind=wx.ITEM_NORMAL, text=u'IEC 61131-3\tF3')
if self.ModeSolo:
- parent.Append(help='', id=wxID_PLCOPENEDITORHELPMENUITEMS3,
+ parent.Append(help='', id=ID_PLCOPENEDITORHELPMENUITEMS3,
kind=wx.ITEM_NORMAL, text=u'About')
self.Bind(wx.EVT_MENU, self.OnPLCOpenMenu,
- id=wxID_PLCOPENEDITORHELPMENUITEMS1)
+ id=ID_PLCOPENEDITORHELPMENUITEMS1)
def _init_coll_FileMenu_Items(self, parent):
- # generated method, don't edit
-
- parent.Append(help='', id=wxID_PLCOPENEDITORFILEMENUITEMS0,
+ parent.Append(help='', id=ID_PLCOPENEDITORFILEMENUITEMS0,
kind=wx.ITEM_NORMAL, text=u'New\tCTRL+N')
- parent.Append(help='', id=wxID_PLCOPENEDITORFILEMENUITEMS1,
+ parent.Append(help='', id=ID_PLCOPENEDITORFILEMENUITEMS1,
kind=wx.ITEM_NORMAL, text=u'Open\tCTRL+O')
- parent.Append(help='', id=wxID_PLCOPENEDITORFILEMENUITEMS2,
+ parent.Append(help='', id=ID_PLCOPENEDITORFILEMENUITEMS2,
kind=wx.ITEM_NORMAL, text=u'Close Tab\tCTRL+W')
- parent.Append(help='', id=wxID_PLCOPENEDITORFILEMENUITEMS3,
+ parent.Append(help='', id=ID_PLCOPENEDITORFILEMENUITEMS3,
kind=wx.ITEM_NORMAL, text=u'Close Project')
parent.AppendSeparator()
- parent.Append(help='', id=wxID_PLCOPENEDITORFILEMENUITEMS5,
+ parent.Append(help='', id=ID_PLCOPENEDITORFILEMENUITEMS5,
kind=wx.ITEM_NORMAL, text=u'Save\tCTRL+S')
- parent.Append(help='', id=wxID_PLCOPENEDITORFILEMENUITEMS6,
+ parent.Append(help='', id=ID_PLCOPENEDITORFILEMENUITEMS6,
kind=wx.ITEM_NORMAL, text=u'Save As...\tCTRL+SHIFT+S')
- parent.Append(help='', id=wxID_PLCOPENEDITORFILEMENUITEMS7,
+ parent.Append(help='', id=ID_PLCOPENEDITORFILEMENUITEMS7,
kind=wx.ITEM_NORMAL, text=u'Generate Program\tCTRL+G')
parent.AppendSeparator()
- parent.Append(help='', id=wxID_PLCOPENEDITORFILEMENUITEMS9,
+ parent.Append(help='', id=ID_PLCOPENEDITORFILEMENUITEMS9,
kind=wx.ITEM_NORMAL, text=u'Properties')
parent.AppendSeparator()
- parent.Append(help='', id=wxID_PLCOPENEDITORFILEMENUITEMS11,
+ parent.Append(help='', id=ID_PLCOPENEDITORFILEMENUITEMS11,
kind=wx.ITEM_NORMAL, text=u'Quit\tCTRL+Q')
self.Bind(wx.EVT_MENU, self.OnNewProjectMenu,
- id=wxID_PLCOPENEDITORFILEMENUITEMS0)
+ id=ID_PLCOPENEDITORFILEMENUITEMS0)
self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu,
- id=wxID_PLCOPENEDITORFILEMENUITEMS1)
+ id=ID_PLCOPENEDITORFILEMENUITEMS1)
self.Bind(wx.EVT_MENU, self.OnCloseTabMenu,
- id=wxID_PLCOPENEDITORFILEMENUITEMS2)
+ id=ID_PLCOPENEDITORFILEMENUITEMS2)
self.Bind(wx.EVT_MENU, self.OnCloseProjectMenu,
- id=wxID_PLCOPENEDITORFILEMENUITEMS3)
+ id=ID_PLCOPENEDITORFILEMENUITEMS3)
self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu,
- id=wxID_PLCOPENEDITORFILEMENUITEMS5)
+ id=ID_PLCOPENEDITORFILEMENUITEMS5)
self.Bind(wx.EVT_MENU, self.OnSaveProjectAsMenu,
- id=wxID_PLCOPENEDITORFILEMENUITEMS6)
+ id=ID_PLCOPENEDITORFILEMENUITEMS6)
self.Bind(wx.EVT_MENU, self.OnGenerateProgramMenu,
- id=wxID_PLCOPENEDITORFILEMENUITEMS7)
+ id=ID_PLCOPENEDITORFILEMENUITEMS7)
self.Bind(wx.EVT_MENU, self.OnPropertiesMenu,
- id=wxID_PLCOPENEDITORFILEMENUITEMS9)
+ id=ID_PLCOPENEDITORFILEMENUITEMS9)
self.Bind(wx.EVT_MENU, self.OnQuitMenu,
- id=wxID_PLCOPENEDITORFILEMENUITEMS11)
+ id=ID_PLCOPENEDITORFILEMENUITEMS11)
def _init_coll_SFCMenu_Items(self, parent):
- # generated method, don't edit
-
- parent.Append(help='', id=wxID_PLCOPENEDITORSFCMENUITEMS0,
+ parent.Append(help='', id=ID_PLCOPENEDITORSFCMENUITEMS0,
kind=wx.ITEM_NORMAL, text=u'Add Transition')
- parent.Append(help='', id=wxID_PLCOPENEDITORSFCMENUITEMS1,
+ parent.Append(help='', id=ID_PLCOPENEDITORSFCMENUITEMS1,
kind=wx.ITEM_NORMAL, text=u'Add Action')
- parent.Append(help='', id=wxID_PLCOPENEDITORSFCMENUITEMS2,
+ parent.Append(help='', id=ID_PLCOPENEDITORSFCMENUITEMS2,
kind=wx.ITEM_NORMAL, text=u'Remove Transition')
- parent.Append(help='', id=wxID_PLCOPENEDITORSFCMENUITEMS3,
+ parent.Append(help='', id=ID_PLCOPENEDITORSFCMENUITEMS3,
kind=wx.ITEM_NORMAL, text=u'Remove Action')
self.Bind(wx.EVT_MENU, self.OnAddPouTransitionMenu,
- id=wxID_PLCOPENEDITORSFCMENUITEMS0)
+ id=ID_PLCOPENEDITORSFCMENUITEMS0)
self.Bind(wx.EVT_MENU, self.OnAddPouActionMenu,
- id=wxID_PLCOPENEDITORSFCMENUITEMS1)
+ id=ID_PLCOPENEDITORSFCMENUITEMS1)
self.Bind(wx.EVT_MENU, self.OnRemovePouTransitionMenu,
- id=wxID_PLCOPENEDITORSFCMENUITEMS2)
+ id=ID_PLCOPENEDITORSFCMENUITEMS2)
self.Bind(wx.EVT_MENU, self.OnRemovePouActionMenu,
- id=wxID_PLCOPENEDITORSFCMENUITEMS3)
+ id=ID_PLCOPENEDITORSFCMENUITEMS3)
def _init_utils(self):
- # generated method, don't edit
self.menuBar1 = wx.MenuBar()
if self.ModeSolo:
@@ -333,32 +319,22 @@
self._init_coll_ConfigMenu_Items(self.ConfigMenu)
def _init_coll_MainGridSizer_Items(self, parent):
- # generated method, don't edit
-
- parent.AddWindow(self.splitterWindow1, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.splitterWindow1, 0, border=0, flag=wx.GROW)
def _init_coll_EditorGridSizer_Items(self, parent):
- # generated method, don't edit
-
- parent.AddWindow(self.ToolBar, 0, border=0, flag=wxGROW)
- parent.AddWindow(self.TabsOpened, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.ToolBar, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.TabsOpened, 0, border=0, flag=wx.GROW)
def _init_coll_MainGridSizer_Growables(self, parent):
- # generated method, don't edit
-
parent.AddGrowableCol(0)
parent.AddGrowableRow(0)
def _init_coll_EditorGridSizer_Growables(self, parent):
- # generated method, don't edit
-
parent.AddGrowableCol(0)
parent.AddGrowableRow(1)
def _init_sizers(self):
- # generated method, don't edit
self.MainGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=1, vgap=0)
-
self.EditorGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
self._init_coll_MainGridSizer_Growables(self.MainGridSizer)
@@ -370,54 +346,53 @@
self.EditorPanel.SetSizer(self.EditorGridSizer)
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Frame.__init__(self, id=wxID_PLCOPENEDITOR, name=u'PLCOpenEditor',
+ wx.Frame.__init__(self, id=ID_PLCOPENEDITOR, name=u'PLCOpenEditor',
parent=prnt, pos=wx.Point(235, 287), size=wx.Size(1000, 600),
style=wx.DEFAULT_FRAME_STYLE, title=u'PLCOpenEditor')
self._init_utils()
self.SetClientSize(wx.Size(1000, 600))
self.SetMenuBar(self.menuBar1)
- self.Bind(wx.EVT_CLOSE, self.OnCloseFrame, id=wxID_PLCOPENEDITOR)
-
- self.splitterWindow1 = wx.SplitterWindow(id=wxID_PLCOPENEDITORSPLITTERWINDOW1,
+ self.Bind(wx.EVT_CLOSE, self.OnCloseFrame, id=ID_PLCOPENEDITOR)
+
+ self.splitterWindow1 = wx.SplitterWindow(id=ID_PLCOPENEDITORSPLITTERWINDOW1,
name='splitterWindow1', parent=self, point=wx.Point(0, 0),
size=wx.Size(-1, -1), style=wx.SP_3D)
self.splitterWindow1.SetNeedUpdating(True)
self.splitterWindow1.SetMinimumPaneSize(1)
- self.EditorPanel = wx.Panel(id=wxID_PLCOPENEDITOREDITORPANEL,
+ self.EditorPanel = wx.Panel(id=ID_PLCOPENEDITOREDITORPANEL,
name='TabPanel', parent=self.splitterWindow1, pos=wx.Point(0, 0),
size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL)
- self.TabsOpened = wx.Notebook(id=wxID_PLCOPENEDITORTABSOPENED,
+ self.TabsOpened = wx.Notebook(id=ID_PLCOPENEDITORTABSOPENED,
name='TabsOpened', parent=self.EditorPanel, pos=wx.Point(0,
0), size=wx.Size(-1, -1), style=0)
self.TabsOpened.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,
- self.OnPouSelectedChanged, id=wxID_PLCOPENEDITORTABSOPENED)
-
- self.ToolBar = wxToolBar(id=wxID_PLCOPENEDITORTOOLBAR, name='ToolBar',
+ self.OnPouSelectedChanged, id=ID_PLCOPENEDITORTABSOPENED)
+
+ self.ToolBar = wx.ToolBar(id=ID_PLCOPENEDITORTOOLBAR, name='ToolBar',
parent=self.EditorPanel, pos=wx.Point(0, 0), size=wx.Size(0, 40),
- style=wxTB_HORIZONTAL | wxNO_BORDER)
- self.ToolBar.AddRadioTool(wxID_PLCOPENEDITORTOOLBARSELECTION,
- wxBitmap(os.path.join(CWD, 'Images/select.png')), wxNullBitmap, "Select an object")
+ style=wx.TB_HORIZONTAL | wx.NO_BORDER)
+ self.ToolBar.AddRadioTool(ID_PLCOPENEDITORTOOLBARSELECTION,
+ wx.Bitmap(os.path.join(CWD, 'Images/select.png')), wx.NullBitmap, "Select an object")
self.Bind(wx.EVT_TOOL, self.OnSelectionTool,
- id=wxID_PLCOPENEDITORTOOLBARSELECTION)
-
- self.ProjectTree = wx.TreeCtrl(id=wxID_PLCOPENEDITORPROJECTTREE,
+ id=ID_PLCOPENEDITORTOOLBARSELECTION)
+
+ self.ProjectTree = wx.TreeCtrl(id=ID_PLCOPENEDITORPROJECTTREE,
name='treeCtrl1', parent=self.splitterWindow1, pos=wx.Point(0, 0),
size=wx.Size(-1, -1),
style=wx.TR_HAS_BUTTONS|wx.TR_EDIT_LABELS|wx.TR_SINGLE|wx.SUNKEN_BORDER)
self.ProjectTree.Bind(wx.EVT_RIGHT_UP, self.OnProjectTreeRightUp)
self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnProjectTreeBeginDrag,
- id=wxID_PLCOPENEDITORPROJECTTREE)
+ id=ID_PLCOPENEDITORPROJECTTREE)
self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnProjectTreeItemBeginEdit,
- id=wxID_PLCOPENEDITORPROJECTTREE)
+ id=ID_PLCOPENEDITORPROJECTTREE)
self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnProjectTreeItemEndEdit,
- id=wxID_PLCOPENEDITORPROJECTTREE)
+ id=ID_PLCOPENEDITORPROJECTTREE)
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnProjectTreeItemActivated,
- id=wxID_PLCOPENEDITORPROJECTTREE)
+ id=ID_PLCOPENEDITORPROJECTTREE)
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnProjectTreeItemSelected,
- id=wxID_PLCOPENEDITORPROJECTTREE)
+ id=ID_PLCOPENEDITORPROJECTTREE)
self.splitterWindow1.SplitVertically(self.ProjectTree, self.EditorPanel,
200)
@@ -427,9 +402,9 @@
self.ModeSolo = controler == None
self._init_ctrls(parent)
- self.TreeImageList = wxImageList(16, 16)
+ self.TreeImageList = wx.ImageList(16, 16)
for language in LANGUAGES:
- self.TreeImageList.Add(wxBitmap(os.path.join(CWD, 'Images/%s.png'%language)))
+ self.TreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'Images/%s.png'%language)))
self.ProjectTree.SetImageList(self.TreeImageList)
if self.ModeSolo:
@@ -443,8 +418,8 @@
self.CurrentToolBar = []
self.CurrentLanguage = ""
- #self.DrawingMode = FREEDRAWING_MODE
- self.DrawingMode = DRIVENDRAWING_MODE
+ self.DrawingMode = FREEDRAWING_MODE
+ #self.DrawingMode = DRIVENDRAWING_MODE
self.RefreshFileMenu()
self.RefreshEditMenu()
@@ -484,11 +459,11 @@
if self.EditMenu:
if self.Controler.HasOpenedProject():
undo, redo = self.Controler.GetBufferState()
- self.EditMenu.Enable(wxID_PLCOPENEDITOREDITMENUITEMS1, undo)
- self.EditMenu.Enable(wxID_PLCOPENEDITOREDITMENUITEMS2, redo)
+ self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUITEMS1, undo)
+ self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUITEMS2, redo)
else:
- self.EditMenu.Enable(wxID_PLCOPENEDITOREDITMENUITEMS1, False)
- self.EditMenu.Enable(wxID_PLCOPENEDITOREDITMENUITEMS2, False)
+ self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUITEMS1, False)
+ self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUITEMS2, False)
if self.Controler.HasOpenedProject():
if self.TabsOpened.GetPageCount() > 0:
self.EditMenu.FindItemByPosition(0).Enable(True)
@@ -514,7 +489,7 @@
old_values = self.Controler.GetProjectProperties()
dialog = ProjectDialog(self)
dialog.SetValues(old_values)
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
new_values = dialog.GetValues()
projectname = new_values.pop("projectName")
new_values["creationDateTime"] = old_values["creationDateTime"]
@@ -524,20 +499,20 @@
def OnCloseFrame(self, event):
if not self.Controler.ProjectIsSaved():
- dialog = wxMessageDialog(self, "There are changes, do you want to save?", "Close Application", wxYES_NO|wxCANCEL|wxICON_QUESTION)
+ dialog = wx.MessageDialog(self, "There are changes, do you want to save?", "Close Application", wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION)
answer = dialog.ShowModal()
dialog.Destroy()
- if answer == wxID_YES:
+ if answer == wx.ID_YES:
self.SaveProject()
event.Skip()
- elif answer == wxID_NO:
+ elif answer == wx.ID_NO:
event.Skip()
else:
event.Skip()
def OnNewProjectMenu(self, event):
dialog = ProjectDialog(self)
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
projectname = values.pop("projectName")
values["creationDateTime"] = datetime(*localtime()[:6])
@@ -555,8 +530,8 @@
directory = os.path.dirname(filepath)
else:
directory = os.getcwd()
- dialog = wxFileDialog(self, "Choose a file", directory, "", "PLCOpen files (*.xml)|*.xml|All files|*.*", wxOPEN)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.FileDialog(self, "Choose a file", directory, "", "PLCOpen files (*.xml)|*.xml|All files|*.*", wx.OPEN)
+ if dialog.ShowModal() == wx.ID_OK:
filepath = dialog.GetPath()
if os.path.isfile(filepath):
self.Controler.OpenXMLFile(filepath)
@@ -601,17 +576,17 @@
event.Skip()
def OnGenerateProgramMenu(self, event):
- dialog = wxFileDialog(self, "Choose a file", os.getcwd(), self.Controler.GetProgramFilePath(), "ST files (*.st)|*.st|All files|*.*", wxSAVE|wxCHANGE_DIR)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.FileDialog(self, "Choose a file", os.getcwd(), self.Controler.GetProgramFilePath(), "ST files (*.st)|*.st|All files|*.*", wx.SAVE|wx.CHANGE_DIR)
+ if dialog.ShowModal() == wx.ID_OK:
filepath = dialog.GetPath()
if os.path.isdir(os.path.dirname(filepath)):
result = self.Controler.GenerateProgram(filepath)
if not result:
- message = wxMessageDialog(self, "Can't generate program to file %s!"%filepath, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "Can't generate program to file %s!"%filepath, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
else:
- message = wxMessageDialog(self, "%s is not a valid folder!"%os.path.dirname(filepath), "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "%s is not a valid folder!"%os.path.dirname(filepath), "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
dialog.Destroy()
@@ -630,17 +605,17 @@
directory, filename = os.path.split(filepath)
else:
directory, filename = os.getcwd(), "%(projectName)s.xml"%self.Controler.GetProjectProperties()
- dialog = wxFileDialog(self, "Choose a file", directory, filename, "PLCOpen files (*.xml)|*.xml|All files|*.*", wxSAVE|wxOVERWRITE_PROMPT)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.FileDialog(self, "Choose a file", directory, filename, "PLCOpen files (*.xml)|*.xml|All files|*.*", wx.SAVE|wx.OVERWRITE_PROMPT)
+ if dialog.ShowModal() == wx.ID_OK:
filepath = dialog.GetPath()
if os.path.isdir(os.path.dirname(filepath)):
result = self.Controler.SaveXMLFile(filepath)
if not result:
- message = wxMessageDialog(self, "Can't save project to file %s!"%filepath, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "Can't save project to file %s!"%filepath, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
else:
- message = wxMessageDialog(self, "%s is not a valid folder!"%os.path.dirname(filepath), "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "%s is not a valid folder!"%os.path.dirname(filepath), "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
self.RefreshTitle()
@@ -661,7 +636,7 @@
if selected != -1:
window = self.TabsOpened.GetPage(selected)
window.SetMode(MODE_SELECTION)
- self.ToolBar.ToggleTool(wxID_PLCOPENEDITORTOOLBARSELECTION, True)
+ self.ToolBar.ToggleTool(ID_PLCOPENEDITORTOOLBARSELECTION, True)
def ResetToolToggle(self, id):
tool = self.ToolBar.FindById(id)
@@ -674,14 +649,14 @@
event.Skip()
def OnCommentTool(self, event):
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARCOMMENT)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARCOMMENT)
selected = self.TabsOpened.GetSelection()
if selected != -1:
self.TabsOpened.GetPage(selected).SetMode(MODE_COMMENT)
event.Skip()
def OnVariableTool(self, event):
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARVARIABLE)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARVARIABLE)
selected = self.TabsOpened.GetSelection()
if selected != -1:
self.TabsOpened.GetPage(selected).SetMode(MODE_VARIABLE)
@@ -694,21 +669,21 @@
event.Skip()
def OnConnectionTool(self, event):
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARCONNECTION)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARCONNECTION)
selected = self.TabsOpened.GetSelection()
if selected != -1:
self.TabsOpened.GetPage(selected).SetMode(MODE_CONNECTION)
event.Skip()
def OnWireTool(self, event):
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARWIRE)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARWIRE)
selected = self.TabsOpened.GetSelection()
if selected != -1:
self.TabsOpened.GetPage(selected).SetMode(MODE_WIRE)
event.Skip()
def OnPowerRailTool(self, event):
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARPOWERRAIL)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARPOWERRAIL)
selected = self.TabsOpened.GetSelection()
if selected != -1:
self.TabsOpened.GetPage(selected).SetMode(MODE_POWERRAIL)
@@ -721,7 +696,7 @@
event.Skip()
def OnCoilTool(self, event):
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARCOIL)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARCOIL)
selected = self.TabsOpened.GetSelection()
if selected != -1:
self.TabsOpened.GetPage(selected).SetMode(MODE_COIL)
@@ -729,7 +704,7 @@
def OnContactTool(self, event):
if self.DrawingMode == FREEDRAWING_MODE:
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARCONTACT)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARCONTACT)
selected = self.TabsOpened.GetSelection()
if selected != -1:
if self.DrawingMode == FREEDRAWING_MODE:
@@ -745,7 +720,7 @@
event.Skip()
def OnInitialStepTool(self, event):
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARINITIALSTEP)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARINITIALSTEP)
selected = self.TabsOpened.GetSelection()
if selected != -1:
self.TabsOpened.GetPage(selected).SetMode(MODE_INITIALSTEP)
@@ -753,7 +728,7 @@
def OnStepTool(self, event):
if self.GetDrawingMode() == FREEDRAWING_MODE:
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARSTEP)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARSTEP)
selected = self.TabsOpened.GetSelection()
if selected != -1:
if self.GetDrawingMode() == FREEDRAWING_MODE:
@@ -764,7 +739,7 @@
def OnActionBlockTool(self, event):
if self.GetDrawingMode() == FREEDRAWING_MODE:
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARACTIONBLOCK)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARACTIONBLOCK)
selected = self.TabsOpened.GetSelection()
if selected != -1:
if self.GetDrawingMode() == FREEDRAWING_MODE:
@@ -774,7 +749,7 @@
event.Skip()
def OnTransitionTool(self, event):
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARTRANSITION)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARTRANSITION)
selected = self.TabsOpened.GetSelection()
if selected != -1:
self.TabsOpened.GetPage(selected).SetMode(MODE_TRANSITION)
@@ -782,7 +757,7 @@
def OnDivergenceTool(self, event):
if self.GetDrawingMode() == FREEDRAWING_MODE:
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARDIVERGENCE)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARDIVERGENCE)
selected = self.TabsOpened.GetSelection()
if selected != -1:
if self.GetDrawingMode() == FREEDRAWING_MODE:
@@ -793,7 +768,7 @@
def OnJumpTool(self, event):
if self.GetDrawingMode() == FREEDRAWING_MODE:
- self.ResetToolToggle(wxID_PLCOPENEDITORTOOLBARJUMP)
+ self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARJUMP)
selected = self.TabsOpened.GetSelection()
if selected != -1:
if self.GetDrawingMode() == FREEDRAWING_MODE:
@@ -829,8 +804,8 @@
block_name = self.ProjectTree.GetItemText(item)
block_type = self.Controler.GetPouType(block_name)
if block_type != "program":
- data = wxTextDataObject(str((block_name, block_type, "")))
- dragSource = wxDropSource(self.ProjectTree)
+ data = wx.TextDataObject(str((block_name, block_type, "")))
+ dragSource = wx.DropSource(self.ProjectTree)
dragSource.SetData(data)
dragSource.DoDragDrop()
@@ -853,8 +828,8 @@
message = "\"%s\" pou already exists!"%new_name
abort = True
elif new_name.upper() in self.Controler.GetProjectPouVariables():
- messageDialog = wxMessageDialog(self, "A variable is defined with \"%s\" as name. It can generate a conflict. Do you wish to continue?"%new_name, "Error", wxYES_NO|wxICON_QUESTION)
- if messageDialog.ShowModal() == wxID_NO:
+ messageDialog = wx.MessageDialog(self, "A variable is defined with \"%s\" as name. It can generate a conflict. Do you wish to continue?"%new_name, "Error", wx.YES_NO|wx.ICON_QUESTION)
+ if messageDialog.ShowModal() == wx.ID_NO:
abort = True
messageDialog.Destroy()
if not abort:
@@ -901,14 +876,14 @@
self.RefreshTabsOpenedTitles()
if message or abort:
if message:
- messageDialog = wxMessageDialog(self, message, "Error", wxOK|wxICON_ERROR)
+ messageDialog = wx.MessageDialog(self, message, "Error", wx.OK|wx.ICON_ERROR)
messageDialog.ShowModal()
messageDialog.Destroy()
item = event.GetItem()
- wxCallAfter(self.ProjectTree.EditLabel, item)
+ wx.CallAfter(self.ProjectTree.EditLabel, item)
event.Veto()
else:
- wxCallAfter(self.RefreshProjectTree)
+ wx.CallAfter(self.RefreshProjectTree)
event.Skip()
def OnProjectTreeItemBeginEdit(self, event):
@@ -942,7 +917,7 @@
## values["returnType"] = self.Controler.GetPouInterfaceReturnTypeByName(item_name)
## values["data"] = self.Controler.GetPouInterfaceVarsByName(item_name)
## dialog.SetValues(values)
-## if dialog.ShowModal() == wxID_OK:
+## if dialog.ShowModal() == wx.ID_OK:
## new_values = dialog.GetValues()
## if "returnType" in new_values:
## self.Controler.SetPouInterfaceReturnType(item_name, new_values["returnType"])
@@ -964,7 +939,7 @@
## dialog.SetPouNames(self.Controler.GetProjectPouNames())
## values = {"data" : self.Controler.GetConfigurationGlobalVars(item_name)}
## dialog.SetValues(values)
-## if dialog.ShowModal() == wxID_OK:
+## if dialog.ShowModal() == wx.ID_OK:
## new_values = dialog.GetValues()
## self.Controler.SetConfigurationGlobalVars(item_name, new_values["data"])
## dialog.Destroy()
@@ -980,7 +955,7 @@
## dialog = EditVariableDialog(self, item_name, None, False, name)
## values = {"data" : self.Controler.GetConfigurationResourceGlobalVars(config_name, item_name)}
## dialog.SetValues(values)
-## if dialog.ShowModal() == wxID_OK:
+## if dialog.ShowModal() == wx.ID_OK:
## new_values = dialog.GetValues()
## self.Controler.SetConfigurationResourceGlobalVars(config_name, item_name, new_values["data"])
## dialog.Destroy()
@@ -1223,9 +1198,9 @@
for radio, modes, id, method, picture, help in ToolBarItems[language]:
if modes & self.DrawingMode:
if radio or self.DrawingMode == FREEDRAWING_MODE:
- self.ToolBar.AddRadioTool(id, wxBitmap(os.path.join(CWD, picture)), wxNullBitmap, help)
+ self.ToolBar.AddRadioTool(id, wx.Bitmap(os.path.join(CWD, picture)), wx.NullBitmap, help)
else:
- self.ToolBar.AddSimpleTool(id, wxBitmap(os.path.join(CWD, picture)), help)
+ self.ToolBar.AddSimpleTool(id, wx.Bitmap(os.path.join(CWD, picture)), help)
self.Bind(wx.EVT_TOOL, getattr(self, method), id=id)
self.CurrentToolBar.append(id)
self.ResetCurrentMode()
@@ -1292,7 +1267,7 @@
def OnAddPouMenu(self, event):
dialog = PouDialog(self)
dialog.SetPouNames(self.Controler.GetProjectPouNames())
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
self.Controler.ProjectAddPou(values["pouName"], values["pouType"], values["language"])
self.RefreshProjectTree()
@@ -1301,8 +1276,8 @@
def OnRemovePouMenu(self, event):
pous = self.Controler.GetProjectPouNames()
- dialog = wxSingleChoiceDialog(self, "Select POU to remove:", "POU Remove", pous, wxOK|wxCANCEL)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.SingleChoiceDialog(self, "Select POU to remove:", "POU Remove", pous, wx.OK|wx.CANCEL)
+ if dialog.ShowModal() == wx.ID_OK:
selected = dialog.GetStringSelection()
if not self.Controler.PouIsUsed(selected):
self.Controler.ProjectRemovePou(selected)
@@ -1315,14 +1290,14 @@
self.RefreshProjectTree()
self.RefreshToolBar()
else:
- message = wxMessageDialog(self, "%s is used by one or more POUs. It can't be removed!"%selected, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "%s is used by one or more POUs. It can't be removed!"%selected, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
event.Skip()
def OnAddConfigurationMenu(self, event):
- dialog = wxTextEntryDialog(self, "Enter configuration name:", "Create new configuration", "", wxOK|wxCANCEL)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.TextEntryDialog(self, "Enter configuration name:", "Create new configuration", "", wx.OK|wx.CANCEL)
+ if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetValue()
self.Controler.ProjectAddConfiguration(value)
self.RefreshProjectTree()
@@ -1331,8 +1306,8 @@
def OnRemoveConfigurationMenu(self, event):
configs = self.Controler.GetProjectConfigNames()
- dialog = wxSingleChoiceDialog(self, "Select Configuration to remove:", "Remove configuration", configs, wxOK|wxCANCEL)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.SingleChoiceDialog(self, "Select Configuration to remove:", "Remove configuration", configs, wx.OK|wx.CANCEL)
+ if dialog.ShowModal() == wx.ID_OK:
selected = dialog.GetStringSelection()
self.Controler.ProjectRemoveConfiguration(selected)
self.RefreshProjectTree()
@@ -1344,7 +1319,7 @@
pouname = self.ProjectTree.GetItemText(selected)
if self.Controler.GetPouBodyType(pouname) == "SFC":
dialog = PouTransitionDialog(self)
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
self.Controler.ProjectAddPouTransition(pouname, values["transitionName"], values["language"])
self.RefreshProjectTree()
@@ -1357,8 +1332,8 @@
pouname = self.ProjectTree.GetItemText(selected)
if self.Controler.GetPouBodyType(pouname) == "SFC":
transitions = self.Controler.GetPouTransitions(pouname)
- dialog = wxSingleChoiceDialog(self, "Select Transition to remove:", "Remove transition", transitions, wxOK|wxCANCEL)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.SingleChoiceDialog(self, "Select Transition to remove:", "Remove transition", transitions, wx.OK|wx.CANCEL)
+ if dialog.ShowModal() == wx.ID_OK:
selected = dialog.GetStringSelection()
self.Controler.ProjectRemovePouTransition(pouname, selected)
self.RefreshProjectTree()
@@ -1371,7 +1346,7 @@
pouname = self.ProjectTree.GetItemText(selected)
if self.Controler.GetPouBodyType(pouname) == "SFC":
dialog = PouActionDialog(self)
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
self.Controler.ProjectAddPouAction(pouname, values["actionName"], values["language"])
self.RefreshProjectTree()
@@ -1384,8 +1359,8 @@
pouname = self.ProjectTree.GetItemText(selected)
if self.Controler.GetPouBodyType(pouname) == "SFC":
actions = self.Controler.GetPouActions(pouname)
- dialog = wxSingleChoiceDialog(self, "Select Action to remove:", "Remove action", actions, wxOK|wxCANCEL)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.SingleChoiceDialog(self, "Select Action to remove:", "Remove action", actions, wx.OK|wx.CANCEL)
+ if dialog.ShowModal() == wx.ID_OK:
selected = dialog.GetStringSelection()
self.Controler.ProjectRemovePouAction(pouname, selected)
self.RefreshProjectTree()
@@ -1396,8 +1371,8 @@
selected = self.ProjectTree.GetSelection()
if self.ProjectTree.GetPyData(selected) == ITEM_CONFIGURATION:
config_name = self.ProjectTree.GetItemText(selected)
- dialog = wxTextEntryDialog(self, "Enter Resource name:", "Create new Resource", "", wxOK|wxCANCEL)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.TextEntryDialog(self, "Enter Resource name:", "Create new Resource", "", wx.OK|wx.CANCEL)
+ if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetValue()
self.Controler.ProjectAddConfigurationResource(config_name, value)
self.RefreshProjectTree()
@@ -1413,8 +1388,8 @@
for config in infos["configs"]:
if config["name"] == config_name:
resources = config["resources"]
- dialog = wxSingleChoiceDialog(self, "Select Resource to remove:", "Remove resource", resources, wxOK|wxCANCEL)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.SingleChoiceDialog(self, "Select Resource to remove:", "Remove resource", resources, wx.OK|wx.CANCEL)
+ if dialog.ShowModal() == wx.ID_OK:
resource = dialog.GetStringSelection()
self.Controler.ProjectRemoveConfigurationResource(config_name, resource)
self.RefreshProjectTree()
@@ -1424,7 +1399,7 @@
def OnPLCOpenMenu(self, event):
result = OpenPDFDoc()
if type(result) == StringType:
- message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, result, "ERROR", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
event.Skip()
@@ -1439,108 +1414,127 @@
# Create Project Dialog
#-------------------------------------------------------------------------------
-[wxID_PROJECTDIALOG, wxID_PROJECTDIALOGMAINPANEL,
- wxID_PROJECTDIALOGPROJECTNAME, wxID_PROJECTDIALOGCOMPANYNAME,
- wxID_PROJECTDIALOGCOMPANYURL, wxID_PROJECTDIALOGPRODUCTNAME,
- wxID_PROJECTDIALOGPRODUCTVERSION, wxID_PROJECTDIALOGPRODUCTRELEASE,
- wxID_PROJECTDIALOGCONTENTDESCRIPTION, wxID_PROJECTDIALOGSTATICTEXT1,
- wxID_PROJECTDIALOGSTATICTEXT2, wxID_PROJECTDIALOGSTATICTEXT3,
- wxID_PROJECTDIALOGSTATICTEXT4, wxID_PROJECTDIALOGSTATICTEXT5,
- wxID_PROJECTDIALOGSTATICTEXT6, wxID_PROJECTDIALOGSTATICTEXT7,
-] = [wx.NewId() for _init_ctrls in range(16)]
+[ID_PROJECTDIALOG, ID_PROJECTDIALOGPROJECTNAME,
+ ID_PROJECTDIALOGCOMPANYNAME, ID_PROJECTDIALOGCOMPANYURL,
+ ID_PROJECTDIALOGPRODUCTNAME, ID_PROJECTDIALOGPRODUCTVERSION,
+ ID_PROJECTDIALOGPRODUCTRELEASE, ID_PROJECTDIALOGCONTENTDESCRIPTION,
+ ID_PROJECTDIALOGSTATICTEXT1, ID_PROJECTDIALOGSTATICTEXT2,
+ ID_PROJECTDIALOGSTATICTEXT3, ID_PROJECTDIALOGSTATICTEXT4,
+ ID_PROJECTDIALOGSTATICTEXT5, ID_PROJECTDIALOGSTATICTEXT6,
+ ID_PROJECTDIALOGSTATICTEXT7,
+] = [wx.NewId() for _init_ctrls in range(15)]
class ProjectDialog(wx.Dialog):
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=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
+
+ def _init_coll_flexGridSizer1_Growables(self, parent):
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(0)
+
+ def _init_coll_MainSizer_Items(self, parent):
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.ProjectName, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.CompanyName, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.CompanyURL, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText4, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.ProductName, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText5, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.ProductVersion, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText6, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.ProductRelease, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText7, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.ContentDescription, 0, border=0, flag=wx.GROW)
+
+ def _init_coll_MainSizer_Growables(self, parent):
+ parent.AddGrowableCol(1)
+ parent.AddGrowableRow(6)
+
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=2, hgap=0, rows=7, vgap=15)
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.SetSizer(self.flexGridSizer1)
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Dialog.__init__(self, id=wxID_PROJECTDIALOG,
+ wx.Dialog.__init__(self, id=ID_PROJECTDIALOG,
name='ProjectDialog', parent=prnt, pos=wx.Point(376, 223),
size=wx.Size(550, 450), style=wx.DEFAULT_DIALOG_STYLE,
title='Create a new project')
self.SetClientSize(wx.Size(550, 450))
- self.MainPanel = wx.Panel(id=wxID_PROJECTDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(450, 400), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
- self.staticText1 = wx.StaticText(id=wxID_PROJECTDIALOGSTATICTEXT1,
- label='Project Name (required):', name='staticText1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(215, 17), style=0)
-
- self.ProjectName = wx.TextCtrl(id=wxID_PROJECTDIALOGPROJECTNAME,
- name='ProjectName', parent=self.MainPanel, pos=wx.Point(224, 24),
- size=wx.Size(295, 24), style=0)
-
- self.staticText2 = wx.StaticText(id=wxID_PROJECTDIALOGSTATICTEXT2,
- label='Company Name (required):', name='staticText2', parent=self.MainPanel,
- pos=wx.Point(24, 64), size=wx.Size(215, 17), style=0)
-
- self.CompanyName = wx.TextCtrl(id=wxID_PROJECTDIALOGCOMPANYNAME,
- name='CompanyName', parent=self.MainPanel, pos=wx.Point(224, 64),
- size=wx.Size(295, 24), style=0)
-
- self.staticText3 = wx.StaticText(id=wxID_PROJECTDIALOGSTATICTEXT3,
- label='Company URL (optional):', name='staticText3', parent=self.MainPanel,
- pos=wx.Point(24, 104), size=wx.Size(215, 17), style=0)
-
- self.CompanyURL = wx.TextCtrl(id=wxID_PROJECTDIALOGCOMPANYURL,
- name='CompanyURL', parent=self.MainPanel, pos=wx.Point(224, 104),
- size=wx.Size(295, 24), style=0)
-
- self.staticText4 = wx.StaticText(id=wxID_PROJECTDIALOGSTATICTEXT4,
- label='Product Name (required):', name='staticText4', parent=self.MainPanel,
- pos=wx.Point(24, 144), size=wx.Size(215, 17), style=0)
-
- self.ProductName = wx.TextCtrl(id=wxID_PROJECTDIALOGPRODUCTNAME,
- name='ProductName', parent=self.MainPanel, pos=wx.Point(224, 144),
- size=wx.Size(295, 24), style=0)
-
- self.staticText5 = wx.StaticText(id=wxID_PROJECTDIALOGSTATICTEXT5,
- label='Product Version (required):', name='staticText5', parent=self.MainPanel,
- pos=wx.Point(24, 184), size=wx.Size(215, 17), style=0)
-
- self.ProductVersion = wx.TextCtrl(id=wxID_PROJECTDIALOGPRODUCTVERSION,
- name='ProductVersion', parent=self.MainPanel, pos=wx.Point(224, 184),
- size=wx.Size(295, 24), style=0)
-
- self.staticText6 = wx.StaticText(id=wxID_PROJECTDIALOGSTATICTEXT6,
- label='Product Release (optional):', name='staticText6', parent=self.MainPanel,
- pos=wx.Point(24, 224), size=wx.Size(215, 17), style=0)
-
- self.ProductRelease = wx.TextCtrl(id=wxID_PROJECTDIALOGPRODUCTRELEASE,
- name='ProductRelease', parent=self.MainPanel, pos=wx.Point(224, 224),
- size=wx.Size(295, 24), style=0)
-
- self.staticText7 = wx.StaticText(id=wxID_PROJECTDIALOGSTATICTEXT7,
- label='Content Description (optional):', name='staticText7', parent=self.MainPanel,
- pos=wx.Point(24, 264), size=wx.Size(215, 17), style=0)
-
- self.ContentDescription = wx.TextCtrl(id=wxID_PROJECTDIALOGCONTENTDESCRIPTION,
- name='ProductRelease', parent=self.MainPanel, pos=wx.Point(224, 264),
- size=wx.Size(295, 120), style=wxTE_MULTILINE)
-
+ self.staticText1 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT1,
+ label='Project Name (required):', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
+ self.ProjectName = wx.TextCtrl(id=ID_PROJECTDIALOGPROJECTNAME,
+ name='ProjectName', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.staticText2 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT2,
+ label='Company Name (required):', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
+ self.CompanyName = wx.TextCtrl(id=ID_PROJECTDIALOGCOMPANYNAME,
+ name='CompanyName', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.staticText3 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT3,
+ label='Company URL (optional):', name='staticText3', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
+ self.CompanyURL = wx.TextCtrl(id=ID_PROJECTDIALOGCOMPANYURL,
+ name='CompanyURL', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.staticText4 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT4,
+ label='Product Name (required):', name='staticText4', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
+ self.ProductName = wx.TextCtrl(id=ID_PROJECTDIALOGPRODUCTNAME,
+ name='ProductName', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.staticText5 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT5,
+ label='Product Version (required):', name='staticText5', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
+ self.ProductVersion = wx.TextCtrl(id=ID_PROJECTDIALOGPRODUCTVERSION,
+ name='ProductVersion', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.staticText6 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT6,
+ label='Product Release (optional):', name='staticText6', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
+ self.ProductRelease = wx.TextCtrl(id=ID_PROJECTDIALOGPRODUCTRELEASE,
+ name='ProductRelease', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.staticText7 = wx.StaticText(id=ID_PROJECTDIALOGSTATICTEXT7,
+ label='Content Description (optional):', name='staticText7', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(200, 17), style=0)
+
+ self.ContentDescription = wx.TextCtrl(id=ID_PROJECTDIALOGCONTENTDESCRIPTION,
+ name='ProductRelease', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 120), style=wx.TE_MULTILINE)
+
+ self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
+
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)
-
- EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
-
+
def OnOK(self, event):
error = []
if self.ProjectName.GetValue() == "":
@@ -1560,11 +1554,11 @@
text += " and %s"%item
else:
text += ", %s"%item
- message = wxMessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
else:
- self.EndModal(wxID_OK)
+ self.EndModal(wx.ID_OK)
def SetValues(self, values):
for item, value in values.items():
@@ -1601,69 +1595,81 @@
# Create Pou Dialog
#-------------------------------------------------------------------------------
-[wxID_POUDIALOG, wxID_POUDIALOGMAINPANEL, wxID_POUDIALOGPOUNAME,
- wxID_POUDIALOGPOUTYPE, wxID_POUDIALOGLANGUAGE, wxID_POUDIALOGSTATICTEXT1,
- wxID_POUDIALOGSTATICTEXT2, wxID_POUDIALOGSTATICTEXT3,
-] = [wx.NewId() for _init_ctrls in range(8)]
+[ID_POUDIALOG, ID_POUDIALOGPOUNAME,
+ ID_POUDIALOGPOUTYPE, ID_POUDIALOGLANGUAGE, ID_POUDIALOGSTATICTEXT1,
+ ID_POUDIALOGSTATICTEXT2, ID_POUDIALOGSTATICTEXT3,
+] = [wx.NewId() for _init_ctrls in range(7)]
class PouDialog(wx.Dialog):
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=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
+
+ def _init_coll_flexGridSizer1_Growables(self, parent):
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(0)
+
+ def _init_coll_MainSizer_Items(self, parent):
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.PouName, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.PouType, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Language, 0, border=0, flag=wx.GROW)
+
+ def _init_coll_MainSizer_Growables(self, parent):
+ parent.AddGrowableCol(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=2, hgap=0, rows=3, vgap=15)
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.SetSizer(self.flexGridSizer1)
-
+
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Dialog.__init__(self, id=wxID_POUDIALOG,
+ wx.Dialog.__init__(self, id=ID_POUDIALOG,
name='PouDialog', parent=prnt, pos=wx.Point(376, 223),
size=wx.Size(300, 200), style=wx.DEFAULT_DIALOG_STYLE,
title='Create a new POU')
self.SetClientSize(wx.Size(300, 200))
- self.MainPanel = wx.Panel(id=wxID_POUDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(300, 200), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
- self.staticText1 = wx.StaticText(id=wxID_POUDIALOGSTATICTEXT1,
- label='POU Name:', name='staticText1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(95, 17), style=0)
-
- self.PouName = wx.TextCtrl(id=wxID_POUDIALOGPOUNAME,
- name='POUName', parent=self.MainPanel, pos=wx.Point(104, 24),
- size=wx.Size(150, 24), style=0)
-
- self.staticText2 = wx.StaticText(id=wxID_POUDIALOGSTATICTEXT2,
- label='POU Type:', name='staticText2', parent=self.MainPanel,
- pos=wx.Point(24, 64), size=wx.Size(95, 17), style=0)
-
- self.PouType = wx.Choice(id=wxID_POUDIALOGPOUTYPE,
- name='POUType', parent=self.MainPanel, pos=wx.Point(104, 64),
- size=wx.Size(150, 24), style=0)
- EVT_CHOICE(self, wxID_POUDIALOGPOUTYPE, self.OnTypeChanged)
-
- self.staticText3 = wx.StaticText(id=wxID_POUDIALOGSTATICTEXT3,
- label='Language:', name='staticText3', parent=self.MainPanel,
- pos=wx.Point(24, 104), size=wx.Size(95, 17), style=0)
-
- self.Language = wx.Choice(id=wxID_POUDIALOGLANGUAGE,
- name='Language', parent=self.MainPanel, pos=wx.Point(104, 104),
- size=wx.Size(150, 24), style=0)
-
+ self.staticText1 = wx.StaticText(id=ID_POUDIALOGSTATICTEXT1,
+ label='POU Name:', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(100, 17), style=0)
+
+ self.PouName = wx.TextCtrl(id=ID_POUDIALOGPOUNAME,
+ name='POUName', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.staticText2 = wx.StaticText(id=ID_POUDIALOGSTATICTEXT2,
+ label='POU Type:', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(100, 17), style=0)
+
+ self.PouType = wx.Choice(id=ID_POUDIALOGPOUTYPE,
+ name='POUType', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+ self.Bind(wx.EVT_CHOICE, self.OnTypeChanged, id=ID_POUDIALOGPOUTYPE)
+
+ self.staticText3 = wx.StaticText(id=ID_POUDIALOGSTATICTEXT3,
+ label='Language:', name='staticText3', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(100, 17), style=0)
+
+ self.Language = wx.Choice(id=ID_POUDIALOGLANGUAGE,
+ name='Language', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
+
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)
for option in ["function","functionBlock","program"]:
self.PouType.Append(option)
@@ -1671,8 +1677,6 @@
self.PouNames = []
- EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
-
def OnOK(self, event):
error = []
pou_name = self.PouName.GetValue()
@@ -1691,31 +1695,31 @@
text += " and %s"%item
else:
text += ", %s"%item
- message = wxMessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
elif not TestIdentifier(pou_name):
- message = wxMessageDialog(self, "\"%s\" is not a valid identifier!"%pou_name, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%pou_name, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
elif pou_name.upper() in IEC_KEYWORDS:
- message = wxMessageDialog(self, "\"%s\" is a keyword. It can't be used!"%pou_name, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%pou_name, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
elif pou_name.upper() in self.PouNames:
- message = wxMessageDialog(self, "\"%s\" pou already exists!"%pou_name, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "\"%s\" pou already exists!"%pou_name, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
else:
- self.EndModal(wxID_OK)
+ self.EndModal(wx.ID_OK)
def RefreshLanguage(self):
selection = self.Language.GetStringSelection()
self.Language.Clear()
for option in ["IL","ST","LD","FBD","SFC"]:
- if option != "SFC" or self.PouType.GetStringSelection() == "program":
+ if option != "SFC" or self.PouType.GetStringSelection() != "function":
self.Language.Append(option)
- if self.Language.FindString(selection) != wxNOT_FOUND:
+ if self.Language.FindString(selection) != wx.NOT_FOUND:
self.Language.SetStringSelection(selection)
def OnTypeChanged(self, event):
@@ -1746,66 +1750,74 @@
# Create Pou Transition Dialog
#-------------------------------------------------------------------------------
-[wxID_POUTRANSITIONDIALOG, wxID_POUTRANSITIONDIALOGMAINPANEL,
- wxID_POUTRANSITIONDIALOGTRANSITIONNAME, wxID_POUTRANSITIONDIALOGLANGUAGE,
- wxID_POUTRANSITIONDIALOGSTATICTEXT1, wxID_POUTRANSITIONDIALOGSTATICTEXT2,
-] = [wx.NewId() for _init_ctrls in range(6)]
+[ID_POUTRANSITIONDIALOG, ID_POUTRANSITIONDIALOGTRANSITIONNAME,
+ ID_POUTRANSITIONDIALOGLANGUAGE, ID_POUTRANSITIONDIALOGSTATICTEXT1,
+ ID_POUTRANSITIONDIALOGSTATICTEXT2,
+] = [wx.NewId() for _init_ctrls in range(5)]
class PouTransitionDialog(wx.Dialog):
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=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
+
+ def _init_coll_flexGridSizer1_Growables(self, parent):
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(0)
+
+ def _init_coll_MainSizer_Items(self, parent):
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.TransitionName, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Language, 0, border=0, flag=wx.GROW)
+
+ def _init_coll_MainSizer_Growables(self, parent):
+ parent.AddGrowableCol(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=2, hgap=0, rows=2, vgap=15)
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.SetSizer(self.flexGridSizer1)
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Dialog.__init__(self, id=wxID_POUTRANSITIONDIALOG,
+ wx.Dialog.__init__(self, id=ID_POUTRANSITIONDIALOG,
name='PouTransitionDialog', parent=prnt, pos=wx.Point(376, 223),
size=wx.Size(350, 200), style=wx.DEFAULT_DIALOG_STYLE,
title='Create a new transition')
self.SetClientSize(wx.Size(350, 160))
- self.MainPanel = wx.Panel(id=wxID_POUTRANSITIONDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(350, 200), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
- self.staticText1 = wx.StaticText(id=wxID_POUTRANSITIONDIALOGSTATICTEXT1,
- label='Transition Name:', name='staticText1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(145, 17), style=0)
-
- self.TransitionName = wx.TextCtrl(id=wxID_POUTRANSITIONDIALOGTRANSITIONNAME,
- name='TransitionName', parent=self.MainPanel, pos=wx.Point(154, 24),
- size=wx.Size(150, 24), style=0)
-
- self.staticText2 = wx.StaticText(id=wxID_POUTRANSITIONDIALOGSTATICTEXT2,
- label='Language:', name='staticText2', parent=self.MainPanel,
- pos=wx.Point(24, 64), size=wx.Size(145, 17), style=0)
-
- self.Language = wx.Choice(id=wxID_POUTRANSITIONDIALOGLANGUAGE,
- name='Language', parent=self.MainPanel, pos=wx.Point(154, 64),
- size=wx.Size(150, 24), style=0)
-
+ self.staticText1 = wx.StaticText(id=ID_POUTRANSITIONDIALOGSTATICTEXT1,
+ label='Transition Name:', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(120, 17), style=0)
+
+ self.TransitionName = wx.TextCtrl(id=ID_POUTRANSITIONDIALOGTRANSITIONNAME,
+ name='TransitionName', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.staticText2 = wx.StaticText(id=ID_POUTRANSITIONDIALOGSTATICTEXT2,
+ label='Language:', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(120, 17), style=0)
+
+ self.Language = wx.Choice(id=ID_POUTRANSITIONDIALOGLANGUAGE,
+ name='Language', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
+
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)
for option in ["IL","ST","LD","FBD"]:
self.Language.Append(option)
- EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
-
def OnOK(self, event):
error = []
if self.TransitionName.GetValue() == "":
@@ -1821,11 +1833,11 @@
text += " and %s"%item
else:
text += ", %s"%item
- message = wxMessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
else:
- self.EndModal(wxID_OK)
+ self.EndModal(wx.ID_OK)
def SetValues(self, values):
for item, value in values.items():
@@ -1844,66 +1856,74 @@
# Create Pou Action Dialog
#-------------------------------------------------------------------------------
-[wxID_POUACTIONDIALOG, wxID_POUACTIONDIALOGMAINPANEL,
- wxID_POUACTIONDIALOGACTIONNAME, wxID_POUACTIONDIALOGLANGUAGE,
- wxID_POUACTIONDIALOGSTATICTEXT1, wxID_POUACTIONDIALOGSTATICTEXT2,
-] = [wx.NewId() for _init_ctrls in range(6)]
+[ID_POUACTIONDIALOG, ID_POUACTIONDIALOGACTIONNAME,
+ ID_POUACTIONDIALOGLANGUAGE, ID_POUACTIONDIALOGSTATICTEXT1,
+ ID_POUACTIONDIALOGSTATICTEXT2,
+] = [wx.NewId() for _init_ctrls in range(5)]
class PouActionDialog(wx.Dialog):
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=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
+ parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
+
+ def _init_coll_flexGridSizer1_Growables(self, parent):
+ parent.AddGrowableCol(0)
+ parent.AddGrowableRow(0)
+
+ def _init_coll_MainSizer_Items(self, parent):
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.ActionName, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.Language, 0, border=0, flag=wx.GROW)
+
+ def _init_coll_MainSizer_Growables(self, parent):
+ parent.AddGrowableCol(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=2, hgap=0, rows=2, vgap=15)
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.SetSizer(self.flexGridSizer1)
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Dialog.__init__(self, id=wxID_POUACTIONDIALOG,
+ wx.Dialog.__init__(self, id=ID_POUACTIONDIALOG,
name='PouActionDialog', parent=prnt, pos=wx.Point(376, 223),
- size=wx.Size(320, 200), style=wx.DEFAULT_DIALOG_STYLE,
+ size=wx.Size(320, 200), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
title='Create a new action')
self.SetClientSize(wx.Size(320, 160))
- self.MainPanel = wx.Panel(id=wxID_POUACTIONDIALOGMAINPANEL,
- name='MainPanel', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(350, 200), style=wx.TAB_TRAVERSAL)
- self.MainPanel.SetAutoLayout(True)
-
- self.staticText1 = wx.StaticText(id=wxID_POUACTIONDIALOGSTATICTEXT1,
- label='Action Name:', name='staticText1', parent=self.MainPanel,
- pos=wx.Point(24, 24), size=wx.Size(145, 17), style=0)
-
- self.ActionName = wx.TextCtrl(id=wxID_POUACTIONDIALOGACTIONNAME,
- name='ActionName', parent=self.MainPanel, pos=wx.Point(124, 24),
- size=wx.Size(150, 24), style=0)
-
- self.staticText3 = wx.StaticText(id=wxID_POUACTIONDIALOGSTATICTEXT2,
- label='Language:', name='staticText2', parent=self.MainPanel,
- pos=wx.Point(24, 64), size=wx.Size(145, 17), style=0)
-
- self.Language = wx.Choice(id=wxID_POUACTIONDIALOGLANGUAGE,
- name='Language', parent=self.MainPanel, pos=wx.Point(124, 64),
- size=wx.Size(150, 24), style=0)
-
+ self.staticText1 = wx.StaticText(id=ID_POUACTIONDIALOGSTATICTEXT1,
+ label='Action Name:', name='staticText1', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(100, 17), style=0)
+
+ self.ActionName = wx.TextCtrl(id=ID_POUACTIONDIALOGACTIONNAME,
+ name='ActionName', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.staticText2 = wx.StaticText(id=ID_POUACTIONDIALOGSTATICTEXT2,
+ label='Language:', name='staticText2', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(100, 17), style=0)
+
+ self.Language = wx.Choice(id=ID_POUACTIONDIALOGLANGUAGE,
+ name='Language', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 24), style=0)
+
+ self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
+
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)
for option in ["IL","ST","LD","FBD"]:
self.Language.Append(option)
- EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
-
def OnOK(self, event):
error = []
if self.ActionName.GetValue() == "":
@@ -1919,11 +1939,11 @@
text += " and %s"%item
else:
text += ", %s"%item
- message = wxMessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
else:
- self.EndModal(wxID_OK)
+ self.EndModal(wx.ID_OK)
def SetValues(self, values):
for item, value in values.items():
@@ -1942,14 +1962,14 @@
# Pou Interface Dialog
#-------------------------------------------------------------------------------
-class VariableTable(wxPyGridTableBase):
+class VariableTable(wx.grid.PyGridTableBase):
"""
- A custom wxGrid Table using user supplied data
+ A custom wx.grid.Grid Table using user supplied data
"""
def __init__(self, parent, data, colnames):
# The base class must be initialized *first*
- wxPyGridTableBase.__init__(self)
+ wx.grid.PyGridTableBase.__init__(self)
self.data = data
self.old_value = None
self.colnames = colnames
@@ -1995,19 +2015,19 @@
def ResetView(self, grid):
"""
- (wxGrid) -> Reset the grid view. Call this to
+ (wx.grid.Grid) -> Reset the grid view. Call this to
update the grid if rows and columns have been added or deleted
"""
grid.BeginBatch()
for current, new, delmsg, addmsg in [
- (self._rows, self.GetNumberRows(), wxGRIDTABLE_NOTIFY_ROWS_DELETED, wxGRIDTABLE_NOTIFY_ROWS_APPENDED),
- (self._cols, self.GetNumberCols(), wxGRIDTABLE_NOTIFY_COLS_DELETED, wxGRIDTABLE_NOTIFY_COLS_APPENDED),
+ (self._rows, self.GetNumberRows(), wx.grid.GRIDTABLE_NOTIFY_ROWS_DELETED, wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED),
+ (self._cols, self.GetNumberCols(), wx.grid.GRIDTABLE_NOTIFY_COLS_DELETED, wx.grid.GRIDTABLE_NOTIFY_COLS_APPENDED),
]:
if new < current:
- msg = wxGridTableMessage(self,delmsg,new,current-new)
+ msg = wx.grid.GridTableMessage(self,delmsg,new,current-new)
grid.ProcessTableMessage(msg)
elif new > current:
- msg = wxGridTableMessage(self,addmsg,new-current)
+ msg = wx.grid.GridTableMessage(self,addmsg,new-current)
grid.ProcessTableMessage(msg)
self.UpdateValues(grid)
grid.EndBatch()
@@ -2024,20 +2044,20 @@
def UpdateValues(self, grid):
"""Update all displayed values"""
# This sends an event to the grid table to update all of the values
- msg = wxGridTableMessage(self, wxGRIDTABLE_REQUEST_VIEW_GET_VALUES)
+ msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
grid.ProcessTableMessage(msg)
def _updateColAttrs(self, grid):
"""
- wxGrid -> update the column attributes to add the
+ wx.grid.Grid -> update the column attributes to add the
appropriate renderer given the column name.
Otherwise default to the default renderer.
"""
for col in range(self.GetNumberCols()):
- attr = wxGridCellAttr()
- attr.SetAlignment(self.Parent.ColAlignements[col], wxALIGN_CENTRE)
+ attr = wx.grid.GridCellAttr()
+ attr.SetAlignment(self.Parent.ColAlignements[col], wx.ALIGN_CENTRE)
grid.SetColAttr(col, attr)
grid.SetColSize(col, self.Parent.ColSizes[col])
@@ -2055,16 +2075,16 @@
if self.Parent.PouIsUsed and self.GetValueByName(row, "Class") in ["Input", "Output", "InOut"]:
grid.SetReadOnly(row, col, True)
else:
- editor = wxGridCellTextEditor()
- renderer = wxGridCellStringRenderer()
+ editor = wx.grid.GridCellTextEditor()
+ renderer = wx.grid.GridCellStringRenderer()
elif colname in ["Initial Value","Location"]:
- editor = wxGridCellTextEditor()
- renderer = wxGridCellStringRenderer()
+ editor = wx.grid.GridCellTextEditor()
+ renderer = wx.grid.GridCellStringRenderer()
elif colname == "Class":
if len(self.Parent.ClassList) == 1 or self.Parent.PouIsUsed and self.GetValueByName(row, "Class") in ["Input", "Output", "InOut"]:
grid.SetReadOnly(row, col, True)
else:
- editor = wxGridCellChoiceEditor()
+ editor = wx.grid.GridCellChoiceEditor()
excluded = []
if self.Parent.PouIsUsed:
excluded.extend(["Input","Output","InOut"])
@@ -2073,16 +2093,16 @@
if self.Parent.PouIsUsed and self.GetValueByName(row, "Class") in ["Input", "Output", "InOut"]:
grid.SetReadOnly(row, col, True)
else:
- editor = wxGridCellChoiceEditor()
+ editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.TypeList)
elif colname in ["Retain", "Constant"]:
- editor = wxGridCellChoiceEditor()
+ editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.OptionList)
grid.SetCellEditor(row, col, editor)
grid.SetCellRenderer(row, col, renderer)
- grid.SetCellBackgroundColour(row, col, wxWHITE)
+ grid.SetCellBackgroundColour(row, col, wx.WHITE)
def SetData(self, data):
self.data = data
@@ -2118,7 +2138,7 @@
def OnDropText(self, x, y, data):
col = self.Parent.VariablesGrid.XToCol(x)
row = self.Parent.VariablesGrid.YToRow(y)
- if col != wxNOT_FOUND and row != wxNOT_FOUND:
+ if col != wx.NOT_FOUND and row != wx.NOT_FOUND:
if self.Parent.Table.GetColLabelValue(col) != "Location":
return
try:
@@ -2126,8 +2146,8 @@
except:
values = None
if values and values[1] == "location":
- dialog = wxSingleChoiceDialog(self.Parent, "Select a variable class:", "Variable class", ["Input", "Output", "Memory"], wxOK|wxCANCEL)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.SingleChoiceDialog(self.Parent, "Select a variable class:", "Variable class", ["Input", "Output", "Memory"], wx.OK|wx.CANCEL)
+ if dialog.ShowModal() == wx.ID_OK:
selected = dialog.GetSelection()
if selected == 0:
location = "%I" + values[0]
@@ -2140,71 +2160,53 @@
self.Parent.SaveValues()
dialog.Destroy()
-[wxID_POUEDITORPANEL, wxID_POUEDITORPANELVIEWER,
- wxID_POUEDITORPANELVARIABLESGRID, wxID_POUEDITORPANELRETURNTYPE,
- wxID_POUEDITORPANELCLASSFILTER, wxID_POUEDITORPANELADDBUTTON,
- wxID_POUEDITORPANELDELETEBUTTON, wxID_POUEDITORPANELUPBUTTON,
- wxID_POUEDITORPANELDOWNBUTTON, wxID_POUEDITORPANELSTATICTEXT1,
- wxID_POUEDITORPANELSTATICTEXT2, wxID_POUEDITORPANELSTATICTEXT3,
+[ID_POUEDITORPANEL, ID_POUEDITORPANELVIEWER,
+ ID_POUEDITORPANELVARIABLESGRID, ID_POUEDITORPANELRETURNTYPE,
+ ID_POUEDITORPANELCLASSFILTER, ID_POUEDITORPANELADDBUTTON,
+ ID_POUEDITORPANELDELETEBUTTON, ID_POUEDITORPANELUPBUTTON,
+ ID_POUEDITORPANELDOWNBUTTON, ID_POUEDITORPANELSTATICTEXT1,
+ ID_POUEDITORPANELSTATICTEXT2, ID_POUEDITORPANELSTATICTEXT3,
] = [wx.NewId() for _init_ctrls in range(12)]
class PouEditorPanel(wx.Panel):
def _init_coll_MainPanelSizer_Items(self, parent):
- # generated method, don't edit
-
- parent.AddWindow(self.Viewer, 0, border=0, flag=wxGROW)
- parent.AddSizer(self.VariablePanelSizer, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.Viewer, 0, border=0, flag=wx.GROW)
+ parent.AddSizer(self.VariablePanelSizer, 0, border=0, flag=wx.GROW)
def _init_coll_MainPanelSizer_Growables(self, parent):
- # generated method, don't edit
-
parent.AddGrowableCol(0)
parent.AddGrowableRow(0)
def _init_coll_VariablePanelSizer_Items(self, parent):
- # generated method, don't edit
-
- parent.AddWindow(self.VariablesGrid, 0, border=0, flag=wxGROW)
- parent.AddSizer(self.ControlPanelSizer, 0, border=0, flag=wxGROW)
+ parent.AddWindow(self.VariablesGrid, 0, border=0, flag=wx.GROW)
+ parent.AddSizer(self.ControlPanelSizer, 0, border=0, flag=wx.GROW)
def _init_coll_VariablePanelSizer_Growables(self, parent):
- # generated method, don't edit
-
parent.AddGrowableCol(0)
parent.AddGrowableRow(0)
def _init_coll_ControlPanelSizer_Items(self, parent):
- # generated method, don't edit
-
- parent.AddSizer(self.ChoicePanelSizer, 0, border=0, flag=wxGROW)
- parent.AddSizer(self.ButtonPanelSizer, 0, border=0, flag=wxALIGN_CENTER)
+ parent.AddSizer(self.ChoicePanelSizer, 0, border=0, flag=wx.GROW)
+ parent.AddSizer(self.ButtonPanelSizer, 0, border=0, flag=wx.ALIGN_CENTER)
def _init_coll_ControlPanelSizer_Growables(self, parent):
- # generated method, don't edit
-
parent.AddGrowableCol(0)
parent.AddGrowableRow(0)
parent.AddGrowableRow(1)
def _init_coll_ChoicePanelSizer_Items(self, parent):
- # generated method, don't edit
-
- parent.AddWindow(self.staticText1, 0, border=0, flag=wxALIGN_BOTTOM)
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.ALIGN_BOTTOM)
parent.AddWindow(self.ReturnType, 0, border=0, flag=0)
- parent.AddWindow(self.staticText2, 0, border=0, flag=wxALIGN_BOTTOM)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.ALIGN_BOTTOM)
parent.AddWindow(self.ClassFilter, 0, border=0, flag=0)
def _init_coll_ButtonPanelSizer_Items(self, parent):
- # generated method, don't edit
-
parent.AddWindow(self.UpButton, 0, border=0, flag=0)
parent.AddWindow(self.AddButton, 0, border=0, flag=0)
parent.AddWindow(self.DownButton, 0, border=0, flag=0)
parent.AddWindow(self.DeleteButton, 0, border=0, flag=0)
def _init_coll_ButtonPanelSizer_Growables(self, parent):
- # generated method, don't edit
-
parent.AddGrowableCol(0)
parent.AddGrowableCol(1)
parent.AddGrowableCol(2)
@@ -2212,15 +2214,10 @@
parent.AddGrowableRow(0)
def _init_sizers(self):
- # generated method, don't edit
self.MainPanelSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
-
self.VariablePanelSizer = wx.FlexGridSizer(cols=2, hgap=10, rows=1, vgap=0)
-
self.ControlPanelSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
-
self.ChoicePanelSizer = wx.GridSizer(cols=1, hgap=5, rows=4, vgap=5)
-
self.ButtonPanelSizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=0)
self._init_coll_MainPanelSizer_Items(self.MainPanelSizer)
@@ -2236,13 +2233,12 @@
self.SetSizer(self.MainPanelSizer)
def _init_ctrls(self, prnt, element_type):
- # generated method, don't edit
- wx.Panel.__init__(self, id=wxID_POUEDITORPANEL,
+ wx.Panel.__init__(self, id=ID_POUEDITORPANEL,
name='EditVariablePanel', parent=prnt, pos=wx.Point(0, 0),
size=wx.Size(-1, -1), style=0)
if element_type == "config":
- self.Viewer = wx.Panel(id=wxID_POUEDITORPANELVIEWER,
+ self.Viewer = wx.Panel(id=ID_POUEDITORPANELVIEWER,
name='ConfigPanel', parent=self, pos=wx.Point(0, 0),
size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL)
self.Viewer.ResetBuffer = lambda: None
@@ -2263,26 +2259,26 @@
else:
self.Viewer.SetKeywords(ST_KEYWORDS)
- self.staticText1 = wx.StaticText(id=wxID_POUEDITORPANELSTATICTEXT1,
+ self.staticText1 = wx.StaticText(id=ID_POUEDITORPANELSTATICTEXT1,
label='Return Type:', name='staticText1', parent=self,
pos=wx.Point(0, 0), size=wx.Size(95, 17), style=0)
- self.ReturnType = wx.Choice(id=wxID_POUEDITORPANELRETURNTYPE,
+ self.ReturnType = wx.Choice(id=ID_POUEDITORPANELRETURNTYPE,
name='ReturnType', parent=self, pos=wx.Point(0, 0),
size=wx.Size(145, 24), style=0)
- self.staticText2 = wx.StaticText(id=wxID_POUEDITORPANELSTATICTEXT2,
+ self.staticText2 = wx.StaticText(id=ID_POUEDITORPANELSTATICTEXT2,
label='Class Filter:', name='staticText2', parent=self,
pos=wx.Point(0, 0), size=wx.Size(95, 17), style=0)
- self.ClassFilter = wx.Choice(id=wxID_POUEDITORPANELCLASSFILTER,
+ self.ClassFilter = wx.Choice(id=ID_POUEDITORPANELCLASSFILTER,
name='ClassFilter', parent=self, pos=wx.Point(0, 0),
size=wx.Size(145, 24), style=0)
- EVT_CHOICE(self, wxID_POUEDITORPANELCLASSFILTER, self.OnClassFilter)
-
- self.VariablesGrid = wx.grid.Grid(id=wxID_POUEDITORPANELVARIABLESGRID,
+ self.Bind(wx.EVT_CHOICE, self.OnClassFilter, id=ID_POUEDITORPANELCLASSFILTER)
+
+ self.VariablesGrid = wx.grid.Grid(id=ID_POUEDITORPANELVARIABLESGRID,
name='VariablesGrid', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(0, 150), style=wxVSCROLL)
+ size=wx.Size(0, 150), style=wx.VSCROLL)
self.VariablesGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
'Sans'))
self.VariablesGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
@@ -2293,25 +2289,25 @@
self.VariablesGrid.SetDropTarget(VariableDropTarget(self))
- self.AddButton = wx.Button(id=wxID_POUEDITORPANELADDBUTTON, label='Add',
+ self.AddButton = wx.Button(id=ID_POUEDITORPANELADDBUTTON, label='Add',
name='AddButton', parent=self, pos=wx.Point(345, 340),
size=wx.Size(72, 32), style=0)
- EVT_BUTTON(self, wxID_POUEDITORPANELADDBUTTON, self.OnAddButton)
-
- self.DeleteButton = wx.Button(id=wxID_POUEDITORPANELDELETEBUTTON, label='Delete',
+ self.Bind(wx.EVT_BUTTON, self.OnAddButton, id=ID_POUEDITORPANELADDBUTTON)
+
+ self.DeleteButton = wx.Button(id=ID_POUEDITORPANELDELETEBUTTON, label='Delete',
name='DeleteButton', parent=self, pos=wx.Point(425, 340),
size=wx.Size(72, 32), style=0)
- EVT_BUTTON(self, wxID_POUEDITORPANELDELETEBUTTON, self.OnDeleteButton)
-
- self.UpButton = wx.Button(id=wxID_POUEDITORPANELUPBUTTON, label='^',
+ self.Bind(wx.EVT_BUTTON, self.OnDeleteButton, id=ID_POUEDITORPANELDELETEBUTTON)
+
+ self.UpButton = wx.Button(id=ID_POUEDITORPANELUPBUTTON, label='^',
name='UpButton', parent=self, pos=wx.Point(505, 340),
size=wx.Size(32, 32), style=0)
- EVT_BUTTON(self, wxID_POUEDITORPANELUPBUTTON, self.OnUpButton)
-
- self.DownButton = wx.Button(id=wxID_POUEDITORPANELDOWNBUTTON, label='v',
+ self.Bind(wx.EVT_BUTTON, self.OnUpButton, id=ID_POUEDITORPANELUPBUTTON)
+
+ self.DownButton = wx.Button(id=ID_POUEDITORPANELDOWNBUTTON, label='v',
name='DownButton', parent=self, pos=wx.Point(545, 340),
size=wx.Size(32, 32), style=0)
- EVT_BUTTON(self, wxID_POUEDITORPANELDOWNBUTTON, self.OnDownButton)
+ self.Bind(wx.EVT_BUTTON, self.OnDownButton, id=ID_POUEDITORPANELDOWNBUTTON)
self._init_sizers()
@@ -2360,12 +2356,12 @@
else:
self.FilterChoices = ["All","Global","Access"]
self.ColSizes = [40, 80, 70, 80, 80, 80, 60, 70]
- self.ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_CENTER]
+ self.ColAlignements = [wx.ALIGN_CENTER, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_CENTER, wx.ALIGN_CENTER]
else:
self.Table = VariableTable(self, [], ["#", "Name", "Class", "Type", "Initial Value", "Retain", "Constant"])
self.FilterChoices = ["All","Interface"," Input"," Output"," InOut"," External","Variables"," Local"," Temp"]
self.ColSizes = [40, 120, 70, 80, 120, 60, 70]
- self.ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_CENTER]
+ self.ColAlignements = [wx.ALIGN_CENTER, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_CENTER, wx.ALIGN_CENTER]
for choice in self.FilterChoices:
self.ClassFilter.Append(choice)
reverse_transfer = {}
@@ -2502,22 +2498,22 @@
value = self.Table.GetValue(row, col)
if colname == "Name":
if not TestIdentifier(value):
- message = wxMessageDialog(self, "\"%s\" is not a valid identifier!"%value, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%value, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
event.Veto()
elif value.upper() in IEC_KEYWORDS:
- message = wxMessageDialog(self, "\"%s\" is a keyword. It can't be used!"%value, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%value, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
event.Veto()
elif value.upper() in self.PouNames:
- message = wxMessageDialog(self, "A pou with \"%s\" as name exists!"%value, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "A pou with \"%s\" as name exists!"%value, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
event.Veto()
elif value.upper() in [var["Name"].upper() for var in self.Values if var != self.Table.data[row]]:
- message = wxMessageDialog(self, "A variable with \"%s\" as name exists in this pou!"%value, "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(self, "A variable with \"%s\" as name exists in this pou!"%value, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
event.Veto()
@@ -2541,14 +2537,14 @@
var_name = self.Table.GetValueByName(row, "Name")
var_class = self.Table.GetValueByName(row, "Class")
var_type = self.Table.GetValueByName(row, "Type")
- data = wxTextDataObject(str((var_name, var_class, var_type)))
- dragSource = wxDropSource(self.VariablesGrid)
+ data = wx.TextDataObject(str((var_name, var_class, var_type)))
+ dragSource = wx.DropSource(self.VariablesGrid)
dragSource.SetData(data)
dragSource.DoDragDrop()
event.Skip()
def OnVariablesGridSelectCell(self, event):
- wxCallAfter(self.RefreshButtons)
+ wx.CallAfter(self.RefreshButtons)
event.Skip()
def MoveValue(self, value_index, move):
@@ -2585,22 +2581,20 @@
self.Parent.RefreshTitle()
self.Parent.RefreshEditMenu()
-##[wxID_EDITVARIABLEDIALOG, wxID_EDITVARIABLEDIALOGMAINPANEL,
-## wxID_EDITVARIABLEDIALOGVARIABLESGRID, wxID_EDITVARIABLEDIALOGRETURNTYPE,
-## wxID_EDITVARIABLEDIALOGCLASSFILTER, wxID_EDITVARIABLEDIALOGADDBUTTON,
-## wxID_EDITVARIABLEDIALOGDELETEBUTTON, wxID_EDITVARIABLEDIALOGUPBUTTON,
-## wxID_EDITVARIABLEDIALOGDOWNBUTTON, wxID_EDITVARIABLEDIALOGSTATICTEXT1,
-## wxID_EDITVARIABLEDIALOGSTATICTEXT2, wxID_EDITVARIABLEDIALOGSTATICTEXT3,
+##[ID_EDITVARIABLEDIALOG, ID_EDITVARIABLEDIALOGMAINPANEL,
+## ID_EDITVARIABLEDIALOGVARIABLESGRID, ID_EDITVARIABLEDIALOGRETURNTYPE,
+## ID_EDITVARIABLEDIALOGCLASSFILTER, ID_EDITVARIABLEDIALOGADDBUTTON,
+## ID_EDITVARIABLEDIALOGDELETEBUTTON, ID_EDITVARIABLEDIALOGUPBUTTON,
+## ID_EDITVARIABLEDIALOGDOWNBUTTON, ID_EDITVARIABLEDIALOGSTATICTEXT1,
+## ID_EDITVARIABLEDIALOGSTATICTEXT2, ID_EDITVARIABLEDIALOGSTATICTEXT3,
##] = [wx.NewId() for _init_ctrls in range(12)]
##
##class EditVariableDialog(wx.Dialog):
## def _init_coll_flexGridSizer1_Items(self, parent):
-## # generated method, don't edit
-##
## parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
+## parent.AddWindow(self.ButtonSizer, 0, border=0, flag=wx.ALIGN_RIGHT)
##
## def _init_sizers(self):
-## # generated method, don't edit
## self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
##
## self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
@@ -2608,42 +2602,41 @@
## self.SetSizer(self.flexGridSizer1)
##
## def _init_ctrls(self, prnt, name):
-## # generated method, don't edit
-## wx.Dialog.__init__(self, id=wxID_EDITVARIABLEDIALOG,
+## wx.Dialog.__init__(self, id=ID_EDITVARIABLEDIALOG,
## name='EditVariableDialog', parent=prnt, pos=wx.Point(376, 223),
## size=wx.Size(600, 440), style=wx.DEFAULT_DIALOG_STYLE,
## title='Edit variables of %s'%name)
## self.SetClientSize(wx.Size(600, 440))
##
-## self.MainPanel = wx.Panel(id=wxID_EDITVARIABLEDIALOGMAINPANEL,
+## self.MainPanel = wx.Panel(id=ID_EDITVARIABLEDIALOGMAINPANEL,
## name='MainPanel', parent=self, pos=wx.Point(0, 0),
## size=wx.Size(600, 440), style=wx.TAB_TRAVERSAL)
## self.MainPanel.SetAutoLayout(True)
##
-## self.staticText1 = wx.StaticText(id=wxID_EDITVARIABLEDIALOGSTATICTEXT1,
+## self.staticText1 = wx.StaticText(id=ID_EDITVARIABLEDIALOGSTATICTEXT1,
## label='Return Type:', name='staticText1', parent=self.MainPanel,
## pos=wx.Point(24, 29), size=wx.Size(95, 17), style=0)
##
-## self.ReturnType = wx.Choice(id=wxID_EDITVARIABLEDIALOGRETURNTYPE,
+## self.ReturnType = wx.Choice(id=ID_EDITVARIABLEDIALOGRETURNTYPE,
## name='ReturnType', parent=self.MainPanel, pos=wx.Point(124, 24),
## size=wx.Size(145, 24), style=0)
##
-## self.staticText2 = wx.StaticText(id=wxID_EDITVARIABLEDIALOGSTATICTEXT2,
+## self.staticText2 = wx.StaticText(id=ID_EDITVARIABLEDIALOGSTATICTEXT2,
## label='Class Filter:', name='staticText2', parent=self.MainPanel,
## pos=wx.Point(324, 29), size=wx.Size(95, 17), style=0)
##
-## self.ClassFilter = wx.Choice(id=wxID_EDITVARIABLEDIALOGCLASSFILTER,
+## self.ClassFilter = wx.Choice(id=ID_EDITVARIABLEDIALOGCLASSFILTER,
## name='ClassFilter', parent=self.MainPanel, pos=wx.Point(424, 24),
## size=wx.Size(145, 24), style=0)
-## EVT_CHOICE(self, wxID_EDITVARIABLEDIALOGCLASSFILTER, self.OnClassFilter)
-##
-## self.staticText3 = wx.StaticText(id=wxID_EDITVARIABLEDIALOGSTATICTEXT3,
+## self.Bind(wx.EVT_CHOICE, self.OnClassFilter, id=ID_EDITVARIABLEDIALOGCLASSFILTER)
+##
+## self.staticText3 = wx.StaticText(id=ID_EDITVARIABLEDIALOGSTATICTEXT3,
## label='Variables:', name='staticText3', parent=self.MainPanel,
## pos=wx.Point(24, 60), size=wx.Size(95, 17), style=0)
##
-## self.VariablesGrid = wx.grid.Grid(id=wxID_EDITVARIABLEDIALOGVARIABLESGRID,
+## self.VariablesGrid = wx.grid.Grid(id=ID_EDITVARIABLEDIALOGVARIABLESGRID,
## name='VariablesGrid', parent=self.MainPanel, pos=wx.Point(24, 80),
-## size=wx.Size(550, 250), style=wxVSCROLL)
+## size=wx.Size(550, 250), style=wx.VSCROLL)
## self.VariablesGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
## 'Sans'))
## self.VariablesGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
@@ -2653,32 +2646,34 @@
## self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnVariablesGridCellChange)
## self.VariablesGrid.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnVariablesGridSelectCell)
##
-## self.AddButton = wx.Button(id=wxID_EDITVARIABLEDIALOGADDBUTTON, label='Add',
+## self.AddButton = wx.Button(id=ID_EDITVARIABLEDIALOGADDBUTTON, label='Add',
## name='AddButton', parent=self.MainPanel, pos=wx.Point(345, 340),
## size=wx.Size(72, 32), style=0)
-## EVT_BUTTON(self, wxID_EDITVARIABLEDIALOGADDBUTTON, self.OnAddButton)
-##
-## self.DeleteButton = wx.Button(id=wxID_EDITVARIABLEDIALOGDELETEBUTTON, label='Delete',
+## self.Bind(wx.EVT_BUTTON, self.OnAddButton, id=ID_EDITVARIABLEDIALOGADDBUTTON)
+##
+## self.DeleteButton = wx.Button(id=ID_EDITVARIABLEDIALOGDELETEBUTTON, label='Delete',
## name='DeleteButton', parent=self.MainPanel, pos=wx.Point(425, 340),
## size=wx.Size(72, 32), style=0)
-## EVT_BUTTON(self, wxID_EDITVARIABLEDIALOGDELETEBUTTON, self.OnDeleteButton)
-##
-## self.UpButton = wx.Button(id=wxID_EDITVARIABLEDIALOGUPBUTTON, label='^',
+## self.Bind(wx.EVT_BUTTON, self.OnDeleteButton, id=ID_EDITVARIABLEDIALOGDELETEBUTTON)
+##
+## self.UpButton = wx.Button(id=ID_EDITVARIABLEDIALOGUPBUTTON, label='^',
## name='UpButton', parent=self.MainPanel, pos=wx.Point(505, 340),
## size=wx.Size(32, 32), style=0)
-## EVT_BUTTON(self, wxID_EDITVARIABLEDIALOGUPBUTTON, self.OnUpButton)
-##
-## self.DownButton = wx.Button(id=wxID_EDITVARIABLEDIALOGDOWNBUTTON, label='v',
+## self.Bind(wx.EVT_BUTTON, self.OnUpButton, id=ID_EDITVARIABLEDIALOGUPBUTTON)
+##
+## self.DownButton = wx.Button(id=ID_EDITVARIABLEDIALOGDOWNBUTTON, label='v',
## name='DownButton', parent=self.MainPanel, pos=wx.Point(545, 340),
## size=wx.Size(32, 32), style=0)
-## EVT_BUTTON(self, wxID_EDITVARIABLEDIALOGDOWNBUTTON, self.OnDownButton)
+## self.Bind(wx.EVT_BUTTON, self.OnDownButton, id=ID_EDITVARIABLEDIALOGDOWNBUTTON)
+##
+## self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
+## self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
##
## self._init_sizers()
##
## def __init__(self, parent, name, pou_type, pou_is_used, filter = "All"):
## self._init_ctrls(parent, name)
-## self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
-## self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_RIGHT)
+##
## self.Filter = filter
## self.PouIsUsed = pou_is_used
## self.FilterChoices = []
@@ -2700,12 +2695,12 @@
## else:
## self.FilterChoices = ["All","Global","Access"]
## self.ColSizes = [80, 70, 80, 80, 80, 60, 70]
-## self.ColAlignements = [wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_CENTER]
+## self.ColAlignements = [wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_CENTER, wx.ALIGN_CENTER]
## else:
## self.Table = VariableTable(self, [], ["Name", "Class", "Type", "Initial Value", "Retain", "Constant"])
## self.FilterChoices = ["All","Interface"," Input"," Output"," InOut"," External","Variables"," Local"," Temp"]
## self.ColSizes = [120, 70, 80, 120, 60, 70]
-## self.ColAlignements = [wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_CENTER]
+## self.ColAlignements = [wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_CENTER, wx.ALIGN_CENTER]
## for choice in self.FilterChoices:
## self.ClassFilter.Append(choice)
## reverse_transfer = {}
@@ -2736,12 +2731,10 @@
## self.PouNames = []
##
## if self.PouIsUsed:
-## wxCallAfter(self.WarningMessage, name)
-##
-## EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
+## wx.CallAfter(self.WarningMessage, name)
##
## def WarningMessage(self, name):
-## message = wxMessageDialog(self, "\"%s\" is used by one or more POUs. Its interface can't be changed!"%name, "WARNING", wxOK|wxICON_EXCLAMATION)
+## message = wx.MessageDialog(self, "\"%s\" is used by one or more POUs. Its interface can't be changed!"%name, "WARNING", wx.OK|wx.ICON_EXCLAMATION)
## message.ShowModal()
## message.Destroy()
##
@@ -2759,11 +2752,11 @@
## text += " and %s"%item
## else:
## text += ", %s"%item
-## message = wxMessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wxOK|wxICON_ERROR)
+## message = wx.MessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wx.OK|wx.ICON_ERROR)
## message.ShowModal()
## message.Destroy()
## else:
-## self.EndModal(wxID_OK)
+## self.EndModal(wx.ID_OK)
##
## def OnClassFilter(self, event):
## self.Filter = self.FilterChoiceTransfer[self.ClassFilter.GetStringSelection()]
@@ -2827,22 +2820,22 @@
## value = self.Table.GetValue(row, col)
## if colname == "Name":
## if not TestIdentifier(value):
-## message = wxMessageDialog(self, "\"%s\" is not a valid identifier!"%value, "Error", wxOK|wxICON_ERROR)
+## message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%value, "Error", wx.OK|wx.ICON_ERROR)
## message.ShowModal()
## message.Destroy()
## event.Veto()
## elif value.upper() in IEC_KEYWORDS:
-## message = wxMessageDialog(self, "\"%s\" is a keyword. It can't be used!"%value, "Error", wxOK|wxICON_ERROR)
+## message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%value, "Error", wx.OK|wx.ICON_ERROR)
## message.ShowModal()
## message.Destroy()
## event.Veto()
## elif value.upper() in self.PouNames:
-## message = wxMessageDialog(self, "A pou with \"%s\" as name exists!"%value, "Error", wxOK|wxICON_ERROR)
+## message = wx.MessageDialog(self, "A pou with \"%s\" as name exists!"%value, "Error", wx.OK|wx.ICON_ERROR)
## message.ShowModal()
## message.Destroy()
## event.Veto()
## elif value.upper() in [var["Name"].upper() for var in self.Values if var != self.Table.data[row]]:
-## message = wxMessageDialog(self, "A variable with \"%s\" as name exists in this pou!"%value, "Error", wxOK|wxICON_ERROR)
+## message = wx.MessageDialog(self, "A variable with \"%s\" as name exists in this pou!"%value, "Error", wx.OK|wx.ICON_ERROR)
## message.ShowModal()
## message.Destroy()
## event.Veto()
@@ -2852,7 +2845,7 @@
## event.Skip()
##
## def OnVariablesGridSelectCell(self, event):
-## wxCallAfter(self.RefreshButtons)
+## wx.CallAfter(self.RefreshButtons)
## event.Skip()
##
## def SetPouNames(self, pou_names):
@@ -2938,7 +2931,7 @@
return res
def Display_Error_Dialog(e_value):
- message = wxMessageDialog(None, str(e_value), "Error", wxOK|wxICON_ERROR)
+ message = wx.MessageDialog(None, str(e_value), "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
@@ -2996,8 +2989,8 @@
sys.excepthook = handle_exception
if __name__ == '__main__':
- app = wxPySimpleApp()
- wxInitAllImageHandlers()
+ app = wx.PySimpleApp()
+ wx.InitAllImageHandlers()
# Install a exception handle for bug reports
wxAddExceptHook(os.getcwd(),__version__)
--- a/RessourceEditor.py Tue Aug 07 17:37:38 2007 +0200
+++ b/RessourceEditor.py Tue Aug 07 17:38:48 2007 +0200
@@ -22,22 +22,21 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from wxPython.wx import *
-from wxPython.grid import *
import wx
+import wx.grid
#-------------------------------------------------------------------------------
# Resource Editor class
#-------------------------------------------------------------------------------
-class ResourceTable(wxPyGridTableBase):
+class ResourceTable(wx.grid.PyGridTableBase):
"""
- A custom wxGrid Table using user supplied data
+ A custom wx.grid.Grid Table using user supplied data
"""
def __init__(self, parent, data, colnames):
# The base class must be initialized *first*
- wxPyGridTableBase.__init__(self)
+ wx.grid.PyGridTableBase.__init__(self)
self.data = data
self.colnames = colnames
self.Parent = parent
@@ -93,19 +92,19 @@
def ResetView(self, grid):
"""
- (wxGrid) -> Reset the grid view. Call this to
+ (wx.grid.Grid) -> Reset the grid view. Call this to
update the grid if rows and columns have been added or deleted
"""
grid.BeginBatch()
for current, new, delmsg, addmsg in [
- (self._rows, self.GetNumberRows(), wxGRIDTABLE_NOTIFY_ROWS_DELETED, wxGRIDTABLE_NOTIFY_ROWS_APPENDED),
- (self._cols, self.GetNumberCols(), wxGRIDTABLE_NOTIFY_COLS_DELETED, wxGRIDTABLE_NOTIFY_COLS_APPENDED),
+ (self._rows, self.GetNumberRows(), wx.grid.GRIDTABLE_NOTIFY_ROWS_DELETED, wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED),
+ (self._cols, self.GetNumberCols(), wx.grid.GRIDTABLE_NOTIFY_COLS_DELETED, wx.grid.GRIDTABLE_NOTIFY_COLS_APPENDED),
]:
if new < current:
- msg = wxGridTableMessage(self,delmsg,new,current-new)
+ msg = wx.grid.GridTableMessage(self,delmsg,new,current-new)
grid.ProcessTableMessage(msg)
elif new > current:
- msg = wxGridTableMessage(self,addmsg,new-current)
+ msg = wx.grid.GridTableMessage(self,addmsg,new-current)
grid.ProcessTableMessage(msg)
self.UpdateValues(grid)
grid.EndBatch()
@@ -122,20 +121,20 @@
def UpdateValues(self, grid):
"""Update all displayed values"""
# This sends an event to the grid table to update all of the values
- msg = wxGridTableMessage(self, wxGRIDTABLE_REQUEST_VIEW_GET_VALUES)
+ msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
grid.ProcessTableMessage(msg)
def _updateColAttrs(self, grid):
"""
- wxGrid -> update the column attributes to add the
+ wx.grid.Grid -> update the column attributes to add the
appropriate renderer given the column name.
Otherwise default to the default renderer.
"""
for col in range(self.GetNumberCols()):
- attr = wxGridCellAttr()
- attr.SetAlignment(self.ColAlignements[col], wxALIGN_CENTRE)
+ attr = wx.grid.GridCellAttr()
+ attr.SetAlignment(self.ColAlignements[col], wx.ALIGN_CENTRE)
grid.SetColAttr(col, attr)
grid.SetColSize(col, self.ColSizes[col])
@@ -146,29 +145,29 @@
colname = self.GetColLabelValue(col)
grid.SetReadOnly(row, col, False)
if colname in ["Name","Interval"]:
- editor = wxGridCellTextEditor()
- renderer = wxGridCellStringRenderer()
+ editor = wx.grid.GridCellTextEditor()
+ renderer = wx.grid.GridCellStringRenderer()
if colname == "Interval" and self.GetValueByName(row, "Single") != "":
grid.SetReadOnly(row, col, True)
elif colname == "Single":
- editor = wxGridCellChoiceEditor()
+ editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.VariableList)
if self.GetValueByName(row, "Interval") != "":
grid.SetReadOnly(row, col, True)
elif colname == "Type":
- editor = wxGridCellChoiceEditor()
+ editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.TypeList)
elif colname == "Priority":
- editor = wxGridCellNumberEditor()
+ editor = wx.grid.GridCellNumberEditor()
editor.SetParameters("0,65535")
elif colname == "Task":
- editor = wxGridCellChoiceEditor()
+ editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.TaskList)
grid.SetCellEditor(row, col, editor)
grid.SetCellRenderer(row, col, renderer)
- grid.SetCellBackgroundColour(row, col, wxWHITE)
+ grid.SetCellBackgroundColour(row, col, wx.WHITE)
def SetData(self, data):
self.data = data
@@ -199,94 +198,69 @@
self.editors = []
-[wxID_RESOURCEEDITOR, wxID_RESOURCEEDITORSTATICTEXT1,
- wxID_RESOURCEEDITORSTATICTEXT2, wxID_RESOURCEEDITORINSTANCESGRID,
- wxID_RESOURCEEDITORTASKSGRID, wxID_RESOURCEEDITORADDINSTANCEBUTTON,
- wxID_RESOURCEEDITORDELETEINSTANCEBUTTON, wxID_RESOURCEEDITORUPINSTANCEBUTTON,
- wxID_RESOURCEEDITORDOWNINSTANCEBUTTON, wxID_RESOURCEEDITORADDTASKBUTTON,
- wxID_RESOURCEEDITORDELETETASKBUTTON, wxID_RESOURCEEDITORUPTASKBUTTON,
- wxID_RESOURCEEDITORDOWNTASKBUTTON,
+[ID_RESOURCEEDITOR, ID_RESOURCEEDITORSTATICTEXT1,
+ ID_RESOURCEEDITORSTATICTEXT2, ID_RESOURCEEDITORINSTANCESGRID,
+ ID_RESOURCEEDITORTASKSGRID, ID_RESOURCEEDITORADDINSTANCEBUTTON,
+ ID_RESOURCEEDITORDELETEINSTANCEBUTTON, ID_RESOURCEEDITORUPINSTANCEBUTTON,
+ ID_RESOURCEEDITORDOWNINSTANCEBUTTON, ID_RESOURCEEDITORADDTASKBUTTON,
+ ID_RESOURCEEDITORDELETETASKBUTTON, ID_RESOURCEEDITORUPTASKBUTTON,
+ ID_RESOURCEEDITORDOWNTASKBUTTON,
] = [wx.NewId() for _init_ctrls in range(13)]
class ResourceEditor(wx.Panel):
def _init_coll_InstancesSizer_Growables(self, parent):
- # generated method, don't edit
-
parent.AddGrowableCol(0)
parent.AddGrowableRow(1)
def _init_coll_InstancesSizer_Items(self, parent):
- # generated method, don't edit
-
- parent.AddSizer(self.InstancesButtonsSizer, 0, border=0, flag=wxGROW)
- parent.AddWindow(self.InstancesGrid, 0, border=0, flag=wxGROW)
+ parent.AddSizer(self.InstancesButtonsSizer, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.InstancesGrid, 0, border=0, flag=wx.GROW)
def _init_coll_InstancesButtonsSizer_Growables(self, parent):
- # generated method, don't edit
-
parent.AddGrowableCol(0)
parent.AddGrowableRow(0)
def _init_coll_InstancesButtonsSizer_Items(self, parent):
- # generated method, don't edit
-
- parent.AddWindow(self.staticText2, 0, border=0, flag=wxALIGN_BOTTOM)
+ parent.AddWindow(self.staticText2, 0, border=0, flag=wx.ALIGN_BOTTOM)
parent.AddWindow(self.AddInstanceButton, 0, border=0, flag=0)
parent.AddWindow(self.DeleteInstanceButton, 0, border=0, flag=0)
parent.AddWindow(self.UpInstanceButton, 0, border=0, flag=0)
parent.AddWindow(self.DownInstanceButton, 0, border=0, flag=0)
def _init_coll_TasksSizer_Growables(self, parent):
- # generated method, don't edit
-
parent.AddGrowableCol(0)
parent.AddGrowableRow(1)
def _init_coll_TasksSizer_Items(self, parent):
- # generated method, don't edit
-
- parent.AddSizer(self.TasksButtonsSizer, 0, border=0, flag=wxGROW)
- parent.AddWindow(self.TasksGrid, 0, border=0, flag=wxGROW)
+ parent.AddSizer(self.TasksButtonsSizer, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.TasksGrid, 0, border=0, flag=wx.GROW)
def _init_coll_TasksButtonsSizer_Growables(self, parent):
- # generated method, don't edit
-
parent.AddGrowableCol(0)
parent.AddGrowableRow(0)
def _init_coll_TasksButtonsSizer_Items(self, parent):
- # generated method, don't edit
-
- parent.AddWindow(self.staticText1, 0, border=0, flag=wxALIGN_BOTTOM)
+ parent.AddWindow(self.staticText1, 0, border=0, flag=wx.ALIGN_BOTTOM)
parent.AddWindow(self.AddTaskButton, 0, border=0, flag=0)
parent.AddWindow(self.DeleteTaskButton, 0, border=0, flag=0)
parent.AddWindow(self.UpTaskButton, 0, border=0, flag=0)
parent.AddWindow(self.DownTaskButton, 0, border=0, flag=0)
def _init_coll_MainGridSizer_Items(self, parent):
- # generated method, don't edit
-
- parent.AddSizer(self.TasksSizer, 0, border=0, flag=wxGROW)
- parent.AddSizer(self.InstancesSizer, 0, border=0, flag=wxGROW)
+ parent.AddSizer(self.TasksSizer, 0, border=0, flag=wx.GROW)
+ parent.AddSizer(self.InstancesSizer, 0, border=0, flag=wx.GROW)
def _init_coll_MainGridSizer_Growables(self, parent):
- # generated method, don't edit
-
parent.AddGrowableCol(0)
parent.AddGrowableRow(0)
parent.AddGrowableRow(1)
def _init_sizers(self):
- # generated method, don't edit
self.MainGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
-
self.InstancesSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
-
self.InstancesButtonsSizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
-
self.TasksSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
-
self.TasksButtonsSizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
self._init_coll_MainGridSizer_Growables(self.MainGridSizer)
@@ -303,76 +277,75 @@
self.SetSizer(self.MainGridSizer)
def _init_ctrls(self, prnt):
- # generated method, don't edit
- wx.Panel.__init__(self, id=wxID_RESOURCEEDITOR, name='', parent=prnt,
+ wx.Panel.__init__(self, id=ID_RESOURCEEDITOR, name='', parent=prnt,
pos=wx.Point(0, 0), size=wx.Size(-1, -1),
style=wx.SUNKEN_BORDER)
- self.staticText1 = wx.StaticText(id=wxID_RESOURCEEDITORSTATICTEXT1,
+ self.staticText1 = wx.StaticText(id=ID_RESOURCEEDITORSTATICTEXT1,
label=u'Tasks:', name='staticText2', parent=self, pos=wx.Point(0,
- 0), size=wx.Size(60, 17), style=wxALIGN_CENTER)
-
- self.TasksGrid = wx.grid.Grid(id=wxID_RESOURCEEDITORTASKSGRID,
+ 0), size=wx.Size(60, 17), style=wx.ALIGN_CENTER)
+
+ self.TasksGrid = wx.grid.Grid(id=ID_RESOURCEEDITORTASKSGRID,
name='TasksGrid', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(-1, -1), style=wxVSCROLL)
+ size=wx.Size(-1, -1), style=wx.VSCROLL)
self.TasksGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
'Sans'))
self.TasksGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
False, 'Sans'))
- EVT_GRID_CELL_CHANGE(self.TasksGrid, self.OnTasksGridCellChange)
-
- self.AddTaskButton = wx.Button(id=wxID_RESOURCEEDITORADDTASKBUTTON, label='Add Task',
+ self.TasksGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnTasksGridCellChange)
+
+ self.AddTaskButton = wx.Button(id=ID_RESOURCEEDITORADDTASKBUTTON, label='Add Task',
name='AddTaskButton', parent=self, pos=wx.Point(0, 0),
size=wx.Size(102, 32), style=0)
- EVT_BUTTON(self, wxID_RESOURCEEDITORADDTASKBUTTON, self.OnAddTaskButton)
-
- self.DeleteTaskButton = wx.Button(id=wxID_RESOURCEEDITORDELETETASKBUTTON, label='Delete Task',
+ self.Bind(wx.EVT_BUTTON, self.OnAddTaskButton, id=ID_RESOURCEEDITORADDTASKBUTTON)
+
+ self.DeleteTaskButton = wx.Button(id=ID_RESOURCEEDITORDELETETASKBUTTON, label='Delete Task',
name='DeleteTaskButton', parent=self, pos=wx.Point(0, 0),
size=wx.Size(102, 32), style=0)
- EVT_BUTTON(self, wxID_RESOURCEEDITORDELETETASKBUTTON, self.OnDeleteTaskButton)
-
- self.UpTaskButton = wx.Button(id=wxID_RESOURCEEDITORUPTASKBUTTON, label='^',
+ self.Bind(wx.EVT_BUTTON, self.OnDeleteTaskButton, id=ID_RESOURCEEDITORDELETETASKBUTTON)
+
+ self.UpTaskButton = wx.Button(id=ID_RESOURCEEDITORUPTASKBUTTON, label='^',
name='UpTaskButton', parent=self, pos=wx.Point(0, 0),
size=wx.Size(32, 32), style=0)
- EVT_BUTTON(self, wxID_RESOURCEEDITORUPTASKBUTTON, self.OnUpTaskButton)
-
- self.DownTaskButton = wx.Button(id=wxID_RESOURCEEDITORDOWNTASKBUTTON, label='v',
+ self.Bind(wx.EVT_BUTTON, self.OnUpTaskButton, id=ID_RESOURCEEDITORUPTASKBUTTON)
+
+ self.DownTaskButton = wx.Button(id=ID_RESOURCEEDITORDOWNTASKBUTTON, label='v',
name='DownTaskButton', parent=self, pos=wx.Point(0, 0),
size=wx.Size(32, 32), style=0)
- EVT_BUTTON(self, wxID_RESOURCEEDITORDOWNTASKBUTTON, self.OnDownTaskButton)
-
- self.staticText2 = wx.StaticText(id=wxID_RESOURCEEDITORSTATICTEXT2,
+ self.Bind(wx.EVT_BUTTON, self.OnDownTaskButton, id=ID_RESOURCEEDITORDOWNTASKBUTTON)
+
+ self.staticText2 = wx.StaticText(id=ID_RESOURCEEDITORSTATICTEXT2,
label=u'Instances:', name='staticText1', parent=self,
- pos=wx.Point(0, 0), size=wx.Size(85, 17), style=wxALIGN_CENTER)
-
- self.InstancesGrid = wx.grid.Grid(id=wxID_RESOURCEEDITORINSTANCESGRID,
+ pos=wx.Point(0, 0), size=wx.Size(85, 17), style=wx.ALIGN_CENTER)
+
+ self.InstancesGrid = wx.grid.Grid(id=ID_RESOURCEEDITORINSTANCESGRID,
name='InstancesGrid', parent=self, pos=wx.Point(0, 0),
- size=wx.Size(-1, -1), style=wxVSCROLL)
+ size=wx.Size(-1, -1), style=wx.VSCROLL)
self.InstancesGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
'Sans'))
self.InstancesGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
False, 'Sans'))
- EVT_GRID_CELL_CHANGE(self.InstancesGrid, self.OnInstancesGridCellChange)
-
- self.AddInstanceButton = wx.Button(id=wxID_RESOURCEEDITORADDINSTANCEBUTTON, label='Add Instance',
+ self.InstancesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnInstancesGridCellChange)
+
+ self.AddInstanceButton = wx.Button(id=ID_RESOURCEEDITORADDINSTANCEBUTTON, label='Add Instance',
name='AddInstanceButton', parent=self, pos=wx.Point(0, 0),
size=wx.Size(122, 32), style=0)
- EVT_BUTTON(self, wxID_RESOURCEEDITORADDINSTANCEBUTTON, self.OnAddInstanceButton)
-
- self.DeleteInstanceButton = wx.Button(id=wxID_RESOURCEEDITORDELETEINSTANCEBUTTON, label='Delete Instance',
+ self.Bind(wx.EVT_BUTTON, self.OnAddInstanceButton, id=ID_RESOURCEEDITORADDINSTANCEBUTTON)
+
+ self.DeleteInstanceButton = wx.Button(id=ID_RESOURCEEDITORDELETEINSTANCEBUTTON, label='Delete Instance',
name='DeleteInstanceButton', parent=self, pos=wx.Point(0, 0),
size=wx.Size(122, 32), style=0)
- EVT_BUTTON(self, wxID_RESOURCEEDITORDELETEINSTANCEBUTTON, self.OnDeleteInstanceButton)
-
- self.UpInstanceButton = wx.Button(id=wxID_RESOURCEEDITORUPINSTANCEBUTTON, label='^',
+ self.Bind(wx.EVT_BUTTON, self.OnDeleteInstanceButton, id=ID_RESOURCEEDITORDELETEINSTANCEBUTTON)
+
+ self.UpInstanceButton = wx.Button(id=ID_RESOURCEEDITORUPINSTANCEBUTTON, label='^',
name='UpInstanceButton', parent=self, pos=wx.Point(0, 0),
size=wx.Size(32, 32), style=0)
- EVT_BUTTON(self, wxID_RESOURCEEDITORUPINSTANCEBUTTON, self.OnUpInstanceButton)
-
- self.DownInstanceButton = wx.Button(id=wxID_RESOURCEEDITORDOWNINSTANCEBUTTON, label='v',
+ self.Bind(wx.EVT_BUTTON, self.OnUpInstanceButton, id=ID_RESOURCEEDITORUPINSTANCEBUTTON)
+
+ self.DownInstanceButton = wx.Button(id=ID_RESOURCEEDITORDOWNINSTANCEBUTTON, label='v',
name='DownInstanceButton', parent=self, pos=wx.Point(0, 0),
size=wx.Size(32, 32), style=0)
- EVT_BUTTON(self, wxID_RESOURCEEDITORDOWNINSTANCEBUTTON, self.OnDownInstanceButton)
+ self.Bind(wx.EVT_BUTTON, self.OnDownInstanceButton, id=ID_RESOURCEEDITORDOWNINSTANCEBUTTON)
self._init_sizers()
@@ -384,7 +357,7 @@
self.TasksDefaultValue = {"Name" : "", "Single" : "", "Interval" : "", "Priority" : 0}
self.TasksTable = ResourceTable(self, [], ["Name", "Single", "Interval", "Priority"])
- self.TasksTable.SetColAlignements([wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_RIGHT, wxALIGN_RIGHT])
+ self.TasksTable.SetColAlignements([wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_RIGHT, wx.ALIGN_RIGHT])
self.TasksTable.SetColSizes([200, 100, 100, 100])
self.TasksGrid.SetTable(self.TasksTable)
self.TasksGrid.SetRowLabelSize(0)
@@ -392,7 +365,7 @@
self.InstancesDefaultValue = {"Name" : "", "Type" : "", "Task" : ""}
self.InstancesTable = ResourceTable(self, [], ["Name", "Type", "Task"])
- self.InstancesTable.SetColAlignements([wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT])
+ self.InstancesTable.SetColAlignements([wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT])
self.InstancesTable.SetColSizes([200, 150, 150])
self.InstancesGrid.SetTable(self.InstancesTable)
self.InstancesGrid.SetRowLabelSize(0)
--- a/SFCViewer.py Tue Aug 07 17:37:38 2007 +0200
+++ b/SFCViewer.py Tue Aug 07 17:38:48 2007 +0200
@@ -22,7 +22,6 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from wxPython.wx import *
import wx
from types import *
@@ -56,7 +55,7 @@
previous.RefreshConnectedPosition(connector)
else:
previous.RefreshOutputPosition()
- wire.SetPoints([wxPoint(pos.x, pos.y + GetWireSize(previous)), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x, pos.y + GetWireSize(previous)), wx.Point(pos.x, pos.y)])
self.AddBlock(transition)
self.Controler.AddCurrentElementEditingTransition(id)
self.RefreshTransitionModel(transition)
@@ -66,7 +65,7 @@
next_block = next.GetParentBlock()
next_pos = next.GetPosition(False)
transition.RefreshOutputPosition((0, pos.y + SFC_WIRE_MIN_SIZE - next_pos.y))
- wire.SetPoints([wxPoint(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wx.Point(pos.x, pos.y)])
if isinstance(next_block, SFC_Divergence):
next_block.RefreshPosition()
transition.RefreshOutputModel(True)
@@ -110,7 +109,7 @@
previous.RefreshConnectedPosition(connector)
else:
previous.RefreshOutputPosition()
- wire.SetPoints([wxPoint(pos.x, pos.y + GetWireSize(previous)), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x, pos.y + GetWireSize(previous)), wx.Point(pos.x, pos.y)])
self.AddBlock(step)
self.Controler.AddCurrentElementEditingStep(id)
self.RefreshStepModel(step)
@@ -120,7 +119,7 @@
next_block = next.GetParentBlock()
next_pos = next.GetPosition(False)
step.RefreshOutputPosition((0, pos.y + SFC_WIRE_MIN_SIZE - next_pos.y))
- wire.SetPoints([wxPoint(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wx.Point(pos.x, pos.y)])
if isinstance(next_block, SFC_Divergence):
next_block.RefreshPosition()
step.RefreshOutputModel(True)
@@ -207,7 +206,7 @@
self.rubberBand.OnLeftDown(event, self.GetLogicalDC(), self.Scaling)
elif self.Mode == MODE_WIRE:
pos = GetScaledEventPosition(event, self.GetLogicalDC(), self.Scaling)
- wire = Wire(self, [wxPoint(pos.x, pos.y), SOUTH], [wxPoint(pos.x, pos.y), NORTH])
+ wire = Wire(self, [wx.Point(pos.x, pos.y), SOUTH], [wx.Point(pos.x, pos.y), NORTH])
wire.oldPos = pos
wire.Handle = (HANDLE_POINT, 0)
wire.ProcessDragging(0, 0)
@@ -234,15 +233,15 @@
elif self.Mode == MODE_COMMENT:
bbox = self.rubberBand.GetCurrentExtent()
self.rubberBand.OnLeftUp(event, self.GetLogicalDC(), self.Scaling)
- wxCallAfter(self.AddComment, bbox)
+ wx.CallAfter(self.AddComment, bbox)
elif self.Mode == MODE_INITIALSTEP:
- wxCallAfter(self.AddInitialStep, GetScaledEventPosition(event, self.GetLogicalDC(), self.Scaling))
+ wx.CallAfter(self.AddInitialStep, GetScaledEventPosition(event, self.GetLogicalDC(), self.Scaling))
elif self.Mode == MODE_SELECTION and self.SelectedElement:
if self.IsWire(self.SelectedElement):
self.SelectedElement.SetSelectedSegment(0)
else:
self.SelectedElement.OnLeftUp(event, self.GetLogicalDC(), self.Scaling)
- wxCallAfter(self.SetCursor, wxNullCursor)
+ wx.CallAfter(self.SetCursor, wx.NullCursor)
self.ReleaseMouse()
self.Refresh()
elif self.Mode == MODE_WIRE and self.SelectedElement:
@@ -270,7 +269,7 @@
else:
self.SelectedElement.SetSelected(True)
self.SelectedElement.OnRightUp(event, dc, self.Scaling)
- wxCallAfter(self.SetCursor, wxNullCursor)
+ wx.CallAfter(self.SetCursor, wx.NullCursor)
self.ReleaseMouse()
self.Refresh()
event.Skip()
@@ -305,18 +304,21 @@
#-------------------------------------------------------------------------------
def OnChar(self, event):
+ xpos, ypos = self.GetScrollPos(wx.HORIZONTAL), self.GetScrollPos(wx.VERTICAL)
+ xmax = self.GetScrollRange(wx.HORIZONTAL) - self.GetScrollThumb(wx.HORIZONTAL)
+ ymax = self.GetScrollRange(wx.VERTICAL) - self.GetScrollThumb(wx.VERTICAL)
keycode = event.GetKeyCode()
if self.Scaling:
scaling = self.Scaling
else:
scaling = (8, 8)
- if keycode == WXK_DELETE and self.SelectedElement:
+ if keycode == wx.WXK_DELETE and self.SelectedElement:
self.SelectedElement.Delete()
self.SelectedElement = None
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh()
- elif keycode == WXK_LEFT:
+ elif keycode == wx.WXK_LEFT:
if event.ControlDown() and event.ShiftDown():
self.Scroll(0, ypos)
elif event.ControlDown():
@@ -326,7 +328,7 @@
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh()
- elif keycode == WXK_RIGHT:
+ elif keycode == wx.WXK_RIGHT:
if event.ControlDown() and event.ShiftDown():
self.Scroll(xmax, ypos)
elif event.ControlDown():
@@ -336,7 +338,7 @@
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh()
- elif keycode == WXK_UP:
+ elif keycode == wx.WXK_UP:
if event.ControlDown() and event.ShiftDown():
self.Scroll(xpos, 0)
elif event.ControlDown():
@@ -346,7 +348,7 @@
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh()
- elif keycode == WXK_DOWN:
+ elif keycode == wx.WXK_DOWN:
if event.ControlDown() and event.ShiftDown():
self.Scroll(xpos, ymax)
elif event.ControlDown():
@@ -362,11 +364,11 @@
#-------------------------------------------------------------------------------
def AddInitialStep(self, pos):
- dialog = StepNameDialog(self.Parent, "Add a new initial step", "Please enter step name", "", wxOK|wxCANCEL)
+ dialog = StepNameDialog(self.Parent, "Add a new initial step", "Please enter step name", "", wx.OK|wx.CANCEL)
dialog.SetPouNames(self.Controler.GetProjectPouNames())
dialog.SetVariables(self.Controler.GetCurrentElementEditingInterfaceVars())
dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step)])
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
id = self.GetNewId()
name = dialog.GetValue()
step = SFC_Step(self, name, True, id)
@@ -385,11 +387,11 @@
def AddStep(self):
if self.SelectedElement in self.Wires or isinstance(self.SelectedElement, SFC_Step):
- dialog = StepNameDialog(self.Parent, "Add a new step", "Please enter step name", "", wxOK|wxCANCEL)
+ dialog = StepNameDialog(self.Parent, "Add a new step", "Please enter step name", "", wx.OK|wx.CANCEL)
dialog.SetPouNames(self.Controler.GetProjectPouNames())
dialog.SetVariables(self.Controler.GetCurrentElementEditingInterfaceVars())
dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step)])
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
name = dialog.GetValue()
if self.IsWire(self.SelectedElement):
self.SelectedElement.SetSelectedSegment(None)
@@ -446,7 +448,7 @@
dialog.SetQualifierList(self.Controler.GetQualifierTypes())
dialog.SetActionList(self.Controler.GetCurrentElementEditingActions())
dialog.SetVariableList(self.Controler.GetCurrentElementEditingInterfaceVars())
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
actions = dialog.GetValues()
self.SelectedElement.AddAction()
self.RefreshStepModel(self.SelectedElement)
@@ -457,7 +459,7 @@
actionblock.SetPosition(pos.x + SFC_WIRE_MIN_SIZE, pos.y - SFC_STEP_DEFAULT_SIZE[1] / 2)
actionblock_connector = actionblock.GetConnector()
wire = self.ConnectConnectors(actionblock_connector, connectors["action"])
- wire.SetPoints([wxPoint(pos.x + SFC_WIRE_MIN_SIZE, pos.y), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x + SFC_WIRE_MIN_SIZE, pos.y), wx.Point(pos.x, pos.y)])
actionblock.SetActions(actions)
self.AddBlock(actionblock)
self.Controler.AddCurrentElementEditingActionBlock(id)
@@ -470,7 +472,7 @@
def AddDivergence(self):
if self.SelectedElement in self.Wires or isinstance(self.SelectedElement, Graphic_Group) or isinstance(self.SelectedElement, SFC_Step):
dialog = DivergenceCreateDialog(self.Parent)
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetValues()
if value["type"] == SELECTION_DIVERGENCE:
if self.SelectedElement in self.Wires and isinstance(self.SelectedElement.EndConnected.GetParentBlock(), SFC_Step):
@@ -508,7 +510,7 @@
divergence_connectors = divergence.GetConnectors()
wire = self.ConnectConnectors(divergence_connectors["inputs"][0], previous)
previous_block.RefreshOutputPosition()
- wire.SetPoints([wxPoint(pos.x, pos.y + wire_size), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x, pos.y + wire_size), wx.Point(pos.x, pos.y)])
self.AddBlock(divergence)
self.Controler.AddCurrentElementEditingDivergence(id, value["type"])
self.RefreshDivergenceModel(divergence)
@@ -520,7 +522,7 @@
next_block = next.GetParentBlock()
divergence.RefreshOutputPosition((0, pos.y + SFC_WIRE_MIN_SIZE - next_pos.y))
divergence.RefreshConnectedPosition(connector)
- wire.SetPoints([wxPoint(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wx.Point(pos.x, pos.y)])
next_block.RefreshModel()
next = None
else:
@@ -566,7 +568,7 @@
divergence_connectors = divergence.GetConnectors()
wire = self.ConnectConnectors(divergence_connectors["inputs"][0], previous)
previous_block.RefreshOutputPosition()
- wire.SetPoints([wxPoint(pos.x, pos.y + wire_size), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x, pos.y + wire_size), wx.Point(pos.x, pos.y)])
self.AddBlock(divergence)
self.Controler.AddCurrentElementEditingDivergence(id, value["type"])
self.RefreshDivergenceModel(divergence)
@@ -578,7 +580,7 @@
next_block = next.GetParentBlock()
divergence.RefreshOutputPosition((0, pos.y + SFC_WIRE_MIN_SIZE - next_pos.y))
divergence.RefreshConnectedPosition(connector)
- wire.SetPoints([wxPoint(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wx.Point(pos.x, pos.y)])
next_block.RefreshModel()
next = None
else:
@@ -632,7 +634,7 @@
pos = input.GetPosition(False)
wire = self.ConnectConnectors(divergence_connectors["inputs"][i], input)
wire_size = GetWireSize(input)
- wire.SetPoints([wxPoint(pos.x, pos.y + wire_size), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x, pos.y + wire_size), wx.Point(pos.x, pos.y)])
input_block = input.GetParentBlock()
input_block.RefreshOutputPosition()
divergence.RefreshPosition()
@@ -648,7 +650,7 @@
next_block = next.GetParentBlock()
divergence.RefreshOutputPosition((0, pos.y + SFC_WIRE_MIN_SIZE - next_pos.y))
divergence.RefreshConnectedPosition(divergence_connectors["outputs"][0])
- wire.SetPoints([wxPoint(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wx.Point(pos.x, pos.y)])
next_block.RefreshModel()
else:
if value["type"] == SELECTION_CONVERGENCE:
@@ -686,8 +688,8 @@
for block in self.Blocks:
if isinstance(block, SFC_Step):
choices.append(block.GetName())
- dialog = wxSingleChoiceDialog(self.Parent, "Add a new jump", "Please choose a target", choices, wxOK|wxCANCEL)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.SingleChoiceDialog(self.Parent, "Add a new jump", "Please choose a target", choices, wx.OK|wx.CANCEL)
+ if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetStringSelection()
self.SelectedElement.AddOutput()
self.RefreshStepModel(self.SelectedElement)
@@ -703,7 +705,7 @@
jump_connector = jump.GetConnector()
wire = self.ConnectConnectors(jump_connector, transition_connectors["output"])
transition.RefreshOutputPosition()
- wire.SetPoints([wxPoint(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wx.Point(pos.x, pos.y)])
self.RefreshJumpModel(jump)
self.RefreshBuffer()
self.RefreshScrollBars()
@@ -711,11 +713,11 @@
dialog.Destroy()
def EditStepContent(self, step):
- dialog = StepNameDialog(self.Parent, "Edit step name", "Please enter step name", step.GetName(), wxOK|wxCANCEL)
+ dialog = StepNameDialog(self.Parent, "Edit step name", "Please enter step name", step.GetName(), wx.OK|wx.CANCEL)
dialog.SetPouNames(self.Controler.GetProjectPouNames())
dialog.SetVariables(self.Controler.GetCurrentElementEditingInterfaceVars())
dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step) and block.GetName() != step.GetName()])
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetValue()
step.SetName(value)
min_size = step.GetMinSize()
@@ -727,52 +729,6 @@
self.Refresh()
dialog.Destroy()
- def EditTransitionContent(self, transition):
- dialog = TransitionContentDialog(self.Parent)
- dialog.SetTransitions(self.Controler.GetCurrentElementEditingTransitions())
- dialog.SetValues({"type":transition.GetType(),"value":transition.GetCondition()})
- if dialog.ShowModal() == wxID_OK:
- values = dialog.GetValues()
- transition.SetType(values["type"])
- transition.SetCondition(values["value"])
- transition.RefreshModel()
- self.RefreshBuffer()
- self.RefreshScrollBars()
- self.Refresh()
- dialog.Destroy()
-
- def EditJumpContent(self, jump):
- choices = []
- for block in self.Blocks:
- if isinstance(block, SFC_Step):
- choices.append(block.GetName())
- dialog = wxSingleChoiceDialog(self.Parent, "Edit jump target", "Please choose a target", choices, wxOK|wxCANCEL)
- dialog.SetSelection(choices.index(jump.GetTarget()))
- if dialog.ShowModal() == wxID_OK:
- value = dialog.GetStringSelection()
- jump.SetTarget(value)
- jump.RefreshModel()
- self.RefreshBuffer()
- self.RefreshScrollBars()
- self.Refresh()
- dialog.Destroy()
-
- def EditActionBlockContent(self, actionblock):
- dialog = ActionBlockDialog(self.Parent)
- dialog.SetQualifierList(self.Controler.GetQualifierTypes())
- dialog.SetActionList(self.Controler.GetCurrentElementEditingActions())
- dialog.SetVariableList(self.Controler.GetCurrentElementEditingInterfaceVars())
- dialog.SetValues(actionblock.GetActions())
- if dialog.ShowModal() == wxID_OK:
- actions = dialog.GetValues()
- actionblock.SetActions(actions)
- actionblock.RefreshModel()
- self.RefreshBuffer()
- self.RefreshScrollBars()
- self.Refresh()
- dialog.Destroy()
-
-
#-------------------------------------------------------------------------------
# Delete element functions
#-------------------------------------------------------------------------------
@@ -828,7 +784,7 @@
next_pos = next.GetPosition(False)
wire_size = GetWireSize(previous_block)
previous_block.RefreshOutputPosition((0, pos.y + wire_size - next_pos.y))
- wire.SetPoints([wxPoint(pos.x, pos.y + wire_size), wxPoint(pos.x, pos.y)])
+ wire.SetPoints([wx.Point(pos.x, pos.y + wire_size), wx.Point(pos.x, pos.y)])
if isinstance(next_block, SFC_Divergence):
next_block.RefreshPosition()
previous_block.RefreshOutputModel(True)
@@ -941,8 +897,8 @@
next_pos = next.GetPosition(False)
wire_size = GetWireSize(previous_block)
previous_block.RefreshOutputPosition((0, previous_pos.y + wire_size - next_pos.y))
- wire.SetPoints([wxPoint(previous_pos.x, previous_pos.y + wire_size),
- wxPoint(previous_pos.x, previous_pos.y)])
+ wire.SetPoints([wx.Point(previous_pos.x, previous_pos.y + wire_size),
+ wx.Point(previous_pos.x, previous_pos.y)])
if isinstance(next_block, SFC_Divergence):
next_block.RefreshPosition()
previous_block.RefreshOutputModel(True)
@@ -971,8 +927,8 @@
next_pos = next.GetPosition(False)
wire_size = GetWireSize(previous_block)
previous_block.RefreshOutputPosition((previous_pos.x - next_pos.x, previous_pos.y + wire_size - next_pos.y))
- wire.SetPoints([wxPoint(previous_pos.x, previous_pos.y + wire_size),
- wxPoint(previous_pos.x, previous_pos.y)])
+ wire.SetPoints([wx.Point(previous_pos.x, previous_pos.y + wire_size),
+ wx.Point(previous_pos.x, previous_pos.y)])
if isinstance(next_block, SFC_Divergence):
next_block.RefreshPosition()
previous_block.RefreshOutputModel(True)
--- a/TextViewer.py Tue Aug 07 17:37:38 2007 +0200
+++ b/TextViewer.py Tue Aug 07 17:38:48 2007 +0200
@@ -22,9 +22,8 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from wxPython.wx import *
-from wxPython.stc import *
import wx
+import wx.stc
from types import *
import re
@@ -41,11 +40,11 @@
LETTERS.append(chr(ord('a') + i))
LETTERS.append(chr(ord('A') + i))
-[wxSTC_PLC_WORD, wxSTC_PLC_COMMENT, wxSTC_PLC_NUMBER, wxSTC_PLC_VARIABLE,
- wxSTC_PLC_FUNCTION, wxSTC_PLC_JUMP] = range(6)
+[STC_PLC_WORD, STC_PLC_COMMENT, STC_PLC_NUMBER, STC_PLC_VARIABLE,
+ STC_PLC_FUNCTION, STC_PLC_JUMP] = range(6)
[SPACE, WORD, NUMBER, COMMENT] = range(4)
-[wxID_TEXTVIEWER,
+[ID_TEXTVIEWER,
] = [wx.NewId() for _init_ctrls in range(1)]
if wx.Platform == '__WXMSW__':
@@ -90,39 +89,39 @@
else:
return None
-class TextViewer(wxStyledTextCtrl):
+class TextViewer(wx.stc.StyledTextCtrl):
def __init__(self, parent, window, controler):
- wxStyledTextCtrl.__init__(self, parent, wxID_TEXTVIEWER, style=0)
-
- self.CmdKeyAssign(ord('+'), wxSTC_SCMOD_CTRL, wxSTC_CMD_ZOOMIN)
- self.CmdKeyAssign(ord('-'), wxSTC_SCMOD_CTRL, wxSTC_CMD_ZOOMOUT)
+ wx.stc.StyledTextCtrl.__init__(self, parent, ID_TEXTVIEWER, style=0)
+
+ self.CmdKeyAssign(ord('+'), wx.stc.STC_SCMOD_CTRL, wx.stc.STC_CMD_ZOOMIN)
+ self.CmdKeyAssign(ord('-'), wx.stc.STC_SCMOD_CTRL, wx.stc.STC_CMD_ZOOMOUT)
self.SetViewWhiteSpace(False)
- self.SetLexer(wxSTC_LEX_CONTAINER)
+ self.SetLexer(wx.stc.STC_LEX_CONTAINER)
# Global default styles for all languages
- self.StyleSetSpec(wxSTC_STYLE_DEFAULT, "face:%(mono)s,size:%(size)d" % faces)
+ self.StyleSetSpec(wx.stc.STC_STYLE_DEFAULT, "face:%(mono)s,size:%(size)d" % faces)
self.StyleClearAll() # Reset all to be like the default
- self.StyleSetSpec(wxSTC_STYLE_LINENUMBER, "back:#C0C0C0,size:%(size)d" % faces)
+ self.StyleSetSpec(wx.stc.STC_STYLE_LINENUMBER, "back:#C0C0C0,size:%(size)d" % faces)
self.SetSelBackground(1, "#E0E0E0")
# Highlighting styles
- self.StyleSetSpec(wxSTC_PLC_WORD, "fore:#00007F,bold,size:%(size)d" % faces)
- self.StyleSetSpec(wxSTC_PLC_VARIABLE, "fore:#7F0000,size:%(size)d" % faces)
- self.StyleSetSpec(wxSTC_PLC_FUNCTION, "fore:#7F7F00,size:%(size)d" % faces)
- self.StyleSetSpec(wxSTC_PLC_COMMENT, "fore:#7F7F7F,size:%(size)d" % faces)
- self.StyleSetSpec(wxSTC_PLC_NUMBER, "fore:#007F7F,size:%(size)d" % faces)
- self.StyleSetSpec(wxSTC_PLC_JUMP, "fore:#007F00,size:%(size)d" % faces)
+ self.StyleSetSpec(STC_PLC_WORD, "fore:#00007F,bold,size:%(size)d" % faces)
+ self.StyleSetSpec(STC_PLC_VARIABLE, "fore:#7F0000,size:%(size)d" % faces)
+ self.StyleSetSpec(STC_PLC_FUNCTION, "fore:#7F7F00,size:%(size)d" % faces)
+ self.StyleSetSpec(STC_PLC_COMMENT, "fore:#7F7F7F,size:%(size)d" % faces)
+ self.StyleSetSpec(STC_PLC_NUMBER, "fore:#007F7F,size:%(size)d" % faces)
+ self.StyleSetSpec(STC_PLC_JUMP, "fore:#007F00,size:%(size)d" % faces)
# Indicators styles
- self.IndicatorSetStyle(0, wxSTC_INDIC_SQUIGGLE)
- self.IndicatorSetForeground(0, wxRED)
+ self.IndicatorSetStyle(0, wx.stc.STC_INDIC_SQUIGGLE)
+ self.IndicatorSetForeground(0, wx.RED)
# Line numbers in the margin
- self.SetMarginType(1, wxSTC_MARGIN_NUMBER)
+ self.SetMarginType(1, wx.stc.STC_MARGIN_NUMBER)
self.SetMarginWidth(1, 50)
# Indentation size
@@ -141,26 +140,26 @@
self.Parent = window
self.Controler = controler
- self.SetModEventMask(wxSTC_MOD_BEFOREINSERT|wxSTC_MOD_BEFOREDELETE)
-
- EVT_KEY_DOWN(self, self.OnKeyDown)
- EVT_STC_STYLENEEDED(self, wxID_TEXTVIEWER, self.OnStyleNeeded)
- EVT_STC_DO_DROP(self, wxID_TEXTVIEWER, self.OnDoDrop)
- EVT_KILL_FOCUS(self, self.OnKillFocus)
- EVT_STC_MODIFIED(self, wxID_TEXTVIEWER, self.OnModification)
+ self.SetModEventMask(wx.stc.STC_MOD_BEFOREINSERT|wx.stc.STC_MOD_BEFOREDELETE)
+
+ self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
+ self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyleNeeded, id=ID_TEXTVIEWER)
+ self.Bind(wx.stc.EVT_STC_DO_DROP, self.OnDoDrop, id=ID_TEXTVIEWER)
+ self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus)
+ self.Bind(wx.stc.EVT_STC_MODIFIED, self.OnModification, id=ID_TEXTVIEWER)
def OnModification(self, event):
if not self.DisableEvents:
mod_type = event.GetModificationType()
- if not (mod_type&wxSTC_PERFORMED_UNDO or mod_type&wxSTC_PERFORMED_REDO):
- if mod_type&wxSTC_MOD_BEFOREINSERT:
+ if not (mod_type&wx.stc.STC_PERFORMED_UNDO or mod_type&wx.stc.STC_PERFORMED_REDO):
+ if mod_type&wx.stc.STC_MOD_BEFOREINSERT:
if self.CurrentAction == None:
self.StartBuffering()
elif self.CurrentAction[0] != "Add" or self.CurrentAction[1] != event.GetPosition() - 1:
self.Controler.EndBuffering()
self.StartBuffering()
self.CurrentAction = ("Add", event.GetPosition())
- elif mod_type&wxSTC_MOD_BEFOREDELETE:
+ elif mod_type&wx.stc.STC_MOD_BEFOREDELETE:
if self.CurrentAction == None:
self.StartBuffering()
elif self.CurrentAction[0] != "Delete" or self.CurrentAction[1] != event.GetPosition() + 1:
@@ -256,23 +255,23 @@
line += char
if char == NEWLINE:
if state == COMMENT:
- self.SetStyling(i - start_pos + 1, wxSTC_PLC_COMMENT)
+ self.SetStyling(i - start_pos + 1, STC_PLC_COMMENT)
elif state == NUMBER:
- self.SetStyling(i - start_pos, wxSTC_PLC_NUMBER)
+ self.SetStyling(i - start_pos, STC_PLC_NUMBER)
elif state == WORD:
if word in self.Keywords:
- self.SetStyling(i - start_pos, wxSTC_PLC_WORD)
+ self.SetStyling(i - start_pos, STC_PLC_WORD)
elif word in self.Variables:
- self.SetStyling(i - start_pos, wxSTC_PLC_VARIABLE)
+ self.SetStyling(i - start_pos, STC_PLC_VARIABLE)
elif word in self.Functions:
- self.SetStyling(i - start_pos, wxSTC_PLC_FUNCTION)
+ self.SetStyling(i - start_pos, STC_PLC_FUNCTION)
elif word in self.Jumps:
- self.SetStyling(i - start_pos, wxSTC_PLC_JUMP)
+ self.SetStyling(i - start_pos, STC_PLC_JUMP)
else:
self.SetStyling(i - start_pos, 31)
if self.GetCurrentPos() < start_pos or self.GetCurrentPos() > i:
- self.StartStyling(start_pos, wxSTC_INDICS_MASK)
- self.SetStyling(i - start_pos, wxSTC_INDIC0_MASK)
+ self.StartStyling(start_pos, wx.stc.STC_INDICS_MASK)
+ self.SetStyling(i - start_pos, wx.stc.STC_INDIC0_MASK)
self.StartStyling(i, 0xff)
else:
self.SetStyling(i - start_pos, 31)
@@ -285,7 +284,7 @@
state = COMMENT
elif state == COMMENT:
if line.endswith("*)"):
- self.SetStyling(i - start_pos + 2, wxSTC_PLC_COMMENT)
+ self.SetStyling(i - start_pos + 2, STC_PLC_COMMENT)
start_pos = i + 1
state = SPACE
elif char in LETTERS:
@@ -309,40 +308,40 @@
else:
if state == WORD:
if word in self.Keywords:
- self.SetStyling(i - start_pos, wxSTC_PLC_WORD)
+ self.SetStyling(i - start_pos, STC_PLC_WORD)
elif word in self.Variables:
- self.SetStyling(i - start_pos, wxSTC_PLC_VARIABLE)
+ self.SetStyling(i - start_pos, STC_PLC_VARIABLE)
elif word in self.Functions:
- self.SetStyling(i - start_pos, wxSTC_PLC_FUNCTION)
+ self.SetStyling(i - start_pos, STC_PLC_FUNCTION)
elif word in self.Jumps:
- self.SetStyling(i - start_pos, wxSTC_PLC_JUMP)
+ self.SetStyling(i - start_pos, STC_PLC_JUMP)
else:
self.SetStyling(i - start_pos, 31)
if self.GetCurrentPos() < start_pos or self.GetCurrentPos() > i:
- self.StartStyling(start_pos, wxSTC_INDICS_MASK)
- self.SetStyling(i - start_pos, wxSTC_INDIC0_MASK)
+ self.StartStyling(start_pos, wx.stc.STC_INDICS_MASK)
+ self.SetStyling(i - start_pos, wx.stc.STC_INDIC0_MASK)
self.StartStyling(i, 0xff)
word = ""
start_pos = i
state = SPACE
elif state == NUMBER:
- self.SetStyling(i - start_pos, wxSTC_PLC_NUMBER)
+ self.SetStyling(i - start_pos, STC_PLC_NUMBER)
start_pos = i
state = SPACE
i += 1
if state == COMMENT:
- self.SetStyling(i - start_pos + 2, wxSTC_PLC_COMMENT)
+ self.SetStyling(i - start_pos + 2, STC_PLC_COMMENT)
elif state == NUMBER:
- self.SetStyling(i - start_pos, wxSTC_PLC_NUMBER)
+ self.SetStyling(i - start_pos, STC_PLC_NUMBER)
elif state == WORD:
if word in self.Keywords:
- self.SetStyling(i - start_pos, wxSTC_PLC_WORD)
+ self.SetStyling(i - start_pos, STC_PLC_WORD)
elif word in self.Variables:
- self.SetStyling(i - start_pos, wxSTC_PLC_VARIABLE)
+ self.SetStyling(i - start_pos, STC_PLC_VARIABLE)
elif word in self.Functions:
- self.SetStyling(i - start_pos, wxSTC_PLC_FUNCTION)
+ self.SetStyling(i - start_pos, STC_PLC_FUNCTION)
elif word in self.Jumps:
- self.SetStyling(i - start_pos, wxSTC_PLC_JUMP)
+ self.SetStyling(i - start_pos, STC_PLC_JUMP)
else:
self.SetStyling(i - start_pos, 31)
else:
@@ -351,15 +350,15 @@
def Cut(self):
self.ResetBuffer()
- self.CmdKeyExecute(wxSTC_CMD_CUT)
+ self.CmdKeyExecute(wx.stc.STC_CMD_CUT)
self.RefreshBuffer()
def Copy(self):
- self.CmdKeyExecute(wxSTC_CMD_COPY)
+ self.CmdKeyExecute(wx.stc.STC_CMD_COPY)
def Paste(self):
self.ResetBuffer()
- self.CmdKeyExecute(wxSTC_CMD_PASTE)
+ self.CmdKeyExecute(wx.stc.STC_CMD_PASTE)
self.RefreshBuffer()
def RefreshModel(self):
@@ -373,7 +372,7 @@
key = event.KeyCode()
# Code completion
- if key == WXK_SPACE and event.ControlDown():
+ if key == wx.WXK_SPACE and event.ControlDown():
line = self.GetCurrentLine()
if line == 0:
@@ -406,7 +405,7 @@
self.AutoCompShow(len(words[-1]), " ".join(kw))
else:
self.TextChanged = False
- wxCallAfter(self.RefreshModel)
+ wx.CallAfter(self.RefreshModel)
event.Skip()
def OnKillFocus(self, event):
--- a/Viewer.py Tue Aug 07 17:37:38 2007 +0200
+++ b/Viewer.py Tue Aug 07 17:38:48 2007 +0200
@@ -22,7 +22,6 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from wxPython.wx import *
import wx
from plcopen.structures import *
@@ -38,11 +37,11 @@
#-------------------------------------------------------------------------------
# ID Constants for menu items
-[wxID_FBDVIEWERCONTEXTUALMENUITEMS0, wxID_FBDVIEWERCONTEXTUALMENUITEMS1,
- wxID_FBDVIEWERCONTEXTUALMENUITEMS2, wxID_FBDVIEWERCONTEXTUALMENUITEMS3,
- wxID_FBDVIEWERCONTEXTUALMENUITEMS5, wxID_FBDVIEWERCONTEXTUALMENUITEMS6,
- wxID_FBDVIEWERCONTEXTUALMENUITEMS8, wxID_FBDVIEWERCONTEXTUALMENUITEMS9,
- wxID_FBDVIEWERCONTEXTUALMENUITEMS11,
+[ID_FBDVIEWERCONTEXTUALMENUITEMS0, ID_FBDVIEWERCONTEXTUALMENUITEMS1,
+ ID_FBDVIEWERCONTEXTUALMENUITEMS2, ID_FBDVIEWERCONTEXTUALMENUITEMS3,
+ ID_FBDVIEWERCONTEXTUALMENUITEMS5, ID_FBDVIEWERCONTEXTUALMENUITEMS6,
+ ID_FBDVIEWERCONTEXTUALMENUITEMS8, ID_FBDVIEWERCONTEXTUALMENUITEMS9,
+ ID_FBDVIEWERCONTEXTUALMENUITEMS11,
] = [wx.NewId() for _init_coll_ContextualMenu_Items in range(9)]
@@ -85,7 +84,7 @@
"""
-Class that implements a Viewer based on a wxScrolledWindow for drawing and
+Class that implements a Viewer based on a wx.ScrolledWindow for drawing and
manipulating graphic elements
"""
@@ -94,46 +93,46 @@
# Create Contextual Menu items
def _init_coll_ContextualMenu_Items(self, parent):
# Create menu items
- parent.Append(help='', id=wxID_FBDVIEWERCONTEXTUALMENUITEMS0,
+ parent.Append(help='', id=ID_FBDVIEWERCONTEXTUALMENUITEMS0,
kind=wx.ITEM_RADIO, text=u'No Modifier')
- parent.Append(help='', id=wxID_FBDVIEWERCONTEXTUALMENUITEMS1,
+ parent.Append(help='', id=ID_FBDVIEWERCONTEXTUALMENUITEMS1,
kind=wx.ITEM_RADIO, text=u'Negated')
- parent.Append(help='', id=wxID_FBDVIEWERCONTEXTUALMENUITEMS2,
+ parent.Append(help='', id=ID_FBDVIEWERCONTEXTUALMENUITEMS2,
kind=wx.ITEM_RADIO, text=u'Rising Edge')
- parent.Append(help='', id=wxID_FBDVIEWERCONTEXTUALMENUITEMS3,
+ parent.Append(help='', id=ID_FBDVIEWERCONTEXTUALMENUITEMS3,
kind=wx.ITEM_RADIO, text=u'Falling Edge')
parent.AppendSeparator()
- parent.Append(help='', id=wxID_FBDVIEWERCONTEXTUALMENUITEMS5,
+ parent.Append(help='', id=ID_FBDVIEWERCONTEXTUALMENUITEMS5,
kind=wx.ITEM_NORMAL, text=u'Add Wire Segment')
- parent.Append(help='', id=wxID_FBDVIEWERCONTEXTUALMENUITEMS6,
+ parent.Append(help='', id=ID_FBDVIEWERCONTEXTUALMENUITEMS6,
kind=wx.ITEM_NORMAL, text=u'Delete Wire Segment')
parent.AppendSeparator()
- parent.Append(help='', id=wxID_FBDVIEWERCONTEXTUALMENUITEMS8,
+ parent.Append(help='', id=ID_FBDVIEWERCONTEXTUALMENUITEMS8,
kind=wx.ITEM_NORMAL, text=u'Add Divergence Branch')
- parent.Append(help='', id=wxID_FBDVIEWERCONTEXTUALMENUITEMS9,
+ parent.Append(help='', id=ID_FBDVIEWERCONTEXTUALMENUITEMS9,
kind=wx.ITEM_NORMAL, text=u'Delete Divergence Branch')
parent.AppendSeparator()
- parent.Append(help='', id=wxID_FBDVIEWERCONTEXTUALMENUITEMS11,
+ parent.Append(help='', id=ID_FBDVIEWERCONTEXTUALMENUITEMS11,
kind=wx.ITEM_NORMAL, text=u'Delete')
# Link menu event to corresponding called functions
self.Bind(wx.EVT_MENU, self.OnNoModifierMenu,
- id=wxID_FBDVIEWERCONTEXTUALMENUITEMS0)
+ id=ID_FBDVIEWERCONTEXTUALMENUITEMS0)
self.Bind(wx.EVT_MENU, self.OnNegatedMenu,
- id=wxID_FBDVIEWERCONTEXTUALMENUITEMS1)
+ id=ID_FBDVIEWERCONTEXTUALMENUITEMS1)
self.Bind(wx.EVT_MENU, self.OnRisingEdgeMenu,
- id=wxID_FBDVIEWERCONTEXTUALMENUITEMS2)
+ id=ID_FBDVIEWERCONTEXTUALMENUITEMS2)
self.Bind(wx.EVT_MENU, self.OnFallingEdgeMenu,
- id=wxID_FBDVIEWERCONTEXTUALMENUITEMS3)
+ id=ID_FBDVIEWERCONTEXTUALMENUITEMS3)
self.Bind(wx.EVT_MENU, self.OnAddSegmentMenu,
- id=wxID_FBDVIEWERCONTEXTUALMENUITEMS5)
+ id=ID_FBDVIEWERCONTEXTUALMENUITEMS5)
self.Bind(wx.EVT_MENU, self.OnDeleteSegmentMenu,
- id=wxID_FBDVIEWERCONTEXTUALMENUITEMS6)
+ id=ID_FBDVIEWERCONTEXTUALMENUITEMS6)
self.Bind(wx.EVT_MENU, self.OnAddBranchMenu,
- id=wxID_FBDVIEWERCONTEXTUALMENUITEMS8)
+ id=ID_FBDVIEWERCONTEXTUALMENUITEMS8)
self.Bind(wx.EVT_MENU, self.OnDeleteBranchMenu,
- id=wxID_FBDVIEWERCONTEXTUALMENUITEMS9)
+ id=ID_FBDVIEWERCONTEXTUALMENUITEMS9)
self.Bind(wx.EVT_MENU, self.OnDeleteMenu,
- id=wxID_FBDVIEWERCONTEXTUALMENUITEMS11)
+ id=ID_FBDVIEWERCONTEXTUALMENUITEMS11)
# Create and initialize Contextual Menu
def _init_menus(self):
@@ -147,7 +146,7 @@
self._init_menus()
# Adding a rubberband to Viewer
self.rubberBand = RubberBand(drawingSurface=self)
- self.SetBackgroundColour(wxColour(255,255,255))
+ self.SetBackgroundColour(wx.Colour(255,255,255))
self.ResetView()
self.Scaling = None
#self.Scaling = (8, 8)
@@ -167,15 +166,15 @@
self.SetDropTarget(ViewerDropTarget(self))
# Link Viewer event to corresponding methods
- EVT_PAINT(self, self.OnPaint)
- EVT_LEFT_DOWN(self, self.OnViewerLeftDown)
- EVT_LEFT_UP(self, self.OnViewerLeftUp)
- EVT_LEFT_DCLICK(self, self.OnViewerLeftDClick)
- EVT_RIGHT_UP(self, self.OnViewerRightUp)
- EVT_MOTION(self, self.OnViewerMotion)
- EVT_CHAR(self, self.OnChar)
- EVT_SCROLLWIN(self, self.OnMoveWindow)
- EVT_SIZE(self, self.OnMoveWindow)
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
+ self.Bind(wx.EVT_LEFT_DOWN, self.OnViewerLeftDown)
+ self.Bind(wx.EVT_LEFT_UP, self.OnViewerLeftUp)
+ self.Bind(wx.EVT_LEFT_DCLICK, self.OnViewerLeftDClick)
+ self.Bind(wx.EVT_RIGHT_UP, self.OnViewerRightUp)
+ self.Bind(wx.EVT_MOTION, self.OnViewerMotion)
+ self.Bind(wx.EVT_CHAR, self.OnChar)
+ self.Bind(wx.EVT_SCROLLWIN, self.OnMoveWindow)
+ self.Bind(wx.EVT_SIZE, self.OnMoveWindow)
# Returns a new id
def GetNewId(self):
@@ -187,7 +186,7 @@
self.ResetView()
def GetLogicalDC(self):
- dc = wxClientDC(self)
+ dc = wx.ClientDC(self)
self.DoPrepareDC(dc)
return dc
@@ -328,7 +327,7 @@
variable.SetSize(instance["width"], instance["height"])
self.AddBlock(variable)
connectors = variable.GetConnectors()
- connectors["output"].SetPosition(wxPoint(*instance["connector"]["position"]))
+ connectors["output"].SetPosition(wx.Point(*instance["connector"]["position"]))
if instance["connector"]["negated"]:
connectors["output"].SetNegated(True)
if instance["connector"]["edge"]:
@@ -339,7 +338,7 @@
variable.SetSize(instance["width"], instance["height"])
self.AddBlock(variable)
connectors = variable.GetConnectors()
- connectors["input"].SetPosition(wxPoint(*instance["connector"]["position"]))
+ connectors["input"].SetPosition(wx.Point(*instance["connector"]["position"]))
if instance["connector"]["negated"]:
connectors["input"].SetNegated(True)
if instance["connector"]["edge"]:
@@ -351,8 +350,8 @@
variable.SetSize(instance["width"], instance["height"])
self.AddBlock(variable)
connectors = variable.GetConnectors()
- connectors["output"].SetPosition(wxPoint(*instance["connectors"]["output"]["position"]))
- connectors["input"].SetPosition(wxPoint(*instance["connectors"]["input"]["position"]))
+ connectors["output"].SetPosition(wx.Point(*instance["connectors"]["output"]["position"]))
+ connectors["input"].SetPosition(wx.Point(*instance["connectors"]["input"]["position"]))
if instance["connectors"]["output"]["negated"]:
connectors["output"].SetNegated(True)
if instance["connectors"]["output"]["edge"]:
@@ -368,14 +367,14 @@
connection.SetSize(instance["width"], instance["height"])
self.AddBlock(connection)
connector = connection.GetConnector()
- connector.SetPosition(wxPoint(*instance["connector"]["position"]))
+ connector.SetPosition(wx.Point(*instance["connector"]["position"]))
elif instance["type"] == "connection":
connection = FBD_Connector(self, CONNECTOR, instance["name"], instance["id"])
connection.SetPosition(instance["x"], instance["y"])
connection.SetSize(instance["width"], instance["height"])
self.AddBlock(connection)
connector = connection.GetConnector()
- connector.SetPosition(wxPoint(*instance["connector"]["position"]))
+ connector.SetPosition(wx.Point(*instance["connector"]["position"]))
self.CreateWires(connector, instance["connector"]["links"], ids)
elif instance["type"] == "comment":
comment = Comment(self, instance["content"], instance["id"])
@@ -388,14 +387,14 @@
self.AddBlock(leftpowerrail)
connectors = leftpowerrail.GetConnectors()
for i, connector in enumerate(instance["connectors"]):
- connectors[i].SetPosition(wxPoint(*connector["position"]))
+ connectors[i].SetPosition(wx.Point(*connector["position"]))
elif instance["type"] == "rightPowerRail":
rightpowerrail = LD_PowerRail(self, RIGHTRAIL, instance["id"], [True for i in range(len(instance["connectors"]))])
rightpowerrail.SetPosition(instance["x"], instance["y"])
self.AddBlock(rightpowerrail)
connectors = rightpowerrail.GetConnectors()
for i, connector in enumerate(instance["connectors"]):
- connectors[i].SetPosition(wxPoint(*connector["position"]))
+ connectors[i].SetPosition(wx.Point(*connector["position"]))
self.CreateWires(connectors[i], connector["links"], ids)
elif instance["type"] == "contact":
if instance["negated"]:
@@ -418,9 +417,9 @@
contact.SetPosition(instance["x"], instance["y"])
self.AddBlock(contact)
connectors = contact.GetConnectors()
- connectors["input"].SetPosition(wxPoint(*instance["connectors"]["input"]["position"]))
+ connectors["input"].SetPosition(wx.Point(*instance["connectors"]["input"]["position"]))
self.CreateWires(connectors["input"], instance["connectors"]["input"]["links"], ids)
- connectors["output"].SetPosition(wxPoint(*instance["connectors"]["output"]["position"]))
+ connectors["output"].SetPosition(wx.Point(*instance["connectors"]["output"]["position"]))
elif instance["type"] == "coil":
if instance["negated"]:
negated = instance["negated"]
@@ -442,9 +441,9 @@
coil.SetPosition(instance["x"], instance["y"])
self.AddBlock(coil)
connectors = coil.GetConnectors()
- connectors["input"].SetPosition(wxPoint(*instance["connectors"]["input"]["position"]))
+ connectors["input"].SetPosition(wx.Point(*instance["connectors"]["input"]["position"]))
self.CreateWires(connectors["input"], instance["connectors"]["input"]["links"], ids)
- connectors["output"].SetPosition(wxPoint(*instance["connectors"]["output"]["position"]))
+ connectors["output"].SetPosition(wx.Point(*instance["connectors"]["output"]["position"]))
elif instance["type"] == "step":
if instance["initial"]:
initial = instance["initial"]
@@ -460,20 +459,22 @@
step.AddAction()
connectors = step.GetConnectors()
if connectors["input"]:
- connectors["input"].SetPosition(wxPoint(*instance["connectors"]["input"]["position"]))
+ connectors["input"].SetPosition(wx.Point(*instance["connectors"]["input"]["position"]))
self.CreateWires(connectors["input"], instance["connectors"]["input"]["links"], ids)
if connectors["output"]:
- connectors["output"].SetPosition(wxPoint(*instance["connectors"]["output"]["position"]))
+ connectors["output"].SetPosition(wx.Point(*instance["connectors"]["output"]["position"]))
if connectors["action"]:
- connectors["action"].SetPosition(wxPoint(*instance["connectors"]["action"]["position"]))
+ connectors["action"].SetPosition(wx.Point(*instance["connectors"]["action"]["position"]))
elif instance["type"] == "transition":
transition = SFC_Transition(self, instance["condition_type"], instance["condition"], instance["id"])
transition.SetPosition(instance["x"], instance["y"])
self.AddBlock(transition)
connectors = transition.GetConnectors()
- connectors["input"].SetPosition(wxPoint(*instance["connectors"]["input"]["position"]))
+ connectors["input"].SetPosition(wx.Point(*instance["connectors"]["input"]["position"]))
self.CreateWires(connectors["input"], instance["connectors"]["input"]["links"], ids)
- connectors["output"].SetPosition(wxPoint(*instance["connectors"]["output"]["position"]))
+ connectors["output"].SetPosition(wx.Point(*instance["connectors"]["output"]["position"]))
+ if instance["condition_type"] == "connection":
+ self.CreateWires(connectors["connection"], instance["connectors"]["connection"]["links"], ids)
elif instance["type"] in ["selectionDivergence", "selectionConvergence", "simultaneousDivergence", "simultaneousConvergence"]:
if instance["type"] == "selectionDivergence":
divergence = SFC_Divergence(self, SELECTION_DIVERGENCE,
@@ -493,17 +494,17 @@
connectors = divergence.GetConnectors()
for i, input_connector in enumerate(instance["connectors"]["inputs"]):
connector = connectors["inputs"][i]
- connector.SetPosition(wxPoint(*input_connector["position"]))
+ connector.SetPosition(wx.Point(*input_connector["position"]))
self.CreateWires(connector, input_connector["links"], ids)
for i, output_connector in enumerate(instance["connectors"]["outputs"]):
connector = connectors["outputs"][i]
- connector.SetPosition(wxPoint(*output_connector["position"]))
+ connector.SetPosition(wx.Point(*output_connector["position"]))
elif instance["type"] == "jump":
jump = SFC_Jump(self, instance["target"], instance["id"])
jump.SetPosition(instance["x"], instance["y"])
self.AddBlock(jump)
connector = jump.GetConnector()
- connector.SetPosition(wxPoint(*instance["connector"]["position"]))
+ connector.SetPosition(wx.Point(*instance["connector"]["position"]))
self.CreateWires(connector, instance["connector"]["links"], ids)
elif instance["type"] == "actionBlock":
actionBlock = SFC_ActionBlock(self, instance["actions"], instance["id"])
@@ -511,7 +512,7 @@
actionBlock.SetSize(instance["width"], instance["height"])
self.AddBlock(actionBlock)
connector = actionBlock.GetConnector()
- connector.SetPosition(wxPoint(*instance["connector"]["position"]))
+ connector.SetPosition(wx.Point(*instance["connector"]["position"]))
self.CreateWires(connector, instance["connector"]["links"], ids)
else:
if instance["name"] != None:
@@ -524,7 +525,7 @@
connectors = block.GetConnectors()
for i, input_connector in enumerate(instance["connectors"]["inputs"]):
connector = connectors["inputs"][i]
- connector.SetPosition(wxPoint(*input_connector["position"]))
+ connector.SetPosition(wx.Point(*input_connector["position"]))
if input_connector["negated"]:
connector.SetNegated(True)
if input_connector["edge"]:
@@ -536,7 +537,7 @@
connector.SetNegated(True)
if output_connector["edge"]:
connector.SetEdge(output_connector["edge"])
- connector.SetPosition(wxPoint(*output_connector["position"]))
+ connector.SetPosition(wx.Point(*output_connector["position"]))
def CreateWires(self, start_connector, links, ids):
for link in links:
@@ -549,7 +550,7 @@
connected = self.FindElementById(refLocalId)
if connected:
points = link["points"]
- end_connector = connected.GetConnector(wxPoint(points[-1][0], points[-1][1]), link["formalParameter"])
+ end_connector = connected.GetConnector(wx.Point(points[-1][0], points[-1][1]), link["formalParameter"])
if end_connector:
wire = Wire(self)
wire.SetPoints(points)
@@ -682,8 +683,8 @@
self.PopupMenu(self.ContextualMenu)
def EditCommentContent(self, comment):
- dialog = wxTextEntryDialog(self.Parent, "Edit comment", "Please enter comment text", comment.GetContent(), wxOK|wxCANCEL|wxTE_MULTILINE)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.TextEntryDialog(self.Parent, "Edit comment", "Please enter comment text", comment.GetContent(), wx.OK|wx.CANCEL|wx.TE_MULTILINE)
+ if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetValue()
comment.SetContent(value)
infos = {"content" : value}
@@ -790,9 +791,9 @@
connector = self.FindBlockConnector(pos)
if connector:
if (connector.GetDirection() == EAST):
- wire = Wire(self, [wxPoint(pos.x, pos.y), EAST], [wxPoint(pos.x, pos.y), WEST])
+ wire = Wire(self, [wx.Point(pos.x, pos.y), EAST], [wx.Point(pos.x, pos.y), WEST])
else:
- wire = Wire(self, [wxPoint(pos.x, pos.y), WEST], [wxPoint(pos.x, pos.y), EAST])
+ wire = Wire(self, [wx.Point(pos.x, pos.y), WEST], [wx.Point(pos.x, pos.y), EAST])
wire.oldPos = pos
wire.Handle = (HANDLE_POINT, 0)
wire.ProcessDragging(0, 0)
@@ -821,34 +822,34 @@
bbox = self.rubberBand.GetCurrentExtent()
self.rubberBand.OnLeftUp(event, self.GetLogicalDC(), self.Scaling)
if self.Mode == MODE_BLOCK:
- wxCallAfter(self.AddNewBlock, bbox)
+ wx.CallAfter(self.AddNewBlock, bbox)
elif self.Mode == MODE_VARIABLE:
- wxCallAfter(self.AddNewVariable, bbox)
+ wx.CallAfter(self.AddNewVariable, bbox)
elif self.Mode == MODE_CONNECTION:
- wxCallAfter(self.AddNewConnection, bbox)
+ wx.CallAfter(self.AddNewConnection, bbox)
elif self.Mode == MODE_COMMENT:
- wxCallAfter(self.AddNewComment, bbox)
+ wx.CallAfter(self.AddNewComment, bbox)
elif self.Mode == MODE_CONTACT:
- wxCallAfter(self.AddNewContact, bbox)
+ wx.CallAfter(self.AddNewContact, bbox)
elif self.Mode == MODE_COIL:
- wxCallAfter(self.AddNewContact, bbox)
+ wx.CallAfter(self.AddNewContact, bbox)
elif self.Mode == MODE_POWERRAIL:
- wxCallAfter(self.AddNewPowerRail, bbox)
+ wx.CallAfter(self.AddNewPowerRail, bbox)
elif self.Mode == MODE_INITIALSTEP:
- wxCallAfter(self.AddNewInitialStep, bbox)
+ wx.CallAfter(self.AddNewInitialStep, bbox)
elif self.Mode == MODE_STEP:
- wxCallAfter(self.AddNewStep, bbox)
+ wx.CallAfter(self.AddNewStep, bbox)
elif self.Mode == MODE_TRANSITION:
- wxCallAfter(self.AddNewTransition, bbox)
+ wx.CallAfter(self.AddNewTransition, bbox)
elif self.Mode == MODE_DIVERGENCE:
- wxCallAfter(self.AddNewDivergence, bbox)
+ wx.CallAfter(self.AddNewDivergence, bbox)
elif self.Mode == MODE_JUMP:
- wxCallAfter(self.AddNewJump, bbox)
+ wx.CallAfter(self.AddNewJump, bbox)
elif self.Mode == MODE_ACTION:
- wxCallAfter(self.AddNewActionBlock, bbox)
+ wx.CallAfter(self.AddNewActionBlock, bbox)
elif self.Mode == MODE_SELECTION and self.SelectedElement:
self.SelectedElement.OnLeftUp(event, self.GetLogicalDC(), self.Scaling)
- wxCallAfter(self.SetCursor, wxNullCursor)
+ wx.CallAfter(self.SetCursor, wx.NullCursor)
self.ReleaseMouse()
self.Refresh()
elif self.Mode == MODE_WIRE and self.SelectedElement:
@@ -864,7 +865,7 @@
self.SelectedElement = None
self.Refresh()
if not self.SavedMode:
- wxCallAfter(self.Parent.ResetCurrentMode)
+ wx.CallAfter(self.Parent.ResetCurrentMode)
event.Skip()
def OnViewerRightUp(self, event):
@@ -876,7 +877,7 @@
self.SelectedElement = element
self.SelectedElement.SetSelected(True)
self.SelectedElement.OnRightUp(event, self.GetLogicalDC(), self.Scaling)
- wxCallAfter(self.SetCursor, wxNullCursor)
+ wx.CallAfter(self.SetCursor, wx.NullCursor)
self.ReleaseMouse()
self.Refresh()
event.Skip()
@@ -904,7 +905,7 @@
self.Refresh()
if (event.Dragging() and self.SelectedElement) or self.rubberBand.IsShown():
position = event.GetPosition()
- move_window = wxPoint()
+ move_window = wx.Point()
window_size = self.GetClientSize()
xstart, ystart = self.GetViewStart()
if position.x < SCROLL_ZONE and xstart > 0:
@@ -925,22 +926,22 @@
#-------------------------------------------------------------------------------
def OnChar(self, event):
- xpos, ypos = self.GetScrollPos(wxHORIZONTAL), self.GetScrollPos(wxVERTICAL)
- xmax = self.GetScrollRange(wxHORIZONTAL) - self.GetScrollThumb(wxHORIZONTAL)
- ymax = self.GetScrollRange(wxVERTICAL) - self.GetScrollThumb(wxVERTICAL)
+ xpos, ypos = self.GetScrollPos(wx.HORIZONTAL), self.GetScrollPos(wx.VERTICAL)
+ xmax = self.GetScrollRange(wx.HORIZONTAL) - self.GetScrollThumb(wx.HORIZONTAL)
+ ymax = self.GetScrollRange(wx.VERTICAL) - self.GetScrollThumb(wx.VERTICAL)
keycode = event.GetKeyCode()
if self.Scaling:
scaling = self.Scaling
else:
scaling = (8, 8)
- if keycode == WXK_DELETE and self.SelectedElement:
+ if keycode == wx.WXK_DELETE and self.SelectedElement:
self.SelectedElement.Clean()
self.SelectedElement.Delete()
self.SelectedElement = None
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh()
- elif keycode == WXK_LEFT:
+ elif keycode == wx.WXK_LEFT:
if event.ControlDown() and event.ShiftDown():
self.Scroll(0, ypos)
elif event.ControlDown():
@@ -950,7 +951,7 @@
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh()
- elif keycode == WXK_RIGHT:
+ elif keycode == wx.WXK_RIGHT:
if event.ControlDown() and event.ShiftDown():
self.Scroll(xmax, ypos)
elif event.ControlDown():
@@ -960,7 +961,7 @@
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh()
- elif keycode == WXK_UP:
+ elif keycode == wx.WXK_UP:
if event.ControlDown() and event.ShiftDown():
self.Scroll(xpos, 0)
elif event.ControlDown():
@@ -970,7 +971,7 @@
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh()
- elif keycode == WXK_DOWN:
+ elif keycode == wx.WXK_DOWN:
if event.ControlDown() and event.ShiftDown():
self.Scroll(xpos, ymax)
elif event.ControlDown():
@@ -989,7 +990,7 @@
dialog = BlockPropertiesDialog(self.Parent)
dialog.SetBlockList(self.Controler.GetBlockTypes())
dialog.SetMinBlockSize((bbox.width, bbox.height))
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
id = self.GetNewId()
values = dialog.GetValues()
if "name" in values:
@@ -1018,7 +1019,7 @@
if returntype:
varlist.append((self.Controler.GetCurrentElementEditingName(), "Output", returntype))
dialog.SetVariables(varlist)
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
id = self.GetNewId()
values = dialog.GetValues()
variable = FBD_Variable(self, values["type"], values["name"], values["value_type"], id)
@@ -1035,7 +1036,7 @@
def AddNewConnection(self, bbox):
dialog = ConnectionPropertiesDialog(self.Parent)
dialog.SetMinConnectionSize((bbox.width, bbox.height))
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
id = self.GetNewId()
values = dialog.GetValues()
connection = FBD_Connector(self, values["type"], values["name"], id)
@@ -1050,8 +1051,8 @@
dialog.Destroy()
def AddNewComment(self, bbox):
- dialog = wxTextEntryDialog(self.Parent, "Add a new comment", "Please enter comment text", "", wxOK|wxCANCEL|wxTE_MULTILINE)
- if dialog.ShowModal() == wxID_OK:
+ dialog = wx.TextEntryDialog(self.Parent, "Add a new comment", "Please enter comment text", "", wx.OK|wx.CANCEL|wx.TE_MULTILINE)
+ if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetValue()
id = self.GetNewId()
comment = Comment(self, value, id)
@@ -1077,7 +1078,7 @@
dialog.SetVariables(varlist)
dialog.SetValues({"name":"","type":CONTACT_NORMAL})
dialog.SetElementSize((bbox.width, bbox.height))
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
id = self.GetNewId()
values = dialog.GetValues()
contact = LD_Contact(self, values["type"], values["name"], id)
@@ -1105,7 +1106,7 @@
dialog.SetVariables(varlist)
dialog.SetValues({"name":"","type":COIL_NORMAL})
dialog.SetElementSize((bbox.width, bbox.height))
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
id = self.GetNewId()
values = dialog.GetValues()
coil = LD_Coil(self, values["type"], values["name"], id)
@@ -1122,7 +1123,7 @@
def AddNewPowerRail(self, bbox):
dialog = LDPowerRailDialog(self.Parent)
dialog.SetMinSize((bbox.width, bbox.height))
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
id = self.GetNewId()
values = dialog.GetValues()
powerrail = LD_PowerRail(self, values["type"], id, [True for i in xrange(values["number"])])
@@ -1139,7 +1140,7 @@
def AddNewTransition(self, bbox):
dialog = TransitionContentDialog(self.Parent)
dialog.SetTransitions(self.Controler.GetCurrentElementEditingTransitions())
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
id = self.GetNewId()
values = dialog.GetValues()
transition = SFC_Transition(self, values["type"], values["value"], id)
@@ -1157,7 +1158,7 @@
def AddNewDivergence(self, bbox):
dialog = DivergenceCreateDialog(self.Parent)
dialog.SetMinSize((bbox.width, bbox.height))
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
id = self.GetNewId()
values = dialog.GetValues()
divergence = SFC_Divergence(self, values["type"], values["number"], id)
@@ -1184,7 +1185,7 @@
values = {"name" : block.GetName(), "type" : block.GetType(), "inputs" : block.GetInputTypes()}
values["extension"] = block.GetExtension()
dialog.SetValues(values)
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
if "name" in values:
block.SetName(values["name"])
@@ -1210,7 +1211,7 @@
dialog.SetVariables(varlist)
values = {"name" : variable.GetName(), "type" : variable.GetType()}
dialog.SetValues(values)
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
old_type = variable.GetType()
values = dialog.GetValues()
variable.SetName(values["name"])
@@ -1231,7 +1232,7 @@
dialog.SetMinConnectionSize(connection.GetSize())
values = {"name" : connection.GetName(), "type" : connection.GetType()}
dialog.SetValues(values)
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
old_type = connection.GetType()
values = dialog.GetValues()
connection.SetName(values["name"])
@@ -1259,7 +1260,7 @@
values = {"name" : contact.GetName(), "type" : contact.GetType()}
dialog.SetValues(values)
dialog.SetElementSize(contact.GetSize())
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
contact.SetName(values["name"])
contact.SetType(values["type"])
@@ -1285,12 +1286,12 @@
values = {"name" : coil.GetName(), "type" : coil.GetType()}
dialog.SetValues(values)
dialog.SetElementSize(coil.GetSize())
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
coil.SetName(values["name"])
coil.SetType(values["type"])
coil.SetSize(values["width"], values["height"])
- self.RefreshContactModel(coil)
+ self.RefreshCoilModel(coil)
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh()
@@ -1299,7 +1300,7 @@
def EditPowerRailContent(self, powerrail):
dialog = LDPowerRailDialog(self.Parent, powerrail.GetType(), len(powerrail.GetConnectors()))
dialog.SetMinSize(powerrail.GetSize())
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
old_type = powerrail.GetType()
values = dialog.GetValues()
powerrail.SetType(values["type"], [True for i in xrange(values["number"])])
@@ -1313,43 +1314,52 @@
self.RefreshScrollBars()
self.Refresh()
dialog.Destroy()
-##
-##
-## def AddNewTransition(self, bbox):
-## dialog = TransitionContentDialog(self.Parent)
-## dialog.SetTransitions(self.Controler.GetCurrentElementEditingTransitions())
-## if dialog.ShowModal() == wxID_OK:
-## id = self.GetNewId()
-## values = dialog.GetValues()
-## transition = SFC_Transition(self, values["type"], values["value"], id)
-## transition.SetPosition(bbox.x, bbox.y)
-## min_width, min_height = transition.GetMinSize()
-## transition.SetSize(max(bbox.width, min_width), max(bbox.height, min_height))
-## self.Blocks.append(transition)
-## self.Elements.append(transition)
-## self.Controler.AddCurrentElementEditingTransition(id)
-## self.RefreshTransitionModel(transition)
-## self.RefreshScrollBars()
-## self.Refresh()
-## dialog.Destroy()
-##
-## def AddNewDivergence(self, bbox):
-## dialog = DivergenceCreateDialog(self.Parent)
-## dialog.SetMinSize((bbox.width, bbox.height))
-## if dialog.ShowModal() == wxID_OK:
-## id = self.GetNewId()
-## values = dialog.GetValues()
-## divergence = SFC_Divergence(self, values["type"], values["number"], id)
-## divergence.SetPosition(bbox.x, bbox.y)
-## min_width, min_height = divergence.GetMinSize()
-## divergence.SetSize(max(bbox.width, min_width), max(bbox.height, min_height))
-## self.Blocks.append(divergence)
-## self.Elements.append(divergence)
-## self.Controler.AddCurrentElementEditingDivergence(id, values["type"])
-## self.RefreshDivergenceModel(divergence)
-## self.RefreshScrollBars()
-## self.Refresh()
-## dialog.Destroy()
+
+
+ def EditTransitionContent(self, transition):
+ dialog = TransitionContentDialog(self.Parent, self.GetDrawingMode() == FREEDRAWING_MODE)
+ dialog.SetTransitions(self.Controler.GetCurrentElementEditingTransitions())
+ dialog.SetValues({"type":transition.GetType(),"value":transition.GetCondition()})
+ dialog.SetElementSize(transition.GetSize())
+ if dialog.ShowModal() == wx.ID_OK:
+ values = dialog.GetValues()
+ transition.SetType(values["type"],values["value"])
+ transition.RefreshModel()
+ self.RefreshBuffer()
+ self.RefreshScrollBars()
+ self.Refresh()
+ dialog.Destroy()
+
+ def EditJumpContent(self, jump):
+ choices = []
+ for block in self.Blocks:
+ if isinstance(block, SFC_Step):
+ choices.append(block.GetName())
+ dialog = wx.SingleChoiceDialog(self.Parent, "Edit jump target", "Please choose a target", choices, wx.OK|wx.CANCEL)
+ dialog.SetSelection(choices.index(jump.GetTarget()))
+ if dialog.ShowModal() == wx.ID_OK:
+ value = dialog.GetStringSelection()
+ jump.SetTarget(value)
+ jump.RefreshModel()
+ self.RefreshBuffer()
+ self.RefreshScrollBars()
+ self.Refresh()
+ dialog.Destroy()
+
+ def EditActionBlockContent(self, actionblock):
+ dialog = ActionBlockDialog(self.Parent)
+ dialog.SetQualifierList(self.Controler.GetQualifierTypes())
+ dialog.SetActionList(self.Controler.GetCurrentElementEditingActions())
+ dialog.SetVariableList(self.Controler.GetCurrentElementEditingInterfaceVars())
+ dialog.SetValues(actionblock.GetActions())
+ if dialog.ShowModal() == wx.ID_OK:
+ actions = dialog.GetValues()
+ actionblock.SetActions(actions)
+ actionblock.RefreshModel()
+ self.RefreshBuffer()
+ self.RefreshScrollBars()
+ self.Refresh()
+ dialog.Destroy()
#-------------------------------------------------------------------------------
# Model update functions
@@ -1627,7 +1637,7 @@
def OnPaint(self, event):
dc = self.GetLogicalDC()
dc.Clear()
- dc.SetPen(wxPen(wxColour(230, 230, 230)))
+ dc.SetPen(wx.Pen(wx.Colour(230, 230, 230)))
if self.Scaling and self.DrawGrid:
width, height = dc.GetSize()
for i in xrange(1, width / self.Scaling[0] + 1):
--- a/graphics/FBD_Objects.py Tue Aug 07 17:37:38 2007 +0200
+++ b/graphics/FBD_Objects.py Tue Aug 07 17:38:48 2007 +0200
@@ -22,7 +22,6 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from wxPython.wx import *
import wx
from GraphicCommons import *
@@ -69,7 +68,7 @@
# Refresh the size of text for name
def RefreshNameSize(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
self.NameSize = dc.GetTextExtent(self.Name)
# Refresh the block bounding box
@@ -85,7 +84,7 @@
else:
bbx_y = self.Pos.y
bbx_height = self.Size[1]
- self.BoundingBox = wxRect(bbx_x, bbx_y, bbx_width + 1, bbx_height + 1)
+ self.BoundingBox = wx.Rect(bbx_x, bbx_y, bbx_width + 1, bbx_height + 1)
# Refresh the positions of the block connectors
def RefreshConnectors(self):
@@ -95,12 +94,12 @@
# Update inputs positions
position = BLOCK_LINE_SIZE + linesize / 2
for input in self.Inputs:
- input.SetPosition(wxPoint(0, position))
+ input.SetPosition(wx.Point(0, position))
position += linesize
# Update outputs positions
position = BLOCK_LINE_SIZE + linesize / 2
for output in self.Outputs:
- output.SetPosition(wxPoint(self.Size[0], position))
+ output.SetPosition(wx.Point(self.Size[0], position))
position += linesize
self.RefreshConnected()
@@ -158,7 +157,7 @@
if type != self.Type or self.Extension != extension:
if type != self.Type:
self.Type = type
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
self.TypeSize = dc.GetTextExtent(self.Type)
self.Extension = extension
# Find the block definition from type given and create the corresponding
@@ -178,7 +177,7 @@
# Extract the inputs properties and create the corresponding connector
self.Inputs = []
for input_name, input_type, input_modifier in inputs:
- connector = Connector(self, input_name, input_type, wxPoint(0, 0), WEST, onlyone = True)
+ connector = Connector(self, input_name, input_type, wx.Point(0, 0), WEST, onlyone = True)
if input_modifier == "negated":
connector.SetNegated(True)
elif input_modifier != "none":
@@ -187,7 +186,7 @@
# Extract the outputs properties and create the corresponding connector
self.Outputs = []
for output_name, output_type, output_modifier in outputs:
- connector = Connector(self, output_name, output_type, wxPoint(0, 0), EAST)
+ connector = Connector(self, output_name, output_type, wx.Point(0, 0), EAST)
if output_modifier == "negated":
connector.SetNegated(True)
elif output_modifier != "none":
@@ -278,8 +277,8 @@
# Draws block
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxWHITE_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.WHITE_BRUSH)
# Draw a rectangle with the block size
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
# Draw block name and block type
@@ -335,7 +334,7 @@
# Refresh the size of text for name
def RefreshNameSize(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
self.NameSize = dc.GetTextExtent(self.Name)
# Refresh the variable bounding box
@@ -348,14 +347,14 @@
bbx_width = self.Size[0] + 2 * CONNECTOR_SIZE
else:
bbx_width = self.Size[0] + CONNECTOR_SIZE
- self.BoundingBox = wxRect(bbx_x, self.Pos.y, bbx_width + 1, self.Size[1] + 1)
+ self.BoundingBox = wx.Rect(bbx_x, self.Pos.y, bbx_width + 1, self.Size[1] + 1)
# Refresh the position of the variable connector
def RefreshConnectors(self):
if self.Input:
- self.Input.SetPosition(wxPoint(0, self.Size[1] / 2))
+ self.Input.SetPosition(wx.Point(0, self.Size[1] / 2))
if self.Output:
- self.Output.SetPosition(wxPoint(self.Size[0], self.Size[1] / 2))
+ self.Output.SetPosition(wx.Point(self.Size[0], self.Size[1] / 2))
self.RefreshConnected()
# Refresh the position of wires connected to connector
@@ -414,9 +413,9 @@
self.Output = None
# Create an input or output connector according to variable type
if self.Type != INPUT:
- self.Input = Connector(self, "", value_type, wxPoint(0, 0), WEST, onlyone = True)
+ self.Input = Connector(self, "", value_type, wx.Point(0, 0), WEST, onlyone = True)
if self.Type != OUTPUT:
- self.Output = Connector(self, "", value_type, wxPoint(0, 0), EAST)
+ self.Output = Connector(self, "", value_type, wx.Point(0, 0), EAST)
self.RefreshConnectors()
elif value_type != self.ValueType:
if self.Input:
@@ -469,8 +468,8 @@
# Draws variable
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxWHITE_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.WHITE_BRUSH)
# Draw a rectangle with the variable size
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
# Draw variable name
@@ -500,13 +499,13 @@
self.Type = type
self.Name = name
self.Id = id
- self.Pos = wxPoint(0, 0)
- self.Size = wxSize(0, 0)
+ self.Pos = wx.Point(0, 0)
+ self.Size = wx.Size(0, 0)
# Create an input or output connector according to connection type
if self.Type == CONNECTOR:
- self.Connector = Connector(self, "", "ANY", wxPoint(0, 0), WEST, onlyone = True)
- else:
- self.Connector = Connector(self, "", "ANY", wxPoint(0, 0), EAST)
+ self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), WEST, onlyone = True)
+ else:
+ self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), EAST)
self.RefreshConnectors()
self.RefreshNameSize()
@@ -525,7 +524,7 @@
# Refresh the size of text for name
def RefreshNameSize(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
self.NameSize = dc.GetTextExtent(self.Name)
# Refresh the connection bounding box
@@ -535,14 +534,14 @@
else:
bbx_x = self.Pos.x
bbx_width = self.Size[0] + CONNECTOR_SIZE
- self.BoundingBox = wxRect(bbx_x, self.Pos.y, bbx_width, self.Size[1])
+ self.BoundingBox = wx.Rect(bbx_x, self.Pos.y, bbx_width, self.Size[1])
# Refresh the position of the connection connector
def RefreshConnectors(self):
if self.Type == CONNECTOR:
- self.Connector.SetPosition(wxPoint(0, self.Size[1] / 2))
- else:
- self.Connector.SetPosition(wxPoint(self.Size[0], self.Size[1] / 2))
+ self.Connector.SetPosition(wx.Point(0, self.Size[1] / 2))
+ else:
+ self.Connector.SetPosition(wx.Point(self.Size[0], self.Size[1] / 2))
self.RefreshConnected()
# Refresh the position of wires connected to connector
@@ -567,9 +566,9 @@
self.Clean()
# Create an input or output connector according to connection type
if self.Type == CONNECTOR:
- self.Connector = Connector(self, "", "ANY", wxPoint(0, 0), WEST, onlyone = True)
+ self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), WEST, onlyone = True)
else:
- self.Connector = Connector(self, "", "ANY", wxPoint(0, 0), EAST)
+ self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), EAST)
self.RefreshConnectors()
# Returns the connection type
@@ -613,8 +612,8 @@
# Draws connection
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxWHITE_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.WHITE_BRUSH)
# Draw a rectangle with the connection size with arrows in
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
arrowsize = min(self.Size[1] / 2, (self.Size[0] - self.NameSize[0] - 10) / 2)
--- a/graphics/GraphicCommons.py Tue Aug 07 17:37:38 2007 +0200
+++ b/graphics/GraphicCommons.py Tue Aug 07 17:38:48 2007 +0200
@@ -22,7 +22,6 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from wxPython.wx import *
import wx
from math import *
@@ -91,12 +90,12 @@
def ResetCursors():
global CURSORS
if CURSORS == None:
- CURSORS = [wxNullCursor,
- wxStockCursor(wxCURSOR_HAND),
- wxStockCursor(wxCURSOR_SIZENWSE),
- wxStockCursor(wxCURSOR_SIZENESW),
- wxStockCursor(wxCURSOR_SIZEWE),
- wxStockCursor(wxCURSOR_SIZENS)]
+ CURSORS = [wx.NullCursor,
+ wx.StockCursor(wx.CURSOR_HAND),
+ wx.StockCursor(wx.CURSOR_SIZENWSE),
+ wx.StockCursor(wx.CURSOR_SIZENESW),
+ wx.StockCursor(wx.CURSOR_SIZEWE),
+ wx.StockCursor(wx.CURSOR_SIZENS)]
HANDLE_CURSORS = {
(1, 1) : 2,
@@ -197,15 +196,15 @@
pos = GetScaledEventPosition(event, dc, scaling)
# Save the point for calculate the box position and size
self.startPoint = pos
- self.currentBox = wxRect(pos.x, pos.y, 0, 0)
- self.drawingSurface.SetCursor(wxStockCursor(wxCURSOR_CROSS))
+ self.currentBox = wx.Rect(pos.x, pos.y, 0, 0)
+ self.drawingSurface.SetCursor(wx.StockCursor(wx.CURSOR_CROSS))
self.Redraw()
# Method called when dragging with a box edited
def OnMotion(self, event, dc, scaling):
pos = GetScaledEventPosition(event, dc, scaling)
# Save the last position and size of the box for erasing it
- self.lastBox = wxRect(self.currentBox.x, self.currentBox.y, self.currentBox.width,
+ self.lastBox = wx.Rect(self.currentBox.x, self.currentBox.y, self.currentBox.width,
self.currentBox.height)
# Calculate new position and size of the box
if pos.x >= self.startPoint.x:
@@ -224,7 +223,7 @@
# Method called when dragging is stopped
def OnLeftUp(self, event, dc, scaling):
- self.drawingSurface.SetCursor(wxNullCursor)
+ self.drawingSurface.SetCursor(wx.NullCursor)
self.lastBox = self.currentBox
self.currentBox = None
self.Redraw()
@@ -232,9 +231,9 @@
# Method that erase the last box and draw the new box
def Redraw(self):
dc = self.drawingSurface.GetLogicalDC()
- dc.SetPen(wxPen(wxWHITE, 1, wxDOT))
- dc.SetBrush(wxTRANSPARENT_BRUSH)
- dc.SetLogicalFunction(wxXOR)
+ dc.SetPen(wx.Pen(wx.WHITE, 1, wx.DOT))
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
+ dc.SetLogicalFunction(wx.XOR)
if self.lastBox:
# Erase last box
dc.DrawRectangle(self.lastBox.x, self.lastBox.y, self.lastBox.width,
@@ -247,9 +246,9 @@
# Erase last box
def Erase(self):
dc = self.drawingSurface.GetLogicalDC()
- dc.SetPen(wxPen(wxWHITE, 1, wxDOT))
- dc.SetBrush(wxTRANSPARENT_BRUSH)
- dc.SetLogicalFunction(wxXOR)
+ dc.SetPen(wx.Pen(wx.WHITE, 1, wx.DOT))
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
+ dc.SetLogicalFunction(wx.XOR)
if self.lastBox:
dc.DrawRectangle(self.lastBox.x, self.lastBox.y, self.lastBox.width,
self.lastBox.height)
@@ -257,9 +256,9 @@
# Draw current box
def Draw(self):
dc = self.drawingSurface.GetLogicalDC()
- dc.SetPen(wxPen(wxWHITE, 1, wxDOT))
- dc.SetBrush(wxTRANSPARENT_BRUSH)
- dc.SetLogicalFunction(wxXOR)
+ dc.SetPen(wx.Pen(wx.WHITE, 1, wx.DOT))
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
+ dc.SetLogicalFunction(wx.XOR)
if self.currentBox:
# Draw current box
dc.DrawRectangle(self.currentBox.x, self.currentBox.y, self.currentBox.width,
@@ -284,9 +283,9 @@
self.Handle = False
self.Dragging = False
self.Selected = False
- self.Pos = wxPoint(0, 0)
- self.Size = wxSize(0, 0)
- self.BoundingBox = wxRect(0, 0, 0, 0)
+ self.Pos = wx.Point(0, 0)
+ self.Size = wx.Size(0, 0)
+ self.BoundingBox = wx.Rect(0, 0, 0, 0)
self.CurrentCursor = 0
ResetCursors()
@@ -318,7 +317,7 @@
# Refresh the element Bounding Box
def RefreshBoundingBox(self):
- self.BoundingBox = wxRect(self.Pos.x, self.Pos.y, self.Size[0], self.Size[1])
+ self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, self.Size[0], self.Size[1])
# Refresh the element connectors position
def RefreshConnectors(self):
@@ -363,9 +362,9 @@
# Test if the point is on a handle of this element
def TestHandle(self, pt):
- extern_rect = wxRect(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y - HANDLE_SIZE - 2,
+ extern_rect = wx.Rect(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y - HANDLE_SIZE - 2,
self.BoundingBox.width + 2 * HANDLE_SIZE + 4, self.BoundingBox.height + 2 * HANDLE_SIZE + 4)
- intern_rect = wxRect(self.BoundingBox.x - 2, self.BoundingBox.y - 2,
+ intern_rect = wx.Rect(self.BoundingBox.x - 2, self.BoundingBox.y - 2,
self.BoundingBox.width + 4, self.BoundingBox.height + 4)
# Verify that this element is selected
if self.Selected and extern_rect.InsideXY(pt.x, pt.y) and not intern_rect.InsideXY(pt.x, pt.y):
@@ -507,8 +506,8 @@
# Draws the handles of this element if it is selected
def Draw(self, dc):
if self.Selected:
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxBLACK_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.BLACK_BRUSH)
dc.DrawRectangle(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y - HANDLE_SIZE - 2, HANDLE_SIZE, HANDLE_SIZE)
dc.DrawRectangle(self.BoundingBox.x + (self.BoundingBox.width - HANDLE_SIZE) / 2,
self.BoundingBox.y - HANDLE_SIZE - 2, HANDLE_SIZE, HANDLE_SIZE)
@@ -522,7 +521,7 @@
self.BoundingBox.y + self.BoundingBox.height + 2, HANDLE_SIZE, HANDLE_SIZE)
dc.DrawRectangle(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y + self.BoundingBox.height + 2, HANDLE_SIZE, HANDLE_SIZE)
dc.DrawRectangle(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y + (self.BoundingBox.height - HANDLE_SIZE) / 2, HANDLE_SIZE, HANDLE_SIZE)
- dc.SetBrush(wxWHITE_BRUSH)
+ dc.SetBrush(wx.WHITE_BRUSH)
#-------------------------------------------------------------------------------
@@ -632,9 +631,9 @@
miny = min(miny, bbox.y)
maxx = max(maxx, bbox.x + bbox.width)
maxy = max(maxy, bbox.y + bbox.height)
- self.BoundingBox = wxRect(minx, miny, maxx - minx, maxy - miny)
+ self.BoundingBox = wx.Rect(minx, miny, maxx - minx, maxy - miny)
else:
- self.BoundingBox = wxRect(0, 0, 0, 0)
+ self.BoundingBox = wx.Rect(0, 0, 0, 0)
# Forbids to change the group position
def SetPosition(x, y):
@@ -684,7 +683,7 @@
self.Negated = negated
self.Edge = edge
self.OneConnected = onlyone
- self.Pen = wxBLACK_PEN
+ self.Pen = wx.BLACK_PEN
self.RefreshNameSize()
# Change the connector pen
@@ -693,7 +692,7 @@
# Make a clone of the connector
def Clone(self):
- return Connector(self.ParentBlock, self.Name, self.Type, wxPoint(self.Pos[0], self.Pos[1]),
+ return Connector(self.ParentBlock, self.Name, self.Type, wx.Point(self.Pos[0], self.Pos[1]),
self.Direction, self.Negated)
# Returns the connector parent block
@@ -720,7 +719,7 @@
# Changes the connector name size
def RefreshNameSize(self):
if self.Name != "":
- dc = wxClientDC(self.ParentBlock.Parent)
+ dc = wx.ClientDC(self.ParentBlock.Parent)
self.NameSize = dc.GetTextExtent(self.Name)
else:
self.NameSize = 0, 0
@@ -751,7 +750,7 @@
else:
x = parent_pos[0] + self.Pos.x
y = parent_pos[1] + self.Pos.y
- return wxPoint(x, y)
+ return wx.Point(x, y)
# Change the connector relative position
def SetPosition(self, pos):
@@ -820,9 +819,9 @@
for wire, index in self.Wires:
if wire not in exclude:
if index == 0:
- wire.MoveStartPoint(wxPoint(x, y))
+ wire.MoveStartPoint(wx.Point(x, y))
else:
- wire.MoveEndPoint(wxPoint(x, y))
+ wire.MoveEndPoint(wx.Point(x, y))
# Refreshes the model of all the wires connected
def RefreshWires(self):
@@ -839,9 +838,9 @@
for wire, handle in self.Wires:
# Get other connector connected to each wire
if handle == 0:
- connector = blocks.GetEndConnected()
+ connector = wire.GetEndConnected()
else:
- connector = blocks.GetStartConnected()
+ connector = wire.GetStartConnected()
# Get parent block for this connector
if connector:
block = connector.GetParentBlock()
@@ -876,14 +875,14 @@
y = parent_pos[1] + self.Pos.y + self.Direction[1] * CONNECTOR_SIZE - ANCHOR_DISTANCE
width = ANCHOR_DISTANCE * 2 + abs(self.Direction[0]) * CONNECTOR_SIZE
height = ANCHOR_DISTANCE * 2 + abs(self.Direction[1]) * CONNECTOR_SIZE
- rect = wxRect(x, y, width, height)
+ rect = wx.Rect(x, y, width, height)
return rect.InsideXY(pt.x, pt.y)
return False
# Draws the connector
def Draw(self, dc):
dc.SetPen(self.Pen)
- dc.SetBrush(wxWHITE_BRUSH)
+ dc.SetBrush(wx.WHITE_BRUSH)
parent_pos = self.ParentBlock.GetPosition()
if self.Negated:
# If connector is negated, draw a circle
@@ -988,25 +987,25 @@
# The selected segment is reinitialised
if segment == None:
if self.StartConnected:
- self.StartConnected.SetPen(wxBLACK_PEN)
+ self.StartConnected.SetPen(wx.BLACK_PEN)
if self.EndConnected:
- self.EndConnected.SetPen(wxBLACK_PEN)
+ self.EndConnected.SetPen(wx.BLACK_PEN)
# The segment selected is the first
elif segment == 0:
if self.StartConnected:
- self.StartConnected.SetPen(wxRED_PEN)
+ self.StartConnected.SetPen(wx.RED_PEN)
if self.EndConnected:
# There is only one segment
if len(self.Segments) == 1:
- self.EndConnected.SetPen(wxRED_PEN)
+ self.EndConnected.SetPen(wx.RED_PEN)
else:
- self.EndConnected.SetPen(wxBLACK_PEN)
+ self.EndConnected.SetPen(wx.BLACK_PEN)
# The segment selected is the last
elif segment == len(self.Segments) - 1:
if self.StartConnected:
- self.StartConnected.SetPen(wxBLACK_PEN)
+ self.StartConnected.SetPen(wx.BLACK_PEN)
if self.EndConnected:
- self.EndConnected.SetPen(wxRED_PEN)
+ self.EndConnected.SetPen(wx.RED_PEN)
self.SelectedSegment = segment
# Reinitialize the wire points
@@ -1043,9 +1042,9 @@
maxx, maxbbxx = max(maxx, self.Points[-1].x), max(maxbbxx, self.Points[-1].x + end_radius)
miny, minbbxy = min(miny, self.Points[-1].y), min(minbbxy, self.Points[-1].y - end_radius)
maxy, maxbbxy = max(maxy, self.Points[-1].y), max(maxbbxy, self.Points[-1].y + end_radius)
- self.Pos = wxPoint(minx, miny)
- self.Size = wxSize(maxx -minx + 1, maxy - miny + 1)
- self.BoundingBox = wxRect(minbbxx, minbbxy, maxbbxx - minbbxx + 1, maxbbxy - minbbxy + 1)
+ self.Pos = wx.Point(minx, miny)
+ self.Size = wx.Size(maxx -minx + 1, maxy - miny + 1)
+ self.BoundingBox = wx.Rect(minbbxx, minbbxy, maxbbxx - minbbxx + 1, maxbbxy - minbbxy + 1)
# Refresh the realpoints that permits to keep the proportionality in wire during resizing
def RefreshRealPoints(self):
@@ -1082,11 +1081,11 @@
def HitTest(self, pt):
test = False
for i in xrange(len(self.Points) - 1):
- rect = wxRect(0, 0, 0, 0)
+ rect = wx.Rect(0, 0, 0, 0)
x1, y1 = self.Points[i].x, self.Points[i].y
x2, y2 = self.Points[i + 1].x, self.Points[i + 1].y
# Calculate a rectangle around the segment
- rect = wxRect(min(x1, x2) - ANCHOR_DISTANCE, min(y1, y2) - ANCHOR_DISTANCE,
+ rect = wx.Rect(min(x1, x2) - ANCHOR_DISTANCE, min(y1, y2) - ANCHOR_DISTANCE,
abs(x1 - x2) + 2 * ANCHOR_DISTANCE, abs(y1 - y2) + 2 * ANCHOR_DISTANCE)
test |= rect.InsideXY(pt.x, pt.y)
return test
@@ -1094,13 +1093,13 @@
# Returns the wire start or end point if the point given is on one of them
def TestPoint(self, pt):
# Test the wire start point
- rect = wxRect(self.Points[0].x - ANCHOR_DISTANCE, self.Points[0].y - ANCHOR_DISTANCE,
+ rect = wx.Rect(self.Points[0].x - ANCHOR_DISTANCE, self.Points[0].y - ANCHOR_DISTANCE,
2 * ANCHOR_DISTANCE, 2 * ANCHOR_DISTANCE)
if rect.InsideXY(pt.x, pt.y):
return 0
# Test the wire end point
if len(self.Points) > 1:
- rect = wxRect(self.Points[-1].x - ANCHOR_DISTANCE, self.Points[-1].y - ANCHOR_DISTANCE,
+ rect = wx.Rect(self.Points[-1].x - ANCHOR_DISTANCE, self.Points[-1].y - ANCHOR_DISTANCE,
2 * ANCHOR_DISTANCE, 2 * ANCHOR_DISTANCE)
if rect.InsideXY(pt.x, pt.y):
return -1
@@ -1114,7 +1113,7 @@
x1, y1 = self.Points[i].x, self.Points[i].y
x2, y2 = self.Points[i + 1].x, self.Points[i + 1].y
# Calculate a rectangle around the segment
- rect = wxRect(min(x1, x2) - ANCHOR_DISTANCE, min(y1, y2) - ANCHOR_DISTANCE,
+ rect = wx.Rect(min(x1, x2) - ANCHOR_DISTANCE, min(y1, y2) - ANCHOR_DISTANCE,
abs(x1 - x2) + 2 * ANCHOR_DISTANCE, abs(y1 - y2) + 2 * ANCHOR_DISTANCE)
if rect.InsideXY(pt.x, pt.y):
return i, self.Segments[i]
@@ -1123,14 +1122,14 @@
# Define the wire points
def SetPoints(self, points):
if len(points) > 1:
- self.Points = [wxPoint(x, y) for x, y in points]
+ self.Points = [wx.Point(x, y) for x, y in points]
# Calculate the start and end directions
self.StartPoint = [None, vector(self.Points[0], self.Points[1])]
self.EndPoint = [None, vector(self.Points[-1], self.Points[-2])]
# Calculate the start and end points
- self.StartPoint[0] = wxPoint(self.Points[0].x + CONNECTOR_SIZE * self.StartPoint[1][0],
+ self.StartPoint[0] = wx.Point(self.Points[0].x + CONNECTOR_SIZE * self.StartPoint[1][0],
self.Points[0].y + CONNECTOR_SIZE * self.StartPoint[1][1])
- self.EndPoint[0] = wxPoint(self.Points[-1].x + CONNECTOR_SIZE * self.EndPoint[1][0],
+ self.EndPoint[0] = wx.Point(self.Points[-1].x + CONNECTOR_SIZE * self.EndPoint[1][0],
self.Points[-1].y + CONNECTOR_SIZE * self.EndPoint[1][1])
self.Points[0] = self.StartPoint[0]
self.Points[-1] = self.EndPoint[0]
@@ -1150,9 +1149,9 @@
# Returns a list of the position of all wire points
def GetPoints(self, invert = False):
points = self.VerifyPoints()
- points[0] = wxPoint(points[0].x - CONNECTOR_SIZE * self.StartPoint[1][0],
+ points[0] = wx.Point(points[0].x - CONNECTOR_SIZE * self.StartPoint[1][0],
points[0].y - CONNECTOR_SIZE * self.StartPoint[1][1])
- points[-1] = wxPoint(points[-1].x - CONNECTOR_SIZE * self.EndPoint[1][0],
+ points[-1] = wx.Point(points[-1].x - CONNECTOR_SIZE * self.EndPoint[1][0],
points[-1].y - CONNECTOR_SIZE * self.EndPoint[1][1])
# An inversion of the list is asked
if invert:
@@ -1192,9 +1191,9 @@
def GeneratePoints(self, realpoints = True):
i = 0
# Calculate the start enad end points with the minimum segment size in the right direction
- end = wxPoint(self.EndPoint[0].x + self.EndPoint[1][0] * MIN_SEGMENT_SIZE,
+ end = wx.Point(self.EndPoint[0].x + self.EndPoint[1][0] * MIN_SEGMENT_SIZE,
self.EndPoint[0].y + self.EndPoint[1][1] * MIN_SEGMENT_SIZE)
- start = wxPoint(self.StartPoint[0].x + self.StartPoint[1][0] * MIN_SEGMENT_SIZE,
+ start = wx.Point(self.StartPoint[0].x + self.StartPoint[1][0] * MIN_SEGMENT_SIZE,
self.StartPoint[0].y + self.StartPoint[1][1] * MIN_SEGMENT_SIZE)
# Evaluate the point till it's the last
while i < len(self.Points) - 1:
@@ -1206,14 +1205,14 @@
if i == 0:
# If the end point is not in the start direction, a point is added
if v_end != self.Segments[0] or v_end == self.EndPoint[1]:
- self.Points.insert(1, wxPoint(start.x, start.y))
+ self.Points.insert(1, wx.Point(start.x, start.y))
self.Segments.insert(1, DirectionChoice((self.Segments[0][1],
self.Segments[0][0]), v_end, self.EndPoint[1]))
# The current point is the second
elif i == 1:
# The previous direction and the target direction are mainly opposed, a point is added
if product(v_end, self.Segments[0]) < 0:
- self.Points.insert(2, wxPoint(self.Points[1].x, self.Points[1].y))
+ self.Points.insert(2, wx.Point(self.Points[1].x, self.Points[1].y))
self.Segments.insert(2, DirectionChoice((self.Segments[1][1],
self.Segments[1][0]), v_end, self.EndPoint[1]))
# The previous direction and the end direction are the same or they are
@@ -1226,7 +1225,7 @@
self.Points[1].y = end.y
# If the previous direction and the end direction are the same, a point is added
if product(self.Segments[0], self.EndPoint[1]) > 0:
- self.Points.insert(2, wxPoint(self.Points[1].x, self.Points[1].y))
+ self.Points.insert(2, wx.Point(self.Points[1].x, self.Points[1].y))
self.Segments.insert(2, DirectionChoice((self.Segments[1][1],
self.Segments[1][0]), v_end, self.EndPoint[1]))
else:
@@ -1236,7 +1235,7 @@
self.Points[1].x = (end.x + start.x) / 2
if self.Segments[0][1] != 0:
self.Points[1].y = (end.y + start.y) / 2
- self.Points.insert(2, wxPoint(self.Points[1].x, self.Points[1].y))
+ self.Points.insert(2, wx.Point(self.Points[1].x, self.Points[1].y))
self.Segments.insert(2, DirectionChoice((self.Segments[1][1],
self.Segments[1][0]), v_end, self.EndPoint[1]))
else:
@@ -1257,12 +1256,13 @@
# If the current point is the third, test if the second
# point can be aligned with the end point
if i == 2:
- test_point = wxPoint(self.Points[1].x, self.Points[1].y)
+ test_point = wx.Point(self.Points[1].x, self.Points[1].y)
if self.Segments[1][0] != 0:
test_point.y = end.y
if self.Segments[1][1] != 0:
test_point.x = end.x
- test = norm(vector(self.Points[0], test_point, False)) > MIN_SEGMENT_SIZE
+ vector_test = vector(self.Points[0], test_point, False)
+ test = norm(vector_test) > MIN_SEGMENT_SIZE and product(self.Segments[0], vector_test) > 0
# The previous point can be aligned
if test:
self.Points[i].x, self.Points[i].y = end.x, end.y
@@ -1278,7 +1278,7 @@
self.Points[2].x = (self.Points[1].x + end.x) / 2
if self.Segments[1][1] != 0:
self.Points[2].y = (self.Points[1].y + end.y) / 2
- self.Points.insert(3, wxPoint(self.Points[2].x, self.Points[2].y))
+ self.Points.insert(3, wx.Point(self.Points[2].x, self.Points[2].y))
self.Segments.insert(3, DirectionChoice((self.Segments[2][1],
self.Segments[2][0]), v_end, self.EndPoint[1]))
else:
@@ -1299,7 +1299,7 @@
if self.Segments[i - 1][1] != 0:
self.Points[i].y = (end.y + self.Points[i - 1].y) / 2
# A point is added
- self.Points.insert(i + 1, wxPoint(self.Points[i].x, self.Points[i].y))
+ self.Points.insert(i + 1, wx.Point(self.Points[i].x, self.Points[i].y))
self.Segments.insert(i + 1, DirectionChoice((self.Segments[i][1],
self.Segments[i][0]), v_end, self.EndPoint[1]))
else:
@@ -1307,7 +1307,7 @@
if i == 0 and product(vector(start, self.Points[1]), self.Segments[0]) < 0:
# If first and second directions aren't perpendiculars, a point is added
if product(self.Segments[0], self.Segments[1]) != 0:
- self.Points.insert(1, wxPoint(start.x, start.y))
+ self.Points.insert(1, wx.Point(start.x, start.y))
self.Segments.insert(1, DirectionChoice((self.Segments[0][1],
self.Segments[0][0]), vector(start, self.Points[1]), self.Segments[1]))
else:
@@ -1375,7 +1375,7 @@
width - dir[0] * MIN_SEGMENT_SIZE - 1))
pointy = max(-dir[1] * MIN_SEGMENT_SIZE, min(int(round(point[1] * (height - 1) / float(lastheight - 1))),
height - dir[1] * MIN_SEGMENT_SIZE - 1))
- self.Points[i] = wxPoint(minx + x + pointx, miny + y + pointy)
+ self.Points[i] = wx.Point(minx + x + pointx, miny + y + pointy)
self.StartPoint[0] = self.Points[0]
self.EndPoint[0] = self.Points[-1]
self.GeneratePoints(False)
@@ -1410,7 +1410,7 @@
width - dir[0] * MIN_SEGMENT_SIZE - 1))
realpointy = max(-dir[1] * MIN_SEGMENT_SIZE, min(int(round(point[1])),
height - dir[1] * MIN_SEGMENT_SIZE - 1))
- self.Points[i] = wxPoint(minx + x + realpointx, miny + y + realpointy)
+ self.Points[i] = wx.Point(minx + x + realpointx, miny + y + realpointy)
self.StartPoint[0] = self.Points[0]
self.EndPoint[0] = self.Points[-1]
self.GeneratePoints(False)
@@ -1504,9 +1504,9 @@
pointx = (self.Points[segment].x + self.Points[segment + 1].x) / 2
if dir[1] != 0:
pointy = (self.Points[segment].y + self.Points[segment + 1].y) / 2
- self.Points.insert(segment + 1, wxPoint(pointx, pointy))
+ self.Points.insert(segment + 1, wx.Point(pointx, pointy))
self.Segments.insert(segment + 1, (dir[1], dir[0]))
- self.Points.insert(segment + 2, wxPoint(pointx, pointy))
+ self.Points.insert(segment + 2, wx.Point(pointx, pointy))
self.Segments.insert(segment + 2, dir)
self.GeneratePoints()
@@ -1528,15 +1528,15 @@
#result = self.TestPoint(pos)
#if result != None:
# self.Handle = (HANDLE_POINT, result)
- # self.Parent.SetCursor(wxStockCursor(wxCURSOR_HAND))
+ # self.Parent.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
#else:
# Test if a segment have been handled
result = self.TestSegment(pos)
if result != None:
if result[1] in (NORTH, SOUTH):
- self.Parent.SetCursor(wxStockCursor(wxCURSOR_SIZEWE))
+ self.Parent.SetCursor(wx.StockCursor(wx.CURSOR_SIZEWE))
elif result[1] in (EAST, WEST):
- self.Parent.SetCursor(wxStockCursor(wxCURSOR_SIZENS))
+ self.Parent.SetCursor(wx.StockCursor(wx.CURSOR_SIZENS))
self.Handle = (HANDLE_SEGMENT, result)
# Execute the default method for a graphic element
else:
@@ -1560,6 +1560,8 @@
def OnLeftDClick(self, event, dc, scaling):
self.ResetPoints()
self.GeneratePoints()
+ self.RefreshModel()
+ self.Parent.RefreshBuffer()
# Method called when a Motion event have been generated
def OnMotion(self, event, dc, scaling):
@@ -1569,9 +1571,13 @@
result = self.TestSegment(pos)
if result:
if result[1] in (NORTH, SOUTH):
- wxCallAfter(self.Parent.SetCursor, wxStockCursor(wxCURSOR_SIZEWE))
+ if self.CurrentCursor != 4:
+ self.CurrentCursor = 4
+ wx.CallAfter(self.Parent.SetCursor, CURSORS[4])
elif result[1] in (EAST, WEST):
- wxCallAfter(self.Parent.SetCursor, wxStockCursor(wxCURSOR_SIZENS))
+ if self.CurrentCursor != 5:
+ self.CurrentCursor = 5
+ wx.CallAfter(self.Parent.SetCursor, CURSORS[5])
else:
# Test if a point has been handled
#result = self.TestPoint(pos)
@@ -1595,7 +1601,7 @@
# A point has been handled
if handle_type == HANDLE_POINT:
# Try to connect point to a connector
- new_pos = wxPoint(self.Points[handle].x + movex, self.Points[handle].y + movey)
+ new_pos = wx.Point(self.Points[handle].x + movex, self.Points[handle].y + movey)
connector = self.Parent.FindBlockConnector(new_pos)
if connector:
if handle == 0 and self.EndConnected != connector:
@@ -1639,8 +1645,8 @@
# Draws the wire lines and points
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxBLACK_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.BLACK_BRUSH)
# Draw the start and end points if they are not connected or the mouse is over them
if len(self.Points) > 0 and (not self.StartConnected or self.OverStart):
dc.DrawCircle(self.Points[0].x, self.Points[0].y, POINT_RADIUS)
@@ -1651,7 +1657,7 @@
dc.DrawPoint(self.Points[-1].x, self.Points[-1].y)
# Draw the segment selected in red
if self.SelectedSegment != None:
- dc.SetPen(wxRED_PEN)
+ dc.SetPen(wx.RED_PEN)
dc.DrawLine(self.Points[self.SelectedSegment].x, self.Points[self.SelectedSegment].y,
self.Points[self.SelectedSegment + 1].x, self.Points[self.SelectedSegment + 1].y)
if self.SelectedSegment == len(self.Segments) - 1:
@@ -1674,8 +1680,8 @@
Graphic_Element.__init__(self, parent)
self.Id = id
self.Content = content
- self.Pos = wxPoint(0, 0)
- self.Size = wxSize(0, 0)
+ self.Pos = wx.Point(0, 0)
+ self.Size = wx.Size(0, 0)
# Method for keeping compatibility with others
def Clean(self):
@@ -1687,7 +1693,7 @@
# Refresh the comment bounding box
def RefreshBoundingBox(self):
- self.BoundingBox = wxRect(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
+ self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
# Changes the comment size
def SetSize(self, width, height):
@@ -1701,7 +1707,7 @@
# Returns the comment minimum size
def GetMinSize(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
min_width = 0
min_height = 0
# The comment minimum size is the maximum size of words in the content
@@ -1761,18 +1767,18 @@
# Draws the comment and its content
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxWHITE_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.WHITE_BRUSH)
# Draws the comment shape
- polygon = [wxPoint(self.Pos.x, self.Pos.y),
- wxPoint(self.Pos.x + self.Size[0] - 10, self.Pos.y),
- wxPoint(self.Pos.x + self.Size[0], self.Pos.y + 10),
- wxPoint(self.Pos.x + self.Size[0], self.Pos.y + self.Size[1] + 1),
- wxPoint(self.Pos.x, self.Pos.y + self.Size[1] + 1)]
+ polygon = [wx.Point(self.Pos.x, self.Pos.y),
+ wx.Point(self.Pos.x + self.Size[0] - 10, self.Pos.y),
+ wx.Point(self.Pos.x + self.Size[0], self.Pos.y + 10),
+ wx.Point(self.Pos.x + self.Size[0], self.Pos.y + self.Size[1] + 1),
+ wx.Point(self.Pos.x, self.Pos.y + self.Size[1] + 1)]
dc.DrawPolygon(polygon)
- lines = [wxPoint(self.Pos.x + self.Size[0] - 10, self.Pos.y),
- wxPoint(self.Pos.x + self.Size[0] - 10, self.Pos.y + 10),
- wxPoint(self.Pos.x + self.Size[0], self.Pos.y + 10)]
+ lines = [wx.Point(self.Pos.x + self.Size[0] - 10, self.Pos.y),
+ wx.Point(self.Pos.x + self.Size[0] - 10, self.Pos.y + 10),
+ wx.Point(self.Pos.x + self.Size[0], self.Pos.y + 10)]
dc.DrawLines(lines)
# Draws the comment content
y = self.Pos.y + 10
--- a/graphics/LD_Objects.py Tue Aug 07 17:37:38 2007 +0200
+++ b/graphics/LD_Objects.py Tue Aug 07 17:38:48 2007 +0200
@@ -22,7 +22,6 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from wxPython.wx import *
import wx
from GraphicCommons import *
@@ -83,12 +82,12 @@
# Refresh the power rail bounding box
def RefreshBoundingBox(self):
- dc = wxClientDC(self.Parent)
- self.BoundingBox = wxRect(self.Pos.x, self.Pos.y, self.Size[0], self.Size[1] + 1)
+ dc = wx.ClientDC(self.Parent)
+ self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, self.Size[0], self.Size[1] + 1)
# Refresh the power rail size
def RefreshSize(self):
- self.Size = wxSize(2, LD_LINE_SIZE * len(self.Connectors))
+ self.Size = wx.Size(2, LD_LINE_SIZE * len(self.Connectors))
self.RefreshBoundingBox()
# Returns the block minimum size
@@ -103,9 +102,9 @@
def InsertConnector(self, idx, connector = True):
if connector:
if self.Type == LEFTRAIL:
- connector = Connector(self, "", "BOOL", wxPoint(2, 0), EAST)
+ connector = Connector(self, "", "BOOL", wx.Point(2, 0), EAST)
elif self.Type == RIGHTRAIL:
- connector = Connector(self, "", "BOOL", wxPoint(0, 0), WEST)
+ connector = Connector(self, "", "BOOL", wx.Point(0, 0), WEST)
self.Connectors.insert(idx, connector)
else:
self.Connectors.insert(idx, None)
@@ -115,7 +114,7 @@
# Moves the divergence connector given
def MoveConnector(self, connector, movey):
position = connector.GetRelPosition()
- connector.SetPosition(wxPoint(position.x, position.y + movey))
+ connector.SetPosition(wx.Point(position.x, position.y + movey))
miny = self.Size[1]
maxy = 0
for connect in self.Connectors:
@@ -127,7 +126,7 @@
if min_pos == self.Pos.y:
for connect in self.Connectors:
connect_pos = connect.GetRelPosition()
- connect.SetPosition(wxPoint(connect_pos.x, connect_pos.y - miny + self.Extensions[0]))
+ connect.SetPosition(wx.Point(connect_pos.x, connect_pos.y - miny + self.Extensions[0]))
self.Size[1] = max(maxy - miny + self.Extensions[0] + self.Extensions[1], self.Size[1])
connector.MoveConnected()
self.RefreshBoundingBox()
@@ -156,9 +155,9 @@
for connector in self.Connectors:
if connector:
if self.Type == LEFTRAIL:
- connector.SetPosition(wxPoint(self.Size[0], position))
+ connector.SetPosition(wx.Point(self.Size[0], position))
elif self.Type == RIGHTRAIL:
- connector.SetPosition(wxPoint(0, position))
+ connector.SetPosition(wx.Point(0, position))
position += LD_LINE_SIZE
self.RefreshConnected()
@@ -217,7 +216,7 @@
connector = self.TestConnector(pos, False)
if connector:
self.Handle = (HANDLE_CONNECTOR, connector)
- self.Parent.SetCursor(wxStockCursor(wxCURSOR_HAND))
+ self.Parent.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
self.Selected = False
# Initializes the last position
self.oldPos = GetScaledEventPosition(event, dc, scaling)
@@ -284,8 +283,8 @@
# Draws power rail
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxBLACK_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.BLACK_BRUSH)
# Draw a rectangle with the power rail size
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
# Draw connectors
@@ -311,10 +310,10 @@
self.Type = type
self.Name = name
self.Id = id
- self.Size = wxSize(LD_ELEMENT_SIZE[0], LD_ELEMENT_SIZE[1])
+ self.Size = wx.Size(LD_ELEMENT_SIZE[0], LD_ELEMENT_SIZE[1])
# Create an input and output connector
- self.Input = Connector(self, "", "BOOL", wxPoint(0, self.Size[1] / 2 + 1), WEST)
- self.Output = Connector(self, "", "BOOL", wxPoint(self.Size[0], self.Size[1] / 2 + 1), EAST)
+ self.Input = Connector(self, "", "BOOL", wx.Point(0, self.Size[1] / 2 + 1), WEST)
+ self.Output = Connector(self, "", "BOOL", wx.Point(self.Size[0], self.Size[1] / 2 + 1), EAST)
self.RefreshNameSize()
self.RefreshTypeSize()
@@ -340,7 +339,7 @@
# Refresh the size of text for name
def RefreshNameSize(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
if self.Name != "":
self.NameSize = dc.GetTextExtent(self.Name)
else:
@@ -348,7 +347,7 @@
# Refresh the size of text for type
def RefreshTypeSize(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
typetext = ""
if self.Type == CONTACT_REVERSE:
typetext = "/"
@@ -363,7 +362,7 @@
# Refresh the contact bounding box
def RefreshBoundingBox(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
# Calculate the size of the name outside the contact
text_width, text_height = dc.GetTextExtent(self.Name)
# Calculate the bounding box size
@@ -377,7 +376,7 @@
bbx_width = self.Size[0]
bbx_y = self.Pos.y
bbx_height = self.Size[1]
- self.BoundingBox = wxRect(bbx_x, bbx_y, bbx_width + 1, bbx_height + 1)
+ self.BoundingBox = wx.Rect(bbx_x, bbx_y, bbx_width + 1, bbx_height + 1)
# Returns the block minimum size
def GetMinSize(self):
@@ -423,8 +422,8 @@
# Refresh the positions of the block connectors
def RefreshConnectors(self):
- self.Input.SetPosition(wxPoint(0, self.Size[1] / 2 + 1))
- self.Output.SetPosition(wxPoint(self.Size[0], self.Size[1] / 2 + 1))
+ self.Input.SetPosition(wx.Point(0, self.Size[1] / 2 + 1))
+ self.Output.SetPosition(wx.Point(self.Size[0], self.Size[1] / 2 + 1))
self.RefreshConnected()
# Changes the contact name
@@ -459,8 +458,8 @@
# Draws contact
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxBLACK_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.BLACK_BRUSH)
# Draw two rectangles for representing the contact
dc.DrawRectangle(self.Pos.x, self.Pos.y, 2, self.Size[1] + 1)
dc.DrawRectangle(self.Pos.x + self.Size[0] - 1, self.Pos.y, 2, self.Size[1] + 1)
@@ -500,10 +499,10 @@
self.Type = type
self.Name = name
self.Id = id
- self.Size = wxSize(LD_ELEMENT_SIZE[0], LD_ELEMENT_SIZE[1])
+ self.Size = wx.Size(LD_ELEMENT_SIZE[0], LD_ELEMENT_SIZE[1])
# Create an input and output connector
- self.Input = Connector(self, "", "BOOL", wxPoint(0, self.Size[1] / 2 + 1), WEST)
- self.Output = Connector(self, "", "BOOL", wxPoint(self.Size[0], self.Size[1] / 2 + 1), EAST)
+ self.Input = Connector(self, "", "BOOL", wx.Point(0, self.Size[1] / 2 + 1), WEST)
+ self.Output = Connector(self, "", "BOOL", wx.Point(self.Size[0], self.Size[1] / 2 + 1), EAST)
self.RefreshNameSize()
self.RefreshTypeSize()
@@ -529,7 +528,7 @@
# Refresh the size of text for name
def RefreshNameSize(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
if self.Name != "":
self.NameSize = dc.GetTextExtent(self.Name)
else:
@@ -537,7 +536,7 @@
# Refresh the size of text for type
def RefreshTypeSize(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
typetext = ""
if self.Type == COIL_REVERSE:
typetext = "/"
@@ -552,7 +551,7 @@
# Refresh the coil bounding box
def RefreshBoundingBox(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
# Calculate the size of the name outside the coil
text_width, text_height = dc.GetTextExtent(self.Name)
# Calculate the bounding box size
@@ -566,7 +565,7 @@
bbx_width = self.Size[0]
bbx_y = self.Pos.y
bbx_height = self.Size[1]
- self.BoundingBox = wxRect(bbx_x, bbx_y, bbx_width + 1, bbx_height + 1)
+ self.BoundingBox = wx.Rect(bbx_x, bbx_y, bbx_width + 1, bbx_height + 1)
# Returns the block minimum size
def GetMinSize(self):
@@ -612,8 +611,8 @@
# Refresh the positions of the block connectors
def RefreshConnectors(self):
- self.Input.SetPosition(wxPoint(0, self.Size[1] / 2 + 1))
- self.Output.SetPosition(wxPoint(self.Size[0], self.Size[1] / 2 + 1))
+ self.Input.SetPosition(wx.Point(0, self.Size[1] / 2 + 1))
+ self.Output.SetPosition(wx.Point(self.Size[0], self.Size[1] / 2 + 1))
self.RefreshConnected()
# Changes the coil name
@@ -648,12 +647,12 @@
# Draws coil
def Draw(self, dc):
- dc.SetPen(wxPen(wxBLACK, 2, wxSOLID))
- dc.SetBrush(wxTRANSPARENT_BRUSH)
+ dc.SetPen(wx.Pen(wx.BLACK, 2, wx.SOLID))
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
# Draw a two circle arcs for representing the coil
dc.DrawEllipticArc(self.Pos.x, self.Pos.y - int(self.Size[1] * (sqrt(2) - 1.) / 2.) + 1, self.Size[0], int(self.Size[1] * sqrt(2)) - 1, 135, 225)
dc.DrawEllipticArc(self.Pos.x, self.Pos.y - int(self.Size[1] * (sqrt(2) - 1.) / 2.) + 1, self.Size[0], int(self.Size[1] * sqrt(2)) - 1, -45, 45)
- dc.SetPen(wxBLACK_PEN)
+ dc.SetPen(wx.BLACK_PEN)
dc.DrawPoint(self.Pos.x + 1, self.Pos.y + self.Size[1] / 2 + 1)
# Draw coil name
dc.DrawText(self.Name, self.Pos.x + (self.Size[0] - self.NameSize[0]) / 2,
--- a/graphics/SFC_Objects.py Tue Aug 07 17:37:38 2007 +0200
+++ b/graphics/SFC_Objects.py Tue Aug 07 17:38:48 2007 +0200
@@ -22,7 +22,6 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from wxPython.wx import *
import wx
from GraphicCommons import *
@@ -50,10 +49,10 @@
self.Name = name
self.Initial = initial
self.Id = id
- self.Size = wxSize(SFC_STEP_DEFAULT_SIZE[0], SFC_STEP_DEFAULT_SIZE[1])
+ self.Size = wx.Size(SFC_STEP_DEFAULT_SIZE[0], SFC_STEP_DEFAULT_SIZE[1])
# Create an input and output connector
if not self.Initial:
- self.Input = Connector(self, "", "ANY", wxPoint(self.Size[0] / 2, 0), NORTH)
+ self.Input = Connector(self, "", "ANY", wx.Point(self.Size[0] / 2, 0), NORTH)
else:
self.Input = None
self.Output = None
@@ -72,16 +71,16 @@
# Unconnect input and output
def Clean(self):
if self.Input:
- self.Input.UnConnect()
+ self.Input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
if self.Output:
- self.Output.UnConnect()
+ self.Output.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
if self.Action:
- self.Action.UnConnect()
+ self.Action.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Add output connector to step
def AddOutput(self):
if not self.Output:
- self.Output = Connector(self, "", "ANY", wxPoint(self.Size[0] / 2, self.Size[1]), SOUTH)
+ self.Output = Connector(self, "", "ANY", wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH)
self.RefreshBoundingBox()
# Remove output connector from step
@@ -94,7 +93,7 @@
# Add action connector to step
def AddAction(self):
if not self.Action:
- self.Action = Connector(self, "", "ANY", wxPoint(self.Size[0], self.Size[1] / 2), EAST)
+ self.Action = Connector(self, "", "ANY", wx.Point(self.Size[0], self.Size[1] / 2), EAST)
self.RefreshBoundingBox()
# Remove action connector from step
@@ -106,7 +105,7 @@
# Refresh the step bounding box
def RefreshBoundingBox(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
# Calculate the bounding box size
if self.Action:
bbx_width = self.Size[0] + CONNECTOR_SIZE
@@ -122,20 +121,20 @@
bbx_height = self.Size[1] + CONNECTOR_SIZE
if self.Output:
bbx_height += CONNECTOR_SIZE
- #self.BoundingBox = wxRect(self.Pos.x, bbx_y, bbx_width + 1, bbx_height + 1)
- self.BoundingBox = wxRect(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
+ #self.BoundingBox = wx.Rect(self.Pos.x, bbx_y, bbx_width + 1, bbx_height + 1)
+ self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
# Refresh the positions of the step connectors
def RefreshConnectors(self):
# Update input position if it exists
if self.Input:
- self.Input.SetPosition(wxPoint(self.Size[0] / 2, 0))
+ self.Input.SetPosition(wx.Point(self.Size[0] / 2, 0))
# Update output position
if self.Output:
- self.Output.SetPosition(wxPoint(self.Size[0] / 2, self.Size[1]))
+ self.Output.SetPosition(wx.Point(self.Size[0] / 2, self.Size[1]))
# Update action position if it exists
if self.Action:
- self.Action.SetPosition(wxPoint(self.Size[0], self.Size[1] / 2))
+ self.Action.SetPosition(wx.Point(self.Size[0], self.Size[1] / 2))
self.RefreshConnected()
# Refresh the position of wires connected to step
@@ -237,7 +236,7 @@
# Returns the step minimum size
def GetMinSize(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
text_width, text_height = dc.GetTextExtent(self.Name)
if self.Initial:
return text_width + 14, text_height + 14
@@ -285,8 +284,8 @@
if diffy != 0:
if isinstance(output_block, SFC_Step):
output_block.MoveActionBlock((diffx, diffy))
- wires[0][0].SetPoints([wxPoint(current_pos.x, current_pos.y + wire_size),
- wxPoint(current_pos.x, current_pos.y)])
+ wires[0][0].SetPoints([wx.Point(current_pos.x, current_pos.y + wire_size),
+ wx.Point(current_pos.x, current_pos.y)])
if not isinstance(output_block, SFC_Divergence) or output_block.GetConnectors()["inputs"].index(output) == 0:
output_block.Move(diffx, diffy, self.Parent.Wires)
output_block.RefreshOutputPosition((diffx, diffy))
@@ -394,8 +393,8 @@
# Draws step
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxWHITE_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.WHITE_BRUSH)
# Draw two rectangles for representing the step
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
if self.Initial:
@@ -424,20 +423,22 @@
class SFC_Transition(Graphic_Element):
# Create a new transition
- def __init__(self, parent, type = "reference", condition = "", id = None):
+ def __init__(self, parent, type = "reference", condition = None, id = None):
Graphic_Element.__init__(self, parent)
- self.Type = type
- self.Condition = condition
+ self.Type = None
self.Id = id
- self.Size = wxSize(SFC_TRANSITION_SIZE[0], SFC_TRANSITION_SIZE[1])
+ self.Size = wx.Size(SFC_TRANSITION_SIZE[0], SFC_TRANSITION_SIZE[1])
# Create an input and output connector
- self.Input = Connector(self, "", "ANY", wxPoint(self.Size[0] / 2, 0), NORTH)
- self.Output = Connector(self, "", "ANY", wxPoint(self.Size[0] / 2, self.Size[1]), SOUTH)
+ self.Input = Connector(self, "", "ANY", wx.Point(self.Size[0] / 2, 0), NORTH)
+ self.Output = Connector(self, "", "ANY", wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH)
+ self.SetType(type, condition)
# Destructor
def __del__(self):
self.Input = None
self.Output = None
+ if self.Type == "connection":
+ self.Condition = None
# Forbids to change the transition size
def SetSize(self, width, height):
@@ -449,27 +450,42 @@
if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
Graphic_Element.Resize(self, x, y, width, height)
+ # Refresh the size of text for name
+ def RefreshConditionSize(self):
+ if self.Type != "connection":
+ dc = wx.ClientDC(self.Parent)
+ if self.Condition != "":
+ self.ConditionSize = dc.GetTextExtent(self.Condition)
+ else:
+ self.ConditionSize = dc.GetTextExtent("Transition")
+
# Delete this transition by calling the appropriate method
def Delete(self):
self.Parent.DeleteTransition(self)
# Unconnect input and output
def Clean(self):
- self.Input.UnConnect()
- self.Output.UnConnect()
+ self.Input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Output.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ if self.Type == "connection":
+ self.Condition.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Refresh the transition bounding box
def RefreshBoundingBox(self):
- dc = wxClientDC(self.Parent)
- if self.Condition != "":
- text_width, text_height = dc.GetTextExtent(self.Condition)
- else:
- text_width, text_height = dc.GetTextExtent("Transition")
- # Calculate the bounding box size
- bbx_width = self.Size[0] + 5 + text_width
- bbx_y = self.Pos.y - max(0, (text_height - 5 - self.Size[1]) / 2)
- bbx_height = max(self.Size[1], text_height)
- self.BoundingBox = wxRect(self.Pos.x, bbx_y, bbx_width + 1, bbx_height - 4)
+ dc = wx.ClientDC(self.Parent)
+ if self.Type == "connection":
+ bbx_x = self.Pos.x - CONNECTOR_SIZE
+ bbx_width = self.Size[0] + CONNECTOR_SIZE
+ bbx_y = self.Pos.y
+ bbx_height = self.Size[1]
+ else:
+ text_width, text_height = self.ConditionSize
+ # Calculate the bounding box size
+ bbx_x = self.Pos.x
+ bbx_width = self.Size[0] + 5 + text_width
+ bbx_y = self.Pos.y - max(0, (text_height - 5 - self.Size[1]) / 2)
+ bbx_height = max(self.Size[1], text_height) - 5
+ self.BoundingBox = wx.Rect(bbx_x, bbx_y, bbx_width + 1, bbx_height + 1)
# Returns the connector connected to input
def GetPreviousConnector(self):
@@ -488,15 +504,19 @@
# Refresh the positions of the transition connectors
def RefreshConnectors(self):
# Update input position
- self.Input.SetPosition(wxPoint(self.Size[0] / 2, 0))
+ self.Input.SetPosition(wx.Point(self.Size[0] / 2, 0))
# Update output position
- self.Output.SetPosition(wxPoint(self.Size[0] / 2, self.Size[1]))
+ self.Output.SetPosition(wx.Point(self.Size[0] / 2, self.Size[1]))
+ if self.Type == "connection":
+ self.Condition.SetPosition(wx.Point(0, self.Size[1] / 2))
self.RefreshConnected()
# Refresh the position of the wires connected to transition
def RefreshConnected(self, exclude = []):
self.Input.MoveConnected(exclude)
self.Output.MoveConnected(exclude)
+ if self.Type == "connection":
+ self.Condition.MoveConnected(exclude)
# Returns the transition connector that starts with the point given if it exists
def GetConnector(self, position, name = None):
@@ -507,6 +527,8 @@
return self.Input
if name == self.Output.GetName():
return self.Output
+ if self.Type == "connection" and name == self.Condition.GetName():
+ return self.Condition
# Test input connector
input_pos = self.Input.GetRelPosition()
if position.x == self.Pos.x + input_pos.x and position.y == self.Pos.y + input_pos.y:
@@ -515,11 +537,19 @@
output_pos = self.Output.GetRelPosition()
if position.x == self.Pos.x + output_pos.x and position.y == self.Pos.y + output_pos.y:
return self.Output
+ if self.Type == "connection":
+ # Test condition connector
+ condition_pos = self.Condition.GetRelPosition()
+ if position.x == self.Pos.x + condition_pos.x and position.y == self.Pos.y + condition_pos.y:
+ return self.Condition
return None
# Returns input and output transition connectors
def GetConnectors(self):
- return {"input":self.Input,"output":self.Output}
+ connectors = {"input":self.Input,"output":self.Output}
+ if self.Type == "connection":
+ connectors["connection"] = self.Condition
+ return connectors
# Test if point given is on transition input or output connector
def TestConnector(self, pt, exclude=True):
@@ -529,24 +559,40 @@
# Test output connector
if self.Output.TestPoint(pt, exclude):
return self.Output
+ # Test condition connector
+ if self.Type == "connection" and self.Condition.TestPoint(pt, exclude):
+ return self.Condition
return None
# Changes the transition type
- def SetType(self, type):
- self.Type = type
+ def SetType(self, type, condition = None):
+ if self.Type != type:
+ if self.Type == "connection":
+ self.Condition.UnConnect()
+ self.Type = type
+ if type == "connection":
+ self.Condition = Connector(self, "", "BOOL", wx.Point(0, self.Size[1] / 2), WEST)
+ else:
+ if condition == None:
+ condition = ""
+ self.Condition = condition
+ self.RefreshConditionSize()
+ elif self.Type != "connection":
+ if condition == None:
+ condition = ""
+ self.Condition = condition
+ self.RefreshConditionSize()
+ self.RefreshBoundingBox()
# Returns the transition type
def GetType(self):
return self.Type
- # Changes the transition condition
- def SetCondition(self, condition):
- self.Condition = condition
- self.RefreshBoundingBox()
-
# Returns the transition condition
def GetCondition(self):
- return self.Condition
+ if self.Type != "connection":
+ return self.Condition
+ return None
# Returns the transition minimum size
def GetMinSize(self):
@@ -647,22 +693,24 @@
# Draws transition
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxBLACK_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.BLACK_BRUSH)
# Draw plain rectangle for representing the transition
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
# Draw transition condition
- if self.Condition != "":
- text_width, text_height = dc.GetTextExtent(self.Condition)
- condition = self.Condition
- else:
- text_width, text_height = dc.GetTextExtent("Transition")
- condition = "Transition"
- dc.DrawText(condition, self.Pos.x + self.Size[0] + 5,
- self.Pos.y + (self.Size[1] - text_height) / 2)
+ if self.Type != "connection":
+ text_width, text_height = self.ConditionSize
+ if self.Condition != "":
+ condition = self.Condition
+ else:
+ condition = "Transition"
+ dc.DrawText(condition, self.Pos.x + self.Size[0] + 5,
+ self.Pos.y + (self.Size[1] - text_height) / 2)
# Draw input and output connectors
self.Input.Draw(dc)
self.Output.Draw(dc)
+ if self.Type == "connection":
+ self.Condition.Draw(dc)
Graphic_Element.Draw(self, dc)
#-------------------------------------------------------------------------------
@@ -684,20 +732,20 @@
self.RealConnectors = None
number = max(2, number)
if self.Type in [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE]:
- self.Size = wxSize((number - 1) * SFC_DEFAULT_SEQUENCE_INTERVAL, 1)
+ self.Size = wx.Size((number - 1) * SFC_DEFAULT_SEQUENCE_INTERVAL, 1)
elif self.Type in [SIMULTANEOUS_DIVERGENCE, SIMULTANEOUS_CONVERGENCE]:
- self.Size = wxSize((number - 1) * SFC_DEFAULT_SEQUENCE_INTERVAL, 3)
+ self.Size = wx.Size((number - 1) * SFC_DEFAULT_SEQUENCE_INTERVAL, 3)
# Create an input and output connector
if self.Type in [SELECTION_DIVERGENCE, SIMULTANEOUS_DIVERGENCE]:
- self.Inputs = [Connector(self, "", "ANY", wxPoint(self.Size[0] / 2, 0), NORTH)]
+ self.Inputs = [Connector(self, "", "ANY", wx.Point(self.Size[0] / 2, 0), NORTH)]
self.Outputs = []
for i in xrange(number):
- self.Outputs.append(Connector(self, "", "ANY", wxPoint(i * SFC_DEFAULT_SEQUENCE_INTERVAL, self.Size[1]), SOUTH))
+ self.Outputs.append(Connector(self, "", "ANY", wx.Point(i * SFC_DEFAULT_SEQUENCE_INTERVAL, self.Size[1]), SOUTH))
elif self.Type in [SELECTION_CONVERGENCE, SIMULTANEOUS_CONVERGENCE]:
self.Inputs = []
for i in xrange(number):
- self.Inputs.append(Connector(self, "", "ANY", wxPoint(i * SFC_DEFAULT_SEQUENCE_INTERVAL, 0), NORTH))
- self.Outputs = [Connector(self, "", "ANY", wxPoint(self.Size[0] / 2, self.Size[1]), SOUTH)]
+ self.Inputs.append(Connector(self, "", "ANY", wx.Point(i * SFC_DEFAULT_SEQUENCE_INTERVAL, 0), NORTH))
+ self.Outputs = [Connector(self, "", "ANY", wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH)]
# Destructor
def __del__(self):
@@ -720,9 +768,9 @@
# Unconnect input and output
def Clean(self):
for input in self.Inputs:
- input.UnConnect()
+ input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
for output in self.Outputs:
- output.UnConnect()
+ output.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Add a branch to the divergence
def AddBranch(self):
@@ -731,7 +779,7 @@
for output in self.Outputs:
pos = output.GetRelPosition()
maxx = max(maxx, pos.x)
- connector = Connector(self, "", "ANY", wxPoint(maxx + SFC_DEFAULT_SEQUENCE_INTERVAL, self.Size[1]), SOUTH)
+ connector = Connector(self, "", "ANY", wx.Point(maxx + SFC_DEFAULT_SEQUENCE_INTERVAL, self.Size[1]), SOUTH)
self.Outputs.append(connector)
self.MoveConnector(connector, 0)
elif self.Type in [SELECTION_CONVERGENCE, SIMULTANEOUS_CONVERGENCE]:
@@ -739,7 +787,7 @@
for input in self.Inputs:
pos = input.GetRelPosition()
maxx = max(maxx, pos.x)
- connector = Connector(self, "", "ANY", wxPoint(maxx + SFC_DEFAULT_SEQUENCE_INTERVAL, 0), NORTH)
+ connector = Connector(self, "", "ANY", wx.Point(maxx + SFC_DEFAULT_SEQUENCE_INTERVAL, 0), NORTH)
self.Inputs.append(connector)
self.MoveConnector(connector, SFC_DEFAULT_SEQUENCE_INTERVAL)
@@ -769,10 +817,10 @@
# Refresh the divergence bounding box
def RefreshBoundingBox(self):
if self.Type in [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE]:
- self.BoundingBox = wxRect(self.Pos.x, self.Pos.y - 2,
+ self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y - 2,
self.Size[0] + 1, self.Size[1] + 5)
elif self.Type in [SIMULTANEOUS_DIVERGENCE, SIMULTANEOUS_CONVERGENCE]:
- self.BoundingBox = wxRect(self.Pos.x - SFC_SIMULTANEOUS_SEQUENCE_EXTRA, self.Pos.y - 2,
+ self.BoundingBox = wx.Rect(self.Pos.x - SFC_SIMULTANEOUS_SEQUENCE_EXTRA, self.Pos.y - 2,
self.Size[0] + 2 * SFC_SIMULTANEOUS_SEQUENCE_EXTRA + 1, self.Size[1] + 5)
# Refresh the position of wires connected to divergence
@@ -785,7 +833,7 @@
# Moves the divergence connector given
def MoveConnector(self, connector, movex):
position = connector.GetRelPosition()
- connector.SetPosition(wxPoint(position.x + movex, position.y))
+ connector.SetPosition(wx.Point(position.x + movex, position.y))
minx = self.Size[0]
maxx = 0
for input in self.Inputs:
@@ -799,10 +847,10 @@
if minx != 0:
for input in self.Inputs:
input_pos = input.GetRelPosition()
- input.SetPosition(wxPoint(input_pos.x - minx, input_pos.y))
+ input.SetPosition(wx.Point(input_pos.x - minx, input_pos.y))
for output in self.Outputs:
output_pos = output.GetRelPosition()
- output.SetPosition(wxPoint(output_pos.x - minx, output_pos.y))
+ output.SetPosition(wx.Point(output_pos.x - minx, output_pos.y))
self.Pos.x += minx
self.Size[0] = maxx - minx
connector.MoveConnected()
@@ -852,18 +900,18 @@
for i, input in enumerate(self.Inputs):
position = input.GetRelPosition()
if self.RealConnectors:
- input.SetPosition(wxPoint(int(round(self.RealConnectors["Inputs"][i] * width)), 0))
+ input.SetPosition(wx.Point(int(round(self.RealConnectors["Inputs"][i] * width)), 0))
else:
- input.SetPosition(wxPoint(int(round(float(position.x)*float(width)/float(self.Size[0]))), 0))
+ input.SetPosition(wx.Point(int(round(float(position.x)*float(width)/float(self.Size[0]))), 0))
input.MoveConnected()
for i, output in enumerate(self.Outputs):
position = output.GetRelPosition()
if self.RealConnectors:
- output.SetPosition(wxPoint(int(round(self.RealConnectors["Outputs"][i] * width)), self.Size[1]))
+ output.SetPosition(wx.Point(int(round(self.RealConnectors["Outputs"][i] * width)), self.Size[1]))
else:
- output.SetPosition(wxPoint(int(round(float(position.x)*float(width)/float(self.Size[0]))), self.Size[1]))
+ output.SetPosition(wx.Point(int(round(float(position.x)*float(width)/float(self.Size[0]))), self.Size[1]))
output.MoveConnected()
- self.Size = wxSize(width, height)
+ self.Size = wx.Size(width, height)
self.RefreshBoundingBox()
# Returns the divergence minimum size
@@ -939,7 +987,7 @@
connector = self.TestConnector(pos, False)
if connector:
self.Handle = (HANDLE_CONNECTOR, connector)
- self.Parent.SetCursor(wxStockCursor(wxCURSOR_HAND))
+ self.Parent.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
self.Selected = False
# Initializes the last position
self.oldPos = GetScaledEventPosition(event, dc, scaling)
@@ -1021,8 +1069,8 @@
# Draws divergence
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxBLACK_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.BLACK_BRUSH)
# Draw plain rectangle for representing the divergence
if self.Type in [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE]:
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
@@ -1053,9 +1101,9 @@
Graphic_Element.__init__(self, parent)
self.Target = target
self.Id = id
- self.Size = wxSize(SFC_JUMP_SIZE[0], SFC_JUMP_SIZE[1])
+ self.Size = wx.Size(SFC_JUMP_SIZE[0], SFC_JUMP_SIZE[1])
# Create an input and output connector
- self.Input = Connector(self, "", "ANY", wxPoint(self.Size[0] / 2, 0), NORTH)
+ self.Input = Connector(self, "", "ANY", wx.Point(self.Size[0] / 2, 0), NORTH)
# Destructor
def __del__(self):
@@ -1077,15 +1125,15 @@
# Unconnect input
def Clean(self):
- self.Input.UnConnect()
+ self.Input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Refresh the jump bounding box
def RefreshBoundingBox(self):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
text_width, text_height = dc.GetTextExtent(self.Target)
# Calculate the bounding box size
bbx_width = self.Size[0] + 2 + text_width
- self.BoundingBox = wxRect(self.Pos.x, self.Pos.y - CONNECTOR_SIZE,
+ self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y - CONNECTOR_SIZE,
bbx_width + 1, self.Size[1] + CONNECTOR_SIZE + 1)
# Returns the connector connected to input
@@ -1097,7 +1145,7 @@
# Refresh the element connectors position
def RefreshConnectors(self):
- self.Input.SetPosition(wxPoint(self.Size[0] / 2, 0))
+ self.Input.SetPosition(wx.Point(self.Size[0] / 2, 0))
self.RefreshConnected()
# Refresh the position of wires connected to jump
@@ -1191,14 +1239,14 @@
# Draws divergence
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxBLACK_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.BLACK_BRUSH)
# Draw plain rectangle for representing the divergence
dc.DrawLine(self.Pos.x + self.Size[0] / 2, self.Pos.y, self.Pos.x + self.Size[0] / 2, self.Pos.y + self.Size[1])
- points = [wxPoint(self.Pos.x, self.Pos.y),
- wxPoint(self.Pos.x + self.Size[0] / 2, self.Pos.y + self.Size[1] / 3),
- wxPoint(self.Pos.x + self.Size[0], self.Pos.y),
- wxPoint(self.Pos.x + self.Size[0] / 2, self.Pos.y + self.Size[1])]
+ points = [wx.Point(self.Pos.x, self.Pos.y),
+ wx.Point(self.Pos.x + self.Size[0] / 2, self.Pos.y + self.Size[1] / 3),
+ wx.Point(self.Pos.x + self.Size[0], self.Pos.y),
+ wx.Point(self.Pos.x + self.Size[0] / 2, self.Pos.y + self.Size[1])]
dc.DrawPolygon(points)
text_width, text_height = dc.GetTextExtent(self.Target)
dc.DrawText(self.Target, self.Pos.x + self.Size[0] + 2,
@@ -1223,9 +1271,9 @@
def __init__(self, parent, actions = [], id = None):
Graphic_Element.__init__(self, parent)
self.Id = id
- self.Size = wxSize(SFC_ACTION_MIN_SIZE[0], SFC_ACTION_MIN_SIZE[1])
+ self.Size = wx.Size(SFC_ACTION_MIN_SIZE[0], SFC_ACTION_MIN_SIZE[1])
# Create an input and output connector
- self.Input = Connector(self, "", "ANY", wxPoint(0, SFC_ACTION_MIN_SIZE[1] / 2), WEST)
+ self.Input = Connector(self, "", "ANY", wx.Point(0, SFC_ACTION_MIN_SIZE[1] / 2), WEST)
self.SetActions(actions)
# Destructor
@@ -1256,11 +1304,11 @@
# Unconnect input and output
def Clean(self):
- self.Input.UnConnect()
+ self.Input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Refresh the action block bounding box
def RefreshBoundingBox(self):
- self.BoundingBox = wxRect(self.Pos.x, self.Pos.y, self.Size[0], self.Size[1])
+ self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, self.Size[0], self.Size[1])
# Refresh the position of wires connected to action block
def RefreshConnected(self, exclude = []):
@@ -1279,7 +1327,7 @@
# Changes the action block actions
def SetActions(self, actions):
- dc = wxClientDC(self.Parent)
+ dc = wx.ClientDC(self.Parent)
self.Actions = actions
self.ColSize = [0, 0, 0]
for action in self.Actions:
@@ -1295,9 +1343,9 @@
self.ColSize[2] = max(self.ColSize[2], width + 10)
if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
line_size = self.GetLineSize()
- self.Size = wxSize(self.ColSize[0] + self.ColSize[1] + self.ColSize[2], len(self.Actions) * line_size)
- else:
- self.Size = wxSize(max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2],
+ self.Size = wx.Size(self.ColSize[0] + self.ColSize[1] + self.ColSize[2], len(self.Actions) * line_size)
+ else:
+ self.Size = wx.Size(max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2],
SFC_ACTION_MIN_SIZE[0]), len(self.Actions) * SFC_ACTION_MIN_SIZE[1])
self.RefreshBoundingBox()
if self.Input:
@@ -1343,8 +1391,8 @@
# Draws divergence
def Draw(self, dc):
- dc.SetPen(wxBLACK_PEN)
- dc.SetBrush(wxWHITE_BRUSH)
+ dc.SetPen(wx.BLACK_PEN)
+ dc.SetBrush(wx.WHITE_BRUSH)
colsize = [self.ColSize[0], self.Size[0] - self.ColSize[0] - self.ColSize[2], self.ColSize[2]]
# Draw plain rectangle for representing the action block
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)