graphics/LD_Objects.py
changeset 633 3536f4469cde
parent 566 6014ef82a98a
child 634 cc3335911c01
--- a/graphics/LD_Objects.py	Wed Jan 25 01:26:29 2012 +0100
+++ b/graphics/LD_Objects.py	Mon Jan 30 16:12:19 2012 +0100
@@ -89,9 +89,9 @@
         self.RefreshConnectors()
     
     # Forbids to select a power rail
-    def HitTest(self, pt):
+    def HitTest(self, pt, connectors=True):
         if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
-            return Graphic_Element.HitTest(self, pt) or self.TestConnector(pt, exclude=False) != None
+            return Graphic_Element.HitTest(self, pt, connectors) or self.TestConnector(pt, exclude=False) != None
         return False
     
     # Forbids to select a power rail
@@ -199,7 +199,7 @@
     # Returns the power rail connector that starts with the point given if it exists 
     def GetConnector(self, position, name = None):
         # if a name is given
-        if name:
+        if name is not None:
             # Test each connector if it exists
             for connector in self.Connectors:
                 if name == connector.GetName():
@@ -509,10 +509,10 @@
     # Returns the contact connector that starts with the point given if it exists 
     def GetConnector(self, position, name = None):
         # if a name is given
-        if name:
+        if name is not None:
             # Test input and output connector
-            if name == self.Input.GetName():
-                return self.Input
+            #if name == self.Input.GetName():
+            #    return self.Input
             if name == self.Output.GetName():
                 return self.Output
         return self.FindNearestConnector(position, [self.Input, self.Output])
@@ -828,10 +828,10 @@
     # Returns the coil connector that starts with the point given if it exists 
     def GetConnector(self, position, name = None):
         # if a name is given
-        if name:
+        if name is not None:
             # Test input and output connector
-            if self.Input and name == self.Input.GetName():
-                return self.Input
+            #if self.Input and name == self.Input.GetName():
+            #    return self.Input
             if self.Output and name == self.Output.GetName():
                 return self.Output
         return self.FindNearestConnector(position, [self.Input, self.Output])