eric7/E5Gui/EricPasswordMeter.py

branch
eric7
changeset 8358
144a6b854f70
parent 8357
a081458cc57b
child 8359
0e29e54e9269
diff -r a081458cc57b -r 144a6b854f70 eric7/E5Gui/EricPasswordMeter.py
--- a/eric7/E5Gui/EricPasswordMeter.py	Sat May 22 19:52:34 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2011 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
-#
-
-"""
-Module implementing a custom widget indicating the strength of a password.
-"""
-
-from PyQt6.QtWidgets import QProgressBar
-
-from Utilities.PasswordChecker import PasswordChecker
-
-
-class EricPasswordMeter(QProgressBar):
-    """
-    Class implementing a custom widget indicating the strength of a password.
-    """
-    def __init__(self, parent=None):
-        """
-        Constructor
-        
-        @param parent reference to the parent widget (QWidget)
-        """
-        super().__init__(parent)
-        
-        super().setTextVisible(False)
-        super().setMaximum(100)
-        self.__increment = 100 // (PasswordChecker.Complexity_VeryStrong + 1)
-        
-        self.__indicatorColors = [
-            "#ff0000",      # red
-            "#ff8800",      # orange
-            "#ffff00",      # yellow
-            "#ccff00",      # yellow green
-            "#00ff00",      # green
-        ]
-        self.__noIndicator = "#ffffff"
-        
-        self.__styleSheetTemplate = (
-            "QProgressBar {{"
-            " border: 2px solid black;"
-            " border-radius: 5px;"
-            " text-align: center; }}"
-            "QProgressBar::chunk:horizontal {{"
-            " background-color: {0}; }}"
-        )
-        self.setStyleSheet(
-            self.__styleSheetTemplate.format(self.__noIndicator))
-    
-    def checkPasswordStrength(self, password):
-        """
-        Public slot to check the password strength and update the
-        progress bar accordingly.
-        
-        @param password password to be checked (string)
-        """
-        strength = PasswordChecker().checkPassword(password)
-        self.setStyleSheet(self.__styleSheetTemplate.format(
-            self.__indicatorColors[strength]))
-        super().setValue(
-            (strength + 1) * self.__increment)
-    
-    def setValue(self, value):
-        """
-        Public method to set the value.
-        
-        Overwritten to do nothing.
-        
-        @param value value (integer)
-        """
-        pass
-    
-    def setMaximum(self, value):
-        """
-        Public method to set the maximum value.
-        
-        Overwritten to do nothing.
-        
-        @param value maximum value (integer)
-        """
-        pass
-    
-    def setMinimum(self, value):
-        """
-        Public method to set the minimal value.
-        
-        Overwritten to do nothing.
-        
-        @param value minimum value (integer)
-        """
-        pass
-
-if __name__ == "__main__":
-    import sys
-    from PyQt6.QtWidgets import QApplication
-    
-    app = QApplication(sys.argv)
-    meter = EricPasswordMeter()
-    meter.show()
-    meter.checkPasswordStrength("Blah2+")
-    app.exec()

eric ide

mercurial