graphics/SFC_Objects.py
changeset 1743 c3c3d1318130
parent 1741 dd94b9a68c61
child 1744 69dfdb26f600
equal deleted inserted replaced
1742:92932cd370a4 1743:c3c3d1318130
   818                self.Condition.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
   818                self.Condition.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
   819             self.Type = type
   819             self.Type = type
   820             if type == "connection":
   820             if type == "connection":
   821                 self.Condition = Connector(self, "", "BOOL", wx.Point(0, self.Size[1] / 2), WEST)
   821                 self.Condition = Connector(self, "", "BOOL", wx.Point(0, self.Size[1] / 2), WEST)
   822             else:
   822             else:
   823                 if condition == None:
   823                 if condition is None:
   824                     condition = ""
   824                     condition = ""
   825                 self.Condition = condition
   825                 self.Condition = condition
   826                 self.RefreshConditionSize()
   826                 self.RefreshConditionSize()
   827         elif self.Type != "connection":
   827         elif self.Type != "connection":
   828             if condition == None:
   828             if condition is None:
   829                 condition = ""
   829                 condition = ""
   830             self.Condition = condition
   830             self.Condition = condition
   831             self.RefreshConditionSize()
   831             self.RefreshConditionSize()
   832         self.RefreshBoundingBox()
   832         self.RefreshBoundingBox()
   833 
   833 
  1195         elif self.Type in [SELECTION_CONVERGENCE, SIMULTANEOUS_CONVERGENCE]:
  1195         elif self.Type in [SELECTION_CONVERGENCE, SIMULTANEOUS_CONVERGENCE]:
  1196             return len(self.Inputs)
  1196             return len(self.Inputs)
  1197 
  1197 
  1198     # Returns if the point given is in the bounding box
  1198     # Returns if the point given is in the bounding box
  1199     def HitTest(self, pt, connectors=True):
  1199     def HitTest(self, pt, connectors=True):
  1200         return self.BoundingBox.InsideXY(pt.x, pt.y) or self.TestConnector(pt, exclude=False) != None
  1200         return self.BoundingBox.InsideXY(pt.x, pt.y) or self.TestConnector(pt, exclude=False) is not None
  1201 
  1201 
  1202     # Refresh the divergence bounding box
  1202     # Refresh the divergence bounding box
  1203     def RefreshBoundingBox(self):
  1203     def RefreshBoundingBox(self):
  1204         if self.Type in [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE]:
  1204         if self.Type in [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE]:
  1205             self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y,
  1205             self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y,