--- a/ProjectPyramid/Project.py Sat Apr 26 17:12:15 2014 +0200 +++ b/ProjectPyramid/Project.py Fri Jul 11 19:01:33 2014 +0200 @@ -19,10 +19,10 @@ import re import sys -from PyQt4.QtCore import QObject, QFileInfo, QTimer, QUrl -from PyQt4.QtGui import QMenu, QDialog, QInputDialog, QDesktopServices, \ - QLineEdit -from PyQt4.QtCore import QProcess as QProcessPyQt +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 E5Gui.E5Application import e5App from E5Gui import E5MessageBox, E5FileDialog @@ -64,8 +64,8 @@ @staticmethod def startDetached(cmd, args=[], path=''): """ - Static method to start the given program (cmd) in a new process, if - none is already running, passing the command line arguments in args. + 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) @@ -109,18 +109,18 @@ self.actions = [] self.selectProjectAct = E5Action( - self.trUtf8('Current Pyramid Project'), + self.tr('Current Pyramid Project'), "", 0, 0, self, 'pyramid_current_project') - self.selectProjectAct.setStatusTip(self.trUtf8( + self.selectProjectAct.setStatusTip(self.tr( 'Selects the current Pyramid project')) - self.selectProjectAct.setWhatsThis(self.trUtf8( + self.selectProjectAct.setWhatsThis(self.tr( """<b>Current Pyramid Project</b>""" """<p>Selects the Pyramid project. Used for multi-project """ """Pyramid projects to switch between the projects.</p>""" )) - self.selectProjectAct.triggered[()].connect(self.__selectProject) + self.selectProjectAct.triggered.connect(self.__selectProject) self.actions.append(self.selectProjectAct) ############################### @@ -128,17 +128,17 @@ ############################### self.createProjectAct = E5Action( - self.trUtf8('Create Pyramid Project'), - self.trUtf8('Create Pyramid &Project'), + self.tr('Create Pyramid Project'), + self.tr('Create Pyramid &Project'), 0, 0, self, 'pyramid_create_project') - self.createProjectAct.setStatusTip(self.trUtf8( + self.createProjectAct.setStatusTip(self.tr( 'Creates a new Pyramid project')) - self.createProjectAct.setWhatsThis(self.trUtf8( + self.createProjectAct.setWhatsThis(self.tr( """<b>Create Pyramid Project</b>""" """<p>Creates a new Pyramid project using "pcreate".</p>""" )) - self.createProjectAct.triggered[()].connect(self.__createProject) + self.createProjectAct.triggered.connect(self.__createProject) self.actions.append(self.createProjectAct) ############################## @@ -146,63 +146,63 @@ ############################## self.runServerAct = E5Action( - self.trUtf8('Run Server'), - self.trUtf8('Run &Server'), + self.tr('Run Server'), + self.tr('Run &Server'), 0, 0, self, 'pyramid_run_server') - self.runServerAct.setStatusTip(self.trUtf8( + self.runServerAct.setStatusTip(self.tr( 'Starts the Pyramid Web server')) - self.runServerAct.setWhatsThis(self.trUtf8( + self.runServerAct.setWhatsThis(self.tr( """<b>Run Server</b>""" """<p>Starts the Pyramid Web server using""" """ "pserve --reload development.ini".</p>""" )) - self.runServerAct.triggered[()].connect(self.__runServer) + self.runServerAct.triggered.connect(self.__runServer) self.actions.append(self.runServerAct) self.runLoggingServerAct = E5Action( - self.trUtf8('Run Server with Logging'), - self.trUtf8('Run Server with &Logging'), + self.tr('Run Server with Logging'), + self.tr('Run Server with &Logging'), 0, 0, self, 'pyramid_run_logging_server') - self.runLoggingServerAct.setStatusTip(self.trUtf8( + self.runLoggingServerAct.setStatusTip(self.tr( 'Starts the Pyramid Web server with logging')) - self.runLoggingServerAct.setWhatsThis(self.trUtf8( + self.runLoggingServerAct.setWhatsThis(self.tr( """<b>Run Server with Logging</b>""" """<p>Starts the Pyramid Web server with logging using""" """ "pserve --log-file=server.log --reload development.ini".</p>""" )) - self.runLoggingServerAct.triggered[()].connect(self.__runLoggingServer) + self.runLoggingServerAct.triggered.connect(self.__runLoggingServer) self.actions.append(self.runLoggingServerAct) self.runBrowserAct = E5Action( - self.trUtf8('Run Web-Browser'), - self.trUtf8('Run &Web-Browser'), + self.tr('Run Web-Browser'), + self.tr('Run &Web-Browser'), 0, 0, self, 'pyramid_run_browser') - self.runBrowserAct.setStatusTip(self.trUtf8( + self.runBrowserAct.setStatusTip(self.tr( 'Starts the default Web-Browser with the URL of the Pyramid Web' ' server')) - self.runBrowserAct.setWhatsThis(self.trUtf8( + self.runBrowserAct.setWhatsThis(self.tr( """<b>Run Web-Browser</b>""" """<p>Starts the default Web-Browser with the URL of the """ """Pyramid Web server.</p>""" )) - self.runBrowserAct.triggered[()].connect(self.__runBrowser) + self.runBrowserAct.triggered.connect(self.__runBrowser) self.actions.append(self.runBrowserAct) self.runPythonShellAct = E5Action( - self.trUtf8('Start Pyramid Python Console'), - self.trUtf8('Start Pyramid &Python Console'), + self.tr('Start Pyramid Python Console'), + self.tr('Start Pyramid &Python Console'), 0, 0, self, 'pyramid_python_console') - self.runPythonShellAct.setStatusTip(self.trUtf8( + self.runPythonShellAct.setStatusTip(self.tr( 'Starts an interactive Python interpreter')) - self.runPythonShellAct.setWhatsThis(self.trUtf8( + self.runPythonShellAct.setWhatsThis(self.tr( """<b>Start Pyramid Python Console</b>""" """<p>Starts an interactive Python interpreter.</p>""" )) - self.runPythonShellAct.triggered[()].connect(self.__runPythonShell) + self.runPythonShellAct.triggered.connect(self.__runPythonShell) self.actions.append(self.runPythonShellAct) ############################## @@ -210,18 +210,18 @@ ############################## self.setupDevelopAct = E5Action( - self.trUtf8('Setup Development Environment'), - self.trUtf8('Setup &Development Environment'), + self.tr('Setup Development Environment'), + self.tr('Setup &Development Environment'), 0, 0, self, 'pyramid_setup_development') - self.setupDevelopAct.setStatusTip(self.trUtf8( + self.setupDevelopAct.setStatusTip(self.tr( 'Setup the Pyramid project in development mode')) - self.setupDevelopAct.setWhatsThis(self.trUtf8( + self.setupDevelopAct.setWhatsThis(self.tr( """<b>Setup Development Environment</b>""" """<p>Setup the Pyramid project in development mode using""" """ "python setup.py develop".</p>""" )) - self.setupDevelopAct.triggered[()].connect(self.__setupDevelop) + self.setupDevelopAct.triggered.connect(self.__setupDevelop) self.actions.append(self.setupDevelopAct) ############################### @@ -229,19 +229,19 @@ ############################### self.initializeDbAct = E5Action( - self.trUtf8('Initialize Database'), - self.trUtf8('Initialize &Database'), + self.tr('Initialize Database'), + self.tr('Initialize &Database'), 0, 0, self, 'pyramid_initialize_database') - self.initializeDbAct.setStatusTip(self.trUtf8( + self.initializeDbAct.setStatusTip(self.tr( 'Initializes (or re-initializes) the database of the current' ' Pyramid project')) - self.initializeDbAct.setWhatsThis(self.trUtf8( + self.initializeDbAct.setWhatsThis(self.tr( """<b>Initialize Database</b>""" """<p>Initializes (or re-initializes) the database of the""" """ current Pyramid project.</p>""" )) - self.initializeDbAct.triggered[()].connect(self.__initializeDatabase) + self.initializeDbAct.triggered.connect(self.__initializeDatabase) self.actions.append(self.initializeDbAct) ############################### @@ -249,48 +249,48 @@ ############################### self.showViewsAct = E5Action( - self.trUtf8('Show Matching Views'), - self.trUtf8('Show Matching &Views'), + self.tr('Show Matching Views'), + self.tr('Show Matching &Views'), 0, 0, self, 'pyramid_show_views') - self.showViewsAct.setStatusTip(self.trUtf8( + self.showViewsAct.setStatusTip(self.tr( 'Show views matching a given URL')) - self.showViewsAct.setWhatsThis(self.trUtf8( + self.showViewsAct.setWhatsThis(self.tr( """<b>Show Matching Views</b>""" """<p>Show views matching a given URL.</p>""" )) - self.showViewsAct.triggered[()].connect(self.__showMatchingViews) + self.showViewsAct.triggered.connect(self.__showMatchingViews) self.actions.append(self.showViewsAct) self.showRoutesAct = E5Action( - self.trUtf8('Show Routes'), - self.trUtf8('Show &Routes'), + self.tr('Show Routes'), + self.tr('Show &Routes'), 0, 0, self, 'pyramid_show_routes') - self.showRoutesAct.setStatusTip(self.trUtf8( + self.showRoutesAct.setStatusTip(self.tr( 'Show all URL dispatch routes used by a Pyramid application')) - self.showRoutesAct.setWhatsThis(self.trUtf8( + self.showRoutesAct.setWhatsThis(self.tr( """<b>Show Routes</b>""" """<p>Show all URL dispatch routes used by a Pyramid application""" """ in the order in which they are evaluated.</p>""" )) - self.showRoutesAct.triggered[()].connect(self.__showRoutes) + self.showRoutesAct.triggered.connect(self.__showRoutes) self.actions.append(self.showRoutesAct) self.showTweensAct = E5Action( - self.trUtf8('Show Tween Objects'), - self.trUtf8('Show &Tween Objects'), + self.tr('Show Tween Objects'), + self.tr('Show &Tween Objects'), 0, 0, self, 'pyramid_show_routes') - self.showTweensAct.setStatusTip(self.trUtf8( + self.showTweensAct.setStatusTip(self.tr( 'Show all implicit and explicit tween objects used by a Pyramid' ' application')) - self.showTweensAct.setWhatsThis(self.trUtf8( + self.showTweensAct.setWhatsThis(self.tr( """<b>Show Tween Objects</b>""" """<p>Show all implicit and explicit tween objects used by a""" """ Pyramid application.</p>""" )) - self.showTweensAct.triggered[()].connect(self.__showTweens) + self.showTweensAct.triggered.connect(self.__showTweens) self.actions.append(self.showTweensAct) ################################## @@ -298,18 +298,18 @@ ################################## self.buildDistroAct = E5Action( - self.trUtf8('Build Distribution'), - self.trUtf8('Build &Distribution'), + self.tr('Build Distribution'), + self.tr('Build &Distribution'), 0, 0, self, 'pyramid_build_distribution') - self.buildDistroAct.setStatusTip(self.trUtf8( + self.buildDistroAct.setStatusTip(self.tr( 'Builds a distribution file for the Pyramid project')) - self.buildDistroAct.setWhatsThis(self.trUtf8( + self.buildDistroAct.setWhatsThis(self.tr( """<b>Build Distribution</b>""" """<p>Builds a distribution file for the Pyramid project using""" """ "python setup.py sdist".</p>""" )) - self.buildDistroAct.triggered[()].connect(self.__buildDistribution) + self.buildDistroAct.triggered.connect(self.__buildDistribution) self.actions.append(self.buildDistroAct) ################################## @@ -317,17 +317,17 @@ ################################## self.documentationAct = E5Action( - self.trUtf8('Documentation'), - self.trUtf8('D&ocumentation'), + self.tr('Documentation'), + self.tr('D&ocumentation'), 0, 0, self, 'pyramid_documentation') - self.documentationAct.setStatusTip(self.trUtf8( + self.documentationAct.setStatusTip(self.tr( 'Shows the help viewer with the Pyramid documentation')) - self.documentationAct.setWhatsThis(self.trUtf8( + self.documentationAct.setWhatsThis(self.tr( """<b>Documentation</b>""" """<p>Shows the help viewer with the Pyramid documentation.</p>""" )) - self.documentationAct.triggered[()].connect(self.__showDocumentation) + self.documentationAct.triggered.connect(self.__showDocumentation) self.actions.append(self.documentationAct) ############################## @@ -335,17 +335,17 @@ ############################## self.aboutPyramidAct = E5Action( - self.trUtf8('About Pyramid'), - self.trUtf8('About P&yramid'), + self.tr('About Pyramid'), + self.tr('About P&yramid'), 0, 0, self, 'pyramid_about') - self.aboutPyramidAct.setStatusTip(self.trUtf8( + self.aboutPyramidAct.setStatusTip(self.tr( 'Shows some information about Pyramid')) - self.aboutPyramidAct.setWhatsThis(self.trUtf8( + self.aboutPyramidAct.setWhatsThis(self.tr( """<b>About Pyramid</b>""" """<p>Shows some information about Pyramid.</p>""" )) - self.aboutPyramidAct.triggered[()].connect(self.__pyramidInfo) + self.aboutPyramidAct.triggered.connect(self.__pyramidInfo) self.actions.append(self.aboutPyramidAct) self.__setCurrentProject(None) @@ -358,7 +358,7 @@ """ self.__menus = {} # clear menus references - menu = QMenu(self.trUtf8('P&yramid'), self.__ui) + menu = QMenu(self.tr('P&yramid'), self.__ui) menu.setTearOffEnabled(True) menu.addAction(self.selectProjectAct) @@ -417,17 +417,13 @@ """ if self.__hooksInstalled: editor = self.__plugin.getPreferences("TranslationsEditor") - try: - if editor: - self.__translationsBrowser.addHookMethodAndMenuEntry( - "open", self.openPOEditor, - self.trUtf8("Open with {0}").format( - os.path.basename(editor))) - else: - self.__translationsBrowser.removeHookMethod("open") - except KeyError: - # ignore for older eric5 versions - pass + if editor: + self.__translationsBrowser.addHookMethodAndMenuEntry( + "open", self.openPOEditor, + self.tr("Open with {0}").format( + os.path.basename(editor))) + else: + self.__translationsBrowser.removeHookMethod("open") def projectOpenedHooks(self): """ @@ -437,7 +433,7 @@ self.__formsBrowser = \ e5App().getObject("ProjectBrowser").getProjectBrowser("forms") self.__formsBrowser.addHookMethodAndMenuEntry( - "newForm", self.newForm, self.trUtf8("New template...")) + "newForm", self.newForm, self.tr("New template...")) if self.__e5project.getProjectLanguage() == "Python2": # Babel and lingua are not yet available for Python 3 @@ -448,19 +444,19 @@ .getProjectBrowser("translations") self.__translationsBrowser.addHookMethodAndMenuEntry( "extractMessages", self.extractMessages, - self.trUtf8("Extract Messages")) + self.tr("Extract Messages")) self.__translationsBrowser.addHookMethodAndMenuEntry( "releaseAll", self.compileCatalogs, - self.trUtf8("Compile All Catalogs")) + self.tr("Compile All Catalogs")) self.__translationsBrowser.addHookMethodAndMenuEntry( "releaseSelected", self.compileSelectedCatalogs, - self.trUtf8("Compile Selected Catalogs")) + self.tr("Compile Selected Catalogs")) self.__translationsBrowser.addHookMethodAndMenuEntry( "generateAll", self.updateCatalogs, - self.trUtf8("Update All Catalogs")) + self.tr("Update All Catalogs")) self.__translationsBrowser.addHookMethodAndMenuEntry( "generateSelected", self.updateSelectedCatalogs, - self.trUtf8("Update Selected Catalogs")) + self.tr("Update Selected Catalogs")) self.__hooksInstalled = True @@ -481,11 +477,7 @@ self.__translationsBrowser.removeHookMethod("releaseSelected") self.__translationsBrowser.removeHookMethod("generateAll") self.__translationsBrowser.removeHookMethod("generateSelected") - try: - self.__translationsBrowser.removeHookMethod("open") - except KeyError: - # ignore for older eric5 versions - pass + self.__translationsBrowser.removeHookMethod("open") self.__translationsBrowser = None self.__hooksInstalled = False @@ -502,7 +494,7 @@ if dlg.exec_() == QDialog.Accepted: template = dlg.getTemplateText() - filter = self.trUtf8( + filter = self.tr( "Chameleon Templates (*.pt);;" "Chameleon Text Templates (*.txt);;" "Mako Templates (*.mako);;" @@ -512,7 +504,7 @@ "All Files (*)") fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( self.__ui, - self.trUtf8("New Form"), + self.tr("New Form"), path, filter, None, @@ -527,9 +519,9 @@ if os.path.exists(fname): res = E5MessageBox.yesNo( self.__ui, - self.trUtf8("New Form"), - self.trUtf8("""The file already exists! Overwrite""" - """ it?"""), + self.tr("New Form"), + self.tr("""The file already exists! Overwrite""" + """ it?"""), icon=E5MessageBox.Warning) if not res: # user selected to not overwrite @@ -542,9 +534,9 @@ except IOError as e: E5MessageBox.critical( self.__ui, - self.trUtf8("New Form"), - self.trUtf8("<p>The new form file <b>{0}</b> could" - " not be created.<br/> Problem: {1}</p>") + self.tr("New Form"), + self.tr("<p>The new form file <b>{0}</b> could" + " not be created.<br/> Problem: {1}</p>") .format(fname, e)) return @@ -757,8 +749,8 @@ msgBox = E5MessageBox.E5MessageBox( E5MessageBox.Question, - self.trUtf8("About Pyramid"), - self.trUtf8( + self.tr("About Pyramid"), + self.tr( "<p>Pyramid is a high-level Python Web framework that" " encourages rapid development and clean, pragmatic" " design.</p>" @@ -836,7 +828,7 @@ args.append("--simulate") args.append("--scaffold={0}".format(scaffold)) args.append(project) - dlg = PyramidDialog(self.trUtf8("Create Pyramid Project"), + dlg = PyramidDialog(self.tr("Create Pyramid Project"), linewrap=False, parent=self.__ui) if dlg.startProcess(cmd, args, self.__e5project.getProjectPath()): dlg.exec_() @@ -897,8 +889,8 @@ cur = 0 project, ok = QInputDialog.getItem( self.__ui, - self.trUtf8("Select Pyramid Project"), - self.trUtf8("Select the Pyramid project to work with."), + self.tr("Select Pyramid Project"), + self.tr("Select the Pyramid project to work with."), projects, cur, False) if not ok: @@ -934,11 +926,11 @@ self.__currentProject = project if self.__currentProject is None: - curProject = self.trUtf8("None") + curProject = self.tr("None") else: curProject = self.__currentProject self.selectProjectAct.setText( - self.trUtf8('&Current Pyramid Project ({0})').format(curProject)) + self.tr('&Current Pyramid Project ({0})').format(curProject)) if self.__currentProject is None: self.__e5project.pdata["TRANSLATIONPATTERN"] = [] @@ -999,9 +991,9 @@ except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, - self.trUtf8('Run Server'), - self.trUtf8('No current Pyramid project selected or no' - ' Pyramid project created yet. Aborting...')) + self.tr('Run Server'), + self.tr('No current Pyramid project selected or no' + ' Pyramid project created yet. Aborting...')) return args = Utilities.parseOptionString(consoleCmd) @@ -1027,8 +1019,8 @@ if not serverProcStarted: E5MessageBox.critical( self.__ui, - self.trUtf8('Process Generation Error'), - self.trUtf8('The Pyramid server could not be started.')) + self.tr('Process Generation Error'), + self.tr('The Pyramid server could not be started.')) def __runLoggingServer(self): """ @@ -1056,9 +1048,9 @@ except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, - self.trUtf8('Run Web-Browser'), - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('Run Web-Browser'), + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return config = configparser.ConfigParser() @@ -1072,9 +1064,9 @@ if not res: E5MessageBox.critical( self.__ui, - self.trUtf8('Run Web-Browser'), - self.trUtf8('Could not start the web-browser for the URL' - ' "{0}".').format(url.toString())) + self.tr('Run Web-Browser'), + self.tr('Could not start the web-browser for the URL' + ' "{0}".').format(url.toString())) def __runPythonShell(self): """ @@ -1088,9 +1080,9 @@ except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, - self.trUtf8('Start Pyramid Python Console'), - self.trUtf8('No current Pyramid project selected or no' - ' Pyramid project created yet. Aborting...')) + self.tr('Start Pyramid Python Console'), + self.tr('No current Pyramid project selected or no' + ' Pyramid project created yet. Aborting...')) return args = Utilities.parseOptionString(consoleCmd) @@ -1111,9 +1103,9 @@ if not started: E5MessageBox.critical( self.__ui, - self.trUtf8('Process Generation Error'), - self.trUtf8('The Pyramid Shell process could not be' - ' started.')) + self.tr('Process Generation Error'), + self.tr('The Pyramid Shell process could not be' + ' started.')) ################################################################## ## slots below implement setup functions @@ -1124,15 +1116,15 @@ Private slot to set up the development environment for the current project. """ - title = self.trUtf8("Setup Development Environment") + title = self.tr("Setup Development Environment") try: wd = self.__projectPath() except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.getPythonCommand() @@ -1142,8 +1134,8 @@ dia = PyramidDialog( title, - msgSuccess=self.trUtf8("Pyramid development environment setup" - " successfully.")) + msgSuccess=self.tr("Pyramid development environment setup" + " successfully.")) res = dia.startProcess(cmd, args, wd) if res: dia.exec_() @@ -1159,15 +1151,15 @@ Private slot to build a distribution file for the current Pyramid project. """ - title = self.trUtf8("Build Distribution File") + title = self.tr("Build Distribution File") try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return from .DistributionTypeSelectionDialog import \ @@ -1185,8 +1177,8 @@ dia = PyramidDialog( title, - msgSuccess=self.trUtf8("Python distribution file built" - " successfully.")) + msgSuccess=self.tr("Python distribution file built" + " successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: dia.exec_() @@ -1207,24 +1199,24 @@ except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, - self.trUtf8("Initialize Database"), - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr("Initialize Database"), + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return "" def __initializeDatabase(self): """ Private slot to initialize the database of the Pyramid project. """ - title = self.trUtf8("Initialize Database") + title = self.tr("Initialize Database") try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.__getInitDbCommand() @@ -1233,7 +1225,7 @@ dia = PyramidDialog( title, - msgSuccess=self.trUtf8("Database initialized successfully.")) + msgSuccess=self.tr("Database initialized successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: dia.exec_() @@ -1246,21 +1238,21 @@ """ Private slot showing all views that would match a given URL. """ - title = self.trUtf8("Show Matching Views") + title = self.tr("Show Matching Views") try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return url, ok = QInputDialog.getText( self.__ui, - self.trUtf8("Show Matching Views"), - self.trUtf8("Enter the URL to be matched:"), + self.tr("Show Matching Views"), + self.tr("Enter the URL to be matched:"), QLineEdit.Normal, "/") if not ok or url == "": @@ -1280,15 +1272,15 @@ """ Private slot showing all URL dispatch routes. """ - title = self.trUtf8("Show Routes") + title = self.tr("Show Routes") try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return from .PyramidRoutesDialog import PyramidRoutesDialog @@ -1302,15 +1294,15 @@ """ Private slot showing all implicit and explicit tween objects. """ - title = self.trUtf8("Show Tween Objects") + title = self.tr("Show Tween Objects") try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.getPyramidCommand("ptweens") @@ -1398,15 +1390,15 @@ """ Public method to extract the messages catalog template file. """ - title = self.trUtf8("Extract messages") + title = self.tr("Extract messages") try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return config = configparser.ConfigParser() @@ -1417,14 +1409,14 @@ E5MessageBox.warning( self.__ui, title, - self.trUtf8('No setup.cfg found or no "extract_messages"' - ' section found in setup.cfg.')) + self.tr('No setup.cfg found or no "extract_messages"' + ' section found in setup.cfg.')) return except configparser.NoOptionError: E5MessageBox.warning( self.__ui, title, - self.trUtf8('No "output_file" option found in setup.cfg.')) + self.tr('No "output_file" option found in setup.cfg.')) return try: @@ -1440,7 +1432,7 @@ dia = PyramidDialog( title, - msgSuccess=self.trUtf8("\nMessages extracted successfully.")) + msgSuccess=self.tr("\nMessages extracted successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: dia.exec_() @@ -1452,7 +1444,7 @@ @param code language code of the new language (string) """ - title = self.trUtf8("Initializing message catalog for '{0}'")\ + title = self.tr("Initializing message catalog for '{0}'")\ .format(code) try: projectPath = self.__projectPath() @@ -1460,8 +1452,8 @@ E5MessageBox.warning( self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.getPythonCommand() @@ -1473,8 +1465,8 @@ dia = PyramidDialog( title, - msgSuccess=self.trUtf8("\nMessage catalog initialized" - " successfully.")) + msgSuccess=self.tr("\nMessage catalog initialized" + " successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: dia.exec_() @@ -1489,15 +1481,15 @@ @param filenames list of filenames (not used) """ - title = self.trUtf8("Compiling message catalogs") + title = self.tr("Compiling message catalogs") try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.getPythonCommand() @@ -1507,8 +1499,8 @@ dia = PyramidDialog( title, - msgSuccess=self.trUtf8("\nMessage catalogs compiled" - " successfully.")) + msgSuccess=self.tr("\nMessage catalogs compiled" + " successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: dia.exec_() @@ -1525,15 +1517,15 @@ @param filenames list of file names (list of string) """ - title = self.trUtf8("Compiling message catalogs") + title = self.tr("Compiling message catalogs") try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return argsLists = [] @@ -1554,13 +1546,13 @@ E5MessageBox.warning( self.__ui, title, - self.trUtf8('No locales detected. Aborting...')) + self.tr('No locales detected. Aborting...')) return dia = PyramidDialog( title, - msgSuccess=self.trUtf8("\nMessage catalogs compiled" - " successfully.")) + msgSuccess=self.tr("\nMessage catalogs compiled" + " successfully.")) res = dia.startBatchProcesses(argsLists, projectPath) if res: dia.exec_() @@ -1577,15 +1569,15 @@ @param filenames list of filenames (not used) """ - title = self.trUtf8("Updating message catalogs") + title = self.tr("Updating message catalogs") try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.getPythonCommand() @@ -1595,7 +1587,7 @@ dia = PyramidDialog( title, - msgSuccess=self.trUtf8("\nMessage catalogs updated successfully.")) + msgSuccess=self.tr("\nMessage catalogs updated successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: dia.exec_() @@ -1606,15 +1598,15 @@ @param filenames list of filenames """ - title = self.trUtf8("Updating message catalogs") + title = self.tr("Updating message catalogs") try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: E5MessageBox.warning( self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.tr('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return argsLists = [] @@ -1635,12 +1627,12 @@ E5MessageBox.warning( self.__ui, title, - self.trUtf8('No locales detected. Aborting...')) + self.tr('No locales detected. Aborting...')) return dia = PyramidDialog( title, - msgSuccess=self.trUtf8("\nMessage catalogs updated successfully.")) + msgSuccess=self.tr("\nMessage catalogs updated successfully.")) res = dia.startBatchProcesses(argsLists, projectPath) if res: dia.exec_() @@ -1661,7 +1653,7 @@ if not started: E5MessageBox.critical( None, - self.trUtf8('Process Generation Error'), - self.trUtf8('The translations editor process ({0}) could' - ' not be started.').format( + self.tr('Process Generation Error'), + self.tr('The translations editor process ({0}) could' + ' not be started.').format( os.path.basename(editor)))