--- a/ProjectDjango/Project.py Sat Dec 23 15:48:51 2023 +0100 +++ b/ProjectDjango/Project.py Sat Dec 23 16:46:05 2023 +0100 @@ -337,7 +337,7 @@ ) self.helpAct.setStatusTip(self.tr("Shows the Django help index")) self.helpAct.setWhatsThis( - self.tr("""<b>Help</b>""" """<p>Shows the Django help index page.</p>""") + self.tr("""<b>Help</b><p>Shows the Django help index page.</p>""") ) self.helpAct.triggered.connect(self.__showHelpIndex) self.actions.append(self.helpAct) @@ -425,9 +425,7 @@ "django_database_inspect", ) self.inspectDatabaseAct.setStatusTip( - self.tr( - "Introspects the database tables and outputs a Django model" " module" - ) + self.tr("Introspects the database tables and outputs a Django model module") ) self.inspectDatabaseAct.setWhatsThis( self.tr( @@ -539,9 +537,7 @@ "django_database_sql_apply_migration", ) self.databaseSqlMigrateAct.setStatusTip( - self.tr( - "Prints the SQL statements to apply a migration of an" " application" - ) + self.tr("Prints the SQL statements to apply a migration of an application") ) self.databaseSqlMigrateAct.setWhatsThis( self.tr( @@ -563,7 +559,7 @@ ) self.databaseSqlMigrateBackwardsAct.setStatusTip( self.tr( - "Prints the SQL statements to unapply a migration of an" " application" + "Prints the SQL statements to unapply a migration of an application" ) ) self.databaseSqlMigrateBackwardsAct.setWhatsThis( @@ -655,9 +651,7 @@ ) self.dumpDataAct.setStatusTip(self.tr("Dump the database data to a fixture")) self.dumpDataAct.setWhatsThis( - self.tr( - """<b>Dump Data</b>""" """<p>Dump the database data to a fixture.</p>""" - ) + self.tr("""<b>Dump Data</b><p>Dump the database data to a fixture.</p>""") ) self.dumpDataAct.triggered.connect(self.__dumpData) self.actions.append(self.dumpDataAct) @@ -672,7 +666,7 @@ ) self.loadDataAct.setStatusTip(self.tr("Load data from fixture files")) self.loadDataAct.setWhatsThis( - self.tr("""<b>Load Data</b>""" """<p>Load data from fixture files.</p>""") + self.tr("""<b>Load Data</b><p>Load data from fixture files.</p>""") ) self.loadDataAct.triggered.connect(self.__loadData) self.actions.append(self.loadDataAct) @@ -1296,13 +1290,9 @@ f.write(" <head>\n") f.write(' <meta content="" />\n') f.write(" <title></title>\n") - f.write( - ' <link rel="stylesheet" type="text/css"' ' href="style.css"/>' - ) + f.write(' <link rel="stylesheet" type="text/css" href="style.css"/>') f.write(" <!--[if lte IE 7]>") - f.write( - ' <link rel="stylesheet" type="text/css"' ' href="ie.css"/>' - ) + f.write(' <link rel="stylesheet" type="text/css" href="ie.css"/>') f.write(" <![endif]-->") f.write(" </head>\n") f.write("\n") @@ -1703,7 +1693,8 @@ """ Public method to get the list of recent applications. - @return list of recent applications entries (list of strings) + @return list of recent applications entries + @rtype list of str """ self.__loadRecentApplications() return self.__recentApplications @@ -2040,7 +2031,7 @@ applName, ok = QInputDialog.getText( self.__ui, self.tr("Start Global Django Application"), - self.tr("Enter the name of the new global Django" " application."), + self.tr("Enter the name of the new global Django application."), QLineEdit.EchoMode.Normal, ) if ok and applName != "": @@ -2271,7 +2262,7 @@ None, self.tr("Run Web-Browser"), self.tr( - "Could not start the web-browser for the" ' url "{0}".' + 'Could not start the web-browser for the url "{0}".' ).format(url.toString()), ) else: @@ -2423,9 +2414,7 @@ res = EricMessageBox.yesNo( self.__ui, title, - self.tr( - """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 = [] @@ -2437,7 +2426,7 @@ args.append("--database={0}".format(self.__currentDatabase)) dia = DjangoDialog( - title, msgSuccess=self.tr("Database tables flushed" " successfully.") + title, msgSuccess=self.tr("Database tables flushed successfully.") ) res = dia.startProcess(args, path) if res: @@ -2535,6 +2524,8 @@ a migration @type bool """ + from .DjangoMigrationSelectionDialog import DjangoMigrationSelectionDialog + try: path = self.__sitePath() except DjangoNoSiteSelectedError: @@ -2549,8 +2540,6 @@ title = self.tr("SQL Migrate") - from .DjangoMigrationSelectionDialog import DjangoMigrationSelectionDialog - dlg = DjangoMigrationSelectionDialog( migrations, migrationRequired=True, suffix=self.__iconSuffix ) @@ -2585,13 +2574,13 @@ """ Private slot to show the available migrations and their status. """ + from .DjangoMigrationsListDialog import DjangoMigrationsListDialog + try: path = self.__sitePath() except DjangoNoSiteSelectedError: return - from .DjangoMigrationsListDialog import DjangoMigrationsListDialog - self.__migrationsListDialog = DjangoMigrationsListDialog( DjangoMigrationsListDialog.MigrationsListMode, self, self.__ui ) @@ -2604,13 +2593,13 @@ """ Private slot to show the migrations plan. """ + from .DjangoMigrationsListDialog import DjangoMigrationsListDialog + try: path = self.__sitePath() except DjangoNoSiteSelectedError: return - from .DjangoMigrationsListDialog import DjangoMigrationsListDialog - self.__migrationsPlanDialog = DjangoMigrationsListDialog( DjangoMigrationsListDialog.MigrationsPlanMode, self, self.__ui ) @@ -2629,6 +2618,8 @@ """ Private slot to apply selected migrations of a selected app. """ + from .DjangoMigrationSelectionDialog import DjangoMigrationSelectionDialog + migrations = self.__getMigrations() if not migrations: EricMessageBox.information( @@ -2638,8 +2629,6 @@ ) return - from .DjangoMigrationSelectionDialog import DjangoMigrationSelectionDialog - dlg = DjangoMigrationSelectionDialog(migrations, suffix=self.__iconSuffix) if dlg.exec() == QDialog.DialogCode.Accepted: app, migration = dlg.getData() @@ -2814,6 +2803,10 @@ """ Private slot to squash migrations. """ + from .DjangoSquashMigrationSelectionDialog import ( + DjangoSquashMigrationSelectionDialog, + ) + migrations = self.__getMigrations() if not migrations: EricMessageBox.information( @@ -2823,10 +2816,6 @@ ) return - from .DjangoSquashMigrationSelectionDialog import ( - DjangoSquashMigrationSelectionDialog, - ) - dlg = DjangoSquashMigrationSelectionDialog(migrations, self, self.__iconSuffix) if dlg.exec() == QDialog.DialogCode.Accepted: app, start, end, noOptimize, name = dlg.getData() @@ -2865,10 +2854,10 @@ """ Private slot to show the changes made to the settings.py file. """ + from .DjangoDiffsettingsDataDialog import DjangoDiffsettingsDataDialog + title = self.tr("Diff Settings") - from .DjangoDiffsettingsDataDialog import DjangoDiffsettingsDataDialog - dlg = DjangoDiffsettingsDataDialog(self, self.__ui) if dlg.exec() == QDialog.DialogCode.Accepted: showAll, defaultModule, outputFormat = dlg.getData() @@ -2927,10 +2916,10 @@ """ Private slot to send a test email through Django. """ + from .DjangoSendTestEmailDataDialog import DjangoSendTestEmailDataDialog + title = self.tr("Send Test Email") - from .DjangoSendTestEmailDataDialog import DjangoSendTestEmailDataDialog - dlg = DjangoSendTestEmailDataDialog(self.__ui) if dlg.exec() == QDialog.DialogCode.Accepted: managers, admins, recipients = dlg.getData() @@ -2997,6 +2986,8 @@ """ Private slot to dump the database data to a fixture. """ + from .DjangoDumpdataDataDialog import DjangoDumpdataDataDialog + title = self.tr("Dump Data") try: @@ -3004,8 +2995,6 @@ except DjangoNoSiteSelectedError: return - from .DjangoDumpdataDataDialog import DjangoDumpdataDataDialog - dlg = DjangoDumpdataDataDialog(self, self.__ui) if dlg.exec() == QDialog.DialogCode.Accepted: appls, excls, dumpFormat, indent = dlg.getData() @@ -3040,6 +3029,8 @@ """ Private slot to load data from fixture files. """ + from .DjangoLoaddataDataDialog import DjangoLoaddataDataDialog + title = self.tr("Load Data") try: @@ -3047,8 +3038,6 @@ except DjangoNoSiteSelectedError: return - from .DjangoLoaddataDataDialog import DjangoLoaddataDataDialog - dlg = DjangoLoaddataDataDialog(self, self.__ui) if dlg.exec() == QDialog.DialogCode.Accepted: fixtures, excludes, appLabel, ignore = dlg.getData() @@ -3079,6 +3068,8 @@ @param deprecation flag indicating to test for deprecation warnings @type bool """ + from .DjangoTestDataDialog import DjangoTestDataDialog + consoleCmd = self.__isSpawningConsole( self.__plugin.getPreferences("ConsoleCommandNoClose") )[1] @@ -3088,8 +3079,6 @@ except DjangoNoSiteSelectedError: return - from .DjangoTestDataDialog import DjangoTestDataDialog - dlg = DjangoTestDataDialog( self, self.__plugin.getPreferences("KeepTestDatabase"), self.__ui ) @@ -3131,12 +3120,12 @@ Private slot to run a development server with data from a set of fixtures. """ + from .DjangoRunTestServerDataDialog import DjangoRunTestServerDataDialog + consoleCmd = self.__isSpawningConsole( self.__plugin.getPreferences("ConsoleCommand") )[1] if consoleCmd: - from .DjangoRunTestServerDataDialog import DjangoRunTestServerDataDialog - dlg = DjangoRunTestServerDataDialog(self, self.__ui) if dlg.exec() == QDialog.DialogCode.Accepted: fixtures = dlg.getData() @@ -3173,7 +3162,7 @@ EricMessageBox.critical( None, self.tr("Process Generation Error"), - self.tr("The Django test server could not be" " started."), + self.tr("The Django test server could not be started."), ) def __testServerProcFinished(self): @@ -3222,7 +3211,7 @@ EricMessageBox.critical( None, self.tr("Process Generation Error"), - self.tr("The Django process could not be" " started."), + self.tr("The Django process could not be started."), ) def __createSuperUser(self): @@ -3360,9 +3349,7 @@ EricMessageBox.warning( None, title, - self.tr( - "No current site selected or no site created yet." " Aborting..." - ), + self.tr("No current site selected or no site created yet. Aborting..."), ) return @@ -3393,9 +3380,7 @@ EricMessageBox.warning( None, title, - self.tr( - "No current site selected or no site created yet." " Aborting..." - ), + self.tr("No current site selected or no site created yet. Aborting..."), ) return @@ -3432,7 +3417,7 @@ @param filenames list of filenames @type list of str """ - title = self.tr("Updating message catalogs (keeping obsolete" " messages)") + title = self.tr("Updating message catalogs (keeping obsolete messages)") try: wd = self.__sitePath() @@ -3440,9 +3425,7 @@ EricMessageBox.warning( None, title, - self.tr( - "No current site selected or no site created yet." " Aborting..." - ), + self.tr("No current site selected or no site created yet. Aborting..."), ) return @@ -3471,7 +3454,7 @@ if res: dia.exec() - def updateCatalogs(self, filenames): + def updateCatalogs(self, filenames): # noqa: U100 """ Public method to update the message catalogs. @@ -3493,9 +3476,7 @@ EricMessageBox.warning( None, title, - self.tr( - "No current site selected or no site created yet." " Aborting..." - ), + self.tr("No current site selected or no site created yet. Aborting..."), ) return @@ -3506,14 +3487,14 @@ if res: dia.exec() - def updateCatalogsWithObsolete(self, filenames): + def updateCatalogsWithObsolete(self, filenames): # noqa: U100 """ Public method to update the message catalogs keeping obsolete messages. @param filenames list of filenames (not used) @type list of str """ - title = self.tr("Updating message catalogs (keeping obsolete" " messages)") + title = self.tr("Updating message catalogs (keeping obsolete messages)") args = [] args.append(self.__getPythonExecutable()) @@ -3527,9 +3508,7 @@ EricMessageBox.warning( None, title, - self.tr( - "No current site selected or no site created yet." " Aborting..." - ), + self.tr("No current site selected or no site created yet. Aborting..."), ) return @@ -3555,9 +3534,7 @@ EricMessageBox.warning( None, title, - self.tr( - "No current site selected or no site created yet." " Aborting..." - ), + self.tr("No current site selected or no site created yet. Aborting..."), ) return @@ -3594,7 +3571,7 @@ if fullName.endswith(".mo"): self.__ericProject.appendFile(fullName) - def compileCatalogs(self, filenames): + def compileCatalogs(self, filenames): # noqa: U100 """ Public method to compile the message catalogs. @@ -3616,9 +3593,7 @@ EricMessageBox.warning( None, title, - self.tr( - "No current site selected or no site created yet." " Aborting..." - ), + self.tr("No current site selected or no site created yet. Aborting..."), ) return @@ -3654,7 +3629,7 @@ None, self.tr("Process Generation Error"), self.tr( - "The translations editor process ({0}) could" " not be started." + "The translations editor process ({0}) could not be started." ).format(os.path.basename(editor)), ) @@ -3666,13 +3641,13 @@ """ Private slot to inspect the project for common problems. """ + from .DjangoCheckOptionsDialog import DjangoCheckOptionsDialog + try: path = self.__sitePath() except DjangoNoSiteSelectedError: return - from .DjangoCheckOptionsDialog import DjangoCheckOptionsDialog - dlg = DjangoCheckOptionsDialog( self.__getPythonExecutable(), path,