E5Gui/E5Action.py

branch
5_1_x
changeset 1523
e38f749a6f28
parent 1510
e75ecf2bd9dd
equal deleted inserted replaced
1517:862a84b4f3e2 1523:e38f749a6f28
101 if len(args) == 7+incr: 101 if len(args) == 7+incr:
102 self.setCheckable(args[6+incr]) 102 self.setCheckable(args[6+incr])
103 103
104 self.__ammendToolTip() 104 self.__ammendToolTip()
105 105
106 def setAlternateShortcut(self, shortcut): 106 def setAlternateShortcut(self, shortcut, removeEmpty=False):
107 """ 107 """
108 Public slot to set the alternative keyboard shortcut. 108 Public slot to set the alternative keyboard shortcut.
109 109
110 @param shortcut the alternative accelerator (QKeySequence) 110 @param shortcut the alternative accelerator (QKeySequence)
111 @param removeEmpty flag indicating to remove the alternate shortcut,
112 if it is empty (boolean)
111 """ 113 """
112 if not shortcut.isEmpty(): 114 if not shortcut.isEmpty():
113 shortcuts = self.shortcuts() 115 shortcuts = self.shortcuts()
114 if len(shortcuts) > 0: 116 if len(shortcuts) > 0:
115 if len(shortcuts) == 1: 117 if len(shortcuts) == 1:
116 shortcuts.append(shortcut) 118 shortcuts.append(shortcut)
117 else: 119 else:
118 shortcuts[1] = shortcut 120 shortcuts[1] = shortcut
119 self.setShortcuts(shortcuts) 121 self.setShortcuts(shortcuts)
122 elif removeEmpty:
123 shortcuts = self.shortcuts()
124 if len(shortcuts) == 2:
125 del shortcuts[1]
126 self.setShortcuts(shortcuts)
120 127
121 def alternateShortcut(self): 128 def alternateShortcut(self):
122 """ 129 """
123 Public method to retrieve the alternative keyboard shortcut. 130 Public method to retrieve the alternative keyboard shortcut.
124 131

eric ide

mercurial