--- a/src/eric7/Preferences/ConfigurationPages/SecurityPage.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Preferences/ConfigurationPages/SecurityPage.py Wed Jul 13 14:55:47 2022 +0200 @@ -20,88 +20,82 @@ """ Class implementing the Security configuration page. """ + def __init__(self, configDialog): """ Constructor - + @param configDialog reference to the configuration dialog (ConfigurationDialog) """ super().__init__() self.setupUi(self) self.setObjectName("SecurityPage") - + self.__configDlg = configDialog self.__displayMode = None - + # set initial values - self.savePasswordsCheckBox.setChecked( - Preferences.getUser("SavePasswords")) - self.masterPasswordCheckBox.setChecked( - Preferences.getUser("UseMasterPassword")) - self.masterPasswordButton.setEnabled( - Preferences.getUser("UseMasterPassword")) - + self.savePasswordsCheckBox.setChecked(Preferences.getUser("SavePasswords")) + self.masterPasswordCheckBox.setChecked(Preferences.getUser("UseMasterPassword")) + self.masterPasswordButton.setEnabled(Preferences.getUser("UseMasterPassword")) + self.__newPassword = "" self.__oldUseMasterPassword = Preferences.getUser("UseMasterPassword") - + self.alwaysRejectCheckBox.setChecked( - Preferences.getWebBrowser("AlwaysRejectFaultyCertificates")) - + Preferences.getWebBrowser("AlwaysRejectFaultyCertificates") + ) + def setMode(self, displayMode): """ Public method to perform mode dependent setups. - + @param displayMode mode of the configuration dialog (ConfigurationMode.DEFAULTMODE, ConfigurationMode.WEBBROWSERMODE) """ from ..ConfigurationDialog import ConfigurationMode + if displayMode in ( ConfigurationMode.DEFAULTMODE, - ConfigurationMode.WEBBROWSERMODE + ConfigurationMode.WEBBROWSERMODE, ): self.__displayMode = displayMode - + self.certificateErrorsGroup.setVisible( displayMode == ConfigurationMode.WEBBROWSERMODE ) - + def save(self): """ Public slot to save the Help Viewers configuration. """ - Preferences.setUser( - "SavePasswords", - self.savePasswordsCheckBox.isChecked()) + Preferences.setUser("SavePasswords", self.savePasswordsCheckBox.isChecked()) Preferences.setUser( - "UseMasterPassword", - self.masterPasswordCheckBox.isChecked()) - - if ( - self.__oldUseMasterPassword != - self.masterPasswordCheckBox.isChecked() - ): + "UseMasterPassword", self.masterPasswordCheckBox.isChecked() + ) + + if self.__oldUseMasterPassword != self.masterPasswordCheckBox.isChecked(): self.__configDlg.masterPasswordChanged.emit("", self.__newPassword) - + Preferences.setWebBrowser( - "AlwaysRejectFaultyCertificates", - self.alwaysRejectCheckBox.isChecked()) - + "AlwaysRejectFaultyCertificates", self.alwaysRejectCheckBox.isChecked() + ) + @pyqtSlot(bool) def on_masterPasswordCheckBox_clicked(self, checked): """ Private slot to handle the use of a master password. - + @param checked flag indicating the state of the check box (boolean) """ if checked: from .MasterPasswordEntryDialog import MasterPasswordEntryDialog + dlg = MasterPasswordEntryDialog("", self) if dlg.exec() == QDialog.DialogCode.Accepted: - Preferences.setUser( - "MasterPassword", - dlg.getMasterPassword()) + Preferences.setUser("MasterPassword", dlg.getMasterPassword()) self.masterPasswordButton.setEnabled(True) self.__newPassword = dlg.getMasterPassword() else: @@ -109,36 +103,32 @@ else: self.masterPasswordButton.setEnabled(False) self.__newPassword = "" - + @pyqtSlot() def on_masterPasswordButton_clicked(self): """ Private slot to change the master password. """ from .MasterPasswordEntryDialog import MasterPasswordEntryDialog - dlg = MasterPasswordEntryDialog( - Preferences.getUser("MasterPassword"), self) + + dlg = MasterPasswordEntryDialog(Preferences.getUser("MasterPassword"), self) if dlg.exec() == QDialog.DialogCode.Accepted: - Preferences.setUser( - "MasterPassword", - dlg.getMasterPassword()) - - if ( - self.__oldUseMasterPassword != - self.masterPasswordCheckBox.isChecked() - ): + Preferences.setUser("MasterPassword", dlg.getMasterPassword()) + + if self.__oldUseMasterPassword != self.masterPasswordCheckBox.isChecked(): # the user is about to change the use of a master password # just save the changed password self.__newPassword = dlg.getMasterPassword() else: self.__configDlg.masterPasswordChanged.emit( - dlg.getCurrentPassword(), dlg.getMasterPassword()) + dlg.getCurrentPassword(), dlg.getMasterPassword() + ) def create(dlg): """ Module function to create the configuration page. - + @param dlg reference to the configuration dialog @return reference to the instantiated page (ConfigurationPageBase) """