--- a/Dialogs.py Wed Oct 24 15:59:46 2007 +0200
+++ b/Dialogs.py Wed Oct 24 16:00:00 2007 +0200
@@ -41,6 +41,14 @@
[CATEGORY, BLOCK] = range(2)
class BlockPropertiesDialog(wx.Dialog):
+
+ if wx.VERSION < (2, 6, 0):
+ def Bind(self, event, function, id = None):
+ if id is not None:
+ event(self, id, function)
+ else:
+ event(self, function)
+
def _init_coll_flexGridSizer1_Items(self, parent):
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)
@@ -143,9 +151,12 @@
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
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)
+ if wx.VERSION >= (2, 5, 0):
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
+ self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
+ else:
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
+ wx.EVT_PAINT(self.Preview, self.OnPaint)
self._init_sizers()
@@ -156,6 +167,7 @@
self.Inputs.Enable(False)
self.Block = None
self.MinBlockSize = None
+ self.First = True
self.PouNames = []
self.PouElementNames = []
@@ -170,7 +182,10 @@
if self.TypeTree.GetItemText(root) == name and same_inputs:
return root
else:
- item, root_cookie = self.TypeTree.GetFirstChild(root)
+ if wx.VERSION < (2, 6, 0):
+ item, root_cookie = self.TypeTree.GetFirstChild(root, 0)
+ else:
+ item, root_cookie = self.TypeTree.GetFirstChild(root)
while item.IsOk():
result = self.FindTreeItem(item, name, inputs)
if result:
@@ -326,7 +341,7 @@
self.Block = None
def OnPaint(self, event):
- if self.Block:
+ if self.Block is not None:
self.RefreshPreview()
event.Skip()
@@ -342,6 +357,14 @@
] = [wx.NewId() for _init_ctrls in range(10)]
class VariablePropertiesDialog(wx.Dialog):
+
+ if wx.VERSION < (2, 6, 0):
+ def Bind(self, event, function, id = None):
+ if id is not None:
+ event(self, id, function)
+ else:
+ event(self, function)
+
def _init_coll_flexGridSizer1_Items(self, parent):
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)
@@ -451,8 +474,11 @@
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
-
+ if wx.VERSION >= (2, 5, 0):
+ self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
+ else:
+ wx.EVT_PAINT(self.Preview, self.OnPaint)
+
self._init_sizers()
def __init__(self, parent):
@@ -603,6 +629,14 @@
] = [wx.NewId() for _init_ctrls in range(9)]
class ConnectionPropertiesDialog(wx.Dialog):
+
+ if wx.VERSION < (2, 6, 0):
+ def Bind(self, event, function, id = None):
+ if id is not None:
+ event(self, id, function)
+ else:
+ event(self, function)
+
def _init_coll_flexGridSizer1_Items(self, parent):
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)
@@ -699,7 +733,10 @@
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
+ if wx.VERSION >= (2, 5, 0):
+ self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
+ else:
+ wx.EVT_PAINT(self.Preview, self.OnPaint)
self._init_sizers()
@@ -775,6 +812,14 @@
] = [wx.NewId() for _init_ctrls in range(11)]
class LDElementDialog(wx.Dialog):
+
+ if wx.VERSION < (2, 6, 0):
+ def Bind(self, event, function, id = None):
+ if id is not None:
+ event(self, id, function)
+ else:
+ event(self, function)
+
def _init_coll_flexGridSizer1_Items(self, parent):
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)
@@ -882,7 +927,10 @@
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
+ if wx.VERSION >= (2, 5, 0):
+ self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
+ else:
+ wx.EVT_PAINT(self.Preview, self.OnPaint)
self._init_sizers()
@@ -992,6 +1040,14 @@
] = [wx.NewId() for _init_ctrls in range(10)]
class LDPowerRailDialog(wx.Dialog):
+
+ if wx.VERSION < (2, 6, 0):
+ def Bind(self, event, function, id = None):
+ if id is not None:
+ event(self, id, function)
+ else:
+ event(self, function)
+
def _init_coll_flexGridSizer1_Items(self, parent):
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)
@@ -1087,7 +1143,10 @@
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
+ if wx.VERSION >= (2, 5, 0):
+ self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
+ else:
+ wx.EVT_PAINT(self.Preview, self.OnPaint)
self._init_sizers()
@@ -1154,6 +1213,14 @@
] = [wx.NewId() for _init_ctrls in range(10)]
class StepContentDialog(wx.Dialog):
+
+ if wx.VERSION < (2, 6, 0):
+ def Bind(self, event, function, id = None):
+ if id is not None:
+ event(self, id, function)
+ else:
+ event(self, function)
+
def _init_coll_flexGridSizer1_Items(self, parent):
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)
@@ -1254,10 +1321,13 @@
setattr(self.Preview, "RefreshStepModel", lambda x:None)
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)
-
+ if wx.VERSION >= (2, 5, 0):
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
+ self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
+ else:
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
+ wx.EVT_PAINT(self.Preview, self.OnPaint)
+
self._init_sizers()
def __init__(self, parent, initial = False):
@@ -1382,6 +1452,14 @@
] = [wx.NewId() for _init_ctrls in range(12)]
class TransitionContentDialog(wx.Dialog):
+
+ if wx.VERSION < (2, 6, 0):
+ def Bind(self, event, function, id = None):
+ if id is not None:
+ event(self, id, function)
+ else:
+ event(self, function)
+
def _init_coll_flexGridSizer1_Items(self, parent):
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)
@@ -1500,9 +1578,12 @@
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)
+ if wx.VERSION >= (2, 5, 0):
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
+ self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
+ else:
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
+ wx.EVT_PAINT(self.Preview, self.OnPaint)
self._init_sizers()
@@ -1644,6 +1725,14 @@
] = [wx.NewId() for _init_ctrls in range(11)]
class DivergenceCreateDialog(wx.Dialog):
+
+ if wx.VERSION < (2, 6, 0):
+ def Bind(self, event, function, id = None):
+ if id is not None:
+ event(self, id, function)
+ else:
+ event(self, function)
+
def _init_coll_flexGridSizer1_Items(self, parent):
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)
@@ -1754,7 +1843,10 @@
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
+ if wx.VERSION >= (2, 5, 0):
+ self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
+ else:
+ wx.EVT_PAINT(self.Preview, self.OnPaint)
self._init_sizers()
@@ -1985,6 +2077,14 @@
] = [wx.NewId() for _init_ctrls in range(7)]
class ActionBlockDialog(wx.Dialog):
+
+ if wx.VERSION < (2, 6, 0):
+ def Bind(self, event, function, id = None):
+ if id is not None:
+ event(self, id, function)
+ else:
+ event(self, function)
+
def _init_coll_flexGridSizer1_Items(self, parent):
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)
@@ -2064,8 +2164,11 @@
self.Bind(wx.EVT_BUTTON, self.OnDownButton, id=ID_ACTIONBLOCKDIALOGDOWNBUTTON)
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
- self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
-
+ if wx.VERSION >= (2, 5, 0):
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
+ else:
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
+
self._init_sizers()
def __init__(self, parent):
@@ -2180,6 +2283,14 @@
class StepNameDialog(wx.TextEntryDialog):
+ if wx.VERSION < (2, 6, 0):
+ def Bind(self, event, function, id = None):
+ if id is not None:
+ event(self, id, function)
+ else:
+ event(self, function)
+
+
def __init__(self, parent, message, caption = "Please enter text", defaultValue = "",
style = wx.OK|wx.CANCEL|wx.CENTRE, pos = wx.DefaultPosition):
wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos)
@@ -2187,9 +2298,11 @@
self.PouNames = []
self.Variables = []
self.StepNames = []
-
- self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetAffirmativeButton().GetId())
-
+ if wx.VERSION >= (2, 5, 0):
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetAffirmativeButton().GetId())
+ else:
+ self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
+
def OnOK(self, event):
step_name = self.GetSizer().GetItem(1).GetWindow().GetValue()
if step_name == "":