ProjectFlask/ServerStartOptionsDialog.py

branch
eric7
changeset 70
22e1d0f69668
parent 66
0d3168d0e310
child 72
4557829a4acf
equal deleted inserted replaced
69:c31a4f756a04 70:22e1d0f69668
17 17
18 class ServerStartOptionsDialog(QDialog, Ui_ServerStartOptionsDialog): 18 class ServerStartOptionsDialog(QDialog, Ui_ServerStartOptionsDialog):
19 """ 19 """
20 Class implementing a dialog to enter parameters to start the server. 20 Class implementing a dialog to enter parameters to start the server.
21 """ 21 """
22
22 def __init__(self, options, parent=None): 23 def __init__(self, options, parent=None):
23 """ 24 """
24 Constructor 25 Constructor
25 26
26 @param options dictionary containing the current server start options 27 @param options dictionary containing the current server start options
27 @type dict 28 @type dict
28 @param parent reference to the parent widget 29 @param parent reference to the parent widget
29 @type QWidget 30 @type QWidget
30 """ 31 """
31 super().__init__(parent) 32 super().__init__(parent)
32 self.setupUi(self) 33 self.setupUi(self)
33 34
34 ericProject = ericApp().getObject("Project") 35 ericProject = ericApp().getObject("Project")
35 36
36 self.certFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) 37 self.certFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
37 self.certFilePicker.setFilters(self.tr( 38 self.certFilePicker.setFilters(
38 "Certificate Files (*.pem);;" 39 self.tr(
39 "Certificate Files (*.cert *.cer *.crt)" 40 "Certificate Files (*.pem);;" "Certificate Files (*.cert *.cer *.crt)"
40 )) 41 )
42 )
41 self.certFilePicker.setDefaultDirectory(ericProject.getProjectPath()) 43 self.certFilePicker.setDefaultDirectory(ericProject.getProjectPath())
42 44
43 self.keyFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) 45 self.keyFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
44 self.keyFilePicker.setFilters(self.tr( 46 self.keyFilePicker.setFilters(self.tr("Key Files (*.pem *.key)"))
45 "Key Files (*.pem *.key)"
46 ))
47 self.keyFilePicker.setDefaultDirectory(ericProject.getProjectPath()) 47 self.keyFilePicker.setDefaultDirectory(ericProject.getProjectPath())
48 48
49 self.developmentCheckBox.setChecked(options.get("development", False)) 49 self.developmentCheckBox.setChecked(options.get("development", False))
50 self.hostEdit.setText(options.get("host", "")) 50 self.hostEdit.setText(options.get("host", ""))
51 self.portSpinBox.setValue(int(options.get("port", "5000"))) 51 self.portSpinBox.setValue(int(options.get("port", "5000")))
52 52
53 msh = self.minimumSizeHint() 53 msh = self.minimumSizeHint()
54 self.resize(max(self.width(), msh.width()), msh.height()) 54 self.resize(max(self.width(), msh.width()), msh.height())
55 55
56 def getDataDict(self): 56 def getDataDict(self):
57 """ 57 """
58 Public method to get a dictionary containing the entered data. 58 Public method to get a dictionary containing the entered data.
59 59
60 @return dictionary containing the entered data 60 @return dictionary containing the entered data
61 @rtype dict 61 @rtype dict
62 """ 62 """
63 options = {} 63 options = {
64 64 "development": self.developmentCheckBox.isChecked(),
65 options["development"] = self.developmentCheckBox.isChecked() 65 }
66
66 host = self.hostEdit.text() 67 host = self.hostEdit.text()
67 if host: 68 if host:
68 options["host"] = host 69 options["host"] = host
69 port = self.portSpinBox.value() 70 port = self.portSpinBox.value()
70 if port != 5000: 71 if port != 5000:
71 options["port"] = str(port) 72 options["port"] = str(port)
72 if self.certFilePicker.text(): 73 if self.certFilePicker.text():
73 options["cert"] = self.certFilePicker.text() 74 options["cert"] = self.certFilePicker.text()
74 if self.keyFilePicker.text(): 75 if self.keyFilePicker.text():
75 options["key"] = self.keyFilePicker.text() 76 options["key"] = self.keyFilePicker.text()
76 77
77 return options 78 return options

eric ide

mercurial