ProjectPyramid/Project.py

branch
eric7
changeset 147
eb28b4b6f7f5
parent 144
5c3684ee818e
child 148
dcbd3a96f03c
diff -r 7d955b1995d5 -r eb28b4b6f7f5 ProjectPyramid/Project.py
--- a/ProjectPyramid/Project.py	Sat May 29 15:05:16 2021 +0200
+++ b/ProjectPyramid/Project.py	Tue Jun 01 19:37:46 2021 +0200
@@ -12,14 +12,14 @@
 import configparser
 import contextlib
 
-from PyQt5.QtCore import QObject, QFileInfo, QTimer, QUrl
-from PyQt5.QtGui import QDesktopServices
-from PyQt5.QtWidgets import QMenu, QDialog, QInputDialog, QLineEdit
-from PyQt5.QtCore import QProcess as QProcessPyQt
+from PyQt6.QtCore import QObject, QFileInfo, QTimer, QUrl, QIODeviceBase
+from PyQt6.QtGui import QDesktopServices
+from PyQt6.QtWidgets import QMenu, QDialog, QInputDialog, QLineEdit
+from PyQt6.QtCore import QProcess as QProcessPyQt
 
-from E5Gui.E5Application import e5App
-from E5Gui import E5MessageBox, E5FileDialog
-from E5Gui.E5Action import E5Action
+from EricWidgets.EricApplication import ericApp
+from EricWidgets import EricMessageBox, EricFileDialog
+from EricGui.EricAction import EricAction
 
 from .PyramidDialog import PyramidDialog
 
@@ -40,14 +40,17 @@
     """
     Class transforming the call arguments in case of gnome-terminal.
     """
-    def start(self, cmd, args=None, mode=QProcessPyQt.ReadWrite):
+    def start(self, cmd, args=None, mode=QIODeviceBase.OpenModeFlag.ReadWrite):
         """
         Public method to start the given program (cmd) in a new process, if
         none is already running, passing the command line arguments in args.
         
-        @param cmd start the given program cmd (string)
-        @keyparam args list of parameters (list of strings)
-        @keyparam mode access mode (QIODevice.OpenMode)
+        @param cmd start the given program cmd
+        @type str
+        @param args list of parameters
+        @type list of str
+        @param mode access mode
+        @type QIODeviceBase.OpenMode
         """
         if args is None:
             args = []
@@ -69,10 +72,14 @@
         Public static method to start the given program (cmd) in a new process,
         if none is already running, passing the command line arguments in args.
         
-        @param cmd start the given program cmd (string)
-        @keyparam args list of parameters (list of strings)
-        @keyparam path new working directory (string)
-        @return tuple of successful start and process id (boolean, integer)
+        @param cmd start the given program cmd
+        @type str
+        @param args list of parameters
+        @type list of str
+        @param path new working directory
+        @type str
+        @return tuple of successful start and process id
+        @rtype tuple of (bool, int)
         """
         if args is None:
             args = []
@@ -109,11 +116,8 @@
         self.__plugin = plugin
         self.__iconSuffix = iconSuffix
         self.__ui = parent
-        self.__e5project = e5App().getObject("Project")
-        try:
-            self.__virtualEnvManager = e5App().getObject("VirtualEnvManager")
-        except KeyError:
-            self.__virtualEnvManager = None
+        self.__ericProject = ericApp().getObject("Project")
+        self.__virtualEnvManager = ericApp().getObject("VirtualEnvManager")
         self.__hooksInstalled = False
         
         self.__menus = {}   # dictionary with references to menus
@@ -128,7 +132,7 @@
         """
         self.actions = []
     
-        self.selectProjectAct = E5Action(
+        self.selectProjectAct = EricAction(
             self.tr('Current Pyramid Project'),
             "",
             0, 0,
@@ -147,7 +151,7 @@
         ## create actions below      ##
         ###############################
         
-        self.createProjectAct = E5Action(
+        self.createProjectAct = EricAction(
             self.tr('Create Pyramid Project'),
             self.tr('Create Pyramid &Project'),
             0, 0,
@@ -165,7 +169,7 @@
         ## run actions below        ##
         ##############################
         
-        self.runServerAct = E5Action(
+        self.runServerAct = EricAction(
             self.tr('Run Server'),
             self.tr('Run &Server'),
             0, 0,
@@ -180,7 +184,7 @@
         self.runServerAct.triggered.connect(self.__runServer)
         self.actions.append(self.runServerAct)
         
-        self.runLoggingServerAct = E5Action(
+        self.runLoggingServerAct = EricAction(
             self.tr('Run Server with Logging'),
             self.tr('Run Server with &Logging'),
             0, 0,
@@ -195,7 +199,7 @@
         self.runLoggingServerAct.triggered.connect(self.__runLoggingServer)
         self.actions.append(self.runLoggingServerAct)
         
-        self.runBrowserAct = E5Action(
+        self.runBrowserAct = EricAction(
             self.tr('Run Web-Browser'),
             self.tr('Run &Web-Browser'),
             0, 0,
@@ -211,7 +215,7 @@
         self.runBrowserAct.triggered.connect(self.__runBrowser)
         self.actions.append(self.runBrowserAct)
     
-        self.runPythonShellAct = E5Action(
+        self.runPythonShellAct = EricAction(
             self.tr('Start Pyramid Python Console'),
             self.tr('Start Pyramid &Python Console'),
             0, 0,
@@ -229,7 +233,7 @@
         ## setup actions below      ##
         ##############################
         
-        self.setupDevelopAct = E5Action(
+        self.setupDevelopAct = EricAction(
             self.tr('Setup Development Environment'),
             self.tr('Setup &Development Environment'),
             0, 0,
@@ -248,7 +252,7 @@
         ## database actions below    ##
         ###############################
         
-        self.initializeDbAct = E5Action(
+        self.initializeDbAct = EricAction(
             self.tr('Initialize Database'),
             self.tr('Initialize &Database'),
             0, 0,
@@ -268,7 +272,7 @@
         ## show actions below        ##
         ###############################
         
-        self.showViewsAct = E5Action(
+        self.showViewsAct = EricAction(
             self.tr('Show Matching Views'),
             self.tr('Show Matching &Views'),
             0, 0,
@@ -282,7 +286,7 @@
         self.showViewsAct.triggered.connect(self.__showMatchingViews)
         self.actions.append(self.showViewsAct)
         
-        self.showRoutesAct = E5Action(
+        self.showRoutesAct = EricAction(
             self.tr('Show Routes'),
             self.tr('Show &Routes'),
             0, 0,
@@ -297,7 +301,7 @@
         self.showRoutesAct.triggered.connect(self.__showRoutes)
         self.actions.append(self.showRoutesAct)
         
-        self.showTweensAct = E5Action(
+        self.showTweensAct = EricAction(
             self.tr('Show Tween Objects'),
             self.tr('Show &Tween Objects'),
             0, 0,
@@ -317,7 +321,7 @@
         ## distribution actions below   ##
         ##################################
         
-        self.buildDistroAct = E5Action(
+        self.buildDistroAct = EricAction(
             self.tr('Build Distribution'),
             self.tr('Build &Distribution'),
             0, 0,
@@ -336,7 +340,7 @@
         ## documentation action below   ##
         ##################################
         
-        self.documentationAct = E5Action(
+        self.documentationAct = EricAction(
             self.tr('Documentation'),
             self.tr('D&ocumentation'),
             0, 0,
@@ -354,7 +358,7 @@
         ## about action below       ##
         ##############################
         
-        self.aboutPyramidAct = E5Action(
+        self.aboutPyramidAct = EricAction(
             self.tr('About Pyramid'),
             self.tr('About P&yramid'),
             0, 0,
@@ -374,7 +378,8 @@
         """
         Public slot to initialize the Pyramid menu.
         
-        @return the menu generated (QMenu)
+        @return the menu generated
+        @rtype QMenu
         """
         self.__menus = {}   # clear menus references
         
@@ -413,9 +418,11 @@
         """
         Public method to get a reference to the requested menu.
         
-        @param name name of the menu (string)
-        @return reference to the menu (QMenu) or None, if no
-            menu with the given name exists
+        @param name name of the menu
+        @type str
+        @return reference to the menu or None, if no menu with the given
+            name exists
+        @rtype QMenu
         """
         if name in self.__menus:
             return self.__menus[name]
@@ -426,7 +433,8 @@
         """
         Public method to get the names of all menus.
         
-        @return menu names (list of string)
+        @return menu names
+        @rtype list of str
         """
         return list(self.__menus.keys())
     
@@ -449,17 +457,17 @@
         """
         Public method to add our hook methods.
         """
-        if self.__e5project.getProjectType() == "Pyramid":
+        if self.__ericProject.getProjectType() == "Pyramid":
             self.__formsBrowser = (
-                e5App().getObject("ProjectBrowser")
+                ericApp().getObject("ProjectBrowser")
                 .getProjectBrowser("forms"))
             self.__formsBrowser.addHookMethodAndMenuEntry(
                 "newForm", self.newForm, self.tr("New template..."))
             
-            self.__e5project.projectLanguageAddedByCode.connect(
+            self.__ericProject.projectLanguageAddedByCode.connect(
                 self.__projectLanguageAdded)
             self.__translationsBrowser = (
-                e5App().getObject("ProjectBrowser")
+                ericApp().getObject("ProjectBrowser")
                 .getProjectBrowser("translations"))
             self.__translationsBrowser.addHookMethodAndMenuEntry(
                 "extractMessages", self.extractMessages,
@@ -489,7 +497,7 @@
             self.__formsBrowser.removeHookMethod("newForm")
             self.__formsBrowser = None
             
-            self.__e5project.projectLanguageAddedByCode.disconnect(
+            self.__ericProject.projectLanguageAddedByCode.disconnect(
                 self.__projectLanguageAdded)
             self.__translationsBrowser.removeHookMethod("extractMessages")
             self.__translationsBrowser.removeHookMethod("releaseAll")
@@ -505,12 +513,13 @@
         """
         Public method to create a new form.
         
-        @param path full directory path for the new form file (string)
+        @param path full directory path for the new form file
+        @type str
         """
         from .FormSelectionDialog import FormSelectionDialog
         
         dlg = FormSelectionDialog()
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             template = dlg.getTemplateText()
             
             fileFilters = self.tr(
@@ -521,13 +530,13 @@
                 "HTML Files (*.html);;"
                 "HTML Files (*.htm);;"
                 "All Files (*)")
-            fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
+            fname, selectedFilter = EricFileDialog.getSaveFileNameAndFilter(
                 self.__ui,
                 self.tr("New Form"),
                 path,
                 fileFilters,
                 None,
-                E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
+                EricFileDialog.DontConfirmOverwrite)
             if fname:
                 ext = QFileInfo(fname).suffix()
                 if not ext:
@@ -536,12 +545,12 @@
                         fname += ex
             
                 if os.path.exists(fname):
-                    res = E5MessageBox.yesNo(
+                    res = EricMessageBox.yesNo(
                         self.__ui,
                         self.tr("New Form"),
                         self.tr("""The file already exists! Overwrite"""
                                 """ it?"""),
-                        icon=E5MessageBox.Warning)
+                        icon=EricMessageBox.Warning)
                     if not res:
                         # user selected to not overwrite
                         return
@@ -550,7 +559,7 @@
                     with open(fname, "w", encoding="utf-8") as f:
                         f.write(template)
                 except OSError as e:
-                    E5MessageBox.critical(
+                    EricMessageBox.critical(
                         self.__ui,
                         self.tr("New Form"),
                         self.tr("<p>The new form file <b>{0}</b> could"
@@ -558,7 +567,7 @@
                         .format(fname, e))
                     return
                 
-                self.__e5project.appendFile(fname)
+                self.__ericProject.appendFile(fname)
                 self.__formsBrowser.sourceFile.emit(fname)
 
     ##################################################################
@@ -578,10 +587,12 @@
         Private method to build all full paths of an executable file from
         the environment.
         
-        @param file filename of the executable (string)
+        @param file filename of the executable
+        @type str
         @return list of full executable names, if the executable file is
             accessible via the searchpath defined by the PATH environment
             variable, or an empty list otherwise.
+        @rtype list of str
         """
         paths = []
         
@@ -611,9 +622,11 @@
         """
         Public method to get the supported Python variants.
         
-        @return list of supported Python variants (list of strings)
+        @return list of supported Python variants
+        @rtype list of str
         """
         variants = []
+        # TODO: that doesn't exist anymore
         cmd = "pcreate"
         
         for variant in ['Python3']:
@@ -669,11 +682,13 @@
         Private method to get the path of the virtual environment.
         
         @param language Python variant to get the virtual environment
-            for (string, one of '' or 'Python3')
-        @return path of the virtual environment (string)
+            for (one of '' or 'Python3')
+        @type str
+        @return path of the virtual environment
+        @rtype str
         """
         if not language:
-            language = self.__e5project.getProjectLanguage()
+            language = self.__ericProject.getProjectLanguage()
         if self.__virtualEnvManager:
             if language == "Python3":
                 venvName = self.__plugin.getPreferences(
@@ -701,11 +716,13 @@
         Private method to get the path of the debugger environment.
         
         @param language Python variant to get the debugger environment
-            for (string, one of '' or 'Python3')
-        @return path of the debugger environment (string)
+            for (one of '' or 'Python3')
+        @type str
+        @return path of the debugger environment
+        @rtype str
         """
         if not language:
-            language = self.__e5project.getProjectLanguage()
+            language = self.__ericProject.getProjectLanguage()
         if self.__virtualEnvManager:
             debugEnv = self.__getVirtualEnvironment(language)
             if not debugEnv:
@@ -724,13 +741,16 @@
         """
         Public method to build a Pyramid command.
         
-        @param cmd command (string)
+        @param cmd command
+        @type str
         @param language Python variant to get the virtual environment
-            for (string, one of '' or 'Python3')
-        @return full pyramid command (string)
+            for (one of '' or 'Python3')
+        @type str
+        @return full pyramid command
+        @rtype str
         """
         if not language:
-            language = self.__e5project.getProjectLanguage()
+            language = self.__ericProject.getProjectLanguage()
         
         virtualEnv = self.__getVirtualEnvironment(language)
         if isWindowsPlatform() and not virtualEnv:
@@ -760,9 +780,10 @@
         """
         Public method to build the Python command.
         
-        @return python command (string)
+        @return python command
+        @rtype str
         """
-        language = self.__e5project.getProjectLanguage()
+        language = self.__ericProject.getProjectLanguage()
         if self.__virtualEnvManager:
             if language == "Python3":
                 venvName = self.__plugin.getPreferences(
@@ -785,8 +806,8 @@
         version = self.getPyramidVersionString()
         url = "http://www.pylonsproject.org/projects/pyramid/about"
         
-        msgBox = E5MessageBox.E5MessageBox(
-            E5MessageBox.Question,
+        msgBox = EricMessageBox.EricMessageBox(
+            EricMessageBox.Question,
             self.tr("About Pyramid"),
             self.tr(
                 "<p>Pyramid is a high-level Python Web framework that"
@@ -799,7 +820,7 @@
                 "</table></p>"
             ).format(version, url),
             modal=True,
-            buttons=E5MessageBox.Ok)
+            buttons=EricMessageBox.Ok)
         msgBox.setIconPixmap(UI.PixmapCache.getPixmap(
             os.path.join("ProjectPyramid", "icons",
                          "pyramid64-{0}".format(self.__iconSuffix))
@@ -814,6 +835,7 @@
         @rtype str
         """
         if not self.__pyramidVersion:
+            # TODO: that doesn't exist anymore
             cmd = self.getPyramidCommand("pcreate")
             if isWindowsPlatform():
                 cmd = os.path.join(os.path.dirname(cmd), "pcreate-script.py")
@@ -852,10 +874,11 @@
         """
         Public method to check, if the given console is a spawning console.
         
-        @param consoleCmd console command (string)
+        @param consoleCmd console command
+        @type str
         @return tuple of two entries giving an indication, if the console
             is spawning (boolean) and the (possibly) cleaned console command
-            (string)
+        @rtype str
         """
         if consoleCmd and consoleCmd[0] == '@':
             return (True, consoleCmd[1:])
@@ -891,9 +914,10 @@
         from .CreateParametersDialog import CreateParametersDialog
         
         dlg = CreateParametersDialog(self)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             scaffold, project, overwrite, simulate = dlg.getData()
             
+            # TODO: that doesn't exist anymore
             cmd = self.getPyramidCommand("pcreate")
             args = []
             if overwrite:
@@ -906,24 +930,26 @@
             args.append(project)
             dlg = PyramidDialog(self.tr("Create Pyramid Project"),
                                 linewrap=False, parent=self.__ui)
-            if dlg.startProcess(cmd, args, self.__e5project.getProjectPath()):
+            if dlg.startProcess(
+                cmd, args, self.__ericProject.getProjectPath()
+            ):
                 dlg.exec()
                 if dlg.normalExit() and not simulate:
                     # search for files created by pcreate and add them to the
                     # project
                     projectPath = os.path.join(
-                        self.__e5project.getProjectPath(), project)
+                        self.__ericProject.getProjectPath(), project)
                     for entry in os.walk(projectPath):
                         for fileName in entry[2]:
                             fullName = os.path.join(entry[0], fileName)
-                            self.__e5project.appendFile(fullName)
+                            self.__ericProject.appendFile(fullName)
                     
                     # create the base directory for translations
                     i18nPath = os.path.join(
                         projectPath, project.lower(), "i18n")
                     if not os.path.exists(i18nPath):
                         os.makedirs(i18nPath)
-                    self.__e5project.setDirty(True)
+                    self.__ericProject.setDirty(True)
                     
                     self.__setCurrentProject(project)
     
@@ -936,10 +962,11 @@
         Private method to determine the relative path of all Pyramid
         projects (= top level dirs).
         
-        @return list of projects (list of string)
+        @return list of projects
+        @rtype list of str
         """
         projects = []
-        ppath = self.__e5project.getProjectPath()
+        ppath = self.__ericProject.getProjectPath()
         for entry in os.listdir(ppath):
             if (
                 entry[0] not in "._" and
@@ -979,9 +1006,10 @@
         """
         Private method to calculate the full path of the Pyramid project.
         
+        @return path of the project
+        @rtype str
         @exception PyramidNoProjectSelectedException raised, if no project is
             selected
-        @return path of the project (string)
         """
         if self.__currentProject is None:
             self.__selectProject()
@@ -989,14 +1017,15 @@
         if self.__currentProject is None:
             raise PyramidNoProjectSelectedException
         else:
-            return os.path.join(self.__e5project.getProjectPath(),
+            return os.path.join(self.__ericProject.getProjectPath(),
                                 self.__currentProject)
     
     def __setCurrentProject(self, project):
         """
         Private slot to set the current project.
         
-        @param project name of the project (string)
+        @param project name of the project
+        @type str
         """
         if project is not None and len(project) == 0:
             self.__currentProject = None
@@ -1012,7 +1041,7 @@
             self.tr('&Current Pyramid Project ({0})').format(curProject))
         
         if self.__currentProject is None:
-            self.__e5project.setTranslationPattern("")
+            self.__ericProject.setTranslationPattern("")
         else:
             lowerProject = self.__project().lower()
             config = configparser.ConfigParser()
@@ -1025,7 +1054,7 @@
                 domain = config.get("init_catalog", "domain")
             except (configparser.NoOptionError, configparser.NoSectionError):
                 domain = lowerProject
-            self.__e5project.setTranslationPattern(
+            self.__ericProject.setTranslationPattern(
                 os.path.join(project, outputDir, "%language%",
                              "LC_MESSAGES", "{0}.po".format(domain))
             )
@@ -1040,9 +1069,10 @@
         """
         Private method to get the name of the current Pyramid project.
         
+        @return name of the project
+        @rtype str
         @exception PyramidNoProjectSelectedException raised, if no project is
             selected
-        @return name of the project (string)
         """
         if self.__currentProject is None:
             self.__selectProject()
@@ -1060,7 +1090,8 @@
         """
         Private slot to start the Pyramid Web server.
         
-        @param logging flag indicating to enable logging (boolean)
+        @param logging flag indicating to enable logging
+        @type bool
         """
         consoleCmd = self.isSpawningConsole(
             self.__plugin.getPreferences("ConsoleCommand"))[1]
@@ -1068,7 +1099,7 @@
             try:
                 projectPath = self.__projectPath()
             except PyramidNoProjectSelectedException:
-                E5MessageBox.warning(
+                EricMessageBox.warning(
                     self.__ui,
                     self.tr('Run Server'),
                     self.tr('No current Pyramid project selected or no'
@@ -1096,7 +1127,7 @@
                 self.__serverProc.start(args[0], args[1:])
                 serverProcStarted = self.__serverProc.waitForStarted()
             if not serverProcStarted:
-                E5MessageBox.critical(
+                EricMessageBox.critical(
                     self.__ui,
                     self.tr('Process Generation Error'),
                     self.tr('The Pyramid server could not be started.'))
@@ -1113,7 +1144,7 @@
         """
         if (
             self.__serverProc is not None and
-            self.__serverProc.state() != QProcess.NotRunning
+            self.__serverProc.state() != QProcess.ProcessState.NotRunning
         ):
             self.__serverProc.terminate()
             QTimer.singleShot(2000, self.__serverProc.kill)
@@ -1127,7 +1158,7 @@
         try:
             projectPath = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 self.tr('Run Web-Browser'),
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1144,7 +1175,7 @@
         if self.__plugin.getPreferences("UseExternalBrowser"):
             res = QDesktopServices.openUrl(QUrl(url))
             if not res:
-                E5MessageBox.critical(
+                EricMessageBox.critical(
                     self.__ui,
                     self.tr('Run Web-Browser'),
                     self.tr('Could not start the web-browser for the URL'
@@ -1162,7 +1193,7 @@
             try:
                 projectPath = self.__projectPath()
             except PyramidNoProjectSelectedException:
-                E5MessageBox.warning(
+                EricMessageBox.warning(
                     self.__ui,
                     self.tr('Start Pyramid Python Console'),
                     self.tr('No current Pyramid project selected or no'
@@ -1180,7 +1211,7 @@
             started, pid = QProcess.startDetached(
                 args[0], args[1:], projectPath)
             if not started:
-                E5MessageBox.critical(
+                EricMessageBox.critical(
                     self.__ui,
                     self.tr('Process Generation Error'),
                     self.tr('The Pyramid Shell process could not be'
@@ -1199,7 +1230,7 @@
         try:
             wd = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1234,7 +1265,7 @@
         try:
             projectPath = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1246,7 +1277,7 @@
         )
         
         dlg = DistributionTypeSelectionDialog(self, projectPath, self.__ui)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             formats = dlg.getFormats()
             cmd = self.getPythonCommand()
             args = []
@@ -1271,13 +1302,14 @@
         """
         Private method to create the path to the initialization script.
         
-        @return path to the initialization script (string)
+        @return path to the initialization script
+        @rtype str
         """
         try:
             cmd = "initialize_{0}_db".format(self.__project())
             return self.getPyramidCommand(cmd)
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 self.tr("Initialize Database"),
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1292,7 +1324,7 @@
         try:
             projectPath = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1322,7 +1354,7 @@
         try:
             projectPath = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1333,7 +1365,7 @@
             self.__ui,
             self.tr("Show Matching Views"),
             self.tr("Enter the URL to be matched:"),
-            QLineEdit.Normal,
+            QLineEdit.EchoMode.Normal,
             "/")
         if not ok or url == "":
             return
@@ -1356,7 +1388,7 @@
         try:
             projectPath = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1378,7 +1410,7 @@
         try:
             projectPath = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1413,14 +1445,16 @@
         """
         Private method to extract the locale out of a file name.
         
-        @param filename name of the file used for extraction (string)
-        @return extracted locale (string) or None
+        @param filename name of the file used for extraction
+        @type str
+        @return extracted locale or None
+        @rtype str
         """
-        if self.__e5project.getTranslationPattern():
+        if self.__ericProject.getTranslationPattern():
             # On Windows, path typically contains backslashes. This leads
             # to an invalid search pattern '...\(' because the opening bracket
             # will be escaped.
-            pattern = self.__e5project.getTranslationPattern()
+            pattern = self.__ericProject.getTranslationPattern()
             pattern = os.path.normpath(pattern)
             pattern = pattern.replace("%language%", "(.*?)")
             pattern = pattern.replace('\\', '\\\\')
@@ -1434,8 +1468,10 @@
         """
         Private method to normalize a list of file names.
         
-        @param filenames list of file names to normalize (list of string)
-        @return normalized file names (list of string)
+        @param filenames list of file names to normalize
+        @type list of str
+        @return normalized file names
+        @rtype list of str
         """
         nfilenames = []
         for filename in filenames:
@@ -1450,8 +1486,10 @@
         """
         Private method to filter a list of file names by Pyramid project.
         
-        @param filenames list of file names to be filtered (list of string)
-        @return file names belonging to the current site (list of string)
+        @param filenames list of file names to be filtered
+        @type list of str
+        @return file names belonging to the current site
+        @rtype list of str
         """
         project = self.__project()
         nfilenames = []
@@ -1469,7 +1507,7 @@
         try:
             projectPath = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1481,14 +1519,14 @@
         try:
             potFile = config.get("extract_messages", "output_file")
         except configparser.NoSectionError:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No setup.cfg found or no "extract_messages"'
                         ' section found in setup.cfg.'))
             return
         except configparser.NoOptionError:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No "output_file" option found in setup.cfg.'))
@@ -1509,20 +1547,21 @@
         res = dia.startProcess(cmd, args, projectPath)
         if res:
             dia.exec()
-            self.__e5project.appendFile(os.path.join(projectPath, potFile))
+            self.__ericProject.appendFile(os.path.join(projectPath, potFile))
             
     def __projectLanguageAdded(self, code):
         """
         Private slot handling the addition of a new language.
         
-        @param code language code of the new language (string)
+        @param code language code of the new language
+        @type str
         """
         title = self.tr(
             "Initializing message catalog for '{0}'").format(code)
         try:
             projectPath = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1544,21 +1583,22 @@
         if res:
             dia.exec()
             
-            langFile = self.__e5project.getTranslationPattern().replace(
+            langFile = self.__ericProject.getTranslationPattern().replace(
                 "%language%", code)
-            self.__e5project.appendFile(langFile)
+            self.__ericProject.appendFile(langFile)
     
     def compileCatalogs(self, filenames):
         """
         Public method to compile the message catalogs.
         
         @param filenames list of filenames (not used)
+        @type list of str
         """
         title = self.tr("Compiling message catalogs")
         try:
             projectPath = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1582,19 +1622,20 @@
                 for fileName in entry[2]:
                     fullName = os.path.join(entry[0], fileName)
                     if fullName.endswith('.mo'):
-                        self.__e5project.appendFile(fullName)
+                        self.__ericProject.appendFile(fullName)
     
     def compileSelectedCatalogs(self, filenames):
         """
         Public method to update the message catalogs.
         
-        @param filenames list of file names (list of string)
+        @param filenames list of file names
+        @type list of str
         """
         title = self.tr("Compiling message catalogs")
         try:
             projectPath = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1616,7 +1657,7 @@
                 argsLists.append(args)
         
         if len(argsLists) == 0:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No locales detected. Aborting...'))
@@ -1634,19 +1675,20 @@
                 for fileName in entry[2]:
                     fullName = os.path.join(entry[0], fileName)
                     if fullName.endswith('.mo'):
-                        self.__e5project.appendFile(fullName)
+                        self.__ericProject.appendFile(fullName)
     
     def updateCatalogs(self, filenames):
         """
         Public method to update the message catalogs.
         
         @param filenames list of filenames (not used)
+        @type list of str
         """
         title = self.tr("Updating message catalogs")
         try:
             projectPath = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1670,12 +1712,13 @@
         Public method to update the message catalogs.
         
         @param filenames list of filenames
+        @type list of str
         """
         title = self.tr("Updating message catalogs")
         try:
             projectPath = self.__projectPath()
         except PyramidNoProjectSelectedException:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No current Pyramid project selected or no Pyramid'
@@ -1697,7 +1740,7 @@
                 argsLists.append(args)
         
         if len(argsLists) == 0:
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui,
                 title,
                 self.tr('No locales detected. Aborting...'))
@@ -1714,7 +1757,8 @@
         """
         Public method to edit the given file in an external .po editor.
         
-        @param poFile name of the .po file (string)
+        @param poFile name of the .po file
+        @type str
         """
         editor = self.__plugin.getPreferences("TranslationsEditor")
         if poFile.endswith(".po") and editor:
@@ -1724,7 +1768,7 @@
                 wd = ""
             started, pid = QProcess.startDetached(editor, [poFile], wd)
             if not started:
-                E5MessageBox.critical(
+                EricMessageBox.critical(
                     None,
                     self.tr('Process Generation Error'),
                     self.tr('The translations editor process ({0}) could'

eric ide

mercurial