ProjectDjango/Project.py

changeset 165
80afe6639c6c
parent 163
1622130167bb
child 167
09aa216b3046
equal deleted inserted replaced
164:ac18f6f98ffc 165:80afe6639c6c
1188 if not res: 1188 if not res:
1189 # user selected to not overwrite 1189 # user selected to not overwrite
1190 return 1190 return
1191 1191
1192 try: 1192 try:
1193 f = open(fname, "w") 1193 with open(fname, "w") as f:
1194 f.write('<!DOCTYPE html>') 1194 f.write('<!DOCTYPE html>')
1195 f.write('<html>\n') 1195 f.write('<html>\n')
1196 f.write(' <head>\n') 1196 f.write(' <head>\n')
1197 f.write(' <meta content="" />\n') 1197 f.write(' <meta content="" />\n')
1198 f.write(' <title></title>\n') 1198 f.write(' <title></title>\n')
1199 f.write(' <link rel="stylesheet" type="text/css"' 1199 f.write(' <link rel="stylesheet" type="text/css"'
1200 ' href="style.css"/>') 1200 ' href="style.css"/>')
1201 f.write(' <!--[if lte IE 7]>') 1201 f.write(' <!--[if lte IE 7]>')
1202 f.write(' <link rel="stylesheet" type="text/css"' 1202 f.write(' <link rel="stylesheet" type="text/css"'
1203 ' href="ie.css"/>') 1203 ' href="ie.css"/>')
1204 f.write(' <![endif]-->') 1204 f.write(' <![endif]-->')
1205 f.write(' </head>\n') 1205 f.write(' </head>\n')
1206 f.write('\n') 1206 f.write('\n')
1207 f.write(' <body class="bodyclass">\n') 1207 f.write(' <body class="bodyclass">\n')
1208 f.write(' <div id="container">') 1208 f.write(' <div id="container">')
1209 f.write(' </div>') 1209 f.write(' </div>')
1210 f.write(' </body>\n') 1210 f.write(' </body>\n')
1211 f.close() 1211 f.close()
1212 f.write('</html>\n') 1212 f.write('</html>\n')
1213 f.close()
1214 except (IOError, OSError) as e: 1213 except (IOError, OSError) as e:
1215 E5MessageBox.critical( 1214 E5MessageBox.critical(
1216 self.__ui, 1215 self.__ui,
1217 self.tr("New Form"), 1216 self.tr("New Form"),
1218 self.tr("<p>The new form file <b>{0}</b> could not be" 1217 self.tr("<p>The new form file <b>{0}</b> could not be"
1293 fullCmds = Utilities.getExecutablePaths(cmd) 1292 fullCmds = Utilities.getExecutablePaths(cmd)
1294 except AttributeError: 1293 except AttributeError:
1295 fullCmds = self.__getExecutablePaths(cmd) 1294 fullCmds = self.__getExecutablePaths(cmd)
1296 for fullCmd in fullCmds: 1295 for fullCmd in fullCmds:
1297 try: 1296 try:
1298 f = open(fullCmd, 'r', encoding='utf-8') 1297 with open(fullCmd, 'r', encoding='utf-8') as f:
1299 l0 = f.readline() 1298 l0 = f.readline()
1300 f.close()
1301 except (IOError, OSError): 1299 except (IOError, OSError):
1302 l0 = "" 1300 l0 = ""
1303 if self.__isSuitableForVariant(variant, l0): 1301 if self.__isSuitableForVariant(variant, l0):
1304 variants.append(variant) 1302 variants.append(variant)
1305 break 1303 break
1493 modal=True, 1491 modal=True,
1494 buttons=E5MessageBox.Ok) 1492 buttons=E5MessageBox.Ok)
1495 msgBox.setIconPixmap(UI.PixmapCache.getPixmap( 1493 msgBox.setIconPixmap(UI.PixmapCache.getPixmap(
1496 os.path.join("ProjectDjango", "icons", 1494 os.path.join("ProjectDjango", "icons",
1497 "django64-{0}".format(self.__iconSuffix)))) 1495 "django64-{0}".format(self.__iconSuffix))))
1498 msgBox.exec_() 1496 msgBox.exec()
1499 1497
1500 def getDjangoVersionString(self): 1498 def getDjangoVersionString(self):
1501 """ 1499 """
1502 Public method to get the Django version as a string. 1500 Public method to get the Django version as a string.
1503 1501
1804 dia = DjangoDialog( 1802 dia = DjangoDialog(
1805 title, 1803 title,
1806 msgSuccess=self.tr("Django project created successfully.")) 1804 msgSuccess=self.tr("Django project created successfully."))
1807 res = dia.startProcess(args, path) 1805 res = dia.startProcess(args, path)
1808 if res: 1806 if res:
1809 dia.exec_() 1807 dia.exec()
1810 1808
1811 # create the base directory for translations 1809 # create the base directory for translations
1812 i18nPath = os.path.join(path, projectName, "locale") 1810 i18nPath = os.path.join(path, projectName, "locale")
1813 if not os.path.exists(i18nPath): 1811 if not os.path.exists(i18nPath):
1814 os.makedirs(i18nPath) 1812 os.makedirs(i18nPath)
1890 dia = DjangoDialog( 1888 dia = DjangoDialog(
1891 title, 1889 title,
1892 msgSuccess=self.tr("Django application created successfully.")) 1890 msgSuccess=self.tr("Django application created successfully."))
1893 res = dia.startProcess(args, path) 1891 res = dia.startProcess(args, path)
1894 if res: 1892 if res:
1895 dia.exec_() 1893 dia.exec()
1896 return res 1894 return res
1897 1895
1898 def __startGlobalApplication(self): 1896 def __startGlobalApplication(self):
1899 """ 1897 """
1900 Private slot to start a new global Django application. 1898 Private slot to start a new global Django application.
2254 return 2252 return
2255 2253
2256 dia = DjangoDialog(title, fixed=True, linewrap=False) 2254 dia = DjangoDialog(title, fixed=True, linewrap=False)
2257 res = dia.startProcess(args, path, False) 2255 res = dia.startProcess(args, path, False)
2258 if res: 2256 if res:
2259 dia.exec_() 2257 dia.exec()
2260 2258
2261 def __databaseFlush(self): 2259 def __databaseFlush(self):
2262 """ 2260 """
2263 Private slot to return all database tables to the state just after 2261 Private slot to return all database tables to the state just after
2264 their installation. 2262 their installation.
2288 title, 2286 title,
2289 msgSuccess=self.tr("Database tables flushed" 2287 msgSuccess=self.tr("Database tables flushed"
2290 " successfully.")) 2288 " successfully."))
2291 res = dia.startProcess(args, path) 2289 res = dia.startProcess(args, path)
2292 if res: 2290 if res:
2293 dia.exec_() 2291 dia.exec()
2294 2292
2295 def __runDatabaseClient(self): 2293 def __runDatabaseClient(self):
2296 """ 2294 """
2297 Private slot to start a database client for a Django project. 2295 Private slot to start a database client for a Django project.
2298 """ 2296 """
2355 2353
2356 dia = DjangoDialog(title, fixed=True, linewrap=False, 2354 dia = DjangoDialog(title, fixed=True, linewrap=False,
2357 saveFilters=fileFilter) 2355 saveFilters=fileFilter)
2358 res = dia.startProcess(args, path, False) 2356 res = dia.startProcess(args, path, False)
2359 if res: 2357 if res:
2360 dia.exec_() 2358 dia.exec()
2361 2359
2362 def __databaseSqlCreateTables(self): 2360 def __databaseSqlCreateTables(self):
2363 """ 2361 """
2364 Private slot to print the CREATE TABLE SQL statements for one 2362 Private slot to print the CREATE TABLE SQL statements for one
2365 or more applications. 2363 or more applications.
2455 DjangoMigrationSelectionDialog 2453 DjangoMigrationSelectionDialog
2456 ) 2454 )
2457 dlg = DjangoMigrationSelectionDialog(migrations, 2455 dlg = DjangoMigrationSelectionDialog(migrations,
2458 migrationRequired=True, 2456 migrationRequired=True,
2459 suffix=self.__iconSuffix) 2457 suffix=self.__iconSuffix)
2460 if dlg.exec_() == QDialog.Accepted: 2458 if dlg.exec() == QDialog.Accepted:
2461 app, migration = dlg.getData() 2459 app, migration = dlg.getData()
2462 2460
2463 args = [] 2461 args = []
2464 args.append(self.__getPythonExecutable()) 2462 args.append(self.__getPythonExecutable())
2465 args.append("manage.py") 2463 args.append("manage.py")
2475 2473
2476 dia = DjangoDialog(title, fixed=True, linewrap=False, 2474 dia = DjangoDialog(title, fixed=True, linewrap=False,
2477 saveFilters=fileFilter) 2475 saveFilters=fileFilter)
2478 res = dia.startProcess(args, path, False) 2476 res = dia.startProcess(args, path, False)
2479 if res: 2477 if res:
2480 dia.exec_() 2478 dia.exec()
2481 2479
2482 ################################################################## 2480 ##################################################################
2483 ## slots below implement migration related functions 2481 ## slots below implement migration related functions
2484 ################################################################## 2482 ##################################################################
2485 2483
2536 from .DjangoMigrationSelectionDialog import ( 2534 from .DjangoMigrationSelectionDialog import (
2537 DjangoMigrationSelectionDialog 2535 DjangoMigrationSelectionDialog
2538 ) 2536 )
2539 dlg = DjangoMigrationSelectionDialog(migrations, 2537 dlg = DjangoMigrationSelectionDialog(migrations,
2540 suffix=self.__iconSuffix) 2538 suffix=self.__iconSuffix)
2541 if dlg.exec_() == QDialog.Accepted: 2539 if dlg.exec() == QDialog.Accepted:
2542 app, migration = dlg.getData() 2540 app, migration = dlg.getData()
2543 self.applyMigrations(app=app, migration=migration) 2541 self.applyMigrations(app=app, migration=migration)
2544 2542
2545 def applyMigrations(self, app=None, migration=None): 2543 def applyMigrations(self, app=None, migration=None):
2546 """ 2544 """
2572 args.append(migration) 2570 args.append(migration)
2573 2571
2574 dia = DjangoDialog(title) 2572 dia = DjangoDialog(title)
2575 res = dia.startProcess(args, path) 2573 res = dia.startProcess(args, path)
2576 if res: 2574 if res:
2577 dia.exec_() 2575 dia.exec()
2578 2576
2579 def __unapplyMigrations(self): 2577 def __unapplyMigrations(self):
2580 """ 2578 """
2581 Private slot to un-apply all migrations of an application. 2579 Private slot to un-apply all migrations of an application.
2582 """ 2580 """
2647 """ 2645 """
2648 Private slot to generate migrations for the Django project. 2646 Private slot to generate migrations for the Django project.
2649 """ 2647 """
2650 from .DjangoMakeMigrationsDialog import DjangoMakeMigrationsDialog 2648 from .DjangoMakeMigrationsDialog import DjangoMakeMigrationsDialog
2651 dlg = DjangoMakeMigrationsDialog(self.getRecentApplications()) 2649 dlg = DjangoMakeMigrationsDialog(self.getRecentApplications())
2652 if dlg.exec_() == QDialog.Accepted: 2650 if dlg.exec() == QDialog.Accepted:
2653 apps, migration, dryRun, empty, merge = dlg.getData() 2651 apps, migration, dryRun, empty, merge = dlg.getData()
2654 if apps: 2652 if apps:
2655 self.setMostRecentApplication(apps) 2653 self.setMostRecentApplication(apps)
2656 apps = apps.split() 2654 apps = apps.split()
2657 self.makeMigrations(apps, migration, dryRun, empty, merge) 2655 self.makeMigrations(apps, migration, dryRun, empty, merge)
2696 args += apps 2694 args += apps
2697 2695
2698 dia = DjangoDialog(title, showInput=True) 2696 dia = DjangoDialog(title, showInput=True)
2699 res = dia.startProcess(args, path) 2697 res = dia.startProcess(args, path)
2700 if res: 2698 if res:
2701 dia.exec_() 2699 dia.exec()
2702 2700
2703 def __squashMigrations(self): 2701 def __squashMigrations(self):
2704 """ 2702 """
2705 Private slot to squash migrations. 2703 Private slot to squash migrations.
2706 """ 2704 """
2715 from .DjangoSquashMigrationSelectionDialog import ( 2713 from .DjangoSquashMigrationSelectionDialog import (
2716 DjangoSquashMigrationSelectionDialog 2714 DjangoSquashMigrationSelectionDialog
2717 ) 2715 )
2718 dlg = DjangoSquashMigrationSelectionDialog( 2716 dlg = DjangoSquashMigrationSelectionDialog(
2719 migrations, self, self.__iconSuffix) 2717 migrations, self, self.__iconSuffix)
2720 if dlg.exec_() == QDialog.Accepted: 2718 if dlg.exec() == QDialog.Accepted:
2721 app, start, end, noOptimize, name = dlg.getData() 2719 app, start, end, noOptimize, name = dlg.getData()
2722 2720
2723 title = self.tr("Squash Migrations") 2721 title = self.tr("Squash Migrations")
2724 2722
2725 try: 2723 try:
2742 args.append(end) 2740 args.append(end)
2743 2741
2744 dia = DjangoDialog(title) 2742 dia = DjangoDialog(title)
2745 res = dia.startProcess(args, path) 2743 res = dia.startProcess(args, path)
2746 if res: 2744 if res:
2747 dia.exec_() 2745 dia.exec()
2748 2746
2749 ################################################################## 2747 ##################################################################
2750 ## slots below implement some tool functions 2748 ## slots below implement some tool functions
2751 ################################################################## 2749 ##################################################################
2752 2750
2756 """ 2754 """
2757 title = self.tr("Diff Settings") 2755 title = self.tr("Diff Settings")
2758 2756
2759 from .DjangoDiffsettingsDataDialog import DjangoDiffsettingsDataDialog 2757 from .DjangoDiffsettingsDataDialog import DjangoDiffsettingsDataDialog
2760 dlg = DjangoDiffsettingsDataDialog(self, self.__ui) 2758 dlg = DjangoDiffsettingsDataDialog(self, self.__ui)
2761 if dlg.exec_() == QDialog.Accepted: 2759 if dlg.exec() == QDialog.Accepted:
2762 showAll, defaultModule, outputFormat = dlg.getData() 2760 showAll, defaultModule, outputFormat = dlg.getData()
2763 2761
2764 args = [] 2762 args = []
2765 args.append(self.__getPythonExecutable()) 2763 args.append(self.__getPythonExecutable())
2766 args.append("manage.py") 2764 args.append("manage.py")
2778 return 2776 return
2779 2777
2780 dia = DjangoDialog(title, fixed=True, linewrap=False) 2778 dia = DjangoDialog(title, fixed=True, linewrap=False)
2781 res = dia.startProcess(args, path, False) 2779 res = dia.startProcess(args, path, False)
2782 if res: 2780 if res:
2783 dia.exec_() 2781 dia.exec()
2784 2782
2785 def __runPythonShell(self): 2783 def __runPythonShell(self):
2786 """ 2784 """
2787 Private slot to start a Python console for a Django project. 2785 Private slot to start a Python console for a Django project.
2788 """ 2786 """
2824 2822
2825 from .DjangoSendTestEmailDataDialog import ( 2823 from .DjangoSendTestEmailDataDialog import (
2826 DjangoSendTestEmailDataDialog 2824 DjangoSendTestEmailDataDialog
2827 ) 2825 )
2828 dlg = DjangoSendTestEmailDataDialog(self.__ui) 2826 dlg = DjangoSendTestEmailDataDialog(self.__ui)
2829 if dlg.exec_() == QDialog.Accepted: 2827 if dlg.exec() == QDialog.Accepted:
2830 managers, admins, recipients = dlg.getData() 2828 managers, admins, recipients = dlg.getData()
2831 2829
2832 args = [] 2830 args = []
2833 args.append(self.__getPythonExecutable()) 2831 args.append(self.__getPythonExecutable())
2834 args.append("manage.py") 2832 args.append("manage.py")
2850 msgSuccess=self.tr("Test Email sent successfully."), 2848 msgSuccess=self.tr("Test Email sent successfully."),
2851 msgError=self.tr("Test Email could not be sent.") 2849 msgError=self.tr("Test Email could not be sent.")
2852 ) 2850 )
2853 res = dia.startProcess(args, path, False) 2851 res = dia.startProcess(args, path, False)
2854 if res: 2852 if res:
2855 dia.exec_() 2853 dia.exec()
2856 2854
2857 ################################################################## 2855 ##################################################################
2858 ## slots below implement caching functions 2856 ## slots below implement caching functions
2859 ################################################################## 2857 ##################################################################
2860 2858
2879 dia = DjangoDialog( 2877 dia = DjangoDialog(
2880 title, 2878 title,
2881 msgSuccess=self.tr("Cache tables created successfully.")) 2879 msgSuccess=self.tr("Cache tables created successfully."))
2882 res = dia.startProcess(args, wd) 2880 res = dia.startProcess(args, wd)
2883 if res: 2881 if res:
2884 dia.exec_() 2882 dia.exec()
2885 2883
2886 ################################################################## 2884 ##################################################################
2887 ## slots below implement testing functions 2885 ## slots below implement testing functions
2888 ################################################################## 2886 ##################################################################
2889 2887
2898 except DjangoNoSiteSelectedException: 2896 except DjangoNoSiteSelectedException:
2899 return 2897 return
2900 2898
2901 from .DjangoDumpdataDataDialog import DjangoDumpdataDataDialog 2899 from .DjangoDumpdataDataDialog import DjangoDumpdataDataDialog
2902 dlg = DjangoDumpdataDataDialog(self, self.__ui) 2900 dlg = DjangoDumpdataDataDialog(self, self.__ui)
2903 if dlg.exec_() == QDialog.Accepted: 2901 if dlg.exec() == QDialog.Accepted:
2904 appls, excls, dumpFormat, indent = dlg.getData() 2902 appls, excls, dumpFormat, indent = dlg.getData()
2905 2903
2906 args = [] 2904 args = []
2907 args.append(self.__getPythonExecutable()) 2905 args.append(self.__getPythonExecutable())
2908 args.append("manage.py") 2906 args.append("manage.py")
2926 2924
2927 dia = DjangoDialog( 2925 dia = DjangoDialog(
2928 title, fixed=True, linewrap=False, saveFilters=fileFilters) 2926 title, fixed=True, linewrap=False, saveFilters=fileFilters)
2929 res = dia.startProcess(args, wd, showCommand=False) 2927 res = dia.startProcess(args, wd, showCommand=False)
2930 if res: 2928 if res:
2931 dia.exec_() 2929 dia.exec()
2932 2930
2933 def __loadData(self): 2931 def __loadData(self):
2934 """ 2932 """
2935 Private slot to load data from fixture files. 2933 Private slot to load data from fixture files.
2936 """ 2934 """
2941 except DjangoNoSiteSelectedException: 2939 except DjangoNoSiteSelectedException:
2942 return 2940 return
2943 2941
2944 from .DjangoLoaddataDataDialog import DjangoLoaddataDataDialog 2942 from .DjangoLoaddataDataDialog import DjangoLoaddataDataDialog
2945 dlg = DjangoLoaddataDataDialog(self, self.__ui) 2943 dlg = DjangoLoaddataDataDialog(self, self.__ui)
2946 if dlg.exec_() == QDialog.Accepted: 2944 if dlg.exec() == QDialog.Accepted:
2947 fixtures, excludes, appLabel, ignore = dlg.getData() 2945 fixtures, excludes, appLabel, ignore = dlg.getData()
2948 2946
2949 args = [] 2947 args = []
2950 args.append(self.__getPythonExecutable()) 2948 args.append(self.__getPythonExecutable())
2951 args.append("manage.py") 2949 args.append("manage.py")
2962 args += fixtures 2960 args += fixtures
2963 2961
2964 dia = DjangoDialog(title) 2962 dia = DjangoDialog(title)
2965 res = dia.startProcess(args, wd) 2963 res = dia.startProcess(args, wd)
2966 if res: 2964 if res:
2967 dia.exec_() 2965 dia.exec()
2968 2966
2969 def __runTestSuite(self, deprecation=False): 2967 def __runTestSuite(self, deprecation=False):
2970 """ 2968 """
2971 Private slot to run the test suite for applications or the whole site. 2969 Private slot to run the test suite for applications or the whole site.
2972 2970
2983 2981
2984 from .DjangoTestDataDialog import DjangoTestDataDialog 2982 from .DjangoTestDataDialog import DjangoTestDataDialog
2985 dlg = DjangoTestDataDialog( 2983 dlg = DjangoTestDataDialog(
2986 self, self.__plugin.getPreferences("KeepTestDatabase"), 2984 self, self.__plugin.getPreferences("KeepTestDatabase"),
2987 self.__ui) 2985 self.__ui)
2988 if dlg.exec_() == QDialog.Accepted: 2986 if dlg.exec() == QDialog.Accepted:
2989 labels, pattern, tags, excludeTags, keep, reverse = ( 2987 labels, pattern, tags, excludeTags, keep, reverse = (
2990 dlg.getData()) 2988 dlg.getData())
2991 2989
2992 self.__plugin.setPreferences("KeepTestDatabase", keep) 2990 self.__plugin.setPreferences("KeepTestDatabase", keep)
2993 2991
3028 if consoleCmd: 3026 if consoleCmd:
3029 from .DjangoRunTestServerDataDialog import ( 3027 from .DjangoRunTestServerDataDialog import (
3030 DjangoRunTestServerDataDialog 3028 DjangoRunTestServerDataDialog
3031 ) 3029 )
3032 dlg = DjangoRunTestServerDataDialog(self, self.__ui) 3030 dlg = DjangoRunTestServerDataDialog(self, self.__ui)
3033 if dlg.exec_() == QDialog.Accepted: 3031 if dlg.exec() == QDialog.Accepted:
3034 fixtures = dlg.getData() 3032 fixtures = dlg.getData()
3035 3033
3036 args = Utilities.parseOptionString(consoleCmd) 3034 args = Utilities.parseOptionString(consoleCmd)
3037 args[0] = Utilities.getExecutablePath(args[0]) 3035 args[0] = Utilities.getExecutablePath(args[0])
3038 args.append(self.__getPythonExecutable()) 3036 args.append(self.__getPythonExecutable())
3167 dia = DjangoDialog( 3165 dia = DjangoDialog(
3168 title, 3166 title,
3169 msgSuccess=self.tr("Expired sessions cleared successfully.")) 3167 msgSuccess=self.tr("Expired sessions cleared successfully."))
3170 res = dia.startProcess(args, wd) 3168 res = dia.startProcess(args, wd)
3171 if res: 3169 if res:
3172 dia.exec_() 3170 dia.exec()
3173 3171
3174 ################################################################## 3172 ##################################################################
3175 ## slots below implement translation functions 3173 ## slots below implement translation functions
3176 ################################################################## 3174 ##################################################################
3177 3175
3260 title, 3258 title,
3261 msgSuccess=self.tr( 3259 msgSuccess=self.tr(
3262 "\nMessage catalog initialized successfully.")) 3260 "\nMessage catalog initialized successfully."))
3263 res = dia.startProcess(args, wd) 3261 res = dia.startProcess(args, wd)
3264 if res: 3262 if res:
3265 dia.exec_() 3263 dia.exec()
3266 3264
3267 langFile = ( 3265 langFile = (
3268 self.__e5project.getTranslationPattern() 3266 self.__e5project.getTranslationPattern()
3269 .replace("%language%", code) 3267 .replace("%language%", code)
3270 ) 3268 )
3312 dia = DjangoDialog( 3310 dia = DjangoDialog(
3313 title, 3311 title,
3314 msgSuccess=self.tr("\nMessage catalogs updated successfully.")) 3312 msgSuccess=self.tr("\nMessage catalogs updated successfully."))
3315 res = dia.startBatchProcesses(argsLists, wd) 3313 res = dia.startBatchProcesses(argsLists, wd)
3316 if res: 3314 if res:
3317 dia.exec_() 3315 dia.exec()
3318 3316
3319 def updateSelectedCatalogsWithObsolete(self, filenames): 3317 def updateSelectedCatalogsWithObsolete(self, filenames):
3320 """ 3318 """
3321 Public method to update the message catalogs keeping obsolete messages. 3319 Public method to update the message catalogs keeping obsolete messages.
3322 3320
3358 dia = DjangoDialog( 3356 dia = DjangoDialog(
3359 title, 3357 title,
3360 msgSuccess=self.tr("\nMessage catalogs updated successfully.")) 3358 msgSuccess=self.tr("\nMessage catalogs updated successfully."))
3361 res = dia.startBatchProcesses(argsLists, wd) 3359 res = dia.startBatchProcesses(argsLists, wd)
3362 if res: 3360 if res:
3363 dia.exec_() 3361 dia.exec()
3364 3362
3365 def updateCatalogs(self, filenames): 3363 def updateCatalogs(self, filenames):
3366 """ 3364 """
3367 Public method to update the message catalogs. 3365 Public method to update the message catalogs.
3368 3366
3390 dia = DjangoDialog( 3388 dia = DjangoDialog(
3391 title, 3389 title,
3392 msgSuccess=self.tr("\nMessage catalogs updated successfully.")) 3390 msgSuccess=self.tr("\nMessage catalogs updated successfully."))
3393 res = dia.startProcess(args, wd) 3391 res = dia.startProcess(args, wd)
3394 if res: 3392 if res:
3395 dia.exec_() 3393 dia.exec()
3396 3394
3397 def updateCatalogsWithObsolete(self, filenames): 3395 def updateCatalogsWithObsolete(self, filenames):
3398 """ 3396 """
3399 Public method to update the message catalogs keeping obsolete messages. 3397 Public method to update the message catalogs keeping obsolete messages.
3400 3398
3422 dia = DjangoDialog( 3420 dia = DjangoDialog(
3423 title, 3421 title,
3424 msgSuccess=self.tr("\nMessage catalogs updated successfully.")) 3422 msgSuccess=self.tr("\nMessage catalogs updated successfully."))
3425 res = dia.startProcess(args, wd) 3423 res = dia.startProcess(args, wd)
3426 if res: 3424 if res:
3427 dia.exec_() 3425 dia.exec()
3428 3426
3429 def compileSelectedCatalogs(self, filenames): 3427 def compileSelectedCatalogs(self, filenames):
3430 """ 3428 """
3431 Public method to update the message catalogs. 3429 Public method to update the message catalogs.
3432 3430
3471 title, 3469 title,
3472 msgSuccess=self.tr( 3470 msgSuccess=self.tr(
3473 "\nMessage catalogs compiled successfully.")) 3471 "\nMessage catalogs compiled successfully."))
3474 res = dia.startBatchProcesses(argsLists, wd, mergedOutput=True) 3472 res = dia.startBatchProcesses(argsLists, wd, mergedOutput=True)
3475 if res: 3473 if res:
3476 dia.exec_() 3474 dia.exec()
3477 3475
3478 for entry in os.walk(self.__sitePath()): 3476 for entry in os.walk(self.__sitePath()):
3479 for fileName in entry[2]: 3477 for fileName in entry[2]:
3480 fullName = os.path.join(entry[0], fileName) 3478 fullName = os.path.join(entry[0], fileName)
3481 if fullName.endswith('.mo'): 3479 if fullName.endswith('.mo'):
3511 title, 3509 title,
3512 msgSuccess=self.tr( 3510 msgSuccess=self.tr(
3513 "\nMessage catalogs compiled successfully.")) 3511 "\nMessage catalogs compiled successfully."))
3514 res = dia.startProcess(args, wd, mergedOutput=True) 3512 res = dia.startProcess(args, wd, mergedOutput=True)
3515 if res: 3513 if res:
3516 dia.exec_() 3514 dia.exec()
3517 3515
3518 for entry in os.walk(self.__sitePath()): 3516 for entry in os.walk(self.__sitePath()):
3519 for fileName in entry[2]: 3517 for fileName in entry[2]:
3520 fullName = os.path.join(entry[0], fileName) 3518 fullName = os.path.join(entry[0], fileName)
3521 if fullName.endswith('.mo'): 3519 if fullName.endswith('.mo'):
3558 from .DjangoCheckOptionsDialog import DjangoCheckOptionsDialog 3556 from .DjangoCheckOptionsDialog import DjangoCheckOptionsDialog
3559 dlg = DjangoCheckOptionsDialog( 3557 dlg = DjangoCheckOptionsDialog(
3560 self.__getPythonExecutable(), path, self.getRecentApplications(), 3558 self.__getPythonExecutable(), path, self.getRecentApplications(),
3561 self.__plugin.getPreferences("CheckDeployMode"), 3559 self.__plugin.getPreferences("CheckDeployMode"),
3562 ) 3560 )
3563 if dlg.exec_() == QDialog.Accepted: 3561 if dlg.exec() == QDialog.Accepted:
3564 deploy, tags, appsStr, settingsFile = dlg.getData() 3562 deploy, tags, appsStr, settingsFile = dlg.getData()
3565 self.__plugin.setPreferences("CheckDeployMode", deploy) 3563 self.__plugin.setPreferences("CheckDeployMode", deploy)
3566 if appsStr != "": 3564 if appsStr != "":
3567 self.setMostRecentApplication(appsStr) 3565 self.setMostRecentApplication(appsStr)
3568 apps = appsStr.split() 3566 apps = appsStr.split()
3581 args += apps 3579 args += apps
3582 3580
3583 dia = DjangoDialog(self.tr("Check Project")) 3581 dia = DjangoDialog(self.tr("Check Project"))
3584 res = dia.startProcess(args, path, mergedOutput=True) 3582 res = dia.startProcess(args, path, mergedOutput=True)
3585 if res: 3583 if res:
3586 dia.exec_() 3584 dia.exec()

eric ide

mercurial