134 self.uiItem = self.__generateCategoryItem(self.tr("General")) |
134 self.uiItem = self.__generateCategoryItem(self.tr("General")) |
135 for act in e5App().getObject("UserInterface").getActions('ui'): |
135 for act in e5App().getObject("UserInterface").getActions('ui'): |
136 self.__generateShortcutItem(self.uiItem, act) |
136 self.__generateShortcutItem(self.uiItem, act) |
137 |
137 |
138 self.wizardsItem = self.__generateCategoryItem(self.tr("Wizards")) |
138 self.wizardsItem = self.__generateCategoryItem(self.tr("Wizards")) |
139 for act in e5App().getObject("UserInterface")\ |
139 for act in ( |
140 .getActions('wizards'): |
140 e5App().getObject("UserInterface").getActions('wizards') |
|
141 ): |
141 self.__generateShortcutItem(self.wizardsItem, act) |
142 self.__generateShortcutItem(self.wizardsItem, act) |
142 |
143 |
143 self.debugItem = self.__generateCategoryItem(self.tr("Debug")) |
144 self.debugItem = self.__generateCategoryItem(self.tr("Debug")) |
144 for act in e5App().getObject("DebugUI").getActions(): |
145 for act in e5App().getObject("DebugUI").getActions(): |
145 self.__generateShortcutItem(self.debugItem, act) |
146 self.__generateShortcutItem(self.debugItem, act) |
240 @param itm reference to the item changed (QTreeWidgetItem) |
241 @param itm reference to the item changed (QTreeWidgetItem) |
241 @param column column changed (integer) |
242 @param column column changed (integer) |
242 """ |
243 """ |
243 if column != 0: |
244 if column != 0: |
244 keystr = itm.text(column).title() |
245 keystr = itm.text(column).title() |
245 if not itm.data(0, self.noCheckRole) and \ |
246 if ( |
246 not self.__checkShortcut(QKeySequence(keystr), |
247 not itm.data(0, self.noCheckRole) and |
247 itm.data(0, self.objectTypeRole), |
248 not self.__checkShortcut(QKeySequence(keystr), |
248 itm.parent()): |
249 itm.data(0, self.objectTypeRole), |
|
250 itm.parent()) |
|
251 ): |
249 itm.setText(column, "") |
252 itm.setText(column, "") |
250 else: |
253 else: |
251 itm.setText(column, keystr) |
254 itm.setText(column, keystr) |
252 self.shortcutsList.closePersistentEditor(itm, column) |
255 self.shortcutsList.closePersistentEditor(itm, column) |
253 |
256 |
262 action (QKeySequence) |
265 action (QKeySequence) |
263 @param noCheck flag indicating that no uniqueness check should |
266 @param noCheck flag indicating that no uniqueness check should |
264 be performed (boolean) |
267 be performed (boolean) |
265 @param objectType type of the object (string). |
268 @param objectType type of the object (string). |
266 """ |
269 """ |
267 if not noCheck and \ |
270 if ( |
268 (not self.__checkShortcut( |
271 not noCheck and |
269 keysequence, objectType, self.__editTopItem) or |
272 (not self.__checkShortcut( |
270 not self.__checkShortcut( |
273 keysequence, objectType, self.__editTopItem) or |
271 altKeysequence, objectType, self.__editTopItem)): |
274 not self.__checkShortcut( |
|
275 altKeysequence, objectType, self.__editTopItem)) |
|
276 ): |
272 return |
277 return |
273 |
278 |
274 self.shortcutsList.currentItem().setText(1, keysequence.toString()) |
279 self.shortcutsList.currentItem().setText(1, keysequence.toString()) |
275 self.shortcutsList.currentItem().setText(2, altKeysequence.toString()) |
280 self.shortcutsList.currentItem().setText(2, altKeysequence.toString()) |
276 |
281 |
302 if itm.data(0, self.noCheckRole): |
307 if itm.data(0, self.noCheckRole): |
303 continue |
308 continue |
304 |
309 |
305 # 2. check object type |
310 # 2. check object type |
306 itmObjectType = itm.data(0, self.objectTypeRole) |
311 itmObjectType = itm.data(0, self.objectTypeRole) |
307 if itmObjectType and \ |
312 if ( |
308 itmObjectType == objectType and \ |
313 itmObjectType and |
309 topItem != origTopItem: |
314 itmObjectType == objectType and |
|
315 topItem != origTopItem |
|
316 ): |
310 continue |
317 continue |
311 |
318 |
312 # 3. check key name |
319 # 3. check key name |
313 if itm.text(0) != keyname: |
320 if itm.text(0) != keyname: |
314 for col in [1, 2]: |
321 for col in [1, 2]: |
458 for topIndex in range(self.shortcutsList.topLevelItemCount()): |
465 for topIndex in range(self.shortcutsList.topLevelItemCount()): |
459 topItem = self.shortcutsList.topLevelItem(topIndex) |
466 topItem = self.shortcutsList.topLevelItem(topIndex) |
460 childHiddenCount = 0 |
467 childHiddenCount = 0 |
461 for index in range(topItem.childCount()): |
468 for index in range(topItem.childCount()): |
462 itm = topItem.child(index) |
469 itm = topItem.child(index) |
463 if (self.actionButton.isChecked() and |
470 if ( |
464 not QRegExp(txt, Qt.CaseInsensitive).indexIn( |
471 (self.actionButton.isChecked() and |
465 itm.text(0)) > -1) or \ |
472 not QRegExp(txt, Qt.CaseInsensitive).indexIn( |
466 (self.shortcutButton.isChecked() and |
473 itm.text(0)) > -1) or |
467 not txt.lower() in itm.text(1).lower() and |
474 (self.shortcutButton.isChecked() and |
468 not txt.lower() in itm.text(2).lower()): |
475 not txt.lower() in itm.text(1).lower() and |
|
476 not txt.lower() in itm.text(2).lower()) |
|
477 ): |
469 itm.setHidden(True) |
478 itm.setHidden(True) |
470 childHiddenCount += 1 |
479 childHiddenCount += 1 |
471 else: |
480 else: |
472 itm.setHidden(False) |
481 itm.setHidden(False) |
473 topItem.setHidden(childHiddenCount == topItem.childCount()) |
482 topItem.setHidden(childHiddenCount == topItem.childCount()) |