ProjectFlask/FlaskConfigDialog.py

changeset 47
144b67fd111a
child 49
3866bd742041
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ProjectFlask/FlaskConfigDialog.py	Tue Dec 01 20:22:23 2020 +0100
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2020 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a dialog to configure project specific flask settings.
+"""
+
+from PyQt5.QtCore import pyqtSlot
+from PyQt5.QtWidgets import QDialog
+
+from E5Gui.E5Application import e5App
+
+from .Ui_FlaskConfigDialog import Ui_FlaskConfigDialog
+
+
+class FlaskConfigDialog(QDialog, Ui_FlaskConfigDialog):
+    """
+    Class implementing a dialog to configure project specific flask settings.
+    """
+    def __init__(self, configuration, parent=None):
+        """
+        Constructor
+        
+        @param configuration current project specific configuration
+        @type dict
+        @param parent reference to the parent widget
+        @type QWidget
+        """
+        super(FlaskConfigDialog, self).__init__(parent)
+        self.setupUi(self)
+        
+        self.virtualEnvironmentComboBox.addItem("")
+        self.virtualEnvironmentComboBox.addItems(
+            sorted(e5App().getObject("VirtualEnvManager").getVirtualenvNames(
+                noRemote=True, noConda=True
+            ))
+        )
+        
+        # TODO: set initial values based on configuration
+        
+        msh = self.minimumSizeHint()
+        self.resize(max(self.width(), msh.width()), msh.height())
+    
+    def getConfiguration(self):
+        """
+        Public method to get the entered configuration data.
+        
+        @return project specific configuration
+        @rtype dict
+        """
+        configuration = {
+            "virtual_environment_name":
+                self.virtualEnvironmentComboBox.currentText(),
+        }
+        
+        return configuration

eric ide

mercurial