22 |
22 |
23 |
23 |
24 class ShortcutsDialog(QDialog, Ui_ShortcutsDialog): |
24 class ShortcutsDialog(QDialog, Ui_ShortcutsDialog): |
25 """ |
25 """ |
26 Class implementing a dialog for the configuration of eric5s keyboard shortcuts. |
26 Class implementing a dialog for the configuration of eric5s keyboard shortcuts. |
|
27 |
|
28 @signal updateShortcuts() emitted when the user pressed the dialogs OK button |
27 """ |
29 """ |
|
30 updateShortcuts = pyqtSignal() |
|
31 |
28 objectNameRole = Qt.UserRole |
32 objectNameRole = Qt.UserRole |
29 noCheckRole = Qt.UserRole + 1 |
33 noCheckRole = Qt.UserRole + 1 |
30 objectTypeRole = Qt.UserRole + 2 |
34 objectTypeRole = Qt.UserRole + 2 |
31 |
35 |
32 def __init__(self, parent = None, name = None, modal = False): |
36 def __init__(self, parent = None, name = None, modal = False): |
46 self.clearSearchButton.setIcon(UI.PixmapCache.getIcon("clearLeft.png")) |
50 self.clearSearchButton.setIcon(UI.PixmapCache.getIcon("clearLeft.png")) |
47 self.shortcutsList.headerItem().setText(self.shortcutsList.columnCount(), "") |
51 self.shortcutsList.headerItem().setText(self.shortcutsList.columnCount(), "") |
48 self.shortcutsList.header().setSortIndicator(0, Qt.AscendingOrder) |
52 self.shortcutsList.header().setSortIndicator(0, Qt.AscendingOrder) |
49 |
53 |
50 self.shortcutDialog = ShortcutDialog() |
54 self.shortcutDialog = ShortcutDialog() |
51 self.connect(self.shortcutDialog, SIGNAL('shortcutChanged'), |
55 self.shortcutDialog.shortcutChanged.connect(self.__shortcutChanged) |
52 self.__shortcutChanged) |
|
53 |
56 |
54 def __resort(self): |
57 def __resort(self): |
55 """ |
58 """ |
56 Private method to resort the tree. |
59 Private method to resort the tree. |
57 """ |
60 """ |
75 itm = QTreeWidgetItem(self.shortcutsList, [title]) |
78 itm = QTreeWidgetItem(self.shortcutsList, [title]) |
76 itm.setExpanded(True) |
79 itm.setExpanded(True) |
77 return itm |
80 return itm |
78 |
81 |
79 def __generateShortcutItem(self, category, action, |
82 def __generateShortcutItem(self, category, action, |
80 noCheck = False, objectType = None): |
83 noCheck = False, objectType = ""): |
81 """ |
84 """ |
82 Private method to generate a keyboard shortcut item. |
85 Private method to generate a keyboard shortcut item. |
83 |
86 |
84 @param category reference to the category item (QTreeWidgetItem) |
87 @param category reference to the category item (QTreeWidgetItem) |
85 @param action reference to the keyboard action (E5Action) |
88 @param action reference to the keyboard action (E5Action) |
405 e5App().getObject("DummyHelpViewer").getActions()) |
408 e5App().getObject("DummyHelpViewer").getActions()) |
406 |
409 |
407 Shortcuts.saveShortcuts() |
410 Shortcuts.saveShortcuts() |
408 Preferences.syncPreferences() |
411 Preferences.syncPreferences() |
409 |
412 |
410 self.emit(SIGNAL('updateShortcuts')) |
413 self.updateShortcuts.emit() |
411 self.hide() |
414 self.hide() |
412 |
415 |
413 @pyqtSlot(str) |
416 @pyqtSlot(str) |
414 def on_searchEdit_textChanged(self, txt): |
417 def on_searchEdit_textChanged(self, txt): |
415 """ |
418 """ |