Preferences/ShortcutsDialog.py

changeset 3025
67064c71df21
parent 3020
542e97d4ecb3
child 3034
7ce719013078
child 3058
0a02c433f52d
equal deleted inserted replaced
3024:17c01303a239 3025:67064c71df21
58 58
59 def __resort(self): 59 def __resort(self):
60 """ 60 """
61 Private method to resort the tree. 61 Private method to resort the tree.
62 """ 62 """
63 self.shortcutsList.sortItems(self.shortcutsList.sortColumn(), 63 self.shortcutsList.sortItems(
64 self.shortcutsList.sortColumn(),
64 self.shortcutsList.header().sortIndicatorOrder()) 65 self.shortcutsList.header().sortIndicatorOrder())
65 66
66 def __resizeColumns(self): 67 def __resizeColumns(self):
67 """ 68 """
68 Private method to resize the list columns. 69 Private method to resize the list columns.
92 @keyparam noCheck flag indicating that no uniqueness check should 93 @keyparam noCheck flag indicating that no uniqueness check should
93 be performed (boolean) 94 be performed (boolean)
94 @keyparam objectType type of the object (string). Objects of the same 95 @keyparam objectType type of the object (string). Objects of the same
95 type are not checked for duplicate shortcuts. 96 type are not checked for duplicate shortcuts.
96 """ 97 """
97 itm = QTreeWidgetItem(category, 98 itm = QTreeWidgetItem(
99 category,
98 [action.iconText(), action.shortcut().toString(), 100 [action.iconText(), action.shortcut().toString(),
99 action.alternateShortcut().toString()]) 101 action.alternateShortcut().toString()])
100 itm.setIcon(0, action.icon()) 102 itm.setIcon(0, action.icon())
101 itm.setData(0, self.objectNameRole, action.objectName()) 103 itm.setData(0, self.objectNameRole, action.objectName())
102 itm.setData(0, self.noCheckRole, noCheck) 104 itm.setData(0, self.noCheckRole, noCheck)
379 381
380 def on_buttonBox_accepted(self): 382 def on_buttonBox_accepted(self):
381 """ 383 """
382 Private slot to handle the OK button press. 384 Private slot to handle the OK button press.
383 """ 385 """
384 self.__saveCategoryActions(self.projectItem, 386 self.__saveCategoryActions(
387 self.projectItem,
385 e5App().getObject("Project").getActions()) 388 e5App().getObject("Project").getActions())
386 self.__saveCategoryActions(self.uiItem, 389 self.__saveCategoryActions(
390 self.uiItem,
387 e5App().getObject("UserInterface").getActions('ui')) 391 e5App().getObject("UserInterface").getActions('ui'))
388 self.__saveCategoryActions(self.wizardsItem, 392 self.__saveCategoryActions(
393 self.wizardsItem,
389 e5App().getObject("UserInterface").getActions('wizards')) 394 e5App().getObject("UserInterface").getActions('wizards'))
390 self.__saveCategoryActions(self.debugItem, 395 self.__saveCategoryActions(
396 self.debugItem,
391 e5App().getObject("DebugUI").getActions()) 397 e5App().getObject("DebugUI").getActions())
392 self.__saveCategoryActions(self.editItem, 398 self.__saveCategoryActions(
399 self.editItem,
393 e5App().getObject("ViewManager").getActions('edit')) 400 e5App().getObject("ViewManager").getActions('edit'))
394 self.__saveCategoryActions(self.fileItem, 401 self.__saveCategoryActions(
402 self.fileItem,
395 e5App().getObject("ViewManager").getActions('file')) 403 e5App().getObject("ViewManager").getActions('file'))
396 self.__saveCategoryActions(self.searchItem, 404 self.__saveCategoryActions(
405 self.searchItem,
397 e5App().getObject("ViewManager").getActions('search')) 406 e5App().getObject("ViewManager").getActions('search'))
398 self.__saveCategoryActions(self.viewItem, 407 self.__saveCategoryActions(
408 self.viewItem,
399 e5App().getObject("ViewManager").getActions('view')) 409 e5App().getObject("ViewManager").getActions('view'))
400 self.__saveCategoryActions(self.macroItem, 410 self.__saveCategoryActions(
411 self.macroItem,
401 e5App().getObject("ViewManager").getActions('macro')) 412 e5App().getObject("ViewManager").getActions('macro'))
402 self.__saveCategoryActions(self.bookmarkItem, 413 self.__saveCategoryActions(
414 self.bookmarkItem,
403 e5App().getObject("ViewManager").getActions('bookmark')) 415 e5App().getObject("ViewManager").getActions('bookmark'))
404 self.__saveCategoryActions(self.spellingItem, 416 self.__saveCategoryActions(
417 self.spellingItem,
405 e5App().getObject("ViewManager").getActions('spelling')) 418 e5App().getObject("ViewManager").getActions('spelling'))
406 419
407 actions = e5App().getObject("ViewManager").getActions('window') 420 actions = e5App().getObject("ViewManager").getActions('window')
408 if actions: 421 if actions:
409 self.__saveCategoryActions(self.windowItem, actions) 422 self.__saveCategoryActions(self.windowItem, actions)
412 category = categoryItem.text(0) 425 category = categoryItem.text(0)
413 ref = e5App().getPluginObject(category) 426 ref = e5App().getPluginObject(category)
414 if ref is not None and hasattr(ref, "getActions"): 427 if ref is not None and hasattr(ref, "getActions"):
415 self.__saveCategoryActions(categoryItem, ref.getActions()) 428 self.__saveCategoryActions(categoryItem, ref.getActions())
416 429
417 self.__saveCategoryActions(self.helpViewerItem, 430 self.__saveCategoryActions(
431 self.helpViewerItem,
418 e5App().getObject("DummyHelpViewer").getActions()) 432 e5App().getObject("DummyHelpViewer").getActions())
419 433
420 Shortcuts.saveShortcuts() 434 Shortcuts.saveShortcuts()
421 Preferences.syncPreferences() 435 Preferences.syncPreferences()
422 436

eric ide

mercurial