38 |
38 |
39 @param plugin reference to the plugin object |
39 @param plugin reference to the plugin object |
40 @type ProjectFlaskPlugin |
40 @type ProjectFlaskPlugin |
41 @param project reference to the project object |
41 @param project reference to the project object |
42 @type Project |
42 @type Project |
43 @param parent parent |
43 @param parent reference to the parent widget |
44 @type QObject |
44 @type QWidget |
45 """ |
45 """ |
46 super().__init__(parent) |
46 super().__init__(parent) |
47 |
47 |
48 self.__plugin = plugin |
48 self.__plugin = plugin |
49 self.__project = project |
49 self.__project = project |
|
50 self.__ui = parent |
50 |
51 |
51 self.__ericProject = ericApp().getObject("Project") |
52 self.__ericProject = ericApp().getObject("Project") |
52 |
53 |
53 self.__migrationSummaryDialog = None |
54 self.__migrationSummaryDialog = None |
54 |
55 |
382 Private slot to show a dialog to edit the migrate configuration. |
383 Private slot to show a dialog to edit the migrate configuration. |
383 """ |
384 """ |
384 from .MigrateConfigDialog import MigrateConfigDialog |
385 from .MigrateConfigDialog import MigrateConfigDialog |
385 |
386 |
386 config = self.__project.getData("flask-migrate", "") |
387 config = self.__project.getData("flask-migrate", "") |
387 dlg = MigrateConfigDialog(config) |
388 dlg = MigrateConfigDialog(config, parent=self.__ui) |
388 if dlg.exec() == QDialog.DialogCode.Accepted: |
389 if dlg.exec() == QDialog.DialogCode.Accepted: |
389 config = dlg.getConfiguration() |
390 config = dlg.getConfiguration() |
390 self.__project.setData("flask-migrate", "", config) |
391 self.__project.setData("flask-migrate", "", config) |
391 |
392 |
392 def __ensureMigrateConfigured(self): |
393 def __ensureMigrateConfigured(self): |
461 |
462 |
462 dlg = FlaskCommandDialog( |
463 dlg = FlaskCommandDialog( |
463 self.__project, |
464 self.__project, |
464 title=title, |
465 title=title, |
465 msgSuccess=self.tr("\nMigrations initialized successfully."), |
466 msgSuccess=self.tr("\nMigrations initialized successfully."), |
|
467 parent=self.__ui, |
466 ) |
468 ) |
467 if dlg.startCommand("db", args): |
469 if dlg.startCommand("db", args): |
468 dlg.exec() |
470 dlg.exec() |
469 if dlg.normalExit(): |
471 if dlg.normalExit(): |
470 for root, _dirs, files in os.walk( |
472 for root, _dirs, files in os.walk( |
511 |
513 |
512 dlg = FlaskCommandDialog( |
514 dlg = FlaskCommandDialog( |
513 self.__project, |
515 self.__project, |
514 title=title, |
516 title=title, |
515 msgSuccess=self.tr("\nMigration created successfully."), |
517 msgSuccess=self.tr("\nMigration created successfully."), |
|
518 parent=self.__ui, |
516 ) |
519 ) |
517 if dlg.startCommand("db", args): |
520 if dlg.startCommand("db", args): |
518 dlg.exec() |
521 dlg.exec() |
519 if dlg.normalExit(): |
522 if dlg.normalExit(): |
520 versionsPattern = os.path.join( |
523 versionsPattern = os.path.join( |
575 |
579 |
576 dlg = FlaskCommandDialog( |
580 dlg = FlaskCommandDialog( |
577 self.__project, |
581 self.__project, |
578 title=title, |
582 title=title, |
579 msgSuccess=self.tr("\nDatabase downgraded successfully."), |
583 msgSuccess=self.tr("\nDatabase downgraded successfully."), |
|
584 parent=self.__ui, |
580 ) |
585 ) |
581 if dlg.startCommand("db", args): |
586 if dlg.startCommand("db", args): |
582 dlg.exec() |
587 dlg.exec() |
583 |
588 |
584 ######################################################### |
589 ######################################################### |
614 |
619 |
615 args = ["history", "--indicate-current", "--verbose"] |
620 args = ["history", "--indicate-current", "--verbose"] |
616 if migrations: |
621 if migrations: |
617 args += ["--directory", migrations] |
622 args += ["--directory", migrations] |
618 |
623 |
619 dlg = FlaskCommandDialog(self.__project, title=title) |
624 dlg = FlaskCommandDialog(self.__project, title=title, parent=self.__ui) |
620 if dlg.startCommand("db", args): |
625 if dlg.startCommand("db", args): |
621 dlg.exec() |
626 dlg.exec() |