1250 Public method to create a new form. |
1250 Public method to create a new form. |
1251 |
1251 |
1252 @param path full directory path for the new form file |
1252 @param path full directory path for the new form file |
1253 @type str |
1253 @type str |
1254 """ |
1254 """ |
1255 fileFilters = self.tr( |
1255 fileFilters = self.tr("HTML Files (*.html);;HTML Files (*.htm);;All Files (*)") |
1256 "HTML Files (*.html);;HTML Files (*.htm);;All Files (*)" |
|
1257 ) |
|
1258 fname, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( |
1256 fname, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( |
1259 self.__ui, |
1257 self.__ui, |
1260 self.tr("New Form"), |
1258 self.tr("New Form"), |
1261 path, |
1259 path, |
1262 fileFilters, |
1260 fileFilters, |
1593 "{1}</a></td></tr>" |
1591 "{1}</a></td></tr>" |
1594 "</table></p>" |
1592 "</table></p>" |
1595 ).format(version, url), |
1593 ).format(version, url), |
1596 modal=True, |
1594 modal=True, |
1597 buttons=EricMessageBox.Ok, |
1595 buttons=EricMessageBox.Ok, |
|
1596 parent=self.__ui, |
1598 ) |
1597 ) |
1599 msgBox.setIconPixmap( |
1598 msgBox.setIconPixmap( |
1600 EricPixmapCache.getPixmap( |
1599 EricPixmapCache.getPixmap( |
1601 os.path.join( |
1600 os.path.join( |
1602 "ProjectDjango", "icons", "django64-{0}".format(self.__iconSuffix) |
1601 "ProjectDjango", "icons", "django64-{0}".format(self.__iconSuffix) |
2395 try: |
2398 try: |
2396 path = self.__sitePath() |
2399 path = self.__sitePath() |
2397 except DjangoNoSiteSelectedError: |
2400 except DjangoNoSiteSelectedError: |
2398 return |
2401 return |
2399 |
2402 |
2400 dia = DjangoDialog(title, fixed=True, linewrap=False) |
2403 dia = DjangoDialog(title, fixed=True, linewrap=False, parent=self.__ui) |
2401 res = dia.startProcess(args, path, False) |
2404 res = dia.startProcess(args, path, False) |
2402 if res: |
2405 if res: |
2403 dia.exec() |
2406 dia.exec() |
2404 |
2407 |
2405 def __databaseFlush(self): |
2408 def __databaseFlush(self): |
2427 args.append("--noinput") |
2430 args.append("--noinput") |
2428 if self.__currentDatabase: |
2431 if self.__currentDatabase: |
2429 args.append("--database={0}".format(self.__currentDatabase)) |
2432 args.append("--database={0}".format(self.__currentDatabase)) |
2430 |
2433 |
2431 dia = DjangoDialog( |
2434 dia = DjangoDialog( |
2432 title, msgSuccess=self.tr("Database tables flushed successfully.") |
2435 title, |
|
2436 msgSuccess=self.tr("Database tables flushed successfully."), |
|
2437 parent=self.__ui, |
2433 ) |
2438 ) |
2434 res = dia.startProcess(args, path) |
2439 res = dia.startProcess(args, path) |
2435 if res: |
2440 if res: |
2436 dia.exec() |
2441 dia.exec() |
2437 |
2442 |
2497 args.append("--database={0}".format(self.__currentDatabase)) |
2502 args.append("--database={0}".format(self.__currentDatabase)) |
2498 args += apps |
2503 args += apps |
2499 |
2504 |
2500 fileFilter = self.tr("SQL Files (*.sql)") |
2505 fileFilter = self.tr("SQL Files (*.sql)") |
2501 |
2506 |
2502 dia = DjangoDialog(title, fixed=True, linewrap=False, saveFilters=fileFilter) |
2507 dia = DjangoDialog( |
|
2508 title, fixed=True, linewrap=False, saveFilters=fileFilter, parent=self.__ui |
|
2509 ) |
2503 res = dia.startProcess(args, path, False) |
2510 res = dia.startProcess(args, path, False) |
2504 if res: |
2511 if res: |
2505 dia.exec() |
2512 dia.exec() |
2506 |
2513 |
2507 def __databaseSqlFlushDatabase(self): |
2514 def __databaseSqlFlushDatabase(self): |
2542 return |
2549 return |
2543 |
2550 |
2544 title = self.tr("SQL Migrate") |
2551 title = self.tr("SQL Migrate") |
2545 |
2552 |
2546 dlg = DjangoMigrationSelectionDialog( |
2553 dlg = DjangoMigrationSelectionDialog( |
2547 migrations, migrationRequired=True, suffix=self.__iconSuffix |
2554 migrations, |
|
2555 migrationRequired=True, |
|
2556 suffix=self.__iconSuffix, |
|
2557 parent=self.__ui, |
2548 ) |
2558 ) |
2549 if dlg.exec() == QDialog.DialogCode.Accepted: |
2559 if dlg.exec() == QDialog.DialogCode.Accepted: |
2550 app, migration = dlg.getData() |
2560 app, migration = dlg.getData() |
2551 |
2561 |
2552 args = [] |
2562 args = [] |
2561 args.append(migration) |
2571 args.append(migration) |
2562 |
2572 |
2563 fileFilter = self.tr("SQL Files (*.sql)") |
2573 fileFilter = self.tr("SQL Files (*.sql)") |
2564 |
2574 |
2565 dia = DjangoDialog( |
2575 dia = DjangoDialog( |
2566 title, fixed=True, linewrap=False, saveFilters=fileFilter |
2576 title, |
|
2577 fixed=True, |
|
2578 linewrap=False, |
|
2579 saveFilters=fileFilter, |
|
2580 parent=self.__ui, |
2567 ) |
2581 ) |
2568 res = dia.startProcess(args, path, False) |
2582 res = dia.startProcess(args, path, False) |
2569 if res: |
2583 if res: |
2570 dia.exec() |
2584 dia.exec() |
2571 |
2585 |
2630 self.tr("Apply Selected Migrations"), |
2644 self.tr("Apply Selected Migrations"), |
2631 self.tr("""No migrations available."""), |
2645 self.tr("""No migrations available."""), |
2632 ) |
2646 ) |
2633 return |
2647 return |
2634 |
2648 |
2635 dlg = DjangoMigrationSelectionDialog(migrations, suffix=self.__iconSuffix) |
2649 dlg = DjangoMigrationSelectionDialog( |
|
2650 migrations, suffix=self.__iconSuffix, parent=self.__ui |
|
2651 ) |
2636 if dlg.exec() == QDialog.DialogCode.Accepted: |
2652 if dlg.exec() == QDialog.DialogCode.Accepted: |
2637 app, migration = dlg.getData() |
2653 app, migration = dlg.getData() |
2638 self.applyMigrations(app=app, migration=migration) |
2654 self.applyMigrations(app=app, migration=migration) |
2639 |
2655 |
2640 def applyMigrations(self, app=None, migration=None): |
2656 def applyMigrations(self, app=None, migration=None): |
2747 """ |
2763 """ |
2748 Private slot to generate migrations for the Django project. |
2764 Private slot to generate migrations for the Django project. |
2749 """ |
2765 """ |
2750 from .DjangoMakeMigrationsDialog import DjangoMakeMigrationsDialog |
2766 from .DjangoMakeMigrationsDialog import DjangoMakeMigrationsDialog |
2751 |
2767 |
2752 dlg = DjangoMakeMigrationsDialog(self.getRecentApplications()) |
2768 dlg = DjangoMakeMigrationsDialog(self.getRecentApplications(), parent=self.__ui) |
2753 if dlg.exec() == QDialog.DialogCode.Accepted: |
2769 if dlg.exec() == QDialog.DialogCode.Accepted: |
2754 apps, migration, dryRun, empty, merge = dlg.getData() |
2770 apps, migration, dryRun, empty, merge = dlg.getData() |
2755 if apps: |
2771 if apps: |
2756 self.setMostRecentApplication(apps) |
2772 self.setMostRecentApplication(apps) |
2757 apps = apps.split() |
2773 apps = apps.split() |
2817 self.tr("Squash Migrations"), |
2833 self.tr("Squash Migrations"), |
2818 self.tr("""No migrations available."""), |
2834 self.tr("""No migrations available."""), |
2819 ) |
2835 ) |
2820 return |
2836 return |
2821 |
2837 |
2822 dlg = DjangoSquashMigrationSelectionDialog(migrations, self, self.__iconSuffix) |
2838 dlg = DjangoSquashMigrationSelectionDialog( |
|
2839 migrations, self, self.__iconSuffix, parent=self.__ui |
|
2840 ) |
2823 if dlg.exec() == QDialog.DialogCode.Accepted: |
2841 if dlg.exec() == QDialog.DialogCode.Accepted: |
2824 app, start, end, noOptimize, name = dlg.getData() |
2842 app, start, end, noOptimize, name = dlg.getData() |
2825 |
2843 |
2826 title = self.tr("Squash Migrations") |
2844 title = self.tr("Squash Migrations") |
2827 |
2845 |
2859 """ |
2877 """ |
2860 from .DjangoDiffsettingsDataDialog import DjangoDiffsettingsDataDialog |
2878 from .DjangoDiffsettingsDataDialog import DjangoDiffsettingsDataDialog |
2861 |
2879 |
2862 title = self.tr("Diff Settings") |
2880 title = self.tr("Diff Settings") |
2863 |
2881 |
2864 dlg = DjangoDiffsettingsDataDialog(self, self.__ui) |
2882 dlg = DjangoDiffsettingsDataDialog(self, parent=self.__ui) |
2865 if dlg.exec() == QDialog.DialogCode.Accepted: |
2883 if dlg.exec() == QDialog.DialogCode.Accepted: |
2866 showAll, defaultModule, outputFormat = dlg.getData() |
2884 showAll, defaultModule, outputFormat = dlg.getData() |
2867 |
2885 |
2868 args = [] |
2886 args = [] |
2869 args.append(self.__getPythonExecutable()) |
2887 args.append(self.__getPythonExecutable()) |
2879 try: |
2897 try: |
2880 path = self.__sitePath() |
2898 path = self.__sitePath() |
2881 except DjangoNoSiteSelectedError: |
2899 except DjangoNoSiteSelectedError: |
2882 return |
2900 return |
2883 |
2901 |
2884 dia = DjangoDialog(title, fixed=True, linewrap=False) |
2902 dia = DjangoDialog(title, fixed=True, linewrap=False, parent=self.__ui) |
2885 res = dia.startProcess(args, path, False) |
2903 res = dia.startProcess(args, path, False) |
2886 if res: |
2904 if res: |
2887 dia.exec() |
2905 dia.exec() |
2888 |
2906 |
2889 def __runPythonShell(self): |
2907 def __runPythonShell(self): |
2921 """ |
2939 """ |
2922 from .DjangoSendTestEmailDataDialog import DjangoSendTestEmailDataDialog |
2940 from .DjangoSendTestEmailDataDialog import DjangoSendTestEmailDataDialog |
2923 |
2941 |
2924 title = self.tr("Send Test Email") |
2942 title = self.tr("Send Test Email") |
2925 |
2943 |
2926 dlg = DjangoSendTestEmailDataDialog(self.__ui) |
2944 dlg = DjangoSendTestEmailDataDialog(parent=self.__ui) |
2927 if dlg.exec() == QDialog.DialogCode.Accepted: |
2945 if dlg.exec() == QDialog.DialogCode.Accepted: |
2928 managers, admins, recipients = dlg.getData() |
2946 managers, admins, recipients = dlg.getData() |
2929 |
2947 |
2930 args = [] |
2948 args = [] |
2931 args.append(self.__getPythonExecutable()) |
2949 args.append(self.__getPythonExecutable()) |
2973 args.append("createcachetable") |
2992 args.append("createcachetable") |
2974 if self.__currentDatabase: |
2993 if self.__currentDatabase: |
2975 args.append("--database={0}".format(self.__currentDatabase)) |
2994 args.append("--database={0}".format(self.__currentDatabase)) |
2976 |
2995 |
2977 dia = DjangoDialog( |
2996 dia = DjangoDialog( |
2978 title, msgSuccess=self.tr("Cache tables created successfully.") |
2997 title, |
|
2998 msgSuccess=self.tr("Cache tables created successfully."), |
|
2999 parent=self.__ui, |
2979 ) |
3000 ) |
2980 res = dia.startProcess(args, wd) |
3001 res = dia.startProcess(args, wd) |
2981 if res: |
3002 if res: |
2982 dia.exec() |
3003 dia.exec() |
2983 |
3004 |
2996 try: |
3017 try: |
2997 wd = self.__sitePath() |
3018 wd = self.__sitePath() |
2998 except DjangoNoSiteSelectedError: |
3019 except DjangoNoSiteSelectedError: |
2999 return |
3020 return |
3000 |
3021 |
3001 dlg = DjangoDumpdataDataDialog(self, self.__ui) |
3022 dlg = DjangoDumpdataDataDialog(self, parent=self.__ui) |
3002 if dlg.exec() == QDialog.DialogCode.Accepted: |
3023 if dlg.exec() == QDialog.DialogCode.Accepted: |
3003 appls, excls, dumpFormat, indent = dlg.getData() |
3024 appls, excls, dumpFormat, indent = dlg.getData() |
3004 |
3025 |
3005 args = [] |
3026 args = [] |
3006 args.append(self.__getPythonExecutable()) |
3027 args.append(self.__getPythonExecutable()) |
3020 fileFilters = self.tr("XML Files (*.xml)") |
3041 fileFilters = self.tr("XML Files (*.xml)") |
3021 elif dumpFormat == "yaml": |
3042 elif dumpFormat == "yaml": |
3022 fileFilters = self.tr("YAML Files (*.yaml)") |
3043 fileFilters = self.tr("YAML Files (*.yaml)") |
3023 |
3044 |
3024 dia = DjangoDialog( |
3045 dia = DjangoDialog( |
3025 title, fixed=True, linewrap=False, saveFilters=fileFilters |
3046 title, |
|
3047 fixed=True, |
|
3048 linewrap=False, |
|
3049 saveFilters=fileFilters, |
|
3050 parent=self.__ui, |
3026 ) |
3051 ) |
3027 res = dia.startProcess(args, wd, showCommand=False) |
3052 res = dia.startProcess(args, wd, showCommand=False) |
3028 if res: |
3053 if res: |
3029 dia.exec() |
3054 dia.exec() |
3030 |
3055 |
3039 try: |
3064 try: |
3040 wd = self.__sitePath() |
3065 wd = self.__sitePath() |
3041 except DjangoNoSiteSelectedError: |
3066 except DjangoNoSiteSelectedError: |
3042 return |
3067 return |
3043 |
3068 |
3044 dlg = DjangoLoaddataDataDialog(self, self.__ui) |
3069 dlg = DjangoLoaddataDataDialog(self, parent=self.__ui) |
3045 if dlg.exec() == QDialog.DialogCode.Accepted: |
3070 if dlg.exec() == QDialog.DialogCode.Accepted: |
3046 fixtures, excludes, appLabel, ignore = dlg.getData() |
3071 fixtures, excludes, appLabel, ignore = dlg.getData() |
3047 |
3072 |
3048 args = [] |
3073 args = [] |
3049 args.append(self.__getPythonExecutable()) |
3074 args.append(self.__getPythonExecutable()) |
3057 args.append("--app={0}".format(appLabel)) |
3082 args.append("--app={0}".format(appLabel)) |
3058 if self.__currentDatabase: |
3083 if self.__currentDatabase: |
3059 args.append("--database={0}".format(self.__currentDatabase)) |
3084 args.append("--database={0}".format(self.__currentDatabase)) |
3060 args += fixtures |
3085 args += fixtures |
3061 |
3086 |
3062 dia = DjangoDialog(title) |
3087 dia = DjangoDialog(title, parent=self.__ui) |
3063 res = dia.startProcess(args, wd) |
3088 res = dia.startProcess(args, wd) |
3064 if res: |
3089 if res: |
3065 dia.exec() |
3090 dia.exec() |
3066 |
3091 |
3067 def __runTestSuite(self, deprecation=False): |
3092 def __runTestSuite(self, deprecation=False): |
3081 wd = self.__sitePath() |
3106 wd = self.__sitePath() |
3082 except DjangoNoSiteSelectedError: |
3107 except DjangoNoSiteSelectedError: |
3083 return |
3108 return |
3084 |
3109 |
3085 dlg = DjangoTestDataDialog( |
3110 dlg = DjangoTestDataDialog( |
3086 self, self.__plugin.getPreferences("KeepTestDatabase"), self.__ui |
3111 self, self.__plugin.getPreferences("KeepTestDatabase"), parent=self.__ui |
3087 ) |
3112 ) |
3088 if dlg.exec() == QDialog.DialogCode.Accepted: |
3113 if dlg.exec() == QDialog.DialogCode.Accepted: |
3089 labels, pattern, tags, excludeTags, keep, reverse = dlg.getData() |
3114 labels, pattern, tags, excludeTags, keep, reverse = dlg.getData() |
3090 |
3115 |
3091 self.__plugin.setPreferences("KeepTestDatabase", keep) |
3116 self.__plugin.setPreferences("KeepTestDatabase", keep) |
3127 |
3152 |
3128 consoleCmd = self.__isSpawningConsole( |
3153 consoleCmd = self.__isSpawningConsole( |
3129 self.__plugin.getPreferences("ConsoleCommand") |
3154 self.__plugin.getPreferences("ConsoleCommand") |
3130 )[1] |
3155 )[1] |
3131 if consoleCmd: |
3156 if consoleCmd: |
3132 dlg = DjangoRunTestServerDataDialog(self, self.__ui) |
3157 dlg = DjangoRunTestServerDataDialog(self, parent=self.__ui) |
3133 if dlg.exec() == QDialog.DialogCode.Accepted: |
3158 if dlg.exec() == QDialog.DialogCode.Accepted: |
3134 fixtures = dlg.getData() |
3159 fixtures = dlg.getData() |
3135 |
3160 |
3136 args = Utilities.parseOptionString(consoleCmd) |
3161 args = Utilities.parseOptionString(consoleCmd) |
3137 args[0] = getExecutablePath(args[0]) |
3162 args[0] = getExecutablePath(args[0]) |
3260 args.append(self.__getPythonExecutable()) |
3285 args.append(self.__getPythonExecutable()) |
3261 args.append("manage.py") |
3286 args.append("manage.py") |
3262 args.append("clearsessions") |
3287 args.append("clearsessions") |
3263 |
3288 |
3264 dia = DjangoDialog( |
3289 dia = DjangoDialog( |
3265 title, msgSuccess=self.tr("Expired sessions cleared successfully.") |
3290 title, |
|
3291 msgSuccess=self.tr("Expired sessions cleared successfully."), |
|
3292 parent=self.__ui, |
3266 ) |
3293 ) |
3267 res = dia.startProcess(args, wd) |
3294 res = dia.startProcess(args, wd) |
3268 if res: |
3295 if res: |
3269 dia.exec() |
3296 dia.exec() |
3270 |
3297 |
3560 None, title, self.tr("No locales detected. Aborting...") |
3597 None, title, self.tr("No locales detected. Aborting...") |
3561 ) |
3598 ) |
3562 return |
3599 return |
3563 |
3600 |
3564 dia = DjangoDialog( |
3601 dia = DjangoDialog( |
3565 title, msgSuccess=self.tr("\nMessage catalogs compiled successfully.") |
3602 title, |
|
3603 msgSuccess=self.tr("\nMessage catalogs compiled successfully."), |
|
3604 parent=self.__ui, |
3566 ) |
3605 ) |
3567 res = dia.startBatchProcesses(argsLists, wd, mergedOutput=True) |
3606 res = dia.startBatchProcesses(argsLists, wd, mergedOutput=True) |
3568 if res: |
3607 if res: |
3569 dia.exec() |
3608 dia.exec() |
3570 |
3609 |
3599 self.tr("No current site selected or no site created yet. Aborting..."), |
3638 self.tr("No current site selected or no site created yet. Aborting..."), |
3600 ) |
3639 ) |
3601 return |
3640 return |
3602 |
3641 |
3603 dia = DjangoDialog( |
3642 dia = DjangoDialog( |
3604 title, msgSuccess=self.tr("\nMessage catalogs compiled successfully.") |
3643 title, |
|
3644 msgSuccess=self.tr("\nMessage catalogs compiled successfully."), |
|
3645 parent=self.__ui, |
3605 ) |
3646 ) |
3606 res = dia.startProcess(args, wd, mergedOutput=True) |
3647 res = dia.startProcess(args, wd, mergedOutput=True) |
3607 if res: |
3648 if res: |
3608 dia.exec() |
3649 dia.exec() |
3609 |
3650 |
3654 dlg = DjangoCheckOptionsDialog( |
3695 dlg = DjangoCheckOptionsDialog( |
3655 self.__getPythonExecutable(), |
3696 self.__getPythonExecutable(), |
3656 path, |
3697 path, |
3657 self.getRecentApplications(), |
3698 self.getRecentApplications(), |
3658 self.__plugin.getPreferences("CheckDeployMode"), |
3699 self.__plugin.getPreferences("CheckDeployMode"), |
|
3700 parent=self.__ui, |
3659 ) |
3701 ) |
3660 if dlg.exec() == QDialog.DialogCode.Accepted: |
3702 if dlg.exec() == QDialog.DialogCode.Accepted: |
3661 deploy, tags, appsStr, settingsFile = dlg.getData() |
3703 deploy, tags, appsStr, settingsFile = dlg.getData() |
3662 self.__plugin.setPreferences("CheckDeployMode", deploy) |
3704 self.__plugin.setPreferences("CheckDeployMode", deploy) |
3663 if appsStr != "": |
3705 if appsStr != "": |
3675 args.append("--deploy") |
3717 args.append("--deploy") |
3676 if settingsFile: |
3718 if settingsFile: |
3677 args.append("--settings={0}".format(settingsFile)) |
3719 args.append("--settings={0}".format(settingsFile)) |
3678 args += apps |
3720 args += apps |
3679 |
3721 |
3680 dia = DjangoDialog(self.tr("Check Project")) |
3722 dia = DjangoDialog(self.tr("Check Project"), parent=self.__ui) |
3681 res = dia.startProcess(args, path, mergedOutput=True) |
3723 res = dia.startProcess(args, path, mergedOutput=True) |
3682 if res: |
3724 if res: |
3683 dia.exec() |
3725 dia.exec() |