equal
deleted
inserted
replaced
235 if name: |
235 if name: |
236 # Test each connector if it exists |
236 # Test each connector if it exists |
237 for connector in self.Connectors: |
237 for connector in self.Connectors: |
238 if connector and name == connector.GetName(): |
238 if connector and name == connector.GetName(): |
239 return connector |
239 return connector |
240 for connector in self.Connectors: |
240 return self.FindNearestConnector(position, [connector for connector in self.Connectors if connector is not None]) |
241 if connector: |
|
242 connector_pos = connector.GetRelPosition() |
|
243 if position.x == self.Pos.x + connector_pos.x and position.y == self.Pos.y + connector_pos.y: |
|
244 return connector |
|
245 return None |
|
246 |
241 |
247 # Returns all the power rail connectors |
242 # Returns all the power rail connectors |
248 def GetConnectors(self): |
243 def GetConnectors(self): |
249 connectors = [connector for connector in self.Connectors if connector] |
244 connectors = [connector for connector in self.Connectors if connector] |
250 if self.Type == LEFTRAIL: |
245 if self.Type == LEFTRAIL: |
550 # Test input and output connector |
545 # Test input and output connector |
551 if name == self.Input.GetName(): |
546 if name == self.Input.GetName(): |
552 return self.Input |
547 return self.Input |
553 if name == self.Output.GetName(): |
548 if name == self.Output.GetName(): |
554 return self.Output |
549 return self.Output |
555 # Test input connector |
550 return self.FindNearestConnector(position, [self.Input, self.Output]) |
556 input_pos = self.Input.GetRelPosition() |
|
557 if position.x == self.Pos.x + input_pos.x and position.y == self.Pos.y + input_pos.y: |
|
558 return self.Input |
|
559 # Test output connector |
|
560 output_pos = self.Output.GetRelPosition() |
|
561 if position.x == self.Pos.x + output_pos.x and position.y == self.Pos.y + output_pos.y: |
|
562 return self.Output |
|
563 return None |
|
564 |
551 |
565 # Returns input and output contact connectors |
552 # Returns input and output contact connectors |
566 def GetConnectors(self): |
553 def GetConnectors(self): |
567 return {"inputs": [self.Input], "outputs": [self.Output]} |
554 return {"inputs": [self.Input], "outputs": [self.Output]} |
568 |
555 |
841 # Test input and output connector |
828 # Test input and output connector |
842 if self.Input and name == self.Input.GetName(): |
829 if self.Input and name == self.Input.GetName(): |
843 return self.Input |
830 return self.Input |
844 if self.Output and name == self.Output.GetName(): |
831 if self.Output and name == self.Output.GetName(): |
845 return self.Output |
832 return self.Output |
846 # Test input connector |
833 return self.FindNearestConnector(position, [self.Input, self.Output]) |
847 input_pos = self.Input.GetRelPosition() |
|
848 if position.x == self.Pos.x + input_pos.x and position.y == self.Pos.y + input_pos.y: |
|
849 return self.Input |
|
850 # Test output connector |
|
851 output_pos = self.Output.GetRelPosition() |
|
852 if position.x == self.Pos.x + output_pos.x and position.y == self.Pos.y + output_pos.y: |
|
853 return self.Output |
|
854 return None |
|
855 |
834 |
856 # Returns input and output coil connectors |
835 # Returns input and output coil connectors |
857 def GetConnectors(self): |
836 def GetConnectors(self): |
858 return {"inputs": [self.Input], "outputs": [self.Output]} |
837 return {"inputs": [self.Input], "outputs": [self.Output]} |
859 |
838 |