--- a/eric7/Preferences/ShortcutsDialog.py Sat May 22 17:01:51 2021 +0200 +++ b/eric7/Preferences/ShortcutsDialog.py Sat May 22 18:51:46 2021 +0200 @@ -14,8 +14,8 @@ from PyQt6.QtGui import QKeySequence from PyQt6.QtWidgets import QHeaderView, QDialog, QTreeWidgetItem -from E5Gui.E5Application import e5App -from E5Gui import E5MessageBox +from E5Gui.EricApplication import ericApp +from E5Gui import EricMessageBox from .Ui_ShortcutsDialog import Ui_ShortcutsDialog @@ -92,7 +92,7 @@ Private method to generate a keyboard shortcut item. @param category reference to the category item (QTreeWidgetItem) - @param action reference to the keyboard action (E5Action) + @param action reference to the keyboard action (EricAction) @param noCheck flag indicating that no uniqueness check should be performed (boolean) @param objectType type of the object (string). Objects of the same @@ -125,59 +125,59 @@ if helpViewer is None: # let the plugin manager create on demand plugin objects - pm = e5App().getObject("PluginManager") + pm = ericApp().getObject("PluginManager") pm.initOnDemandPlugins() # populate the various lists self.projectItem = self.__generateCategoryItem(self.tr("Project")) - for act in e5App().getObject("Project").getActions(): + for act in ericApp().getObject("Project").getActions(): self.__generateShortcutItem(self.projectItem, act) self.uiItem = self.__generateCategoryItem(self.tr("General")) - for act in e5App().getObject("UserInterface").getActions('ui'): + for act in ericApp().getObject("UserInterface").getActions('ui'): self.__generateShortcutItem(self.uiItem, act) self.wizardsItem = self.__generateCategoryItem(self.tr("Wizards")) for act in ( - e5App().getObject("UserInterface").getActions('wizards') + ericApp().getObject("UserInterface").getActions('wizards') ): self.__generateShortcutItem(self.wizardsItem, act) self.debugItem = self.__generateCategoryItem(self.tr("Debug")) - for act in e5App().getObject("DebugUI").getActions(): + for act in ericApp().getObject("DebugUI").getActions(): self.__generateShortcutItem(self.debugItem, act) self.editItem = self.__generateCategoryItem(self.tr("Edit")) - for act in e5App().getObject("ViewManager").getActions('edit'): + for act in ericApp().getObject("ViewManager").getActions('edit'): self.__generateShortcutItem(self.editItem, act) self.fileItem = self.__generateCategoryItem(self.tr("File")) - for act in e5App().getObject("ViewManager").getActions('file'): + for act in ericApp().getObject("ViewManager").getActions('file'): self.__generateShortcutItem(self.fileItem, act) self.searchItem = self.__generateCategoryItem(self.tr("Search")) - for act in e5App().getObject("ViewManager").getActions('search'): + for act in ericApp().getObject("ViewManager").getActions('search'): self.__generateShortcutItem(self.searchItem, act) self.viewItem = self.__generateCategoryItem(self.tr("View")) - for act in e5App().getObject("ViewManager").getActions('view'): + for act in ericApp().getObject("ViewManager").getActions('view'): self.__generateShortcutItem(self.viewItem, act) self.macroItem = self.__generateCategoryItem(self.tr("Macro")) - for act in e5App().getObject("ViewManager").getActions('macro'): + for act in ericApp().getObject("ViewManager").getActions('macro'): self.__generateShortcutItem(self.macroItem, act) self.bookmarkItem = self.__generateCategoryItem( self.tr("Bookmarks")) - for act in e5App().getObject("ViewManager").getActions('bookmark'): + for act in ericApp().getObject("ViewManager").getActions('bookmark'): self.__generateShortcutItem(self.bookmarkItem, act) self.spellingItem = self.__generateCategoryItem( self.tr("Spelling")) - for act in e5App().getObject("ViewManager").getActions('spelling'): + for act in ericApp().getObject("ViewManager").getActions('spelling'): self.__generateShortcutItem(self.spellingItem, act) - actions = e5App().getObject("ViewManager").getActions('window') + actions = ericApp().getObject("ViewManager").getActions('window') if actions: self.windowItem = self.__generateCategoryItem( self.tr("Window")) @@ -185,10 +185,10 @@ self.__generateShortcutItem(self.windowItem, act) self.pluginCategoryItems = [] - for category, ref in e5App().getPluginObjects(): + for category, ref in ericApp().getPluginObjects(): if hasattr(ref, "getActions"): categoryItem = self.__generateCategoryItem(category) - objectType = e5App().getPluginObjectType(category) + objectType = ericApp().getPluginObjectType(category) for act in ref.getActions(): self.__generateShortcutItem(categoryItem, act, objectType=objectType) @@ -325,7 +325,7 @@ itmseq = itm.text(col) # step 1: check if shortcut is already allocated if keystr == itmseq: - res = E5MessageBox.yesNo( + res = EricMessageBox.yesNo( self, self.tr("Edit shortcuts"), self.tr( @@ -333,7 +333,7 @@ """ allocated to the <b>{1}</b> action. """ """Remove this binding?</p>""") .format(keystr, itm.text(0)), - icon=E5MessageBox.Warning) + icon=EricMessageBox.Warning) if res: itm.setText(col, "") return True @@ -345,14 +345,14 @@ # step 2: check if shortcut hides an already allocated if itmseq.startswith("{0}+".format(keystr)): - res = E5MessageBox.yesNo( + res = EricMessageBox.yesNo( self, self.tr("Edit shortcuts"), self.tr( """<p><b>{0}</b> hides the <b>{1}</b>""" """ action. Remove this binding?</p>""") .format(keystr, itm.text(0)), - icon=E5MessageBox.Warning) + icon=EricMessageBox.Warning) if res: itm.setText(col, "") return True @@ -362,7 +362,7 @@ # step 3: check if shortcut is hidden by an # already allocated if keystr.startswith("{0}+".format(itmseq)): - res = E5MessageBox.yesNo( + res = EricMessageBox.yesNo( self, self.tr("Edit shortcuts"), self.tr( @@ -370,7 +370,7 @@ """<b>{1}</b> action. """ """Remove this binding?</p>""") .format(keystr, itm.text(0)), - icon=E5MessageBox.Warning) + icon=EricMessageBox.Warning) if res: itm.setText(col, "") return True @@ -384,7 +384,7 @@ 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 E5Action) + @param actions list of actions for the category (list of EricAction) """ for index in range(category.childCount()): itm = category.child(index) @@ -403,45 +403,45 @@ if self.__helpViewer is None: self.__saveCategoryActions( self.projectItem, - e5App().getObject("Project").getActions()) + ericApp().getObject("Project").getActions()) self.__saveCategoryActions( self.uiItem, - e5App().getObject("UserInterface").getActions('ui')) + ericApp().getObject("UserInterface").getActions('ui')) self.__saveCategoryActions( self.wizardsItem, - e5App().getObject("UserInterface").getActions('wizards')) + ericApp().getObject("UserInterface").getActions('wizards')) self.__saveCategoryActions( self.debugItem, - e5App().getObject("DebugUI").getActions()) + ericApp().getObject("DebugUI").getActions()) self.__saveCategoryActions( self.editItem, - e5App().getObject("ViewManager").getActions('edit')) + ericApp().getObject("ViewManager").getActions('edit')) self.__saveCategoryActions( self.fileItem, - e5App().getObject("ViewManager").getActions('file')) + ericApp().getObject("ViewManager").getActions('file')) self.__saveCategoryActions( self.searchItem, - e5App().getObject("ViewManager").getActions('search')) + ericApp().getObject("ViewManager").getActions('search')) self.__saveCategoryActions( self.viewItem, - e5App().getObject("ViewManager").getActions('view')) + ericApp().getObject("ViewManager").getActions('view')) self.__saveCategoryActions( self.macroItem, - e5App().getObject("ViewManager").getActions('macro')) + ericApp().getObject("ViewManager").getActions('macro')) self.__saveCategoryActions( self.bookmarkItem, - e5App().getObject("ViewManager").getActions('bookmark')) + ericApp().getObject("ViewManager").getActions('bookmark')) self.__saveCategoryActions( self.spellingItem, - e5App().getObject("ViewManager").getActions('spelling')) + ericApp().getObject("ViewManager").getActions('spelling')) - actions = e5App().getObject("ViewManager").getActions('window') + actions = ericApp().getObject("ViewManager").getActions('window') if actions: self.__saveCategoryActions(self.windowItem, actions) for categoryItem in self.pluginCategoryItems: category = categoryItem.text(0) - ref = e5App().getPluginObject(category) + ref = ericApp().getPluginObject(category) if ref is not None and hasattr(ref, "getActions"): self.__saveCategoryActions(categoryItem, ref.getActions())