Adding contextual menu on LD_Contact, LD_Coil, LD_PowerRail and SFC_ActionBlock
authorlbessard
Sun, 09 Dec 2007 17:07:45 +0100
changeset 127 436268f31dae
parent 126 4a76987f8a40
child 128 d16a8df4d322
Adding contextual menu on LD_Contact, LD_Coil, LD_PowerRail and SFC_ActionBlock
graphics/LD_Objects.py
graphics/SFC_Objects.py
--- a/graphics/LD_Objects.py	Sun Dec 09 16:59:15 2007 +0100
+++ b/graphics/LD_Objects.py	Sun Dec 09 17:07:45 2007 +0100
@@ -288,15 +288,7 @@
     
     # Method called when a RightUp event have been generated
     def OnRightUp(self, event, dc, scaling):
-        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)
-        if connector:
-            self.Handle = (HANDLE_CONNECTOR, connector)
-        #    self.Parent.PopupDivergenceMenu(True)
-        #else:
-            # Popup the divergence menu without delete branch
-        #    self.Parent.PopupDivergenceMenu(False)
+        self.Parent.PopupDefaultMenu()
     
     # Refreshes the powerrail state according to move defined and handle selected
     def ProcessDragging(self, movex, movey):
@@ -496,6 +488,11 @@
         # Edit the contact properties
         self.Parent.EditContactContent(self)
     
+    # Method called when a RightUp event have been generated
+    def OnRightUp(self, event, dc, scaling):
+        # Popup the default menu
+        self.Parent.PopupDefaultMenu()
+    
     # Refreshes the contact model
     def RefreshModel(self, move=True):
         self.Parent.RefreshContactModel(self)
@@ -695,6 +692,11 @@
         # Edit the coil properties
         self.Parent.EditCoilContent(self)
     
+    # Method called when a RightUp event have been generated
+    def OnRightUp(self, event, dc, scaling):
+        # Popup the default menu
+        self.Parent.PopupDefaultMenu()
+    
     # Refreshes the coil model
     def RefreshModel(self, move=True):
         self.Parent.RefreshCoilModel(self)
--- a/graphics/SFC_Objects.py	Sun Dec 09 16:59:15 2007 +0100
+++ b/graphics/SFC_Objects.py	Sun Dec 09 17:07:45 2007 +0100
@@ -373,6 +373,7 @@
             if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
                 self.Move(movex, movey)
                 self.RefreshConnected()
+                return True, True
             elif self.Initial:
                 self.MoveActionBlock((movex, movey))
                 self.Move(movex, movey, self.Parent.Wires)
@@ -1494,6 +1495,11 @@
         # Edit the action block properties
         self.Parent.EditActionBlockContent(self)
     
+    # Method called when a RightUp event have been generated
+    def OnRightUp(self, event, dc, scaling):
+        # Popup the default menu
+        self.Parent.PopupDefaultMenu()
+    
     # Refreshes the action block state according to move defined and handle selected
     def ProcessDragging(self, movex, movey):
         if self.Parent.GetDrawingMode() != FREEDRAWING_MODE: