Wed, 14 Oct 2020 18:52:12 +0200
Changed calls of exec_() into exec().
--- a/ChangeLog Tue Jun 23 17:48:29 2020 +0200 +++ b/ChangeLog Wed Oct 14 18:52:12 2020 +0200 @@ -1,5 +1,8 @@ ChangeLog --------- +Version 6.1.0: +- changed exec_() into exec() + Version 6.0.1: - bug fixes
--- a/PluginProjectDjango.py Tue Jun 23 17:48:29 2020 +0200 +++ b/PluginProjectDjango.py Wed Oct 14 18:52:12 2020 +0200 @@ -26,7 +26,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "6.0.1" +version = "6.1.0" className = "ProjectDjangoPlugin" packageName = "ProjectDjango" shortDescription = "Project support for Django projects."
--- a/ProjectDjango/DjangoDialog.py Tue Jun 23 17:48:29 2020 +0200 +++ b/ProjectDjango/DjangoDialog.py Wed Oct 14 18:52:12 2020 +0200 @@ -292,9 +292,8 @@ txt = self.resultbox.toPlainText() try: - f = open(fname, "w", encoding="utf-8") - f.write(txt) - f.close() + with open(fname, "w", encoding="utf-8") as f: + f.write(txt) except IOError as err: E5MessageBox.critical( self,
--- a/ProjectDjango/Project.py Tue Jun 23 17:48:29 2020 +0200 +++ b/ProjectDjango/Project.py Wed Oct 14 18:52:12 2020 +0200 @@ -1190,27 +1190,26 @@ return try: - f = open(fname, "w") - f.write('<!DOCTYPE html>') - f.write('<html>\n') - 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(' <!--[if lte IE 7]>') - f.write(' <link rel="stylesheet" type="text/css"' - ' href="ie.css"/>') - f.write(' <![endif]-->') - f.write(' </head>\n') - f.write('\n') - f.write(' <body class="bodyclass">\n') - f.write(' <div id="container">') - f.write(' </div>') - f.write(' </body>\n') - f.close() - f.write('</html>\n') - f.close() + with open(fname, "w") as f: + f.write('<!DOCTYPE html>') + f.write('<html>\n') + 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(' <!--[if lte IE 7]>') + f.write(' <link rel="stylesheet" type="text/css"' + ' href="ie.css"/>') + f.write(' <![endif]-->') + f.write(' </head>\n') + f.write('\n') + f.write(' <body class="bodyclass">\n') + f.write(' <div id="container">') + f.write(' </div>') + f.write(' </body>\n') + f.close() + f.write('</html>\n') except (IOError, OSError) as e: E5MessageBox.critical( self.__ui, @@ -1295,9 +1294,8 @@ fullCmds = self.__getExecutablePaths(cmd) for fullCmd in fullCmds: try: - f = open(fullCmd, 'r', encoding='utf-8') - l0 = f.readline() - f.close() + with open(fullCmd, 'r', encoding='utf-8') as f: + l0 = f.readline() except (IOError, OSError): l0 = "" if self.__isSuitableForVariant(variant, l0): @@ -1495,7 +1493,7 @@ msgBox.setIconPixmap(UI.PixmapCache.getPixmap( os.path.join("ProjectDjango", "icons", "django64-{0}".format(self.__iconSuffix)))) - msgBox.exec_() + msgBox.exec() def getDjangoVersionString(self): """ @@ -1806,7 +1804,7 @@ msgSuccess=self.tr("Django project created successfully.")) res = dia.startProcess(args, path) if res: - dia.exec_() + dia.exec() # create the base directory for translations i18nPath = os.path.join(path, projectName, "locale") @@ -1892,7 +1890,7 @@ msgSuccess=self.tr("Django application created successfully.")) res = dia.startProcess(args, path) if res: - dia.exec_() + dia.exec() return res def __startGlobalApplication(self): @@ -2256,7 +2254,7 @@ dia = DjangoDialog(title, fixed=True, linewrap=False) res = dia.startProcess(args, path, False) if res: - dia.exec_() + dia.exec() def __databaseFlush(self): """ @@ -2290,7 +2288,7 @@ " successfully.")) res = dia.startProcess(args, path) if res: - dia.exec_() + dia.exec() def __runDatabaseClient(self): """ @@ -2357,7 +2355,7 @@ saveFilters=fileFilter) res = dia.startProcess(args, path, False) if res: - dia.exec_() + dia.exec() def __databaseSqlCreateTables(self): """ @@ -2457,7 +2455,7 @@ dlg = DjangoMigrationSelectionDialog(migrations, migrationRequired=True, suffix=self.__iconSuffix) - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: app, migration = dlg.getData() args = [] @@ -2477,7 +2475,7 @@ saveFilters=fileFilter) res = dia.startProcess(args, path, False) if res: - dia.exec_() + dia.exec() ################################################################## ## slots below implement migration related functions @@ -2538,7 +2536,7 @@ ) dlg = DjangoMigrationSelectionDialog(migrations, suffix=self.__iconSuffix) - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: app, migration = dlg.getData() self.applyMigrations(app=app, migration=migration) @@ -2574,7 +2572,7 @@ dia = DjangoDialog(title) res = dia.startProcess(args, path) if res: - dia.exec_() + dia.exec() def __unapplyMigrations(self): """ @@ -2649,7 +2647,7 @@ """ from .DjangoMakeMigrationsDialog import DjangoMakeMigrationsDialog dlg = DjangoMakeMigrationsDialog(self.getRecentApplications()) - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: apps, migration, dryRun, empty, merge = dlg.getData() if apps: self.setMostRecentApplication(apps) @@ -2698,7 +2696,7 @@ dia = DjangoDialog(title, showInput=True) res = dia.startProcess(args, path) if res: - dia.exec_() + dia.exec() def __squashMigrations(self): """ @@ -2717,7 +2715,7 @@ ) dlg = DjangoSquashMigrationSelectionDialog( migrations, self, self.__iconSuffix) - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: app, start, end, noOptimize, name = dlg.getData() title = self.tr("Squash Migrations") @@ -2744,7 +2742,7 @@ dia = DjangoDialog(title) res = dia.startProcess(args, path) if res: - dia.exec_() + dia.exec() ################################################################## ## slots below implement some tool functions @@ -2758,7 +2756,7 @@ from .DjangoDiffsettingsDataDialog import DjangoDiffsettingsDataDialog dlg = DjangoDiffsettingsDataDialog(self, self.__ui) - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: showAll, defaultModule, outputFormat = dlg.getData() args = [] @@ -2780,7 +2778,7 @@ dia = DjangoDialog(title, fixed=True, linewrap=False) res = dia.startProcess(args, path, False) if res: - dia.exec_() + dia.exec() def __runPythonShell(self): """ @@ -2826,7 +2824,7 @@ DjangoSendTestEmailDataDialog ) dlg = DjangoSendTestEmailDataDialog(self.__ui) - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: managers, admins, recipients = dlg.getData() args = [] @@ -2852,7 +2850,7 @@ ) res = dia.startProcess(args, path, False) if res: - dia.exec_() + dia.exec() ################################################################## ## slots below implement caching functions @@ -2881,7 +2879,7 @@ msgSuccess=self.tr("Cache tables created successfully.")) res = dia.startProcess(args, wd) if res: - dia.exec_() + dia.exec() ################################################################## ## slots below implement testing functions @@ -2900,7 +2898,7 @@ from .DjangoDumpdataDataDialog import DjangoDumpdataDataDialog dlg = DjangoDumpdataDataDialog(self, self.__ui) - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: appls, excls, dumpFormat, indent = dlg.getData() args = [] @@ -2928,7 +2926,7 @@ title, fixed=True, linewrap=False, saveFilters=fileFilters) res = dia.startProcess(args, wd, showCommand=False) if res: - dia.exec_() + dia.exec() def __loadData(self): """ @@ -2943,7 +2941,7 @@ from .DjangoLoaddataDataDialog import DjangoLoaddataDataDialog dlg = DjangoLoaddataDataDialog(self, self.__ui) - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: fixtures, excludes, appLabel, ignore = dlg.getData() args = [] @@ -2964,7 +2962,7 @@ dia = DjangoDialog(title) res = dia.startProcess(args, wd) if res: - dia.exec_() + dia.exec() def __runTestSuite(self, deprecation=False): """ @@ -2985,7 +2983,7 @@ dlg = DjangoTestDataDialog( self, self.__plugin.getPreferences("KeepTestDatabase"), self.__ui) - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: labels, pattern, tags, excludeTags, keep, reverse = ( dlg.getData()) @@ -3030,7 +3028,7 @@ DjangoRunTestServerDataDialog ) dlg = DjangoRunTestServerDataDialog(self, self.__ui) - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: fixtures = dlg.getData() args = Utilities.parseOptionString(consoleCmd) @@ -3169,7 +3167,7 @@ msgSuccess=self.tr("Expired sessions cleared successfully.")) res = dia.startProcess(args, wd) if res: - dia.exec_() + dia.exec() ################################################################## ## slots below implement translation functions @@ -3262,7 +3260,7 @@ "\nMessage catalog initialized successfully.")) res = dia.startProcess(args, wd) if res: - dia.exec_() + dia.exec() langFile = ( self.__e5project.getTranslationPattern() @@ -3314,7 +3312,7 @@ msgSuccess=self.tr("\nMessage catalogs updated successfully.")) res = dia.startBatchProcesses(argsLists, wd) if res: - dia.exec_() + dia.exec() def updateSelectedCatalogsWithObsolete(self, filenames): """ @@ -3360,7 +3358,7 @@ msgSuccess=self.tr("\nMessage catalogs updated successfully.")) res = dia.startBatchProcesses(argsLists, wd) if res: - dia.exec_() + dia.exec() def updateCatalogs(self, filenames): """ @@ -3392,7 +3390,7 @@ msgSuccess=self.tr("\nMessage catalogs updated successfully.")) res = dia.startProcess(args, wd) if res: - dia.exec_() + dia.exec() def updateCatalogsWithObsolete(self, filenames): """ @@ -3424,7 +3422,7 @@ msgSuccess=self.tr("\nMessage catalogs updated successfully.")) res = dia.startProcess(args, wd) if res: - dia.exec_() + dia.exec() def compileSelectedCatalogs(self, filenames): """ @@ -3473,7 +3471,7 @@ "\nMessage catalogs compiled successfully.")) res = dia.startBatchProcesses(argsLists, wd, mergedOutput=True) if res: - dia.exec_() + dia.exec() for entry in os.walk(self.__sitePath()): for fileName in entry[2]: @@ -3513,7 +3511,7 @@ "\nMessage catalogs compiled successfully.")) res = dia.startProcess(args, wd, mergedOutput=True) if res: - dia.exec_() + dia.exec() for entry in os.walk(self.__sitePath()): for fileName in entry[2]: @@ -3560,7 +3558,7 @@ self.__getPythonExecutable(), path, self.getRecentApplications(), self.__plugin.getPreferences("CheckDeployMode"), ) - if dlg.exec_() == QDialog.Accepted: + if dlg.exec() == QDialog.Accepted: deploy, tags, appsStr, settingsFile = dlg.getData() self.__plugin.setPreferences("CheckDeployMode", deploy) if appsStr != "": @@ -3583,4 +3581,4 @@ dia = DjangoDialog(self.tr("Check Project")) res = dia.startProcess(args, path, mergedOutput=True) if res: - dia.exec_() + dia.exec()