Sat, 23 Dec 2023 17:08:59 +0100
Corrected some code style issues.
# -*- coding: utf-8 -*- # Copyright (c) 2020 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> # """ Module implementing a dialog to enter parameters to start the server. """ from PyQt6.QtWidgets import QDialog from eric7.EricWidgets.EricApplication import ericApp from eric7.EricWidgets.EricPathPicker import EricPathPickerModes from .Ui_ServerStartOptionsDialog import Ui_ServerStartOptionsDialog class ServerStartOptionsDialog(QDialog, Ui_ServerStartOptionsDialog): """ Class implementing a dialog to enter parameters to start the server. """ def __init__(self, options, parent=None): """ Constructor @param options dictionary containing the current server start options @type dict @param parent reference to the parent widget @type QWidget """ super().__init__(parent) self.setupUi(self) ericProject = ericApp().getObject("Project") self.certFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) self.certFilePicker.setFilters( self.tr("Certificate Files (*.pem);;Certificate Files (*.cert *.cer *.crt)") ) self.certFilePicker.setDefaultDirectory(ericProject.getProjectPath()) self.keyFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) self.keyFilePicker.setFilters(self.tr("Key Files (*.pem *.key)")) self.keyFilePicker.setDefaultDirectory(ericProject.getProjectPath()) self.developmentCheckBox.setChecked(options.get("development", False)) self.hostEdit.setText(options.get("host", "")) self.portSpinBox.setValue(int(options.get("port", "5000"))) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) def getDataDict(self): """ Public method to get a dictionary containing the entered data. @return dictionary containing the entered data @rtype dict """ options = { "development": self.developmentCheckBox.isChecked(), } host = self.hostEdit.text() if host: options["host"] = host port = self.portSpinBox.value() if port != 5000: options["port"] = str(port) if self.certFilePicker.text(): options["cert"] = self.certFilePicker.text() if self.keyFilePicker.text(): options["key"] = self.keyFilePicker.text() return options