E5Gui/E5Action.py

changeset 1521
1e684e74d2a1
parent 1509
c0b5e693b0eb
child 1579
6a9a44a74031
equal deleted inserted replaced
1520:25d97c7ea897 1521:1e684e74d2a1
103 if len(args) == 7 + incr: 103 if len(args) == 7 + incr:
104 self.setCheckable(args[6 + incr]) 104 self.setCheckable(args[6 + incr])
105 105
106 self.__ammendToolTip() 106 self.__ammendToolTip()
107 107
108 def setAlternateShortcut(self, shortcut): 108 def setAlternateShortcut(self, shortcut, removeEmpty=False):
109 """ 109 """
110 Public slot to set the alternative keyboard shortcut. 110 Public slot to set the alternative keyboard shortcut.
111 111
112 @param shortcut the alternative accelerator (QKeySequence) 112 @param shortcut the alternative accelerator (QKeySequence)
113 @param removeEmpty flag indicating to remove the alternate shortcut,
114 if it is empty (boolean)
113 """ 115 """
114 if not shortcut.isEmpty(): 116 if not shortcut.isEmpty():
115 shortcuts = self.shortcuts() 117 shortcuts = self.shortcuts()
116 if len(shortcuts) > 0: 118 if len(shortcuts) > 0:
117 if len(shortcuts) == 1: 119 if len(shortcuts) == 1:
118 shortcuts.append(shortcut) 120 shortcuts.append(shortcut)
119 else: 121 else:
120 shortcuts[1] = shortcut 122 shortcuts[1] = shortcut
121 self.setShortcuts(shortcuts) 123 self.setShortcuts(shortcuts)
124 elif removeEmpty:
125 shortcuts = self.shortcuts()
126 if len(shortcuts) == 2:
127 del shortcuts[1]
128 self.setShortcuts(shortcuts)
122 129
123 def alternateShortcut(self): 130 def alternateShortcut(self):
124 """ 131 """
125 Public method to retrieve the alternative keyboard shortcut. 132 Public method to retrieve the alternative keyboard shortcut.
126 133

eric ide

mercurial