graphics/SFC_Objects.py
changeset 243 c5da8b706cde
parent 231 fc2d6cbb8b39
child 249 d8425712acef
--- a/graphics/SFC_Objects.py	Wed Aug 27 16:55:16 2008 +0200
+++ b/graphics/SFC_Objects.py	Wed Aug 27 16:56:25 2008 +0200
@@ -234,15 +234,15 @@
         return {"input":self.Input,"output":self.Output,"action":self.Action}
     
     # Test if point given is on step input or output connector
-    def TestConnector(self, pt, exclude=True):
+    def TestConnector(self, pt, direction = None, exclude=True):
         # Test input connector if it exists
-        if self.Input and self.Input.TestPoint(pt, exclude):
+        if self.Input and self.Input.TestPoint(pt, direction, exclude):
             return self.Input
         # Test output connector
-        if self.Output and self.Output.TestPoint(pt, exclude):
+        if self.Output and self.Output.TestPoint(pt, direction, exclude):
             return self.Output
         # Test action connector
-        if self.Action and self.Action.TestPoint(pt, exclude):
+        if self.Action and self.Action.TestPoint(pt, direction, exclude):
             return self.Action
         return None
 
@@ -676,15 +676,15 @@
         return connectors
     
     # Test if point given is on transition input or output connector
-    def TestConnector(self, pt, exclude=True):
+    def TestConnector(self, pt, direction = None, exclude=True):
         # Test input connector
-        if self.Input.TestPoint(pt, exclude):
+        if self.Input.TestPoint(pt, direction, exclude):
             return self.Input
         # Test output connector
-        if self.Output.TestPoint(pt, exclude):
+        if self.Output.TestPoint(pt, direction, exclude):
             return self.Output
         # Test condition connector
-        if self.Type == "connection" and self.Condition.TestPoint(pt, exclude):
+        if self.Type == "connection" and self.Condition.TestPoint(pt, direction, exclude):
             return self.Condition
         return None
 
@@ -1015,7 +1015,7 @@
     # Returns if the point given is in the bounding box
     def HitTest(self, pt):
         rect = self.BoundingBox
-        return rect.InsideXY(pt.x, pt.y) or self.TestConnector(pt, False) != None
+        return rect.InsideXY(pt.x, pt.y) or self.TestConnector(pt, exclude=False) != None
     
     # Refresh the divergence bounding box
     def RefreshBoundingBox(self):
@@ -1089,14 +1089,14 @@
         return {"inputs":self.Inputs,"outputs":self.Outputs}
     
     # Test if point given is on divergence input or output connector
-    def TestConnector(self, pt, exclude=True):
+    def TestConnector(self, pt, direction = None, exclude=True):
         # Test input connector
         for input in self.Inputs:
-            if input.TestPoint(pt, exclude):
+            if input.TestPoint(pt, direction, exclude):
                 return input
         # Test output connector
         for output in self.Outputs:
-            if output.TestPoint(pt, exclude):
+            if output.TestPoint(pt, direction, exclude):
                 return output
         return None
     
@@ -1209,7 +1209,7 @@
     def OnRightDown(self, event, dc, scaling):
         pos = GetScaledEventPosition(event, dc, scaling)
         # Test if a connector have been handled
-        connector = self.TestConnector(pos, False)
+        connector = self.TestConnector(pos, exclude=False)
         if connector:
             self.Handle = (HANDLE_CONNECTOR, connector)
             self.Parent.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
@@ -1237,7 +1237,7 @@
         else:
             pos = GetScaledEventPosition(event, dc, scaling)
             # Popup the menu with special items for a block and a connector if one is handled
-            connector = self.TestConnector(pos, False)
+            connector = self.TestConnector(pos, exclude=False)
             if connector:
                 self.Handle = (HANDLE_CONNECTOR, connector)
                 self.Parent.PopupDivergenceMenu(True)
@@ -1416,9 +1416,9 @@
         return self.Input
     
     # Test if point given is on jump input connector
-    def TestConnector(self, pt, exclude = True):
+    def TestConnector(self, pt, direction = None, exclude = True):
         # Test input connector
-        if self.Input and self.Input.TestPoint(pt, exclude):
+        if self.Input and self.Input.TestPoint(pt, direction, exclude):
             return self.Input
         return None
     
@@ -1626,9 +1626,9 @@
         return self.Input
     
     # Test if point given is on action block input connector
-    def TestConnector(self, pt, exclude = True):
+    def TestConnector(self, pt, direction = None, exclude = True):
         # Test input connector
-        if self.Input.TestPoint(pt, exclude):
+        if self.Input.TestPoint(pt, direction, exclude):
             return self.Input
         return None