Unable segment deletion on first and last segment
authorlbessard
Fri, 22 Aug 2008 13:52:19 +0200
changeset 237 097e8ee006cb
parent 236 9f594b90bb1a
child 238 389f2046e495
Unable segment deletion on first and last segment
graphics/GraphicCommons.py
graphics/LD_Objects.py
--- 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)
--- a/graphics/LD_Objects.py	Fri Aug 22 13:50:42 2008 +0200
+++ b/graphics/LD_Objects.py	Fri Aug 22 13:52:19 2008 +0200
@@ -560,7 +560,6 @@
         dc.SetLogicalFunction(wx.COPY)
     
     def AddError(self, infos, start, end):
-        print infos
         self.Errors[infos[0]] = (start[1], end[1])
     
     # Draws contact