ProjectFlask/FlaskConfigDialog.py

changeset 47
144b67fd111a
child 49
3866bd742041
equal deleted inserted replaced
46:e700f73e1c6f 47:144b67fd111a
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2020 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to configure project specific flask settings.
8 """
9
10 from PyQt5.QtCore import pyqtSlot
11 from PyQt5.QtWidgets import QDialog
12
13 from E5Gui.E5Application import e5App
14
15 from .Ui_FlaskConfigDialog import Ui_FlaskConfigDialog
16
17
18 class FlaskConfigDialog(QDialog, Ui_FlaskConfigDialog):
19 """
20 Class implementing a dialog to configure project specific flask settings.
21 """
22 def __init__(self, configuration, parent=None):
23 """
24 Constructor
25
26 @param configuration current project specific configuration
27 @type dict
28 @param parent reference to the parent widget
29 @type QWidget
30 """
31 super(FlaskConfigDialog, self).__init__(parent)
32 self.setupUi(self)
33
34 self.virtualEnvironmentComboBox.addItem("")
35 self.virtualEnvironmentComboBox.addItems(
36 sorted(e5App().getObject("VirtualEnvManager").getVirtualenvNames(
37 noRemote=True, noConda=True
38 ))
39 )
40
41 # TODO: set initial values based on configuration
42
43 msh = self.minimumSizeHint()
44 self.resize(max(self.width(), msh.width()), msh.height())
45
46 def getConfiguration(self):
47 """
48 Public method to get the entered configuration data.
49
50 @return project specific configuration
51 @rtype dict
52 """
53 configuration = {
54 "virtual_environment_name":
55 self.virtualEnvironmentComboBox.currentText(),
56 }
57
58 return configuration

eric ide

mercurial