E5Gui/E5Action.py

branch
5_1_x
changeset 1523
e38f749a6f28
parent 1510
e75ecf2bd9dd
diff -r 862a84b4f3e2 -r e38f749a6f28 E5Gui/E5Action.py
--- a/E5Gui/E5Action.py	Fri Dec 30 15:21:21 2011 +0100
+++ b/E5Gui/E5Action.py	Sun Jan 01 17:16:40 2012 +0100
@@ -103,11 +103,13 @@
         
         self.__ammendToolTip()
         
-    def setAlternateShortcut(self, shortcut):
+    def setAlternateShortcut(self, shortcut, removeEmpty=False):
         """
         Public slot to set the alternative keyboard shortcut.
         
         @param shortcut the alternative accelerator (QKeySequence)
+        @param removeEmpty flag indicating to remove the alternate shortcut,
+            if it is empty (boolean)
         """
         if not shortcut.isEmpty():
             shortcuts = self.shortcuts()
@@ -117,6 +119,11 @@
                 else:
                     shortcuts[1] = shortcut
                 self.setShortcuts(shortcuts)
+        elif removeEmpty:
+            shortcuts = self.shortcuts()
+            if len(shortcuts) == 2:
+                del shortcuts[1]
+                self.setShortcuts(shortcuts)
         
     def alternateShortcut(self):
         """

eric ide

mercurial