graphics/FBD_Objects.py
changeset 162 e746ff4aa8be
parent 145 4fb225afddf4
child 165 e464a4e4e06d
equal deleted inserted replaced
161:6af49f77fa2b 162:e746ff4aa8be
    51         self.Colour = wx.BLACK
    51         self.Colour = wx.BLACK
    52         self.Pen = wx.BLACK_PEN
    52         self.Pen = wx.BLACK_PEN
    53         self.SetType(type, extension, inputs, connectors)
    53         self.SetType(type, extension, inputs, connectors)
    54     
    54     
    55     # Make a clone of this FBD_Block
    55     # Make a clone of this FBD_Block
    56     def Clone(self, id = None, name = "", pos = None):
    56     def Clone(self, parent, id = None, name = "", pos = None):
    57         if self.Name != "" and name == "":
    57         if self.Name != "" and name == "":
    58             name = self.Name
    58             name = self.Name
    59         block = FBD_Block(self.Parent, self.Type, name, id, self.Extension)
    59         block = FBD_Block(parent, self.Type, name, id, self.Extension)
    60         block.SetSize(self.Size[0], self.Size[1])
    60         block.SetSize(self.Size[0], self.Size[1])
    61         if pos is not None:
    61         if pos is not None:
    62             block.SetPosition(pos.x, pos.y)
    62             block.SetPosition(pos.x, pos.y)
    63         block.Inputs = [input.Clone(block) for input in self.Inputs]
    63         block.Inputs = [input.Clone(block) for input in self.Inputs]
    64         block.Outputs = [output.Clone(block) for output in self.Outputs]
    64         block.Outputs = [output.Clone(block) for output in self.Outputs]
   399         self.Input = None
   399         self.Input = None
   400         self.Output = None
   400         self.Output = None
   401         self.SetType(type, value_type)
   401         self.SetType(type, value_type)
   402     
   402     
   403     # Make a clone of this FBD_Variable
   403     # Make a clone of this FBD_Variable
   404     def Clone(self, id = None, pos = None):
   404     def Clone(self, parent, id = None, pos = None):
   405         variable = FBD_Variable(self.Parent, self.Type, self.Name, self.ValueType, id)
   405         variable = FBD_Variable(parent, self.Type, self.Name, self.ValueType, id)
   406         variable.SetSize(self.Size[0], self.Size[1])
   406         variable.SetSize(self.Size[0], self.Size[1])
   407         if pos is not None:
   407         if pos is not None:
   408             variable.SetPosition(pos.x, pos.y)
   408             variable.SetPosition(pos.x, pos.y)
   409         if self.Input:
   409         if self.Input:
   410             variable.Input = self.Input.Clone(variable)
   410             variable.Input = self.Input.Clone(variable)
   647             if self.Connector and self.Connector.IsConnected():
   647             if self.Connector and self.Connector.IsConnected():
   648                 rect = rect.Union(self.Connector.GetConnectedRedrawRect(movex, movey))
   648                 rect = rect.Union(self.Connector.GetConnectedRedrawRect(movex, movey))
   649         return rect
   649         return rect
   650     
   650     
   651     # Make a clone of this FBD_Connector
   651     # Make a clone of this FBD_Connector
   652     def Clone(self, id = None, pos = None):
   652     def Clone(self, parent, id = None, pos = None):
   653         connection = FBD_Connector(self.Parent, self.Type, self.Name, id)
   653         connection = FBD_Connector(parent, self.Type, self.Name, id)
   654         connection.SetSize(self.Size[0], self.Size[1])
   654         connection.SetSize(self.Size[0], self.Size[1])
   655         if pos is not None:
   655         if pos is not None:
   656             connection.SetPosition(pos.x, pos.y)
   656             connection.SetPosition(pos.x, pos.y)
   657         connection.Connector = self.Connector.Clone(connection)
   657         connection.Connector = self.Connector.Clone(connection)
   658         return connection
   658         return connection