--- a/ProjectDjango/Project.py Sat Apr 26 16:57:10 2014 +0200 +++ b/ProjectDjango/Project.py Sun Jul 06 18:43:50 2014 +0200 @@ -17,10 +17,10 @@ import os import re -from PyQt4.QtCore import QObject, QTimer, QUrl, QFileInfo -from PyQt4.QtGui import QMenu, QInputDialog, QLineEdit, QDesktopServices, \ - QDialog -from PyQt4.QtCore import QProcess as QProcessPyQt +from PyQt5.QtCore import QObject, QTimer, QUrl, QFileInfo +from PyQt5.QtGui import QDesktopServices +from PyQt5.QtWidgets import QMenu, QInputDialog, QLineEdit, QDialog +from PyQt5.QtCore import QProcess as QProcessPyQt from E5Gui.E5Application import e5App from E5Gui import E5MessageBox, E5FileDialog @@ -48,7 +48,7 @@ """ def start(self, cmd, args=[], mode=QProcessPyQt.ReadWrite): """ - Static method to start the given program (cmd) in a new process, if + 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) @@ -63,8 +63,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) @@ -112,18 +112,18 @@ self.actions = [] self.selectSiteAct = E5Action( - self.trUtf8('Current Project'), + self.tr('Current Project'), "", 0, 0, self, 'django_current_project') - self.selectSiteAct.setStatusTip(self.trUtf8( + self.selectSiteAct.setStatusTip(self.tr( 'Selects the current project')) - self.selectSiteAct.setWhatsThis(self.trUtf8( + self.selectSiteAct.setWhatsThis(self.tr( """<b>Current Project</b>""" """<p>Selects the current project. Used for multi-project """ """Django projects to switch between the projects.</p>""" )) - self.selectSiteAct.triggered[()].connect(self.__selectSite) + self.selectSiteAct.triggered.connect(self.__selectSite) self.actions.append(self.selectSiteAct) self.__setCurrentSite(None) @@ -132,49 +132,49 @@ ############################## self.startProjectAct = E5Action( - self.trUtf8('Start Project'), - self.trUtf8('Start &Project'), + self.tr('Start Project'), + self.tr('Start &Project'), 0, 0, self, 'django_start_project') - self.startProjectAct.setStatusTip(self.trUtf8( + self.startProjectAct.setStatusTip(self.tr( 'Starts a new Django project')) - self.startProjectAct.setWhatsThis(self.trUtf8( + self.startProjectAct.setWhatsThis(self.tr( """<b>Start Project</b>""" """<p>Starts a new Django project using "django-admin.py""" """ startproject".</p>""" )) - self.startProjectAct.triggered[()].connect(self.__startProject) + self.startProjectAct.triggered.connect(self.__startProject) self.actions.append(self.startProjectAct) self.startGlobalApplicationAct = E5Action( - self.trUtf8('Start Application (global)'), - self.trUtf8('Start Application (&global)'), + self.tr('Start Application (global)'), + self.tr('Start Application (&global)'), 0, 0, self, 'django_start_global_application') - self.startGlobalApplicationAct.setStatusTip(self.trUtf8( + self.startGlobalApplicationAct.setStatusTip(self.tr( 'Starts a new global Django application')) - self.startGlobalApplicationAct.setWhatsThis(self.trUtf8( + self.startGlobalApplicationAct.setWhatsThis(self.tr( """<b>Start Application (global)</b>""" """<p>Starts a new global Django application using""" """ "django-admin.py startapp".</p>""" )) - self.startGlobalApplicationAct.triggered[()].connect( + self.startGlobalApplicationAct.triggered.connect( self.__startGlobalApplication) self.actions.append(self.startGlobalApplicationAct) self.startLocalApplicationAct = E5Action( - self.trUtf8('Start Application (local)'), - self.trUtf8('Start Application (&local)'), + self.tr('Start Application (local)'), + self.tr('Start Application (&local)'), 0, 0, self, 'django_start_local_application') - self.startLocalApplicationAct.setStatusTip(self.trUtf8( + self.startLocalApplicationAct.setStatusTip(self.tr( 'Starts a new local Django application')) - self.startLocalApplicationAct.setWhatsThis(self.trUtf8( + self.startLocalApplicationAct.setWhatsThis(self.tr( """<b>Start Application (local)</b>""" """<p>Starts a new local Django application using""" """ "manage.py startapp".</p>""" )) - self.startLocalApplicationAct.triggered[()].connect( + self.startLocalApplicationAct.triggered.connect( self.__startLocalApplication) self.actions.append(self.startLocalApplicationAct) @@ -183,34 +183,34 @@ ############################## self.runServerAct = E5Action( - self.trUtf8('Run Server'), - self.trUtf8('Run &Server'), + self.tr('Run Server'), + self.tr('Run &Server'), 0, 0, self, 'django_run_server') - self.runServerAct.setStatusTip(self.trUtf8( + self.runServerAct.setStatusTip(self.tr( 'Starts the Django Web server')) - self.runServerAct.setWhatsThis(self.trUtf8( + self.runServerAct.setWhatsThis(self.tr( """<b>Run Server</b>""" """<p>Starts the Django Web server using "manage.py""" """ runserver".</p>""" )) - self.runServerAct.triggered[()].connect(self.__runServer) + self.runServerAct.triggered.connect(self.__runServer) self.actions.append(self.runServerAct) 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, 'django_run_browser') - self.runBrowserAct.setStatusTip(self.trUtf8( + self.runBrowserAct.setStatusTip(self.tr( 'Starts the default Web-Browser with the URL of the Django 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 """ """Django Web server.</p>""" )) - self.runBrowserAct.triggered[()].connect(self.__runBrowser) + self.runBrowserAct.triggered.connect(self.__runBrowser) self.actions.append(self.runBrowserAct) ############################## @@ -218,18 +218,18 @@ ############################## self.createCacheTableAct = E5Action( - self.trUtf8('Create Cache Tables'), - self.trUtf8('C&reate Cache Tables'), + self.tr('Create Cache Tables'), + self.tr('C&reate Cache Tables'), 0, 0, self, 'django_create_cache_tables') - self.createCacheTableAct.setStatusTip(self.trUtf8( + self.createCacheTableAct.setStatusTip(self.tr( 'Creates the tables needed to use the SQL cache backend')) - self.createCacheTableAct.setWhatsThis(self.trUtf8( + self.createCacheTableAct.setWhatsThis(self.tr( """<b>Create Cache Tables</b>""" """<p>Creates the tables needed to use the SQL cache""" """ backend.</p>""" )) - self.createCacheTableAct.triggered[()].connect( + self.createCacheTableAct.triggered.connect( self.__createCacheTables) self.actions.append(self.createCacheTableAct) @@ -238,17 +238,17 @@ ############################## self.helpAct = E5Action( - self.trUtf8('Help'), - self.trUtf8('&Help'), + self.tr('Help'), + self.tr('&Help'), 0, 0, self, 'django_help') - self.helpAct.setStatusTip(self.trUtf8( + self.helpAct.setStatusTip(self.tr( 'Shows the Django help index')) - self.helpAct.setWhatsThis(self.trUtf8( + self.helpAct.setWhatsThis(self.tr( """<b>Help</b>""" """<p>Shows the Django help index page.</p>""" )) - self.helpAct.triggered[()].connect(self.__showHelpIndex) + self.helpAct.triggered.connect(self.__showHelpIndex) self.actions.append(self.helpAct) ############################## @@ -256,17 +256,17 @@ ############################## self.aboutDjangoAct = E5Action( - self.trUtf8('About Django'), - self.trUtf8('About D&jango'), + self.tr('About Django'), + self.tr('About D&jango'), 0, 0, self, 'django_about') - self.aboutDjangoAct.setStatusTip(self.trUtf8( + self.aboutDjangoAct.setStatusTip(self.tr( 'Shows some information about Django')) - self.aboutDjangoAct.setWhatsThis(self.trUtf8( + self.aboutDjangoAct.setWhatsThis(self.tr( """<b>About Django</b>""" """<p>Shows some information about Django.</p>""" )) - self.aboutDjangoAct.triggered[()].connect(self.__djangoInfo) + self.aboutDjangoAct.triggered.connect(self.__djangoInfo) self.actions.append(self.aboutDjangoAct) self.__initDatabaseActions() @@ -281,63 +281,63 @@ Private method to define the database related actions. """ self.syncDatabaseAct = E5Action( - self.trUtf8('Synchronize'), - self.trUtf8('&Synchronize'), + self.tr('Synchronize'), + self.tr('&Synchronize'), 0, 0, self, 'django_database_syncdb') - self.syncDatabaseAct.setStatusTip(self.trUtf8( + self.syncDatabaseAct.setStatusTip(self.tr( 'Synchronizes the database')) - self.syncDatabaseAct.setWhatsThis(self.trUtf8( + self.syncDatabaseAct.setWhatsThis(self.tr( """<b>Synchronize</b>""" """<p>Synchronizes the database.</p>""" )) - self.syncDatabaseAct.triggered[()].connect(self.__databaseSynchronize) + self.syncDatabaseAct.triggered.connect(self.__databaseSynchronize) self.actions.append(self.syncDatabaseAct) self.inspectDatabaseAct = E5Action( - self.trUtf8('Introspect'), - self.trUtf8('&Introspect'), + self.tr('Introspect'), + self.tr('&Introspect'), 0, 0, self, 'django_database_inspect') - self.inspectDatabaseAct.setStatusTip(self.trUtf8( + self.inspectDatabaseAct.setStatusTip(self.tr( 'Introspects the database tables and outputs a Django model' ' module')) - self.inspectDatabaseAct.setWhatsThis(self.trUtf8( + self.inspectDatabaseAct.setWhatsThis(self.tr( """<b>Introspect</b>""" """<p>Introspects the database tables and outputs a """ """Django model module.</p>""" )) - self.inspectDatabaseAct.triggered[()].connect(self.__databaseInspect) + self.inspectDatabaseAct.triggered.connect(self.__databaseInspect) self.actions.append(self.inspectDatabaseAct) self.flushDatabaseAct = E5Action( - self.trUtf8('Flush'), - self.trUtf8('&Flush'), + self.tr('Flush'), + self.tr('&Flush'), 0, 0, self, 'django_database_flush') - self.flushDatabaseAct.setStatusTip(self.trUtf8( + self.flushDatabaseAct.setStatusTip(self.tr( 'Returns all database tables to the state just after their' ' installation')) - self.flushDatabaseAct.setWhatsThis(self.trUtf8( + self.flushDatabaseAct.setWhatsThis(self.tr( """<b>Flush</b>""" """<p>Returns all database tables to the state """ """just after their installation.</p>""" )) - self.flushDatabaseAct.triggered[()].connect(self.__databaseFlush) + self.flushDatabaseAct.triggered.connect(self.__databaseFlush) self.actions.append(self.flushDatabaseAct) self.databaseClientAct = E5Action( - self.trUtf8('Start Client Console'), - self.trUtf8('Start &Client Console'), + self.tr('Start Client Console'), + self.tr('Start &Client Console'), 0, 0, self, 'django_database_client') - self.databaseClientAct.setStatusTip(self.trUtf8( + self.databaseClientAct.setStatusTip(self.tr( 'Starts a console window for the database client')) - self.databaseClientAct.setWhatsThis(self.trUtf8( + self.databaseClientAct.setWhatsThis(self.tr( """<b>Start Client Console</b>""" """<p>Starts a console window for the database client.</p>""" )) - self.databaseClientAct.triggered[()].connect(self.__runDatabaseClient) + self.databaseClientAct.triggered.connect(self.__runDatabaseClient) self.actions.append(self.databaseClientAct) def __initDatabaseSqlActions(self): @@ -345,121 +345,121 @@ Private method to define the database SQL related actions. """ self.databaseSqlCreateTablesAct = E5Action( - self.trUtf8('Create Tables'), - self.trUtf8('Create &Tables'), + self.tr('Create Tables'), + self.tr('Create &Tables'), 0, 0, self, 'django_database_sql_create_tables') - self.databaseSqlCreateTablesAct.setStatusTip(self.trUtf8( + self.databaseSqlCreateTablesAct.setStatusTip(self.tr( 'Prints the CREATE TABLE SQL statements for one or more' ' applications')) - self.databaseSqlCreateTablesAct.setWhatsThis(self.trUtf8( + self.databaseSqlCreateTablesAct.setWhatsThis(self.tr( """<b>Create Tables</b>""" """<p>Prints the CREATE TABLE SQL statements for one or """ """more applications.</p>""" )) - self.databaseSqlCreateTablesAct.triggered[()].connect( + self.databaseSqlCreateTablesAct.triggered.connect( self.__databaseSqlCreateTables) self.actions.append(self.databaseSqlCreateTablesAct) self.databaseSqlCreateIndexesAct = E5Action( - self.trUtf8('Create Indexes'), - self.trUtf8('Create &Indexes'), + self.tr('Create Indexes'), + self.tr('Create &Indexes'), 0, 0, self, 'django_database_sql_create_indexes') - self.databaseSqlCreateIndexesAct.setStatusTip(self.trUtf8( + self.databaseSqlCreateIndexesAct.setStatusTip(self.tr( 'Prints the CREATE INDEX SQL statements for one or more' ' applications')) - self.databaseSqlCreateIndexesAct.setWhatsThis(self.trUtf8( + self.databaseSqlCreateIndexesAct.setWhatsThis(self.tr( """<b>Create Indexes</b>""" """<p>Prints the CREATE INDEX SQL statements for one or """ """more applications.</p>""" )) - self.databaseSqlCreateIndexesAct.triggered[()].connect( + self.databaseSqlCreateIndexesAct.triggered.connect( self.__databaseSqlCreateIndexes) self.actions.append(self.databaseSqlCreateIndexesAct) self.databaseSqlCreateEverythingAct = E5Action( - self.trUtf8('Create Everything'), - self.trUtf8('Create &Everything'), + self.tr('Create Everything'), + self.tr('Create &Everything'), 0, 0, self, 'django_database_sql_create_everything') - self.databaseSqlCreateEverythingAct.setStatusTip(self.trUtf8( + self.databaseSqlCreateEverythingAct.setStatusTip(self.tr( 'Prints the CREATE ... SQL statements for one or more' ' applications')) - self.databaseSqlCreateEverythingAct.setWhatsThis(self.trUtf8( + self.databaseSqlCreateEverythingAct.setWhatsThis(self.tr( """<b>Create Everything</b>""" """<p>Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL """ """statements for one or more applications.</p>""" )) - self.databaseSqlCreateEverythingAct.triggered[()].connect( + self.databaseSqlCreateEverythingAct.triggered.connect( self.__databaseSqlCreateEverything) self.actions.append(self.databaseSqlCreateEverythingAct) self.databaseSqlCustomAct = E5Action( - self.trUtf8('Custom Statements'), - self.trUtf8('&Custom Statements'), + self.tr('Custom Statements'), + self.tr('&Custom Statements'), 0, 0, self, 'django_database_sql_custom') - self.databaseSqlCustomAct.setStatusTip(self.trUtf8( + self.databaseSqlCustomAct.setStatusTip(self.tr( 'Prints the custom table modifying SQL statements for ' 'one or more applications')) - self.databaseSqlCustomAct.setWhatsThis(self.trUtf8( + self.databaseSqlCustomAct.setWhatsThis(self.tr( """<b>Custom Statements</b>""" """<p>Prints the custom table modifying SQL statements """ """for one or more applications.</p>""" )) - self.databaseSqlCustomAct.triggered[()].connect( + self.databaseSqlCustomAct.triggered.connect( self.__databaseSqlCustom) self.actions.append(self.databaseSqlCustomAct) self.databaseSqlDropTablesAct = E5Action( - self.trUtf8('Drop Tables'), - self.trUtf8('&Drop Tables'), + self.tr('Drop Tables'), + self.tr('&Drop Tables'), 0, 0, self, 'django_database_sql_drop_tables') - self.databaseSqlDropTablesAct.setStatusTip(self.trUtf8( + self.databaseSqlDropTablesAct.setStatusTip(self.tr( 'Prints the DROP TABLE SQL statements for ' 'one or more applications')) - self.databaseSqlDropTablesAct.setWhatsThis(self.trUtf8( + self.databaseSqlDropTablesAct.setWhatsThis(self.tr( """<b>Drop Tables</b>""" """<p>Prints the DROP TABLE SQL statements """ """for one or more applications.</p>""" )) - self.databaseSqlDropTablesAct.triggered[()].connect( + self.databaseSqlDropTablesAct.triggered.connect( self.__databaseSqlDropTables) self.actions.append(self.databaseSqlDropTablesAct) self.databaseSqlFlushAct = E5Action( - self.trUtf8('Flush Database'), - self.trUtf8('&Flush Database'), + self.tr('Flush Database'), + self.tr('&Flush Database'), 0, 0, self, 'django_database_sql_flush_database') - self.databaseSqlFlushAct.setStatusTip(self.trUtf8( + self.databaseSqlFlushAct.setStatusTip(self.tr( 'Prints a list of statements to return all database tables to the' ' state just after their installation')) - self.databaseSqlFlushAct.setWhatsThis(self.trUtf8( + self.databaseSqlFlushAct.setWhatsThis(self.tr( """<b>Flush Database</b>""" """<p>Prints a list of statements to return all database tables""" """ to the state just after their installation.</p>""" )) - self.databaseSqlFlushAct.triggered[()].connect( + self.databaseSqlFlushAct.triggered.connect( self.__databaseSqlFlushDatabase) self.actions.append(self.databaseSqlFlushAct) self.databaseSqlResetSeqAct = E5Action( - self.trUtf8('Reset Sequences'), - self.trUtf8('Reset &Sequences'), + self.tr('Reset Sequences'), + self.tr('Reset &Sequences'), 0, 0, self, 'django_database_sql_reset_sequences') - self.databaseSqlResetSeqAct.setStatusTip(self.trUtf8( + self.databaseSqlResetSeqAct.setStatusTip(self.tr( 'Prints the SQL statements for resetting sequences for ' 'one or more applications')) - self.databaseSqlResetSeqAct.setWhatsThis(self.trUtf8( + self.databaseSqlResetSeqAct.setWhatsThis(self.tr( """<b>Reset Sequences</b>""" """<p>Prints the SQL statements for resetting sequences for """ """one or more applications.</p>""" )) - self.databaseSqlResetSeqAct.triggered[()].connect( + self.databaseSqlResetSeqAct.triggered.connect( self.__databaseSqlResetSequences) self.actions.append(self.databaseSqlResetSeqAct) @@ -468,59 +468,59 @@ Private method to define the tool actions. """ self.diffSettingsAct = E5Action( - self.trUtf8('Diff Settings'), - self.trUtf8('&Diff Settings'), + self.tr('Diff Settings'), + self.tr('&Diff Settings'), 0, 0, self, 'django_tools_diffsettings') - self.diffSettingsAct.setStatusTip(self.trUtf8( + self.diffSettingsAct.setStatusTip(self.tr( 'Shows the modification made to the settings')) - self.diffSettingsAct.setWhatsThis(self.trUtf8( + self.diffSettingsAct.setWhatsThis(self.tr( """<b>Diff Settings</b>""" """<p>Shows the modification made to the settings.</p>""" )) - self.diffSettingsAct.triggered[()].connect(self.__diffSettings) + self.diffSettingsAct.triggered.connect(self.__diffSettings) self.actions.append(self.diffSettingsAct) self.cleanupAct = E5Action( - self.trUtf8('Cleanup'), - self.trUtf8('&Cleanup'), + self.tr('Cleanup'), + self.tr('&Cleanup'), 0, 0, self, 'django_tools_cleanup') - self.cleanupAct.setStatusTip(self.trUtf8( + self.cleanupAct.setStatusTip(self.tr( 'Cleans out old data from the database')) - self.cleanupAct.setWhatsThis(self.trUtf8( + self.cleanupAct.setWhatsThis(self.tr( """<b>Cleanup</b>""" """<p>Cleans out old data from the database.</p>""" )) - self.cleanupAct.triggered[()].connect(self.__cleanup) + self.cleanupAct.triggered.connect(self.__cleanup) self.actions.append(self.cleanupAct) self.validateAct = E5Action( - self.trUtf8('Validate'), - self.trUtf8('&Validate'), + self.tr('Validate'), + self.tr('&Validate'), 0, 0, self, 'django_tools_validate') - self.validateAct.setStatusTip(self.trUtf8( + self.validateAct.setStatusTip(self.tr( 'Validates all installed models')) - self.validateAct.setWhatsThis(self.trUtf8( + self.validateAct.setWhatsThis(self.tr( """<b>Validate</b>""" """<p>Validates all installed models.</p>""" )) - self.validateAct.triggered[()].connect(self.__validate) + self.validateAct.triggered.connect(self.__validate) self.actions.append(self.validateAct) self.runPythonShellAct = E5Action( - self.trUtf8('Start Python Console'), - self.trUtf8('Start &Python Console'), + self.tr('Start Python Console'), + self.tr('Start &Python Console'), 0, 0, self, 'django_tools_pythonconsole') - self.runPythonShellAct.setStatusTip(self.trUtf8( + self.runPythonShellAct.setStatusTip(self.tr( 'Starts a Python interactive interpreter')) - self.runPythonShellAct.setWhatsThis(self.trUtf8( + self.runPythonShellAct.setWhatsThis(self.tr( """<b>Start Python Console</b>""" """<p>Starts a Python interactive interpreter.</p>""" )) - self.runPythonShellAct.triggered[()].connect(self.__runPythonShell) + self.runPythonShellAct.triggered.connect(self.__runPythonShell) self.actions.append(self.runPythonShellAct) def __initTestingActions(self): @@ -528,60 +528,60 @@ Private method to define the testing actions. """ self.dumpDataAct = E5Action( - self.trUtf8('Dump Data'), - self.trUtf8('&Dump Data'), + self.tr('Dump Data'), + self.tr('&Dump Data'), 0, 0, self, 'django_tools_dumpdata') - self.dumpDataAct.setStatusTip(self.trUtf8( + self.dumpDataAct.setStatusTip(self.tr( 'Dump the database data to a fixture')) - self.dumpDataAct.setWhatsThis(self.trUtf8( + self.dumpDataAct.setWhatsThis(self.tr( """<b>Dump Data</b>""" """<p>Dump the database data to a fixture.</p>""" )) - self.dumpDataAct.triggered[()].connect(self.__dumpData) + self.dumpDataAct.triggered.connect(self.__dumpData) self.actions.append(self.dumpDataAct) self.loadDataAct = E5Action( - self.trUtf8('Load Data'), - self.trUtf8('&Load Data'), + self.tr('Load Data'), + self.tr('&Load Data'), 0, 0, self, 'django_tools_loaddata') - self.loadDataAct.setStatusTip(self.trUtf8( + self.loadDataAct.setStatusTip(self.tr( 'Load data from fixture files')) - self.loadDataAct.setWhatsThis(self.trUtf8( + self.loadDataAct.setWhatsThis(self.tr( """<b>Load Data</b>""" """<p>Load data from fixture files.</p>""" )) - self.loadDataAct.triggered[()].connect(self.__loadData) + self.loadDataAct.triggered.connect(self.__loadData) self.actions.append(self.loadDataAct) self.runTestAct = E5Action( - self.trUtf8('Run Testsuite'), - self.trUtf8('Run &Testsuite'), + self.tr('Run Testsuite'), + self.tr('Run &Testsuite'), 0, 0, self, 'django_tools_run_test') - self.runTestAct.setStatusTip(self.trUtf8( + self.runTestAct.setStatusTip(self.tr( 'Run the test suite for applications or the whole site')) - self.runTestAct.setWhatsThis(self.trUtf8( + self.runTestAct.setWhatsThis(self.tr( """<b>Run Testsuite</b>""" """<p>Run the test suite for applications or the whole site.</p>""" )) - self.runTestAct.triggered[()].connect(self.__runTestSuite) + self.runTestAct.triggered.connect(self.__runTestSuite) self.actions.append(self.runTestAct) self.runTestServerAct = E5Action( - self.trUtf8('Run Testserver'), - self.trUtf8('Run Test&server'), + self.tr('Run Testserver'), + self.tr('Run Test&server'), 0, 0, self, 'django_tools_run_test_server') - self.runTestServerAct.setStatusTip(self.trUtf8( + self.runTestServerAct.setStatusTip(self.tr( 'Run a development server with data from a set of fixtures')) - self.runTestServerAct.setWhatsThis(self.trUtf8( + self.runTestServerAct.setWhatsThis(self.tr( """<b>Run Testserver</b>""" """<p>Run a development server with data from a set of""" """ fixtures.</p>""" )) - self.runTestServerAct.triggered[()].connect(self.__runTestServer) + self.runTestServerAct.triggered.connect(self.__runTestServer) self.actions.append(self.runTestServerAct) def __initAuthorizationActions(self): @@ -589,31 +589,31 @@ Private method to define the authorization actions. """ self.changePasswordAct = E5Action( - self.trUtf8('Change Password'), - self.trUtf8('Change &Password'), + self.tr('Change Password'), + self.tr('Change &Password'), 0, 0, self, 'django_auth_changepassword') - self.changePasswordAct.setStatusTip(self.trUtf8( + self.changePasswordAct.setStatusTip(self.tr( 'Change the password of a user')) - self.changePasswordAct.setWhatsThis(self.trUtf8( + self.changePasswordAct.setWhatsThis(self.tr( """<b>Change Password</b>""" """<p>Change the password of a user of the Django project.</p>""" )) - self.changePasswordAct.triggered[()].connect(self.__changePassword) + self.changePasswordAct.triggered.connect(self.__changePassword) self.actions.append(self.changePasswordAct) self.createSuperUserAct = E5Action( - self.trUtf8('Create Superuser'), - self.trUtf8('Create &Superuser'), + self.tr('Create Superuser'), + self.tr('Create &Superuser'), 0, 0, self, 'django_auth_createsuperuser') - self.createSuperUserAct.setStatusTip(self.trUtf8( + self.createSuperUserAct.setStatusTip(self.tr( 'Create a superuser account')) - self.createSuperUserAct.setWhatsThis(self.trUtf8( + self.createSuperUserAct.setWhatsThis(self.tr( """<b>Create Superuser</b>""" """<p>Create a superuser account for the Django project.</p>""" )) - self.createSuperUserAct.triggered[()].connect(self.__createSuperUser) + self.createSuperUserAct.triggered.connect(self.__createSuperUser) self.actions.append(self.createSuperUserAct) def __initSessionActions(self): @@ -621,17 +621,17 @@ Private method to define the session actions. """ self.clearSessionsAct = E5Action( - self.trUtf8('Clear Sessions'), - self.trUtf8('Clear &Sessions'), + self.tr('Clear Sessions'), + self.tr('Clear &Sessions'), 0, 0, self, 'django_session_clearsessions') - self.clearSessionsAct.setStatusTip(self.trUtf8( + self.clearSessionsAct.setStatusTip(self.tr( 'Clear expired sessions')) - self.clearSessionsAct.setWhatsThis(self.trUtf8( + self.clearSessionsAct.setWhatsThis(self.tr( """<b>Clear Sessions</b>""" """<p>Clear expired sessions of the Django project.</p>""" )) - self.clearSessionsAct.triggered[()].connect(self.__clearSessions) + self.clearSessionsAct.triggered.connect(self.__clearSessions) self.actions.append(self.clearSessionsAct) def initMenu(self): @@ -642,7 +642,7 @@ """ self.__menus = {} # clear menus references - menu = QMenu(self.trUtf8('D&jango'), self.__ui) + menu = QMenu(self.tr('D&jango'), self.__ui) menu.setTearOffEnabled(True) menu.addAction(self.selectSiteAct) @@ -680,7 +680,7 @@ @return the menu generated (QMenu) """ - menu = QMenu(self.trUtf8("&Database"), self.__ui) + menu = QMenu(self.tr("&Database"), self.__ui) menu.setTearOffEnabled(True) menu.addAction(self.syncDatabaseAct) @@ -703,7 +703,7 @@ @return the menu generated (QMenu) """ - menu = QMenu(self.trUtf8("Show &SQL"), self.__ui) + menu = QMenu(self.tr("Show &SQL"), self.__ui) menu.setTearOffEnabled(True) menu.addAction(self.databaseSqlCreateTablesAct) @@ -727,7 +727,7 @@ @return the menu generated (QMenu) """ - menu = QMenu(self.trUtf8("&Tools"), self.__ui) + menu = QMenu(self.tr("&Tools"), self.__ui) menu.setTearOffEnabled(True) menu.addAction(self.diffSettingsAct) @@ -746,7 +746,7 @@ @return the menu generated (QMenu) """ - menu = QMenu(self.trUtf8("T&esting"), self.__ui) + menu = QMenu(self.tr("T&esting"), self.__ui) menu.setTearOffEnabled(True) menu.addAction(self.dumpDataAct) @@ -765,7 +765,7 @@ @return the menu generated (QMenu) """ - menu = QMenu(self.trUtf8("&Authorization"), self.__ui) + menu = QMenu(self.tr("&Authorization"), self.__ui) menu.setTearOffEnabled(True) menu.addAction(self.changePasswordAct) @@ -781,7 +781,7 @@ @return the menu generated (QMenu) """ - menu = QMenu(self.trUtf8("&Session"), self.__ui) + menu = QMenu(self.tr("&Session"), self.__ui) menu.setTearOffEnabled(True) menu.addAction(self.clearSessionsAct) @@ -822,18 +822,14 @@ """ 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): """ @@ -844,7 +840,7 @@ e5App().getObject("ProjectBrowser").getProjectBrowser("forms") self.__formsBrowser.addHookMethodAndMenuEntry( "newForm", - self.newForm, self.trUtf8("New template...")) + self.newForm, self.tr("New template...")) self.__e5project.projectLanguageAddedByCode.connect( self.__projectLanguageAdded) @@ -853,25 +849,25 @@ .getProjectBrowser("translations") self.__translationsBrowser.addHookMethodAndMenuEntry( "generateAll", - self.updateCatalogs, self.trUtf8("Update all catalogs")) + self.updateCatalogs, self.tr("Update all catalogs")) self.__translationsBrowser.addHookMethodAndMenuEntry( "generateSelected", self.updateSelectedCatalogs, - self.trUtf8("Update selected catalogs")) + self.tr("Update selected catalogs")) self.__translationsBrowser.addHookMethodAndMenuEntry( "generateAllWithObsolete", self.updateCatalogsWithObsolete, - self.trUtf8("Update all catalogs (with obsolete)")) + self.tr("Update all catalogs (with obsolete)")) self.__translationsBrowser.addHookMethodAndMenuEntry( "generateSelectedWithObsolete", self.updateSelectedCatalogsWithObsolete, - self.trUtf8("Update selected catalogs (with obsolete)")) + self.tr("Update selected catalogs (with obsolete)")) self.__translationsBrowser.addHookMethodAndMenuEntry( "releaseAll", - self.compileCatalogs, self.trUtf8("Compile all catalogs")) + self.compileCatalogs, self.tr("Compile all catalogs")) self.__translationsBrowser.addHookMethodAndMenuEntry( "releaseSelected", self.compileSelectedCatalogs, - self.trUtf8("Compile selected catalogs")) + self.tr("Compile selected catalogs")) self.__hooksInstalled = True @@ -899,11 +895,7 @@ "releaseAll") self.__translationsBrowser.removeHookMethod( "releaseSelected") - try: - self.__translationsBrowser.removeHookMethod("open") - except KeyError: - # ignore for older eric5 versions - pass + self.__translationsBrowser.removeHookMethod("open") self.__translationsBrowser = None self.__hooksInstalled = False @@ -916,7 +908,7 @@ """ fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( self.__ui, - self.trUtf8("New Form"), + self.tr("New Form"), path, filter, None, @@ -935,8 +927,8 @@ 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: @@ -968,9 +960,9 @@ except (IOError, OSError) 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, str(e))) return @@ -1165,7 +1157,7 @@ def __getPythonExecutable(self): """ - Public method to build the Python command. + Private method to build the Python command. @return python command (string) """ @@ -1204,8 +1196,8 @@ msgBox = E5MessageBox.E5MessageBox( E5MessageBox.Question, - self.trUtf8("About Django"), - self.trUtf8( + self.tr("About Django"), + self.tr( "<p>Django is a high-level Python Web framework that" " encourages rapid " "development and clean, pragmatic design.</p>" @@ -1256,8 +1248,8 @@ """ applStr, ok = QInputDialog.getItem( self.__ui, - self.trUtf8("Select Applications"), - self.trUtf8("Enter the list of applications separated by spaces."), + self.tr("Select Applications"), + self.tr("Enter the list of applications separated by spaces."), self.getRecentApplications(), 0, True) if ok and applStr != "": @@ -1311,9 +1303,9 @@ def getProjectPath(self): """ - Public method to get the path of the eric5 project. + Public method to get the path of the eric6 project. - @return path of the eric5 project (string) + @return path of the eric6 project (string) """ return self.__e5project.getProjectPath() @@ -1348,15 +1340,15 @@ Public slot to start a new Django project or application. """ if self.__e5project.getProjectType() == "Django": - projectStr = self.trUtf8("Project") - applStr = self.trUtf8("Application") + projectStr = self.tr("Project") + applStr = self.tr("Application") selections = ["", projectStr, applStr] - selection, ok = QInputDialog.getItem( + selection, ok = QInputDialog.getItem( self.__ui, - self.trUtf8("Start Django"), - self.trUtf8("Select if this project should be a " - "Django Project or Application.<br />" - "Select the empty entry for none."), + self.tr("Start Django"), + self.tr("Select if this project should be a " + "Django Project or Application.<br />" + "Select the empty entry for none."), selections, 0, False) if ok and bool(selection): @@ -1378,7 +1370,7 @@ (string) @return flag indicating a successful creation (boolean) """ - title = self.trUtf8("Start Django Project") + title = self.tr("Start Django Project") args = [] if Utilities.isWindowsPlatform(): @@ -1392,8 +1384,8 @@ E5MessageBox.critical( self.__ui, title, - self.trUtf8("""<p>The <b>django-admin.py</b> script is""" - """ not in the path. Aborting...</p>""")) + self.tr("""<p>The <b>django-admin.py</b> script is""" + """ not in the path. Aborting...</p>""")) return args.append("startproject") @@ -1401,7 +1393,7 @@ dia = DjangoDialog( title, - msgSuccess=self.trUtf8("Django project created successfully.")) + msgSuccess=self.tr("Django project created successfully.")) res = dia.startProcess(args, path) if res: dia.exec_() @@ -1425,8 +1417,8 @@ """ projectName, ok = QInputDialog.getText( self.__ui, - self.trUtf8("Start Django Project"), - self.trUtf8("Enter the name of the new Django project."), + self.tr("Start Django Project"), + self.tr("Enter the name of the new Django project."), QLineEdit.Normal) if ok and projectName != "": res = self.__createProject(projectName, @@ -1451,7 +1443,7 @@ (boolean) @return flag indicating a successful creation (boolean) """ - title = self.trUtf8("Start Django Application") + title = self.tr("Start Django Application") args = [] if isGlobal: @@ -1466,9 +1458,9 @@ E5MessageBox.critical( self.__ui, title, - self.trUtf8("""<p>The <b>django-admin.py</b> script""" - """ is not in the path.""" - """ Aborting...</p>""")) + self.tr("""<p>The <b>django-admin.py</b> script""" + """ is not in the path.""" + """ Aborting...</p>""")) return else: args.append(self.__getPythonExecutable()) @@ -1482,7 +1474,7 @@ dia = DjangoDialog( title, - msgSuccess=self.trUtf8("Django application created successfully.")) + msgSuccess=self.tr("Django application created successfully.")) res = dia.startProcess(args, path) if res: dia.exec_() @@ -1494,9 +1486,9 @@ """ applName, ok = QInputDialog.getText( self.__ui, - self.trUtf8("Start Global Django Application"), - self.trUtf8("Enter the name of the new global Django" - " application."), + self.tr("Start Global Django Application"), + self.tr("Enter the name of the new global Django" + " application."), QLineEdit.Normal) if ok and applName != "": res = self.__createApplication(applName, @@ -1516,8 +1508,8 @@ """ applName, ok = QInputDialog.getText( self.__ui, - self.trUtf8("Start Local Django Application"), - self.trUtf8("Enter the name of the new local Django application."), + self.tr("Start Local Django Application"), + self.tr("Enter the name of the new local Django application."), QLineEdit.Normal) if ok and applName != "": res = self.__createApplication(applName, "", False) @@ -1565,8 +1557,8 @@ cur = 0 site, ok = QInputDialog.getItem( self.__ui, - self.trUtf8("Select Project"), - self.trUtf8("Select the Django project to work with."), + self.tr("Select Project"), + self.tr("Select the Django project to work with."), sites, cur, False) if not ok: @@ -1597,13 +1589,13 @@ """ self.__currentSite = site if self.__currentSite is None: - curSite = self.trUtf8("None") + curSite = self.tr("None") elif self.__currentSite == "": - curSite = self.trUtf8("Project") + curSite = self.tr("Project") else: curSite = self.__currentSite self.selectSiteAct.setText( - self.trUtf8('&Current Django project ({0})').format(curSite)) + self.tr('&Current Django project ({0})').format(curSite)) if self.__currentSite is None: self.__e5project.pdata["TRANSLATIONPATTERN"] = [] @@ -1667,8 +1659,8 @@ if not serverProcStarted: E5MessageBox.critical( None, - self.trUtf8('Process Generation Error'), - self.trUtf8('The Django server could not be started.')) + self.tr('Process Generation Error'), + self.tr('The Django server could not be started.')) except DjangoNoSiteSelectedException: pass @@ -1712,9 +1704,9 @@ if not res: E5MessageBox.critical( None, - 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())) ################################################################## ## slots below implement database related functions @@ -1738,9 +1730,9 @@ if not started: E5MessageBox.critical( None, - self.trUtf8('Process Generation Error'), - self.trUtf8('The Django process could not be' - ' started.')) + self.tr('Process Generation Error'), + self.tr('The Django process could not be' + ' started.')) except DjangoNoSiteSelectedException: pass @@ -1749,7 +1741,7 @@ Private slot to introspect the database and output a Django model module. """ - title = self.trUtf8("Introspect Database") + title = self.tr("Introspect Database") args = [] args.append(self.__getPythonExecutable()) @@ -1776,13 +1768,13 @@ except DjangoNoSiteSelectedException: return - title = self.trUtf8("Flush Database") + title = self.tr("Flush Database") res = E5MessageBox.yesNo( self.__ui, title, - self.trUtf8("""Flushing the database will destroy all data.""" - """ Are you sure?""")) + self.tr("""Flushing the database will destroy all data.""" + """ Are you sure?""")) if res: args = [] args.append(self.__getPythonExecutable()) @@ -1792,8 +1784,8 @@ dia = DjangoDialog( title, - msgSuccess=self.trUtf8("Database tables flushed" - " successfully.")) + msgSuccess=self.tr("Database tables flushed" + " successfully.")) res = dia.startProcess(args, path) if res: dia.exec_() @@ -1816,9 +1808,8 @@ if not started: E5MessageBox.critical( None, - self.trUtf8('Process Generation Error'), - self.trUtf8('The Django process could not be' - ' started.')) + self.tr('Process Generation Error'), + self.tr('The Django process could not be started.')) except DjangoNoSiteSelectedException: pass @@ -1853,7 +1844,7 @@ args.append(command) args += apps - fileFilter = self.trUtf8("SQL Files (*.sql)") + fileFilter = self.tr("SQL Files (*.sql)") dia = DjangoDialog(title, fixed=True, linewrap=False, saveFilters=fileFilter) @@ -1866,49 +1857,49 @@ Private slot to print the CREATE TABLE SQL statements for one or more applications. """ - self.__sqlCommand(self.trUtf8("Create Tables"), "sql") + self.__sqlCommand(self.tr("Create Tables"), "sql") def __databaseSqlCreateIndexes(self): """ Private slot to print the CREATE INDEX SQL statements for one or more applications. """ - self.__sqlCommand(self.trUtf8("Create Indexes"), "sqlindexes") + self.__sqlCommand(self.tr("Create Indexes"), "sqlindexes") def __databaseSqlCreateEverything(self): """ Private slot to print the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for one or more applications. """ - self.__sqlCommand(self.trUtf8("Create Everything"), "sqlall") + self.__sqlCommand(self.tr("Create Everything"), "sqlall") def __databaseSqlCustom(self): """ Private slot to print the custom table modifying SQL statements for one or more applications. """ - self.__sqlCommand(self.trUtf8("Custom Statements"), "sqlcustom") + self.__sqlCommand(self.tr("Custom Statements"), "sqlcustom") def __databaseSqlDropTables(self): """ Private slot to print the DROP TABLE SQL statements for one or more applications. """ - self.__sqlCommand(self.trUtf8("Drop Tables"), "sqlclear") + self.__sqlCommand(self.tr("Drop Tables"), "sqlclear") def __databaseSqlFlushDatabase(self): """ Private slot to print a list of statements to return all database tables to their initial state. """ - self.__sqlCommand(self.trUtf8("Flush Database"), "sqlflush", False) + self.__sqlCommand(self.tr("Flush Database"), "sqlflush", False) def __databaseSqlResetSequences(self): """ Private slot to print the SQL statements for resetting sequences for one or more applications. """ - self.__sqlCommand(self.trUtf8("Reset Sequences"), "sqlsequencereset") + self.__sqlCommand(self.tr("Reset Sequences"), "sqlsequencereset") ################################################################## ## slots below implement some tool functions @@ -1918,7 +1909,7 @@ """ Private slot to show the changes made to the settings.py file. """ - title = self.trUtf8("Diff Settings") + title = self.tr("Diff Settings") args = [] args.append(self.__getPythonExecutable()) @@ -1939,7 +1930,7 @@ """ Private slot to clean out old data from the database. """ - title = self.trUtf8("Cleanup") + title = self.tr("Cleanup") args = [] args.append(self.__getPythonExecutable()) @@ -1953,7 +1944,7 @@ dia = DjangoDialog( title, - msgSuccess=self.trUtf8("Database cleaned up successfully.")) + msgSuccess=self.tr("Database cleaned up successfully.")) res = dia.startProcess(args, path) if res: dia.exec_() @@ -1962,7 +1953,7 @@ """ Private slot to validate all installed models. """ - title = self.trUtf8("Validate") + title = self.tr("Validate") args = [] args.append(self.__getPythonExecutable()) @@ -2004,9 +1995,8 @@ if not started: E5MessageBox.critical( None, - self.trUtf8('Process Generation Error'), - self.trUtf8('The Django process could not be' - ' started.')) + self.tr('Process Generation Error'), + self.tr('The Django process could not be started.')) except DjangoNoSiteSelectedException: pass @@ -2018,7 +2008,7 @@ """ Private slot to create the tables for the SQL caching backend. """ - title = self.trUtf8("Create Cache Tables") + title = self.tr("Create Cache Tables") try: wd = self.__sitePath() @@ -2028,8 +2018,8 @@ tblStr, ok = QInputDialog.getText( self.__ui, title, - self.trUtf8("Enter the names of the cache tables separated by" - " spaces."), + self.tr("Enter the names of the cache tables separated by" + " spaces."), QLineEdit.Normal) if ok and tblStr != "": tableNames = tblStr.split() @@ -2042,7 +2032,7 @@ dia = DjangoDialog( title, - msgSuccess=self.trUtf8("Cache tables created successfully.")) + msgSuccess=self.tr("Cache tables created successfully.")) res = dia.startProcess(args, wd) if res: dia.exec_() @@ -2055,7 +2045,7 @@ """ Private slot to dump the database data to a fixture. """ - title = self.trUtf8("Dump Data") + title = self.tr("Dump Data") try: wd = self.__sitePath() @@ -2078,11 +2068,11 @@ args += appls if format == "json": - fileFilters = self.trUtf8("JSON Files (*.json)") + fileFilters = self.tr("JSON Files (*.json)") elif format == "xml": - fileFilters = self.trUtf8("XML Files (*.xml)") + fileFilters = self.tr("XML Files (*.xml)") elif format == "yaml": - fileFilters = self.trUtf8("YAML Files (*.yaml)") + fileFilters = self.tr("YAML Files (*.yaml)") dia = DjangoDialog( title, fixed=True, linewrap=False, saveFilters=fileFilters) @@ -2094,7 +2084,7 @@ """ Private slot to load data from fixture files. """ - title = self.trUtf8("Load Data") + title = self.tr("Load Data") try: wd = self.__sitePath() @@ -2140,8 +2130,8 @@ if not started: E5MessageBox.critical( None, - self.trUtf8('Process Generation Error'), - self.trUtf8('The Django process could not be started.')) + self.tr('Process Generation Error'), + self.tr('The Django process could not be started.')) def __runTestServer(self): """ @@ -2187,9 +2177,9 @@ if not serverProcStarted: E5MessageBox.critical( None, - self.trUtf8('Process Generation Error'), - self.trUtf8('The Django test server could not be' - ' started.')) + self.tr('Process Generation Error'), + self.tr('The Django test server could not be' + ' started.')) except DjangoNoSiteSelectedException: pass @@ -2217,8 +2207,8 @@ if consoleCmd: userName, ok = QInputDialog.getText( self.__ui, - self.trUtf8("Change Password"), - self.trUtf8("Enter the name of the user:"), + self.tr("Change Password"), + self.tr("Enter the name of the user:"), QLineEdit.Normal) if ok and userName != "": args = Utilities.parseOptionString(consoleCmd) @@ -2234,9 +2224,9 @@ if not started: E5MessageBox.critical( None, - self.trUtf8('Process Generation Error'), - self.trUtf8('The Django process could not be' - ' started.')) + self.tr('Process Generation Error'), + self.tr('The Django process could not be' + ' started.')) except DjangoNoSiteSelectedException: pass @@ -2258,9 +2248,8 @@ if not started: E5MessageBox.critical( None, - self.trUtf8('Process Generation Error'), - self.trUtf8('The Django process could not be' - ' started.')) + self.tr('Process Generation Error'), + self.tr('The Django process could not be started.')) except DjangoNoSiteSelectedException: pass @@ -2272,7 +2261,7 @@ """ Private slot to clear expired sessions. """ - title = self.trUtf8("Clear Sessions") + title = self.tr("Clear Sessions") try: wd = self.__sitePath() @@ -2286,7 +2275,7 @@ dia = DjangoDialog( title, - msgSuccess=self.trUtf8("Expired sessions cleared successfully.")) + msgSuccess=self.tr("Expired sessions cleared successfully.")) res = dia.startProcess(args, wd) if res: dia.exec_() @@ -2353,7 +2342,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) args = [] @@ -2369,13 +2358,13 @@ E5MessageBox.warning( None, title, - self.trUtf8('No current site selected or no site created yet.' - ' Aborting...')) + self.tr('No current site selected or no site created yet.' + ' Aborting...')) return dia = DjangoDialog( title, - msgSuccess=self.trUtf8( + msgSuccess=self.tr( "\nMessage catalog initialized successfully.")) res = dia.startProcess(args, wd) if res: @@ -2391,7 +2380,7 @@ @param filenames list of file names (list of strings) """ - title = self.trUtf8("Updating message catalogs") + title = self.tr("Updating message catalogs") try: wd = self.__sitePath() @@ -2399,8 +2388,8 @@ E5MessageBox.warning( None, title, - self.trUtf8('No current site selected or no site created yet.' - ' Aborting...')) + self.tr('No current site selected or no site created yet.' + ' Aborting...')) return argsLists = [] @@ -2422,12 +2411,12 @@ E5MessageBox.warning( None, title, - self.trUtf8('No locales detected. Aborting...')) + self.tr('No locales detected. Aborting...')) return dia = DjangoDialog( title, - msgSuccess=self.trUtf8("\nMessage catalogs updated successfully.")) + msgSuccess=self.tr("\nMessage catalogs updated successfully.")) res = dia.startBatchProcesses(argsLists, wd) if res: dia.exec_() @@ -2438,8 +2427,8 @@ @param filenames list of filenames """ - title = self.trUtf8("Updating message catalogs (keeping obsolete" - " messages)") + title = self.tr("Updating message catalogs (keeping obsolete" + " messages)") try: wd = self.__sitePath() @@ -2447,8 +2436,8 @@ E5MessageBox.warning( None, title, - self.trUtf8('No current site selected or no site created yet.' - ' Aborting...')) + self.tr('No current site selected or no site created yet.' + ' Aborting...')) return argsLists = [] @@ -2469,12 +2458,12 @@ E5MessageBox.warning( None, title, - self.trUtf8('No locales detected. Aborting...')) + self.tr('No locales detected. Aborting...')) return dia = DjangoDialog( title, - msgSuccess=self.trUtf8("\nMessage catalogs updated successfully.")) + msgSuccess=self.tr("\nMessage catalogs updated successfully.")) res = dia.startBatchProcesses(argsLists, wd) if res: dia.exec_() @@ -2485,7 +2474,7 @@ @param filenames list of filenames (not used) """ - title = self.trUtf8("Updating message catalogs") + title = self.tr("Updating message catalogs") args = [] args.append(self.__getPythonExecutable()) @@ -2500,13 +2489,13 @@ E5MessageBox.warning( None, title, - self.trUtf8('No current site selected or no site created yet.' - ' Aborting...')) + self.tr('No current site selected or no site created yet.' + ' Aborting...')) return dia = DjangoDialog( title, - msgSuccess=self.trUtf8("\nMessage catalogs updated successfully.")) + msgSuccess=self.tr("\nMessage catalogs updated successfully.")) res = dia.startProcess(args, wd) if res: dia.exec_() @@ -2517,8 +2506,8 @@ @param filenames list of filenames (not used) """ - title = self.trUtf8("Updating message catalogs (keeping obsolete" - " messages)") + title = self.tr("Updating message catalogs (keeping obsolete" + " messages)") args = [] args.append(self.__getPythonExecutable()) @@ -2532,13 +2521,13 @@ E5MessageBox.warning( None, title, - self.trUtf8('No current site selected or no site created yet.' - ' Aborting...')) + self.tr('No current site selected or no site created yet.' + ' Aborting...')) return dia = DjangoDialog( title, - msgSuccess=self.trUtf8("\nMessage catalogs updated successfully.")) + msgSuccess=self.tr("\nMessage catalogs updated successfully.")) res = dia.startProcess(args, wd) if res: dia.exec_() @@ -2549,7 +2538,7 @@ @param filenames list of filenames """ - title = self.trUtf8("Compiling message catalogs") + title = self.tr("Compiling message catalogs") try: wd = self.__sitePath() @@ -2557,8 +2546,8 @@ E5MessageBox.warning( None, title, - self.trUtf8('No current site selected or no site created yet.' - ' Aborting...')) + self.tr('No current site selected or no site created yet.' + ' Aborting...')) return argsLists = [] @@ -2579,12 +2568,12 @@ E5MessageBox.warning( None, title, - self.trUtf8('No locales detected. Aborting...')) + self.tr('No locales detected. Aborting...')) return dia = DjangoDialog( title, - msgSuccess=self.trUtf8( + msgSuccess=self.tr( "\nMessage catalogs compiled successfully.")) res = dia.startBatchProcesses(argsLists, wd, mergedOutput=True) if res: @@ -2602,7 +2591,7 @@ @param filenames list of filenames (not used) """ - title = self.trUtf8("Compiling message catalogs") + title = self.tr("Compiling message catalogs") args = [] args.append(self.__getPythonExecutable()) @@ -2615,13 +2604,13 @@ E5MessageBox.warning( None, title, - self.trUtf8('No current site selected or no site created yet.' - ' Aborting...')) + self.tr('No current site selected or no site created yet.' + ' Aborting...')) return dia = DjangoDialog( title, - msgSuccess=self.trUtf8( + msgSuccess=self.tr( "\nMessage catalogs compiled successfully.")) res = dia.startProcess(args, wd, mergedOutput=True) if res: @@ -2649,7 +2638,7 @@ if not started: E5MessageBox.critical( None, - self.trUtf8('Process Generation Error'), - self.trUtf8('The translations editor process ({0}) could' - ' not be started.') + self.tr('Process Generation Error'), + self.tr('The translations editor process ({0}) could' + ' not be started.') .format(os.path.basename(editor)))