Dialogs.py
changeset 113 9eeaebd867aa
parent 108 9aa1fdfb7cb2
child 118 0c53d6a36013
equal deleted inserted replaced
112:317148fc1225 113:9eeaebd867aa
    39 ] = [wx.NewId() for _init_ctrls in range(10)]
    39 ] = [wx.NewId() for _init_ctrls in range(10)]
    40 
    40 
    41 [CATEGORY, BLOCK] = range(2)
    41 [CATEGORY, BLOCK] = range(2)
    42 
    42 
    43 class BlockPropertiesDialog(wx.Dialog):
    43 class BlockPropertiesDialog(wx.Dialog):
       
    44     
       
    45     if wx.VERSION < (2, 6, 0):
       
    46         def Bind(self, event, function, id = None):
       
    47             if id is not None:
       
    48                 event(self, id, function)
       
    49             else:
       
    50                 event(self, function)
       
    51     
    44     def _init_coll_flexGridSizer1_Items(self, parent):
    52     def _init_coll_flexGridSizer1_Items(self, parent):
    45         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
    53         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
    46         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
    54         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
    47 
    55 
    48     def _init_coll_flexGridSizer1_Growables(self, parent):
    56     def _init_coll_flexGridSizer1_Growables(self, parent):
   141               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
   149               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
   142         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
   150         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
   143         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
   151         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
   144 
   152 
   145         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
   153         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
   146         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
   154         if wx.VERSION >= (2, 5, 0):
   147         
   155             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
   148         self.Bind(wx.EVT_PAINT, self.OnPaint)
   156             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
       
   157         else:
       
   158             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
       
   159             wx.EVT_PAINT(self.Preview, self.OnPaint)
   149         
   160         
   150         self._init_sizers()
   161         self._init_sizers()
   151 
   162 
   152     def __init__(self, parent):
   163     def __init__(self, parent):
   153         self._init_ctrls(parent)
   164         self._init_ctrls(parent)
   154         self.BlockName.SetValue("")
   165         self.BlockName.SetValue("")
   155         self.BlockName.Enable(False)
   166         self.BlockName.Enable(False)
   156         self.Inputs.Enable(False)
   167         self.Inputs.Enable(False)
   157         self.Block = None
   168         self.Block = None
   158         self.MinBlockSize = None
   169         self.MinBlockSize = None
       
   170         self.First = True
   159         
   171         
   160         self.PouNames = []
   172         self.PouNames = []
   161         self.PouElementNames = []
   173         self.PouElementNames = []
   162     
   174     
   163     def FindTreeItem(self, root, name, inputs = None):
   175     def FindTreeItem(self, root, name, inputs = None):
   168             else:
   180             else:
   169                 same_inputs = True
   181                 same_inputs = True
   170             if self.TypeTree.GetItemText(root) == name and same_inputs:
   182             if self.TypeTree.GetItemText(root) == name and same_inputs:
   171                 return root
   183                 return root
   172             else:
   184             else:
   173                 item, root_cookie = self.TypeTree.GetFirstChild(root)
   185                 if wx.VERSION < (2, 6, 0):
       
   186                     item, root_cookie = self.TypeTree.GetFirstChild(root, 0)
       
   187                 else:
       
   188                     item, root_cookie = self.TypeTree.GetFirstChild(root)
   174                 while item.IsOk():
   189                 while item.IsOk():
   175                     result = self.FindTreeItem(item, name, inputs)
   190                     result = self.FindTreeItem(item, name, inputs)
   176                     if result:
   191                     if result:
   177                         return result
   192                         return result
   178                     item, root_cookie = self.TypeTree.GetNextChild(root, root_cookie)
   193                     item, root_cookie = self.TypeTree.GetNextChild(root, root_cookie)
   324                     self.Block.Draw(dc)
   339                     self.Block.Draw(dc)
   325                 else:
   340                 else:
   326                     self.Block = None
   341                     self.Block = None
   327 
   342 
   328     def OnPaint(self, event):
   343     def OnPaint(self, event):
   329         if self.Block:
   344         if self.Block is not None:
   330             self.RefreshPreview()
   345             self.RefreshPreview()
   331         event.Skip()
   346         event.Skip()
   332 
   347 
   333 #-------------------------------------------------------------------------------
   348 #-------------------------------------------------------------------------------
   334 #                          Create New Variable Dialog
   349 #                          Create New Variable Dialog
   340  ID_VARIABLEPROPERTIESDIALOGSTATICTEXT1, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT2,
   355  ID_VARIABLEPROPERTIESDIALOGSTATICTEXT1, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT2,
   341  ID_VARIABLEPROPERTIESDIALOGSTATICTEXT3, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT4,
   356  ID_VARIABLEPROPERTIESDIALOGSTATICTEXT3, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT4,
   342 ] = [wx.NewId() for _init_ctrls in range(10)]
   357 ] = [wx.NewId() for _init_ctrls in range(10)]
   343 
   358 
   344 class VariablePropertiesDialog(wx.Dialog):
   359 class VariablePropertiesDialog(wx.Dialog):
       
   360     
       
   361     if wx.VERSION < (2, 6, 0):
       
   362         def Bind(self, event, function, id = None):
       
   363             if id is not None:
       
   364                 event(self, id, function)
       
   365             else:
       
   366                 event(self, function)
       
   367     
   345     def _init_coll_flexGridSizer1_Items(self, parent):
   368     def _init_coll_flexGridSizer1_Items(self, parent):
   346         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   369         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   347         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   370         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   348         
   371         
   349     def _init_coll_flexGridSizer1_Growables(self, parent):
   372     def _init_coll_flexGridSizer1_Growables(self, parent):
   449         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
   472         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
   450         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
   473         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
   451 
   474 
   452         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
   475         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
   453 
   476 
   454         self.Bind(wx.EVT_PAINT, self.OnPaint)
   477         if wx.VERSION >= (2, 5, 0):
   455 
   478             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
       
   479         else:
       
   480             wx.EVT_PAINT(self.Preview, self.OnPaint)
       
   481         
   456         self._init_sizers()
   482         self._init_sizers()
   457 
   483 
   458     def __init__(self, parent):
   484     def __init__(self, parent):
   459         self._init_ctrls(parent)
   485         self._init_ctrls(parent)
   460         self.Variable = None
   486         self.Variable = None
   601  ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT1, ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT2, 
   627  ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT1, ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT2, 
   602  ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT3, 
   628  ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT3, 
   603 ] = [wx.NewId() for _init_ctrls in range(9)]
   629 ] = [wx.NewId() for _init_ctrls in range(9)]
   604 
   630 
   605 class ConnectionPropertiesDialog(wx.Dialog):
   631 class ConnectionPropertiesDialog(wx.Dialog):
       
   632     
       
   633     if wx.VERSION < (2, 6, 0):
       
   634         def Bind(self, event, function, id = None):
       
   635             if id is not None:
       
   636                 event(self, id, function)
       
   637             else:
       
   638                 event(self, function)
       
   639     
   606     def _init_coll_flexGridSizer1_Items(self, parent):
   640     def _init_coll_flexGridSizer1_Items(self, parent):
   607         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   641         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   608         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   642         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   609         
   643         
   610     def _init_coll_flexGridSizer1_Growables(self, parent):
   644     def _init_coll_flexGridSizer1_Growables(self, parent):
   697               name='Spacer', parent=self, pos=wx.Point(0, 0),
   731               name='Spacer', parent=self, pos=wx.Point(0, 0),
   698               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   732               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   699 
   733 
   700         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
   734         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
   701         
   735         
   702         self.Bind(wx.EVT_PAINT, self.OnPaint)
   736         if wx.VERSION >= (2, 5, 0):
       
   737             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
       
   738         else:
       
   739             wx.EVT_PAINT(self.Preview, self.OnPaint)
   703         
   740         
   704         self._init_sizers()
   741         self._init_sizers()
   705 
   742 
   706     def __init__(self, parent):
   743     def __init__(self, parent):
   707         self._init_ctrls(parent)
   744         self._init_ctrls(parent)
   773  ID_LDELEMENTDIALOGSTATICTEXT1, ID_LDELEMENTDIALOGSTATICTEXT2, 
   810  ID_LDELEMENTDIALOGSTATICTEXT1, ID_LDELEMENTDIALOGSTATICTEXT2, 
   774  ID_LDELEMENTDIALOGSTATICTEXT3, 
   811  ID_LDELEMENTDIALOGSTATICTEXT3, 
   775 ] = [wx.NewId() for _init_ctrls in range(11)]
   812 ] = [wx.NewId() for _init_ctrls in range(11)]
   776 
   813 
   777 class LDElementDialog(wx.Dialog):
   814 class LDElementDialog(wx.Dialog):
       
   815     
       
   816     if wx.VERSION < (2, 6, 0):
       
   817         def Bind(self, event, function, id = None):
       
   818             if id is not None:
       
   819                 event(self, id, function)
       
   820             else:
       
   821                 event(self, function)
       
   822     
   778     def _init_coll_flexGridSizer1_Items(self, parent):
   823     def _init_coll_flexGridSizer1_Items(self, parent):
   779         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   824         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   780         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   825         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   781         
   826         
   782     def _init_coll_flexGridSizer1_Growables(self, parent):
   827     def _init_coll_flexGridSizer1_Growables(self, parent):
   880               name='Spacer', parent=self, pos=wx.Point(0, 0),
   925               name='Spacer', parent=self, pos=wx.Point(0, 0),
   881               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   926               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   882 
   927 
   883         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
   928         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
   884         
   929         
   885         self.Bind(wx.EVT_PAINT, self.OnPaint)
   930         if wx.VERSION >= (2, 5, 0):
       
   931             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
       
   932         else:
       
   933             wx.EVT_PAINT(self.Preview, self.OnPaint)
   886         
   934         
   887         self._init_sizers()
   935         self._init_sizers()
   888 
   936 
   889     def __init__(self, parent, type):
   937     def __init__(self, parent, type):
   890         self.Type = type
   938         self.Type = type
   990  ID_LDPOWERRAILDIALOGSTATICTEXT1, ID_LDPOWERRAILDIALOGSTATICTEXT2, 
  1038  ID_LDPOWERRAILDIALOGSTATICTEXT1, ID_LDPOWERRAILDIALOGSTATICTEXT2, 
   991  ID_LDPOWERRAILDIALOGSTATICTEXT3, ID_LDPOWERRAILDIALOGPINNUMBER,
  1039  ID_LDPOWERRAILDIALOGSTATICTEXT3, ID_LDPOWERRAILDIALOGPINNUMBER,
   992 ] = [wx.NewId() for _init_ctrls in range(10)]
  1040 ] = [wx.NewId() for _init_ctrls in range(10)]
   993 
  1041 
   994 class LDPowerRailDialog(wx.Dialog):
  1042 class LDPowerRailDialog(wx.Dialog):
       
  1043     
       
  1044     if wx.VERSION < (2, 6, 0):
       
  1045         def Bind(self, event, function, id = None):
       
  1046             if id is not None:
       
  1047                 event(self, id, function)
       
  1048             else:
       
  1049                 event(self, function)
       
  1050     
   995     def _init_coll_flexGridSizer1_Items(self, parent):
  1051     def _init_coll_flexGridSizer1_Items(self, parent):
   996         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
  1052         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   997         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
  1053         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   998         
  1054         
   999     def _init_coll_flexGridSizer1_Growables(self, parent):
  1055     def _init_coll_flexGridSizer1_Growables(self, parent):
  1085               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1141               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1086               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
  1142               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
  1087 
  1143 
  1088         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
  1144         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
  1089         
  1145         
  1090         self.Bind(wx.EVT_PAINT, self.OnPaint)
  1146         if wx.VERSION >= (2, 5, 0):
       
  1147             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
       
  1148         else:
       
  1149             wx.EVT_PAINT(self.Preview, self.OnPaint)
  1091         
  1150         
  1092         self._init_sizers()
  1151         self._init_sizers()
  1093 
  1152 
  1094     def __init__(self, parent, type = LEFTRAIL, number = 1):
  1153     def __init__(self, parent, type = LEFTRAIL, number = 1):
  1095         self._init_ctrls(parent)
  1154         self._init_ctrls(parent)
  1152  ID_STEPCONTENTDIALOGCHECKBOX3, ID_STEPCONTENTDIALOGSTATICTEXT1, 
  1211  ID_STEPCONTENTDIALOGCHECKBOX3, ID_STEPCONTENTDIALOGSTATICTEXT1, 
  1153  ID_STEPCONTENTDIALOGSTATICTEXT2, ID_STEPCONTENTDIALOGSTATICTEXT3, 
  1212  ID_STEPCONTENTDIALOGSTATICTEXT2, ID_STEPCONTENTDIALOGSTATICTEXT3, 
  1154 ] = [wx.NewId() for _init_ctrls in range(10)]
  1213 ] = [wx.NewId() for _init_ctrls in range(10)]
  1155 
  1214 
  1156 class StepContentDialog(wx.Dialog):
  1215 class StepContentDialog(wx.Dialog):
       
  1216     
       
  1217     if wx.VERSION < (2, 6, 0):
       
  1218         def Bind(self, event, function, id = None):
       
  1219             if id is not None:
       
  1220                 event(self, id, function)
       
  1221             else:
       
  1222                 event(self, function)
       
  1223     
  1157     def _init_coll_flexGridSizer1_Items(self, parent):
  1224     def _init_coll_flexGridSizer1_Items(self, parent):
  1158         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
  1225         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
  1159         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
  1226         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
  1160         
  1227         
  1161     def _init_coll_flexGridSizer1_Growables(self, parent):
  1228     def _init_coll_flexGridSizer1_Growables(self, parent):
  1252         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
  1319         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
  1253         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
  1320         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
  1254         setattr(self.Preview, "RefreshStepModel", lambda x:None)
  1321         setattr(self.Preview, "RefreshStepModel", lambda x:None)
  1255 
  1322 
  1256         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
  1323         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
  1257         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
  1324         if wx.VERSION >= (2, 5, 0):
  1258         
  1325             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
  1259         self.Bind(wx.EVT_PAINT, self.OnPaint)
  1326             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
  1260 
  1327         else:
       
  1328             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
       
  1329             wx.EVT_PAINT(self.Preview, self.OnPaint)
       
  1330         
  1261         self._init_sizers()
  1331         self._init_sizers()
  1262 
  1332 
  1263     def __init__(self, parent, initial = False):
  1333     def __init__(self, parent, initial = False):
  1264         self._init_ctrls(parent)
  1334         self._init_ctrls(parent)
  1265         self.Step = None
  1335         self.Step = None
  1380  ID_TRANSITIONCONTENTDIALOGRADIOBUTTON3, ID_TRANSITIONCONTENTDIALOGSTATICTEXT1, 
  1450  ID_TRANSITIONCONTENTDIALOGRADIOBUTTON3, ID_TRANSITIONCONTENTDIALOGSTATICTEXT1, 
  1381  ID_TRANSITIONCONTENTDIALOGSTATICTEXT2, ID_TRANSITIONCONTENTDIALOGSTATICTEXT3, 
  1451  ID_TRANSITIONCONTENTDIALOGSTATICTEXT2, ID_TRANSITIONCONTENTDIALOGSTATICTEXT3, 
  1382 ] = [wx.NewId() for _init_ctrls in range(12)]
  1452 ] = [wx.NewId() for _init_ctrls in range(12)]
  1383 
  1453 
  1384 class TransitionContentDialog(wx.Dialog):
  1454 class TransitionContentDialog(wx.Dialog):
       
  1455     
       
  1456     if wx.VERSION < (2, 6, 0):
       
  1457         def Bind(self, event, function, id = None):
       
  1458             if id is not None:
       
  1459                 event(self, id, function)
       
  1460             else:
       
  1461                 event(self, function)
       
  1462     
  1385     def _init_coll_flexGridSizer1_Items(self, parent):
  1463     def _init_coll_flexGridSizer1_Items(self, parent):
  1386         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
  1464         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
  1387         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
  1465         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
  1388         
  1466         
  1389     def _init_coll_flexGridSizer1_Growables(self, parent):
  1467     def _init_coll_flexGridSizer1_Growables(self, parent):
  1498         self.Spacer = wx.Panel(id=ID_TRANSITIONCONTENTDIALOGSPACER,
  1576         self.Spacer = wx.Panel(id=ID_TRANSITIONCONTENTDIALOGSPACER,
  1499               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1577               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1500               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
  1578               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
  1501 
  1579 
  1502         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
  1580         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
  1503         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
  1581         if wx.VERSION >= (2, 5, 0):
  1504         
  1582             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
  1505         self.Bind(wx.EVT_PAINT, self.OnPaint)
  1583             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
       
  1584         else:
       
  1585             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
       
  1586             wx.EVT_PAINT(self.Preview, self.OnPaint)
  1506         
  1587         
  1507         self._init_sizers()
  1588         self._init_sizers()
  1508 
  1589 
  1509     def __init__(self, parent, connection):
  1590     def __init__(self, parent, connection):
  1510         self.Connection = connection
  1591         self.Connection = connection
  1642  ID_DIVERGENCECREATEDIALOGSTATICTEXT1, ID_DIVERGENCECREATEDIALOGSTATICTEXT2, 
  1723  ID_DIVERGENCECREATEDIALOGSTATICTEXT1, ID_DIVERGENCECREATEDIALOGSTATICTEXT2, 
  1643  ID_DIVERGENCECREATEDIALOGSTATICTEXT3,  
  1724  ID_DIVERGENCECREATEDIALOGSTATICTEXT3,  
  1644 ] = [wx.NewId() for _init_ctrls in range(11)]
  1725 ] = [wx.NewId() for _init_ctrls in range(11)]
  1645 
  1726 
  1646 class DivergenceCreateDialog(wx.Dialog):
  1727 class DivergenceCreateDialog(wx.Dialog):
       
  1728     
       
  1729     if wx.VERSION < (2, 6, 0):
       
  1730         def Bind(self, event, function, id = None):
       
  1731             if id is not None:
       
  1732                 event(self, id, function)
       
  1733             else:
       
  1734                 event(self, function)
       
  1735     
  1647     def _init_coll_flexGridSizer1_Items(self, parent):
  1736     def _init_coll_flexGridSizer1_Items(self, parent):
  1648         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
  1737         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
  1649         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
  1738         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
  1650         
  1739         
  1651     def _init_coll_flexGridSizer1_Growables(self, parent):
  1740     def _init_coll_flexGridSizer1_Growables(self, parent):
  1752               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1841               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1753               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
  1842               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
  1754 
  1843 
  1755         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
  1844         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
  1756         
  1845         
  1757         self.Bind(wx.EVT_PAINT, self.OnPaint)
  1846         if wx.VERSION >= (2, 5, 0):
       
  1847             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
       
  1848         else:
       
  1849             wx.EVT_PAINT(self.Preview, self.OnPaint)
  1758         
  1850         
  1759         self._init_sizers()
  1851         self._init_sizers()
  1760 
  1852 
  1761     def __init__(self, parent):
  1853     def __init__(self, parent):
  1762         self._init_ctrls(parent)
  1854         self._init_ctrls(parent)
  1983  ID_ACTIONBLOCKDIALOGDELETEBUTTON, ID_ACTIONBLOCKDIALOGUPBUTTON, 
  2075  ID_ACTIONBLOCKDIALOGDELETEBUTTON, ID_ACTIONBLOCKDIALOGUPBUTTON, 
  1984  ID_ACTIONBLOCKDIALOGDOWNBUTTON, 
  2076  ID_ACTIONBLOCKDIALOGDOWNBUTTON, 
  1985 ] = [wx.NewId() for _init_ctrls in range(7)]
  2077 ] = [wx.NewId() for _init_ctrls in range(7)]
  1986 
  2078 
  1987 class ActionBlockDialog(wx.Dialog):
  2079 class ActionBlockDialog(wx.Dialog):
       
  2080     
       
  2081     if wx.VERSION < (2, 6, 0):
       
  2082         def Bind(self, event, function, id = None):
       
  2083             if id is not None:
       
  2084                 event(self, id, function)
       
  2085             else:
       
  2086                 event(self, function)
       
  2087     
  1988     def _init_coll_flexGridSizer1_Items(self, parent):
  2088     def _init_coll_flexGridSizer1_Items(self, parent):
  1989         parent.AddSizer(self.TopSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
  2089         parent.AddSizer(self.TopSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
  1990         parent.AddSizer(self.GridButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT)
  2090         parent.AddSizer(self.GridButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT)
  1991         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
  2091         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
  1992         
  2092         
  2062               name='DownButton', parent=self, pos=wx.Point(0, 0),
  2162               name='DownButton', parent=self, pos=wx.Point(0, 0),
  2063               size=wx.Size(32, 32), style=0)
  2163               size=wx.Size(32, 32), style=0)
  2064         self.Bind(wx.EVT_BUTTON, self.OnDownButton, id=ID_ACTIONBLOCKDIALOGDOWNBUTTON)
  2164         self.Bind(wx.EVT_BUTTON, self.OnDownButton, id=ID_ACTIONBLOCKDIALOGDOWNBUTTON)
  2065 
  2165 
  2066         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
  2166         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
  2067         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
  2167         if wx.VERSION >= (2, 5, 0):
  2068 
  2168             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
       
  2169         else:
       
  2170             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
       
  2171         
  2069         self._init_sizers()
  2172         self._init_sizers()
  2070 
  2173 
  2071     def __init__(self, parent):
  2174     def __init__(self, parent):
  2072         self._init_ctrls(parent)
  2175         self._init_ctrls(parent)
  2073         
  2176         
  2178 #                          Edit Step Name Dialog
  2281 #                          Edit Step Name Dialog
  2179 #-------------------------------------------------------------------------------
  2282 #-------------------------------------------------------------------------------
  2180 
  2283 
  2181 class StepNameDialog(wx.TextEntryDialog):
  2284 class StepNameDialog(wx.TextEntryDialog):
  2182 
  2285 
       
  2286     if wx.VERSION < (2, 6, 0):
       
  2287         def Bind(self, event, function, id = None):
       
  2288             if id is not None:
       
  2289                 event(self, id, function)
       
  2290             else:
       
  2291                 event(self, function)
       
  2292     
       
  2293 
  2183     def __init__(self, parent, message, caption = "Please enter text", defaultValue = "", 
  2294     def __init__(self, parent, message, caption = "Please enter text", defaultValue = "", 
  2184                        style = wx.OK|wx.CANCEL|wx.CENTRE, pos = wx.DefaultPosition):
  2295                        style = wx.OK|wx.CANCEL|wx.CENTRE, pos = wx.DefaultPosition):
  2185         wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos)
  2296         wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos)
  2186         
  2297         
  2187         self.PouNames = []
  2298         self.PouNames = []
  2188         self.Variables = []
  2299         self.Variables = []
  2189         self.StepNames = []
  2300         self.StepNames = []
  2190         
  2301         if wx.VERSION >= (2, 5, 0):
  2191         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetAffirmativeButton().GetId())
  2302             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetAffirmativeButton().GetId())
  2192         
  2303         else:
       
  2304             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
       
  2305     
  2193     def OnOK(self, event):
  2306     def OnOK(self, event):
  2194         step_name = self.GetSizer().GetItem(1).GetWindow().GetValue()
  2307         step_name = self.GetSizer().GetItem(1).GetWindow().GetValue()
  2195         if step_name == "":
  2308         if step_name == "":
  2196             message = wx.MessageDialog(self, "You must type a name!", "Error", wx.OK|wx.ICON_ERROR)
  2309             message = wx.MessageDialog(self, "You must type a name!", "Error", wx.OK|wx.ICON_ERROR)
  2197             message.ShowModal()
  2310             message.ShowModal()