graphics/GraphicCommons.py
changeset 237 097e8ee006cb
parent 231 fc2d6cbb8b39
child 243 c5da8b706cde
--- a/graphics/GraphicCommons.py	Fri Aug 22 13:50:42 2008 +0200
+++ b/graphics/GraphicCommons.py	Fri Aug 22 13:52:19 2008 +0200
@@ -1449,7 +1449,7 @@
     def TestSegment(self, pt, all=False):
         for i in xrange(len(self.Segments)):
             # If wire is not in a Ladder Diagram, first and last segments are excluded
-            if 0 < i < len(self.Segments) - 1 or all:
+            if all or 0 < i < len(self.Segments) - 1:
                 x1, y1 = self.Points[i].x, self.Points[i].y
                 x2, y2 = self.Points[i + 1].x, self.Points[i + 1].y
                 # Calculate a rectangle around the segment
@@ -1903,11 +1903,11 @@
     def OnRightUp(self, event, dc, scaling):
         pos = GetScaledEventPosition(event, dc, scaling)
         # Test if a segment has been handled
-        result = self.TestSegment(pos)
+        result = self.TestSegment(pos, True)
         if result != None:
             self.Handle = (HANDLE_SEGMENT, result)
             # Popup the menu with special items for a wire
-            self.Parent.PopupWireMenu()
+            self.Parent.PopupWireMenu(0 < result < len(self.Segments) - 1)
         else:
             # Execute the default method for a graphic element
             Graphic_Element.OnRightUp(self, event, dc, scaling)