ProjectDjango/Project.py

changeset 148
4cb7aa43845d
parent 146
8c42fc23c94c
child 159
e08458938716
equal deleted inserted replaced
147:17a08bd37c2b 148:4cb7aa43845d
97 Class implementing the Django project support. 97 Class implementing the Django project support.
98 """ 98 """
99 RecentApplicationsKey = "Django/RecentApplications" 99 RecentApplicationsKey = "Django/RecentApplications"
100 RecentDatabaseNamesKey = "Django/RecentDatabaseNames" 100 RecentDatabaseNamesKey = "Django/RecentDatabaseNames"
101 101
102 def __init__(self, plugin, parent=None): 102 def __init__(self, plugin, iconSuffix, parent=None):
103 """ 103 """
104 Constructor 104 Constructor
105 105
106 @param plugin reference to the plugin object 106 @param plugin reference to the plugin object
107 @param parent parent (QObject) 107 @type ProjectDjangoPlugin
108 @param iconSuffix suffix for the icons
109 @type str
110 @param parent parent
111 @type QObject
108 """ 112 """
109 super(Project, self).__init__(parent) 113 super(Project, self).__init__(parent)
110 114
111 self.__plugin = plugin 115 self.__plugin = plugin
116 self.__iconSuffix = iconSuffix
112 self.__ui = parent 117 self.__ui = parent
118
113 self.__e5project = e5App().getObject("Project") 119 self.__e5project = e5App().getObject("Project")
114 try: 120 try:
115 self.__virtualEnvManager = e5App().getObject("VirtualEnvManager") 121 self.__virtualEnvManager = e5App().getObject("VirtualEnvManager")
116 except KeyError: 122 except KeyError:
117 self.__virtualEnvManager = None 123 self.__virtualEnvManager = None
1592 "</table></p>" 1598 "</table></p>"
1593 ).format(version, url), 1599 ).format(version, url),
1594 modal=True, 1600 modal=True,
1595 buttons=E5MessageBox.Ok) 1601 buttons=E5MessageBox.Ok)
1596 msgBox.setIconPixmap(UI.PixmapCache.getPixmap( 1602 msgBox.setIconPixmap(UI.PixmapCache.getPixmap(
1597 os.path.join("ProjectDjango", "icons", "django64.png"))) 1603 os.path.join("ProjectDjango", "icons",
1604 "django64-{0}".format(self.__iconSuffix))))
1598 msgBox.exec_() 1605 msgBox.exec_()
1599 1606
1600 def getDjangoVersionString(self): 1607 def getDjangoVersionString(self):
1601 """ 1608 """
1602 Public method to get the Django version as a string. 1609 Public method to get the Django version as a string.
2559 title = self.tr("SQL Migrate") 2566 title = self.tr("SQL Migrate")
2560 2567
2561 from .DjangoMigrationSelectionDialog import \ 2568 from .DjangoMigrationSelectionDialog import \
2562 DjangoMigrationSelectionDialog 2569 DjangoMigrationSelectionDialog
2563 dlg = DjangoMigrationSelectionDialog(migrations, 2570 dlg = DjangoMigrationSelectionDialog(migrations,
2564 migrationRequired=True) 2571 migrationRequired=True,
2572 suffix=self.__iconSuffix)
2565 if dlg.exec_() == QDialog.Accepted: 2573 if dlg.exec_() == QDialog.Accepted:
2566 app, migration = dlg.getData() 2574 app, migration = dlg.getData()
2567 2575
2568 args = [] 2576 args = []
2569 args.append(self.__getPythonExecutable()) 2577 args.append(self.__getPythonExecutable())
2638 self.tr("""No migrations available.""")) 2646 self.tr("""No migrations available."""))
2639 return 2647 return
2640 2648
2641 from .DjangoMigrationSelectionDialog import \ 2649 from .DjangoMigrationSelectionDialog import \
2642 DjangoMigrationSelectionDialog 2650 DjangoMigrationSelectionDialog
2643 dlg = DjangoMigrationSelectionDialog(migrations) 2651 dlg = DjangoMigrationSelectionDialog(migrations,
2652 suffix=self.__iconSuffix)
2644 if dlg.exec_() == QDialog.Accepted: 2653 if dlg.exec_() == QDialog.Accepted:
2645 app, migration = dlg.getData() 2654 app, migration = dlg.getData()
2646 self.applyMigrations(app=app, migration=migration) 2655 self.applyMigrations(app=app, migration=migration)
2647 2656
2648 def applyMigrations(self, app=None, migration=None): 2657 def applyMigrations(self, app=None, migration=None):
2816 return 2825 return
2817 2826
2818 from .DjangoSquashMigrationSelectionDialog import \ 2827 from .DjangoSquashMigrationSelectionDialog import \
2819 DjangoSquashMigrationSelectionDialog 2828 DjangoSquashMigrationSelectionDialog
2820 dlg = DjangoSquashMigrationSelectionDialog( 2829 dlg = DjangoSquashMigrationSelectionDialog(
2821 migrations, self) 2830 migrations, self, self.__iconSuffix)
2822 if dlg.exec_() == QDialog.Accepted: 2831 if dlg.exec_() == QDialog.Accepted:
2823 app, start, end, noOptimize, name = dlg.getData() 2832 app, start, end, noOptimize, name = dlg.getData()
2824 2833
2825 title = self.tr("Squash Migrations") 2834 title = self.tr("Squash Migrations")
2826 2835

eric ide

mercurial