ProjectDjango/DjangoMakeMigrationsDialog.py

changeset 74
f33822c3eb47
child 75
0165ce437462
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ProjectDjango/DjangoMakeMigrationsDialog.py	Mon Dec 19 19:26:40 2016 +0100
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2016 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a dialog to enter the data needed to make migrations.
+"""
+
+from __future__ import unicode_literals
+
+from PyQt5.QtWidgets import QDialog
+
+from .Ui_DjangoMakeMigrationsDialog import Ui_DjangoMakeMigrationsDialog
+
+
+class DjangoMakeMigrationsDialog(QDialog, Ui_DjangoMakeMigrationsDialog):
+    """
+    Class implementing a dialog to enter the data needed to make migrations.
+    """
+    def __init__(self, recentApps, parent=None):
+        """
+        Constructor
+        
+        @param parent reference to the parent widget
+        @type QWidget
+        """
+        super(DjangoMakeMigrationsDialog, self).__init__(parent)
+        self.setupUi(self)
+        
+        self.applicationsComboBox.addItems(recentApps)
+    
+    def getData(self):
+        """
+        Public method to get the data for the migration.
+        
+        @return tuple containing the application names, a migration name
+            and the dry-run flag
+        @rtype tuple of two str and a bool
+        """
+        return (
+            self.applicationsComboBox.currentText(),
+            self.nameEdit.text(),
+            self.dryrunCheckBox.isChecked(),
+        )

eric ide

mercurial