Dialogs.py
changeset 226 6a2f7ddd2e50
parent 165 e464a4e4e06d
child 251 cc5377a296ea
equal deleted inserted replaced
225:7726c8ffda42 226:6a2f7ddd2e50
   160               name='Preview', parent=self, pos=wx.Point(0, 0),
   160               name='Preview', parent=self, pos=wx.Point(0, 0),
   161               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
   161               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
   162         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
   162         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
   163         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
   163         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
   164         setattr(self.Preview, "GetScaling", lambda:None)
   164         setattr(self.Preview, "GetScaling", lambda:None)
       
   165         setattr(self.Preview, "GetBlockType", self.Controler.GetBlockType)
       
   166         setattr(self.Preview, "IsOfType", self.Controler.IsOfType)
   165 
   167 
   166         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
   168         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
   167         if wx.VERSION >= (2, 5, 0):
   169         if wx.VERSION >= (2, 5, 0):
   168             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
   170             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
   169             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
   171             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
   171             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
   173             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
   172             wx.EVT_PAINT(self.Preview, self.OnPaint)
   174             wx.EVT_PAINT(self.Preview, self.OnPaint)
   173         
   175         
   174         self._init_sizers()
   176         self._init_sizers()
   175 
   177 
   176     def __init__(self, parent):
   178     def __init__(self, parent, controler):
       
   179         self.Controler = controler
   177         self._init_ctrls(parent)
   180         self._init_ctrls(parent)
   178         self.BlockName.SetValue("")
   181         self.BlockName.SetValue("")
   179         self.BlockName.Enable(False)
   182         self.BlockName.Enable(False)
   180         self.Inputs.Enable(False)
   183         self.Inputs.Enable(False)
   181         self.Block = None
   184         self.Block = None
   297     def OnTypeTreeItemSelected(self, event):
   300     def OnTypeTreeItemSelected(self, event):
   298         self.BlockName.SetValue("")
   301         self.BlockName.SetValue("")
   299         selected = event.GetItem()
   302         selected = event.GetItem()
   300         pydata = self.TypeTree.GetPyData(selected)
   303         pydata = self.TypeTree.GetPyData(selected)
   301         if pydata["type"] != CATEGORY:
   304         if pydata["type"] != CATEGORY:
   302             blocktype = GetBlockType(self.TypeTree.GetItemText(selected), pydata["inputs"])
   305             blocktype = self.Controler.GetBlockType(self.TypeTree.GetItemText(selected), pydata["inputs"])
   303             if blocktype:
   306             if blocktype:
   304                 self.Inputs.SetValue(len(blocktype["inputs"]))
   307                 self.Inputs.SetValue(len(blocktype["inputs"]))
   305                 self.Inputs.Enable(blocktype["extensible"])
   308                 self.Inputs.Enable(blocktype["extensible"])
   306                 self.BlockName.Enable(blocktype["type"] != "function")
   309                 self.BlockName.Enable(blocktype["type"] != "function")
   307                 self.TypeDesc.SetValue(blocktype["comment"])
   310                 self.TypeDesc.SetValue(blocktype["comment"])
   449         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
   452         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
   450         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
   453         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
   451         
   454         
   452         self.SetSizer(self.flexGridSizer1)
   455         self.SetSizer(self.flexGridSizer1)
   453 
   456 
   454     def _init_ctrls(self, prnt):
   457     def _init_ctrls(self, prnt, ctrler):
   455         wx.Dialog.__init__(self, id=ID_VARIABLEPROPERTIESDIALOG,
   458         wx.Dialog.__init__(self, id=ID_VARIABLEPROPERTIESDIALOG,
   456               name='VariablePropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
   459               name='VariablePropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
   457               size=wx.Size(400, 380), style=wx.DEFAULT_DIALOG_STYLE,
   460               size=wx.Size(400, 380), style=wx.DEFAULT_DIALOG_STYLE,
   458               title='Variable Properties')
   461               title='Variable Properties')
   459         self.SetClientSize(wx.Size(400, 380))
   462         self.SetClientSize(wx.Size(400, 380))
   506               name='Preview', parent=self, pos=wx.Point(0, 0),
   509               name='Preview', parent=self, pos=wx.Point(0, 0),
   507               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
   510               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
   508         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
   511         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
   509         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
   512         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
   510         setattr(self.Preview, "GetScaling", lambda:None)
   513         setattr(self.Preview, "GetScaling", lambda:None)
       
   514         setattr(self.Preview, "IsOfType", ctrler.IsOfType)
   511 
   515 
   512         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
   516         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
   513 
   517 
   514         if wx.VERSION >= (2, 5, 0):
   518         if wx.VERSION >= (2, 5, 0):
   515             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
   519             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
   516         else:
   520         else:
   517             wx.EVT_PAINT(self.Preview, self.OnPaint)
   521             wx.EVT_PAINT(self.Preview, self.OnPaint)
   518         
   522         
   519         self._init_sizers()
   523         self._init_sizers()
   520 
   524 
   521     def __init__(self, parent):
   525     def __init__(self, parent, controler):
   522         self._init_ctrls(parent)
   526         self._init_ctrls(parent, controler)
   523         self.Variable = None
   527         self.Variable = None
   524         self.VarList = []
   528         self.VarList = []
   525         self.MinVariableSize = None
   529         self.MinVariableSize = None
   526         self.RefreshNameList()
   530         self.RefreshNameList()
   527         
   531         
   731         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
   735         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
   732         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
   736         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
   733 
   737 
   734         self.SetSizer(self.flexGridSizer1)
   738         self.SetSizer(self.flexGridSizer1)
   735 
   739 
   736     def _init_ctrls(self, prnt):
   740     def _init_ctrls(self, prnt, ctrler):
   737         wx.Dialog.__init__(self, id=ID_CONNECTIONPROPERTIESDIALOG,
   741         wx.Dialog.__init__(self, id=ID_CONNECTIONPROPERTIESDIALOG,
   738               name='ConnectionPropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
   742               name='ConnectionPropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
   739               size=wx.Size(350, 220), style=wx.DEFAULT_DIALOG_STYLE,
   743               size=wx.Size(350, 220), style=wx.DEFAULT_DIALOG_STYLE,
   740               title='Connection Properties')
   744               title='Connection Properties')
   741         self.SetClientSize(wx.Size(350, 220))
   745         self.SetClientSize(wx.Size(350, 220))
   773               name='Preview', parent=self, pos=wx.Point(0, 0),
   777               name='Preview', parent=self, pos=wx.Point(0, 0),
   774               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
   778               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
   775         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
   779         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
   776         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
   780         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
   777         setattr(self.Preview, "GetScaling", lambda:None)
   781         setattr(self.Preview, "GetScaling", lambda:None)
       
   782         setattr(self.Preview, "IsOfType", ctrler.IsOfType)
   778 
   783 
   779         self.Spacer = wx.Panel(id=ID_CONNECTIONPROPERTIESDIALOGSPACER,
   784         self.Spacer = wx.Panel(id=ID_CONNECTIONPROPERTIESDIALOGSPACER,
   780               name='Spacer', parent=self, pos=wx.Point(0, 0),
   785               name='Spacer', parent=self, pos=wx.Point(0, 0),
   781               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   786               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   782 
   787 
   787         else:
   792         else:
   788             wx.EVT_PAINT(self.Preview, self.OnPaint)
   793             wx.EVT_PAINT(self.Preview, self.OnPaint)
   789         
   794         
   790         self._init_sizers()
   795         self._init_sizers()
   791 
   796 
   792     def __init__(self, parent):
   797     def __init__(self, parent, controler):
   793         self._init_ctrls(parent)
   798         self._init_ctrls(parent, controler)
   794         self.Connection = None
   799         self.Connection = None
   795         self.MinConnectionSize = None
   800         self.MinConnectionSize = None
   796     
   801     
   797     def SetPreviewFont(self, font):
   802     def SetPreviewFont(self, font):
   798         self.Preview.SetFont(font)
   803         self.Preview.SetFont(font)
   921         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
   926         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
   922         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
   927         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
   923 
   928 
   924         self.SetSizer(self.flexGridSizer1)
   929         self.SetSizer(self.flexGridSizer1)
   925 
   930 
   926     def _init_ctrls(self, prnt, title, labels):
   931     def _init_ctrls(self, prnt, ctrler, title, labels):
   927         wx.Dialog.__init__(self, id=ID_LDELEMENTDIALOG,
   932         wx.Dialog.__init__(self, id=ID_LDELEMENTDIALOG,
   928               name='LDElementDialog', parent=prnt, pos=wx.Point(376, 223),
   933               name='LDElementDialog', parent=prnt, pos=wx.Point(376, 223),
   929               size=wx.Size(350, 260), style=wx.DEFAULT_DIALOG_STYLE,
   934               size=wx.Size(350, 260), style=wx.DEFAULT_DIALOG_STYLE,
   930               title=title)
   935               title=title)
   931         self.SetClientSize(wx.Size(350, 260))
   936         self.SetClientSize(wx.Size(350, 260))
   972               name='Preview', parent=self, pos=wx.Point(0, 0),
   977               name='Preview', parent=self, pos=wx.Point(0, 0),
   973               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
   978               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
   974         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
   979         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
   975         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
   980         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
   976         setattr(self.Preview, "GetScaling", lambda:None)
   981         setattr(self.Preview, "GetScaling", lambda:None)
       
   982         setattr(self.Preview, "IsOfType", ctrler.IsOfType)
   977 
   983 
   978         self.Spacer = wx.Panel(id=ID_LDELEMENTDIALOGSPACER,
   984         self.Spacer = wx.Panel(id=ID_LDELEMENTDIALOGSPACER,
   979               name='Spacer', parent=self, pos=wx.Point(0, 0),
   985               name='Spacer', parent=self, pos=wx.Point(0, 0),
   980               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   986               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   981 
   987 
   986         else:
   992         else:
   987             wx.EVT_PAINT(self.Preview, self.OnPaint)
   993             wx.EVT_PAINT(self.Preview, self.OnPaint)
   988         
   994         
   989         self._init_sizers()
   995         self._init_sizers()
   990 
   996 
   991     def __init__(self, parent, type):
   997     def __init__(self, parent, controler, type):
   992         self.Type = type
   998         self.Type = type
   993         if type == "contact":
   999         if type == "contact":
   994             self._init_ctrls(parent, "Edit Contact Values", ['Normal','Negate','Rising Edge','Falling Edge'])
  1000             self._init_ctrls(parent, controler, "Edit Contact Values", ['Normal','Negate','Rising Edge','Falling Edge'])
   995             self.Element = LD_Contact(self.Preview, CONTACT_NORMAL, "")
  1001             self.Element = LD_Contact(self.Preview, CONTACT_NORMAL, "")
   996         elif type == "coil":
  1002         elif type == "coil":
   997             self._init_ctrls(parent, "Edit Coil Values", ['Normal','Negate','Set','Reset'])
  1003             self._init_ctrls(parent, controler, "Edit Coil Values", ['Normal','Negate','Set','Reset'])
   998             self.Element = LD_Coil(self.Preview, COIL_NORMAL, "")
  1004             self.Element = LD_Coil(self.Preview, COIL_NORMAL, "")
   999     
  1005     
  1000     def SetPreviewFont(self, font):
  1006     def SetPreviewFont(self, font):
  1001         self.Preview.SetFont(font)
  1007         self.Preview.SetFont(font)
  1002     
  1008     
  1152         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
  1158         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
  1153         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
  1159         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
  1154 
  1160 
  1155         self.SetSizer(self.flexGridSizer1)
  1161         self.SetSizer(self.flexGridSizer1)
  1156 
  1162 
  1157     def _init_ctrls(self, prnt):
  1163     def _init_ctrls(self, prnt, ctrler):
  1158         wx.Dialog.__init__(self, id=ID_LDPOWERRAILDIALOG,
  1164         wx.Dialog.__init__(self, id=ID_LDPOWERRAILDIALOG,
  1159               name='PowerRailDialog', parent=prnt, pos=wx.Point(376, 223),
  1165               name='PowerRailDialog', parent=prnt, pos=wx.Point(376, 223),
  1160               size=wx.Size(350, 260), style=wx.DEFAULT_DIALOG_STYLE,
  1166               size=wx.Size(350, 260), style=wx.DEFAULT_DIALOG_STYLE,
  1161               title='Power Rail Properties')
  1167               title='Power Rail Properties')
  1162         self.SetClientSize(wx.Size(350, 260))
  1168         self.SetClientSize(wx.Size(350, 260))
  1193               name='Preview', parent=self, pos=wx.Point(0, 0),
  1199               name='Preview', parent=self, pos=wx.Point(0, 0),
  1194               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
  1200               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
  1195         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
  1201         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
  1196         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
  1202         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
  1197         setattr(self.Preview, "GetScaling", lambda:None)
  1203         setattr(self.Preview, "GetScaling", lambda:None)
       
  1204         setattr(self.Preview, "IsOfType", ctrler.IsOfType)
  1198 
  1205 
  1199         self.Spacer = wx.Panel(id=ID_LDELEMENTDIALOGSPACER,
  1206         self.Spacer = wx.Panel(id=ID_LDELEMENTDIALOGSPACER,
  1200               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1207               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1201               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
  1208               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
  1202 
  1209 
  1207         else:
  1214         else:
  1208             wx.EVT_PAINT(self.Preview, self.OnPaint)
  1215             wx.EVT_PAINT(self.Preview, self.OnPaint)
  1209         
  1216         
  1210         self._init_sizers()
  1217         self._init_sizers()
  1211 
  1218 
  1212     def __init__(self, parent, type = LEFTRAIL, number = 1):
  1219     def __init__(self, parent, controler, type = LEFTRAIL, number = 1):
  1213         self._init_ctrls(parent)
  1220         self._init_ctrls(parent, controler)
  1214         self.Type = type
  1221         self.Type = type
  1215         if type == LEFTRAIL:
  1222         if type == LEFTRAIL:
  1216             self.radioButton1.SetValue(True)
  1223             self.radioButton1.SetValue(True)
  1217         elif type == RIGHTRAIL:
  1224         elif type == RIGHTRAIL:
  1218             self.radioButton2.SetValue(True)
  1225             self.radioButton2.SetValue(True)
  1331         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
  1338         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
  1332         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
  1339         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
  1333 
  1340 
  1334         self.SetSizer(self.flexGridSizer1)
  1341         self.SetSizer(self.flexGridSizer1)
  1335 
  1342 
  1336     def _init_ctrls(self, prnt):
  1343     def _init_ctrls(self, prnt, ctrler):
  1337         wx.Dialog.__init__(self, id=ID_STEPCONTENTDIALOG,
  1344         wx.Dialog.__init__(self, id=ID_STEPCONTENTDIALOG,
  1338               name='StepContentDialog', parent=prnt, pos=wx.Point(376, 223),
  1345               name='StepContentDialog', parent=prnt, pos=wx.Point(376, 223),
  1339               size=wx.Size(400, 250), style=wx.DEFAULT_DIALOG_STYLE,
  1346               size=wx.Size(400, 250), style=wx.DEFAULT_DIALOG_STYLE,
  1340               title='Edit Step')
  1347               title='Edit Step')
  1341         self.SetClientSize(wx.Size(400, 250))
  1348         self.SetClientSize(wx.Size(400, 250))
  1381               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
  1388               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
  1382         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
  1389         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
  1383         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
  1390         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
  1384         setattr(self.Preview, "RefreshStepModel", lambda x:None)
  1391         setattr(self.Preview, "RefreshStepModel", lambda x:None)
  1385         setattr(self.Preview, "GetScaling", lambda:None)
  1392         setattr(self.Preview, "GetScaling", lambda:None)
       
  1393         setattr(self.Preview, "IsOfType", ctrler.IsOfType)
  1386 
  1394 
  1387         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
  1395         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
  1388         if wx.VERSION >= (2, 5, 0):
  1396         if wx.VERSION >= (2, 5, 0):
  1389             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
  1397             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
  1390             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
  1398             self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
  1392             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
  1400             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
  1393             wx.EVT_PAINT(self.Preview, self.OnPaint)
  1401             wx.EVT_PAINT(self.Preview, self.OnPaint)
  1394         
  1402         
  1395         self._init_sizers()
  1403         self._init_sizers()
  1396 
  1404 
  1397     def __init__(self, parent, initial = False):
  1405     def __init__(self, parent, controler, initial = False):
  1398         self._init_ctrls(parent)
  1406         self._init_ctrls(parent, controler)
  1399         self.Step = None
  1407         self.Step = None
  1400         self.Initial = initial
  1408         self.Initial = initial
  1401         self.MinStepSize = None
  1409         self.MinStepSize = None
  1402     
  1410     
  1403         self.PouNames = []
  1411         self.PouNames = []
  1577         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
  1585         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
  1578         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
  1586         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
  1579 
  1587 
  1580         self.SetSizer(self.flexGridSizer1)
  1588         self.SetSizer(self.flexGridSizer1)
  1581 
  1589 
  1582     def _init_ctrls(self, prnt):
  1590     def _init_ctrls(self, prnt, ctrler):
  1583         wx.Dialog.__init__(self, id=ID_TRANSITIONCONTENTDIALOG,
  1591         wx.Dialog.__init__(self, id=ID_TRANSITIONCONTENTDIALOG,
  1584               name='ProjectDialog', parent=prnt, pos=wx.Point(376, 223),
  1592               name='ProjectDialog', parent=prnt, pos=wx.Point(376, 223),
  1585               size=wx.Size(350, 300), style=wx.DEFAULT_DIALOG_STYLE,
  1593               size=wx.Size(350, 300), style=wx.DEFAULT_DIALOG_STYLE,
  1586               title='Edit transition')
  1594               title='Edit transition')
  1587         self.SetClientSize(wx.Size(350, 300))
  1595         self.SetClientSize(wx.Size(350, 300))
  1639               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
  1647               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
  1640         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
  1648         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
  1641         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
  1649         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
  1642         setattr(self.Preview, "RefreshTransitionModel", lambda x:None)
  1650         setattr(self.Preview, "RefreshTransitionModel", lambda x:None)
  1643         setattr(self.Preview, "GetScaling", lambda:None)
  1651         setattr(self.Preview, "GetScaling", lambda:None)
       
  1652         setattr(self.Preview, "IsOfType", ctrler.IsOfType)
  1644 
  1653 
  1645         self.Spacer = wx.Panel(id=ID_TRANSITIONCONTENTDIALOGSPACER,
  1654         self.Spacer = wx.Panel(id=ID_TRANSITIONCONTENTDIALOGSPACER,
  1646               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1655               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1647               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
  1656               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
  1648 
  1657 
  1654             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
  1663             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
  1655             wx.EVT_PAINT(self.Preview, self.OnPaint)
  1664             wx.EVT_PAINT(self.Preview, self.OnPaint)
  1656         
  1665         
  1657         self._init_sizers()
  1666         self._init_sizers()
  1658 
  1667 
  1659     def __init__(self, parent, connection):
  1668     def __init__(self, parent, controler, connection):
  1660         self.Connection = connection
  1669         self.Connection = connection
  1661         self._init_ctrls(parent)
  1670         self._init_ctrls(parent, controler)
  1662         self.Transition = None
  1671         self.Transition = None
  1663         self.MinTransitionSize = None
  1672         self.MinTransitionSize = None
  1664         
  1673         
  1665         self.Element = SFC_Transition(self.Preview)
  1674         self.Element = SFC_Transition(self.Preview)
  1666     
  1675     
  1854         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
  1863         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
  1855         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
  1864         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
  1856 
  1865 
  1857         self.SetSizer(self.flexGridSizer1)
  1866         self.SetSizer(self.flexGridSizer1)
  1858     
  1867     
  1859     def _init_ctrls(self, prnt):
  1868     def _init_ctrls(self, prnt, ctrler):
  1860         wx.Dialog.__init__(self, id=ID_DIVERGENCECREATEDIALOG,
  1869         wx.Dialog.__init__(self, id=ID_DIVERGENCECREATEDIALOG,
  1861               name='DivergencePropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
  1870               name='DivergencePropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
  1862               size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE,
  1871               size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE,
  1863               title='Create a new divergence or convergence')
  1872               title='Create a new divergence or convergence')
  1864         self.SetClientSize(wx.Size(500, 300))
  1873         self.SetClientSize(wx.Size(500, 300))
  1907         self.Preview = wx.Panel(id=ID_DIVERGENCECREATEDIALOGPREVIEW,
  1916         self.Preview = wx.Panel(id=ID_DIVERGENCECREATEDIALOGPREVIEW,
  1908               name='Preview', parent=self, pos=wx.Point(0, 0),
  1917               name='Preview', parent=self, pos=wx.Point(0, 0),
  1909               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
  1918               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
  1910         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
  1919         self.Preview.SetBackgroundColour(wx.Colour(255,255,255))
  1911         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
  1920         setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
       
  1921         setattr(self.Preview, "IsOfType", ctrler.IsOfType)
  1912 
  1922 
  1913         self.Spacer = wx.Panel(id=ID_TRANSITIONCONTENTDIALOGSPACER,
  1923         self.Spacer = wx.Panel(id=ID_TRANSITIONCONTENTDIALOGSPACER,
  1914               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1924               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1915               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
  1925               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
  1916 
  1926 
  1921         else:
  1931         else:
  1922             wx.EVT_PAINT(self.Preview, self.OnPaint)
  1932             wx.EVT_PAINT(self.Preview, self.OnPaint)
  1923         
  1933         
  1924         self._init_sizers()
  1934         self._init_sizers()
  1925 
  1935 
  1926     def __init__(self, parent):
  1936     def __init__(self, parent, controler):
  1927         self._init_ctrls(parent)
  1937         self._init_ctrls(parent, controler)
  1928         
  1938         
  1929         self.Divergence = None
  1939         self.Divergence = None
  1930         self.MinSize = (0, 0)
  1940         self.MinSize = (0, 0)
  1931     
  1941     
  1932     def SetPreviewFont(self, font):
  1942     def SetPreviewFont(self, font):