src/eric7/Preferences/ConfigurationPages/MasterPasswordEntryDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/Preferences/ConfigurationPages/MasterPasswordEntryDialog.py
--- a/src/eric7/Preferences/ConfigurationPages/MasterPasswordEntryDialog.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/Preferences/ConfigurationPages/MasterPasswordEntryDialog.py	Wed Jul 13 14:55:47 2022 +0200
@@ -17,26 +17,27 @@
     """
     Class implementing a dialog to enter or change the master password.
     """
+
     def __init__(self, oldPasswordHash, parent=None):
         """
         Constructor
-        
+
         @param oldPasswordHash hash of the current password (string)
         @param parent reference to the parent widget (QWidget)
         """
         super().__init__(parent)
         self.setupUi(self)
-        
+
         self.__oldPasswordHash = oldPasswordHash
         if self.__oldPasswordHash == "":
             self.currentPasswordEdit.setEnabled(False)
             if hasattr(self.currentPasswordEdit, "setPlaceholderText"):
                 self.currentPasswordEdit.setPlaceholderText(
-                    self.tr("(not defined yet)"))
-        
-        self.buttonBox.button(
-            QDialogButtonBox.StandardButton.Ok).setEnabled(False)
-    
+                    self.tr("(not defined yet)")
+                )
+
+        self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False)
+
     def __updateUI(self):
         """
         Private slot to update the variable parts of the UI.
@@ -45,74 +46,74 @@
         error = ""
         if self.currentPasswordEdit.isEnabled():
             from Utilities.crypto.py3PBKDF2 import verifyPassword
+
             enable = verifyPassword(
-                self.currentPasswordEdit.text(), self.__oldPasswordHash)
+                self.currentPasswordEdit.text(), self.__oldPasswordHash
+            )
             if not enable:
                 error = error or self.tr("Wrong password entered.")
-        
+
         if self.newPasswordEdit.text() == "":
             enable = False
             error = error or self.tr("New password must not be empty.")
-        
+
         if (
-            self.newPasswordEdit.text() != "" and
-            self.newPasswordEdit.text() != self.newPasswordAgainEdit.text()
+            self.newPasswordEdit.text() != ""
+            and self.newPasswordEdit.text() != self.newPasswordAgainEdit.text()
         ):
             enable = False
             error = error or self.tr("Repeated password is wrong.")
-        
+
         if (
-            self.currentPasswordEdit.isEnabled() and
-            self.newPasswordEdit.text() == self.currentPasswordEdit.text()
+            self.currentPasswordEdit.isEnabled()
+            and self.newPasswordEdit.text() == self.currentPasswordEdit.text()
         ):
             enable = False
-            error = error or self.tr(
-                "Old and new password must not be the same.")
-        
-        self.buttonBox.button(
-            QDialogButtonBox.StandardButton.Ok).setEnabled(enable)
+            error = error or self.tr("Old and new password must not be the same.")
+
+        self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enable)
         self.errorLabel.setText(error)
-    
+
     @pyqtSlot(str)
     def on_currentPasswordEdit_textChanged(self, txt):
         """
         Private slot to handle changes of the current password.
-        
+
         @param txt content of the edit widget (string)
         """
         self.__updateUI()
-    
+
     @pyqtSlot(str)
     def on_newPasswordEdit_textChanged(self, txt):
         """
         Private slot to handle changes of the new password.
-        
+
         @param txt content of the edit widget (string)
         """
         self.passwordMeter.checkPasswordStrength(txt)
         self.__updateUI()
-    
+
     @pyqtSlot(str)
     def on_newPasswordAgainEdit_textChanged(self, txt):
         """
         Private slot to handle changes of the new again password.
-        
+
         @param txt content of the edit widget (string)
         """
         self.__updateUI()
-    
+
     def getMasterPassword(self):
         """
         Public method to get the new master password.
-        
+
         @return new master password (string)
         """
         return self.newPasswordEdit.text()
-    
+
     def getCurrentPassword(self):
         """
         Public method to get the current master password.
-        
+
         @return current master password (string)
         """
         return self.currentPasswordEdit.text()

eric ide

mercurial