E5Gui/E5Action.py

changeset 1521
1e684e74d2a1
parent 1509
c0b5e693b0eb
child 1579
6a9a44a74031
--- a/E5Gui/E5Action.py	Sun Jan 01 16:45:41 2012 +0100
+++ b/E5Gui/E5Action.py	Sun Jan 01 17:14:12 2012 +0100
@@ -105,11 +105,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()
@@ -119,6 +121,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