6 """ |
6 """ |
7 Module implementing a dialog to enter parameters to start the server. |
7 Module implementing a dialog to enter parameters to start the server. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt5.QtWidgets import QDialog |
10 from PyQt5.QtWidgets import QDialog |
|
11 |
|
12 from E5Gui.E5PathPicker import E5PathPickerModes |
|
13 from E5Gui.E5Application import e5App |
11 |
14 |
12 from .Ui_ServerStartOptionsDialog import Ui_ServerStartOptionsDialog |
15 from .Ui_ServerStartOptionsDialog import Ui_ServerStartOptionsDialog |
13 |
16 |
14 |
17 |
15 class ServerStartOptionsDialog(QDialog, Ui_ServerStartOptionsDialog): |
18 class ServerStartOptionsDialog(QDialog, Ui_ServerStartOptionsDialog): |
25 @param parent reference to the parent widget |
28 @param parent reference to the parent widget |
26 @type QWidget |
29 @type QWidget |
27 """ |
30 """ |
28 super(ServerStartOptionsDialog, self).__init__(parent) |
31 super(ServerStartOptionsDialog, self).__init__(parent) |
29 self.setupUi(self) |
32 self.setupUi(self) |
|
33 |
|
34 e5project = e5App().getObject("Project") |
|
35 |
|
36 self.certFilePicker.setMode(E5PathPickerModes.OpenFileMode) |
|
37 self.certFilePicker.setFilters(self.tr( |
|
38 "Certificate Files (*.pem);;" |
|
39 "Certificate Files (*.cert *.cer *.crt)" |
|
40 )) |
|
41 self.certFilePicker.setDefaultDirectory(e5project.getProjectPath()) |
|
42 |
|
43 self.keyFilePicker.setMode(E5PathPickerModes.OpenFileMode) |
|
44 self.keyFilePicker.setFilters(self.tr( |
|
45 "Key Files (*.pem *.key)" |
|
46 )) |
|
47 self.keyFilePicker.setDefaultDirectory(e5project.getProjectPath()) |
30 |
48 |
31 self.developmentCheckBox.setChecked(options.get("development", False)) |
49 self.developmentCheckBox.setChecked(options.get("development", False)) |
32 self.hostEdit.setText(options.get("host", "")) |
50 self.hostEdit.setText(options.get("host", "")) |
33 self.portSpinBox.setValue(int(options.get("port", "5000"))) |
51 self.portSpinBox.setValue(int(options.get("port", "5000"))) |
34 |
52 |
49 if host: |
67 if host: |
50 options["host"] = host |
68 options["host"] = host |
51 port = self.portSpinBox.value() |
69 port = self.portSpinBox.value() |
52 if port != 5000: |
70 if port != 5000: |
53 options["port"] = str(port) |
71 options["port"] = str(port) |
|
72 if self.certFilePicker.text(): |
|
73 options["cert"] = self.certFilePicker.text() |
|
74 if self.keyFilePicker.text(): |
|
75 options["key"] = self.keyFilePicker.text() |
54 |
76 |
55 return options |
77 return options |