diff -r 3733e2b23cf7 -r a071d4065202 src/eric7/Preferences/ShortcutsDialog.py --- a/src/eric7/Preferences/ShortcutsDialog.py Wed Dec 20 11:06:38 2023 +0100 +++ b/src/eric7/Preferences/ShortcutsDialog.py Wed Dec 20 14:58:58 2023 +0100 @@ -49,7 +49,7 @@ self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) - self.__helpViewer = None + self.__webBrowser = None self.shortcutsList.headerItem().setText(self.shortcutsList.columnCount(), "") self.shortcutsList.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) @@ -79,8 +79,10 @@ """ Private method to generate a category item. - @param title title for the item (string) - @return reference to the category item (QTreeWidgetItem) + @param title title for the item + @type str + @return reference to the category item + @rtype QTreeWidgetItem """ itm = QTreeWidgetItem(self.shortcutsList, [title]) itm.setExpanded(True) @@ -90,12 +92,16 @@ """ Private method to generate a keyboard shortcut item. - @param category reference to the category item (QTreeWidgetItem) - @param action reference to the keyboard action (EricAction) + @param category reference to the category item + @type QTreeWidgetItem + @param action reference to the keyboard action + @type EricAction @param noCheck flag indicating that no uniqueness check should - be performed (boolean) - @param objectType type of the object (string). Objects of the same + be performed + @type bool + @param objectType type of the object. Objects of the same type are not checked for duplicate shortcuts. + @type str """ itm = QTreeWidgetItem( category, @@ -113,20 +119,21 @@ else: itm.setData(0, self.objectTypeRole, None) - def populate(self, helpViewer=None): + def populate(self, webBrowser=None): """ Public method to populate the dialog. - @param helpViewer reference to the help window object + @param webBrowser reference to the web browser window object + @type WebBrowserWindow """ self.searchEdit.clear() self.searchEdit.setFocus() self.shortcutsList.clear() self.actionButton.setChecked(True) - self.__helpViewer = helpViewer + self.__webBrowser = webBrowser - if helpViewer is None: + if webBrowser is None: # let the plugin manager create on demand plugin objects pm = ericApp().getObject("PluginManager") pm.initOnDemandPlugins() @@ -194,11 +201,11 @@ self.pluginCategoryItems.append(categoryItem) else: - self.helpViewerItem = self.__generateCategoryItem( + self.__webBrowserItem = self.__generateCategoryItem( self.tr("eric Web Browser") ) - for act in helpViewer.getActions(): - self.__generateShortcutItem(self.helpViewerItem, act, True) + for act in webBrowser.getActions(): + self.__generateShortcutItem(self.__webBrowserItem, act, True) self.__resort() self.__resizeColumns() @@ -210,8 +217,10 @@ """ Private slot to handle a double click in the shortcuts list. - @param itm the list item that was double clicked (QTreeWidgetItem) - @param column the list item was double clicked in (integer) + @param itm the list item that was double clicked + @type QTreeWidgetItem + @param column the list item was double clicked in + @type int """ if itm.childCount(): return @@ -230,8 +239,10 @@ """ Private slot to handle a click in the shortcuts list. - @param itm the list item that was clicked (QTreeWidgetItem) - @param column the list item was clicked in (integer) + @param itm the list item that was clicked + @type QTreeWidgetItem + @param column the list item was clicked in + @type int """ if itm.childCount() or column not in [1, 2]: return @@ -242,8 +253,10 @@ """ Private slot to handle the edit of a shortcut key. - @param itm reference to the item changed (QTreeWidgetItem) - @param column column changed (integer) + @param itm reference to the item changed + @type QTreeWidgetItem + @param column column changed + @type int """ if column != 0: keystr = itm.text(column).title() @@ -260,12 +273,14 @@ Private slot to handle the shortcutChanged signal of the shortcut dialog. - @param keysequence the keysequence of the changed action (QKeySequence) - @param altKeysequence the alternative keysequence of the changed - action (QKeySequence) - @param noCheck flag indicating that no uniqueness check should - be performed (boolean) - @param objectType type of the object (string). + @param keysequence the keysequence of the changed action + @type QKeySequence + @param altKeysequence the alternative keysequence of the changed action + @type QKeySequence + @param noCheck flag indicating that no uniqueness check should be performed + @type bool + @param objectType type of the object + @type str """ if not noCheck and ( not self.__checkShortcut(keysequence, objectType, self.__editTopItem) @@ -283,12 +298,15 @@ """ Private method to check a keysequence for uniqueness. - @param keysequence the keysequence to check (QKeySequence) - @param objectType type of the object (string). Entries with the same + @param keysequence the keysequence to check + @type QKeySequence + @param objectType type of the object. Entries with the same object type are not checked for uniqueness. + @type str @param origTopItem refrence to the parent of the item to be checked - (QTreeWidgetItem) - @return flag indicating uniqueness (boolean) + @type QTreeWidgetItem + @return flag indicating uniqueness + @rtype bool """ if keysequence.isEmpty(): return True @@ -381,8 +399,10 @@ """ Private method to save the actions for a category. - @param category reference to the category item (QTreeWidgetItem) - @param actions list of actions for the category (list of EricAction) + @param category reference to the category item + @type QTreeWidgetItem + @param actions list of actions for the category + @type list of EricAction """ for index in range(category.childCount()): itm = category.child(index) @@ -399,7 +419,7 @@ """ Private slot to handle the OK button press. """ - if self.__helpViewer is None: + if self.__webBrowser is None: self.__saveCategoryActions( self.projectItem, ericApp().getObject("Project").getActions() ) @@ -451,9 +471,9 @@ else: self.__saveCategoryActions( - self.helpViewerItem, self.__helpViewer.getActions() + self.__webBrowserItem, self.__webBrowser.getActions() ) - Shortcuts.saveShortcuts(helpViewer=self.__helpViewer) + Shortcuts.saveShortcuts(webBrowser=self.__webBrowser) Preferences.syncPreferences() @@ -465,7 +485,8 @@ """ Private slot called, when the text in the search edit changes. - @param txt text of the search edit (string) + @param txt text of the search edit + @type str """ rx = re.compile(re.escape(txt), re.IGNORECASE) for topIndex in range(self.shortcutsList.topLevelItemCount()): @@ -492,7 +513,8 @@ """ Private slot called, when the action radio button is toggled. - @param checked state of the action radio button (boolean) + @param checked state of the action radio button + @type bool """ if checked: self.on_searchEdit_textChanged(self.searchEdit.text()) @@ -502,7 +524,8 @@ """ Private slot called, when the shortcuts radio button is toggled. - @param checked state of the shortcuts radio button (boolean) + @param checked state of the shortcuts radio button + @type bool """ if checked: self.on_searchEdit_textChanged(self.searchEdit.text())