--- a/src/eric7/Preferences/Shortcuts.py Wed Dec 20 11:06:38 2023 +0100 +++ b/src/eric7/Preferences/Shortcuts.py Wed Dec 20 14:58:58 2023 +0100 @@ -24,9 +24,12 @@ """ Private function to read a single keyboard shortcut from the settings. - @param act reference to the action object (EricAction) - @param category category the action belongs to (string) + @param act reference to the action object + @type EricAction + @param category category the action belongs to + @type str @param prefClass preferences class used as the storage area + @type Prefs """ if act.objectName(): accel = prefClass.settings.value( @@ -41,16 +44,18 @@ act.setAlternateShortcut(QKeySequence(accel), removeEmpty=True) -def readShortcuts(prefClass=Prefs, helpViewer=None, pluginName=None): +def readShortcuts(prefClass=Prefs, webBrowser=None, pluginName=None): """ Module function to read the keyboard shortcuts for the defined QActions. @param prefClass preferences class used as the storage area - @param helpViewer reference to the help window object + @type Prefs + @param webBrowser reference to the web browser window object + @type WebBrowserWindow @param pluginName name of the plugin for which to load shortcuts - (string) + @type str """ - if helpViewer is None and pluginName is None: + if webBrowser is None and pluginName is None: for act in ericApp().getObject("Project").getActions(): __readShortcut(act, "Project", prefClass) @@ -95,10 +100,10 @@ for act in actions: __readShortcut(act, category, prefClass) - if helpViewer is not None: - helpViewerCategory = helpViewer.getActionsCategory() - for act in helpViewer.getActions(): - __readShortcut(act, helpViewerCategory, prefClass) + if webBrowser is not None: + webBrowserCategory = webBrowser.getActionsCategory() + for act in webBrowser.getActions(): + __readShortcut(act, webBrowserCategory, prefClass) if pluginName is not None: with contextlib.suppress(KeyError): @@ -113,9 +118,12 @@ """ Private function to write a single keyboard shortcut to the settings. - @param act reference to the action object (EricAction) - @param category category the action belongs to (string) + @param act reference to the action object + @type EricAction + @param category category the action belongs to + @type str @param prefClass preferences class used as the storage area + @type Prefs """ if act.objectName(): prefClass.settings.setValue( @@ -128,14 +136,16 @@ ) -def saveShortcuts(prefClass=Prefs, helpViewer=None): +def saveShortcuts(prefClass=Prefs, webBrowser=None): """ Module function to write the keyboard shortcuts for the defined QActions. @param prefClass preferences class used as the storage area - @param helpViewer reference to the help window object + @type Prefs + @param webBrowser reference to the web browser window object + @type WebBrowserWindow """ - if helpViewer is None: + if webBrowser is None: # step 1: clear all previously saved shortcuts prefClass.settings.beginGroup("Shortcuts") prefClass.settings.remove("") @@ -187,16 +197,16 @@ __saveShortcut(act, category, prefClass) else: - helpViewerCategory = helpViewer.getActionsCategory() + webBrowserCategory = webBrowser.getActionsCategory() # step 1: clear all previously saved shortcuts - prefClass.settings.beginGroup("Shortcuts/{0}".format(helpViewerCategory)) + prefClass.settings.beginGroup("Shortcuts/{0}".format(webBrowserCategory)) prefClass.settings.remove("") prefClass.settings.endGroup() # step 2: save the shortcuts - for act in helpViewer.getActions(): - __saveShortcut(act, helpViewerCategory, prefClass) + for act in webBrowser.getActions(): + __saveShortcut(act, webBrowserCategory, prefClass) def exportShortcuts(fn, helpViewer=None):