equal
deleted
inserted
replaced
87 else: |
87 else: |
88 Graphic_Element.SetSize(self, LD_POWERRAIL_WIDTH, height) |
88 Graphic_Element.SetSize(self, LD_POWERRAIL_WIDTH, height) |
89 self.RefreshConnectors() |
89 self.RefreshConnectors() |
90 |
90 |
91 # Forbids to select a power rail |
91 # Forbids to select a power rail |
92 def HitTest(self, pt): |
92 def HitTest(self, pt, connectors=True): |
93 if self.Parent.GetDrawingMode() == FREEDRAWING_MODE: |
93 if self.Parent.GetDrawingMode() == FREEDRAWING_MODE: |
94 return Graphic_Element.HitTest(self, pt) or self.TestConnector(pt, exclude=False) != None |
94 return Graphic_Element.HitTest(self, pt, connectors) or self.TestConnector(pt, exclude=False) != None |
95 return False |
95 return False |
96 |
96 |
97 # Forbids to select a power rail |
97 # Forbids to select a power rail |
98 def IsInSelection(self, rect): |
98 def IsInSelection(self, rect): |
99 if self.Parent.GetDrawingMode() == FREEDRAWING_MODE: |
99 if self.Parent.GetDrawingMode() == FREEDRAWING_MODE: |
197 connector.MoveConnected(exclude) |
197 connector.MoveConnected(exclude) |
198 |
198 |
199 # Returns the power rail connector that starts with the point given if it exists |
199 # Returns the power rail connector that starts with the point given if it exists |
200 def GetConnector(self, position, name = None): |
200 def GetConnector(self, position, name = None): |
201 # if a name is given |
201 # if a name is given |
202 if name: |
202 if name is not None: |
203 # Test each connector if it exists |
203 # Test each connector if it exists |
204 for connector in self.Connectors: |
204 for connector in self.Connectors: |
205 if name == connector.GetName(): |
205 if name == connector.GetName(): |
206 return connector |
206 return connector |
207 return self.FindNearestConnector(position, [connector for connector in self.Connectors if connector is not None]) |
207 return self.FindNearestConnector(position, [connector for connector in self.Connectors if connector is not None]) |
507 self.Output.MoveConnected(exclude) |
507 self.Output.MoveConnected(exclude) |
508 |
508 |
509 # Returns the contact connector that starts with the point given if it exists |
509 # Returns the contact connector that starts with the point given if it exists |
510 def GetConnector(self, position, name = None): |
510 def GetConnector(self, position, name = None): |
511 # if a name is given |
511 # if a name is given |
512 if name: |
512 if name is not None: |
513 # Test input and output connector |
513 # Test input and output connector |
514 if name == self.Input.GetName(): |
514 #if name == self.Input.GetName(): |
515 return self.Input |
515 # return self.Input |
516 if name == self.Output.GetName(): |
516 if name == self.Output.GetName(): |
517 return self.Output |
517 return self.Output |
518 return self.FindNearestConnector(position, [self.Input, self.Output]) |
518 return self.FindNearestConnector(position, [self.Input, self.Output]) |
519 |
519 |
520 # Returns input and output contact connectors |
520 # Returns input and output contact connectors |
826 self.Output.MoveConnected(exclude) |
826 self.Output.MoveConnected(exclude) |
827 |
827 |
828 # Returns the coil connector that starts with the point given if it exists |
828 # Returns the coil connector that starts with the point given if it exists |
829 def GetConnector(self, position, name = None): |
829 def GetConnector(self, position, name = None): |
830 # if a name is given |
830 # if a name is given |
831 if name: |
831 if name is not None: |
832 # Test input and output connector |
832 # Test input and output connector |
833 if self.Input and name == self.Input.GetName(): |
833 #if self.Input and name == self.Input.GetName(): |
834 return self.Input |
834 # return self.Input |
835 if self.Output and name == self.Output.GetName(): |
835 if self.Output and name == self.Output.GetName(): |
836 return self.Output |
836 return self.Output |
837 return self.FindNearestConnector(position, [self.Input, self.Output]) |
837 return self.FindNearestConnector(position, [self.Input, self.Output]) |
838 |
838 |
839 # Returns input and output coil connectors |
839 # Returns input and output coil connectors |