graphics/SFC_Objects.py
changeset 249 d8425712acef
parent 243 c5da8b706cde
child 253 d9391572655f
equal deleted inserted replaced
248:f7df265edd54 249:d8425712acef
    57         else:
    57         else:
    58             self.Input = None
    58             self.Input = None
    59         self.Output = None
    59         self.Output = None
    60         self.Action = None
    60         self.Action = None
    61     
    61     
    62     # Destructor
    62     def Flush(self):
    63     def __del__(self):
    63         if self.Input is not None:
    64         self.Input = None
    64             self.Input.Flush()
    65         self.Output = None
    65             self.Input = None
    66         self.Action = None
    66         if self.Output is not None:
       
    67             self.Output.Flush()
       
    68             self.Output = None
       
    69         if self.Output is not None:
       
    70             self.Action.Flush()
       
    71             self.Action = None
    67     
    72     
    68     # Make a clone of this SFC_Step
    73     # Make a clone of this SFC_Step
    69     def Clone(self, parent, id = None, name = "Step", pos = None):
    74     def Clone(self, parent, id = None, name = "Step", pos = None):
    70         step = SFC_Step(parent, name, self.Initial, id)
    75         step = SFC_Step(parent, name, self.Initial, id)
    71         step.SetSize(self.Size[0], self.Size[1])
    76         step.SetSize(self.Size[0], self.Size[1])
   516         self.Output = Connector(self, "", None, wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH, onlyone = True)
   521         self.Output = Connector(self, "", None, wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH, onlyone = True)
   517         self.SetType(type, condition)
   522         self.SetType(type, condition)
   518         self.SetPriority(priority)
   523         self.SetPriority(priority)
   519         self.Errors = {}
   524         self.Errors = {}
   520     
   525     
   521     # Destructor
   526     def Flush(self):
   522     def __del__(self):
   527         if self.Input is not None:
   523         self.Input = None
   528             self.Input.Flush()
   524         self.Output = None
   529             self.Input = None
   525         if self.Type == "connection":
   530         if self.Output is not None:
       
   531             self.Output.Flush()
       
   532             self.Output = None
       
   533         if self.Type == "connection" and self.Condition is not None:
       
   534             self.Condition.Flush()
   526             self.Condition = None
   535             self.Condition = None
   527     
   536     
   528     # Make a clone of this SFC_Transition
   537     # Make a clone of this SFC_Transition
   529     def Clone(self, parent, id = None, pos = None):
   538     def Clone(self, parent, id = None, pos = None):
   530         transition = SFC_Transition(parent, self.Type, self.Condition, self.Priority, id)
   539         transition = SFC_Transition(parent, self.Type, self.Condition, self.Priority, id)
   919             self.Inputs = []
   928             self.Inputs = []
   920             for i in xrange(number):
   929             for i in xrange(number):
   921                 self.Inputs.append(Connector(self, "", None, wx.Point(i * SFC_DEFAULT_SEQUENCE_INTERVAL, 0), NORTH, onlyone = True))
   930                 self.Inputs.append(Connector(self, "", None, wx.Point(i * SFC_DEFAULT_SEQUENCE_INTERVAL, 0), NORTH, onlyone = True))
   922             self.Outputs = [Connector(self, "", None, wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH, onlyone = True)]
   931             self.Outputs = [Connector(self, "", None, wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH, onlyone = True)]
   923     
   932     
   924     # Destructor
   933     def Flush(self):
   925     def __del__(self):
   934         for input in self.Inputs:
       
   935             input.Flush()
   926         self.Inputs = []
   936         self.Inputs = []
       
   937         for output in self.Outputs:
       
   938             output.Flush()
   927         self.Outputs = []
   939         self.Outputs = []
   928     
   940     
   929     # Make a clone of this SFC_Divergence
   941     # Make a clone of this SFC_Divergence
   930     def Clone(self, parent, id = None, pos = None):
   942     def Clone(self, parent, id = None, pos = None):
   931         divergence = SFC_Divergence(parent, self.Type, max(len(self.Inputs), len(self.Outputs)), id)
   943         divergence = SFC_Divergence(parent, self.Type, max(len(self.Inputs), len(self.Outputs)), id)
  1336         self.Size = wx.Size(SFC_JUMP_SIZE[0], SFC_JUMP_SIZE[1])
  1348         self.Size = wx.Size(SFC_JUMP_SIZE[0], SFC_JUMP_SIZE[1])
  1337         self.Errors = {}
  1349         self.Errors = {}
  1338         # Create an input and output connector
  1350         # Create an input and output connector
  1339         self.Input = Connector(self, "", None, wx.Point(self.Size[0] / 2, 0), NORTH, onlyone = True)
  1351         self.Input = Connector(self, "", None, wx.Point(self.Size[0] / 2, 0), NORTH, onlyone = True)
  1340         
  1352         
  1341     # Destructor
  1353     def Flush(self):
  1342     def __del__(self):
  1354         if self.Input is not None:
  1343         self.Input = None
  1355             self.Input.Flush()
       
  1356             self.Input = None
  1344     
  1357     
  1345     # Make a clone of this SFC_Jump
  1358     # Make a clone of this SFC_Jump
  1346     def Clone(self, parent, id = None, pos = None):
  1359     def Clone(self, parent, id = None, pos = None):
  1347         jump = SFC_Jump(parent, self.Target, id)
  1360         jump = SFC_Jump(parent, self.Target, id)
  1348         jump.SetSize(self.Size[0], self.Size[1])
  1361         jump.SetSize(self.Size[0], self.Size[1])
  1562         self.Errors = {}
  1575         self.Errors = {}
  1563         # Create an input and output connector
  1576         # Create an input and output connector
  1564         self.Input = Connector(self, "", None, wx.Point(0, SFC_ACTION_MIN_SIZE[1] / 2), WEST, onlyone = True)
  1577         self.Input = Connector(self, "", None, wx.Point(0, SFC_ACTION_MIN_SIZE[1] / 2), WEST, onlyone = True)
  1565         self.SetActions(actions)
  1578         self.SetActions(actions)
  1566     
  1579     
  1567     # Destructor
  1580     def Flush(self):
  1568     def __del__(self):
  1581         if self.Input is not None:
  1569         self.Input = None
  1582             self.Input.Flush()
       
  1583             self.Input = None
  1570     
  1584     
  1571     # Make a clone of this SFC_ActionBlock
  1585     # Make a clone of this SFC_ActionBlock
  1572     def Clone(self, parent, id = None, pos = None):
  1586     def Clone(self, parent, id = None, pos = None):
  1573         actions = [action.copy() for action in self.Actions]
  1587         actions = [action.copy() for action in self.Actions]
  1574         action_block = SFC_ActionBlock(parent, actions, id)
  1588         action_block = SFC_ActionBlock(parent, actions, id)