graphics/FBD_Objects.py
changeset 563 3f92a5e18804
parent 537 a31bf722aa82
child 566 6014ef82a98a
equal deleted inserted replaced
562:0ce12552cf36 563:3f92a5e18804
    47         self.SetName(name)
    47         self.SetName(name)
    48         self.SetExecutionOrder(executionOrder)
    48         self.SetExecutionOrder(executionOrder)
    49         self.Inputs = []
    49         self.Inputs = []
    50         self.Outputs = []
    50         self.Outputs = []
    51         self.Colour = wx.BLACK
    51         self.Colour = wx.BLACK
    52         self.Pen = wx.BLACK_PEN
    52         self.Pen = MiterPen(wx.BLACK)
    53         self.SetType(type, extension, inputs, connectors, executionControl)
    53         self.SetType(type, extension, inputs, connectors, executionControl)
    54         self.Errors = {}
    54         self.Errors = {}
    55     
    55     
    56     # Make a clone of this FBD_Block
    56     # Make a clone of this FBD_Block
    57     def Clone(self, parent, id = None, name = "", pos = None):
    57     def Clone(self, parent, id = None, name = "", pos = None):
   238                 inputs = connectors.get("inputs", [])
   238                 inputs = connectors.get("inputs", [])
   239                 outputs = connectors.get("outputs", [])
   239                 outputs = connectors.get("outputs", [])
   240             if self.ExecutionControl:
   240             if self.ExecutionControl:
   241                 inputs.insert(0, ("EN","BOOL","none"))
   241                 inputs.insert(0, ("EN","BOOL","none"))
   242                 outputs.insert(0, ("ENO","BOOL","none"))
   242                 outputs.insert(0, ("ENO","BOOL","none"))
   243             self.Pen = wx.Pen(self.Colour)
   243             self.Pen = MiterPen(self.Colour)
   244             self.Clean()
   244             self.Clean()
   245             # Extract the inputs properties and create the corresponding connector
   245             # Extract the inputs properties and create the corresponding connector
   246             self.Inputs = []
   246             self.Inputs = []
   247             for input_name, input_type, input_modifier in inputs:
   247             for input_name, input_type, input_modifier in inputs:
   248                 connector = Connector(self, input_name, input_type, wx.Point(0, 0), WEST, onlyone = True)
   248                 connector = Connector(self, input_name, input_type, wx.Point(0, 0), WEST, onlyone = True)
   649             self.Errors.append((start[1], end[1]))
   649             self.Errors.append((start[1], end[1]))
   650     
   650     
   651     # Draws variable
   651     # Draws variable
   652     def Draw(self, dc):
   652     def Draw(self, dc):
   653         Graphic_Element.Draw(self, dc)
   653         Graphic_Element.Draw(self, dc)
   654         dc.SetPen(wx.BLACK_PEN)
   654         dc.SetPen(MiterPen(wx.BLACK))
   655         dc.SetBrush(wx.WHITE_BRUSH)
   655         dc.SetBrush(wx.WHITE_BRUSH)
   656         
   656         
   657         if getattr(dc, "printing", False):
   657         if getattr(dc, "printing", False):
   658             name_size = dc.GetTextExtent(self.Name)
   658             name_size = dc.GetTextExtent(self.Name)
   659             executionorder_size = dc.GetTextExtent(str(self.ExecutionOrder))
   659             executionorder_size = dc.GetTextExtent(str(self.ExecutionOrder))
   852                 self.Connector.RefreshWires()
   852                 self.Connector.RefreshWires()
   853     
   853     
   854     # Draws connection
   854     # Draws connection
   855     def Draw(self, dc):
   855     def Draw(self, dc):
   856         Graphic_Element.Draw(self, dc)
   856         Graphic_Element.Draw(self, dc)
   857         dc.SetPen(wx.BLACK_PEN)
   857         dc.SetPen(MiterPen(wx.BLACK))
   858         dc.SetBrush(wx.WHITE_BRUSH)
   858         dc.SetBrush(wx.WHITE_BRUSH)
   859         
   859         
   860         if getattr(dc, "printing", False):
   860         if getattr(dc, "printing", False):
   861             name_size = dc.GetTextExtent(self.Name)
   861             name_size = dc.GetTextExtent(self.Name)
   862         else:
   862         else: