diff --git a/conf.py b/conf.py index 1e03e95..34f1758 100644 --- a/conf.py +++ b/conf.py @@ -79,13 +79,13 @@ LICENSE_ES = LICENSE_EN INFO = { 'en': { - 'display_name': 'My first extension', - 'description': 'My great extension', + 'display_name': 'ZAZ Pass', + 'description': 'Generate passwords', 'license': LICENSE_EN, }, 'es': { - 'display_name': 'Mi primer extensión', - 'description': 'Mi gran extensión', + 'display_name': 'ZAZ Pass', + 'description': 'Generar contraseñas', 'license': LICENSE_ES, }, } diff --git a/files/ZAZPass_v0.1.0.oxt b/files/ZAZPass_v0.1.0.oxt index 615ce34..120611b 100644 Binary files a/files/ZAZPass_v0.1.0.oxt and b/files/ZAZPass_v0.1.0.oxt differ diff --git a/source/description.xml b/source/description.xml index a79f4d3..bd624cf 100644 --- a/source/description.xml +++ b/source/description.xml @@ -3,8 +3,8 @@ - My first extension - Mi primer extensión + ZAZ Pass + ZAZ Pass diff --git a/source/description/desc_en.txt b/source/description/desc_en.txt index b667a4b..8df5af8 100644 --- a/source/description/desc_en.txt +++ b/source/description/desc_en.txt @@ -1 +1 @@ -My great extension \ No newline at end of file +Generate passwords \ No newline at end of file diff --git a/source/description/desc_es.txt b/source/description/desc_es.txt index d8d8fdc..362f8b2 100644 --- a/source/description/desc_es.txt +++ b/source/description/desc_es.txt @@ -1 +1 @@ -Mi gran extensión \ No newline at end of file +Generar contraseñas \ No newline at end of file diff --git a/source/pythonpath/zpass.py b/source/pythonpath/zpass.py index 49fc150..a0e0659 100644 --- a/source/pythonpath/zpass.py +++ b/source/pythonpath/zpass.py @@ -100,6 +100,16 @@ def _password_copy(): return +def _get_quality(strength): + if strength <= 0.33: + quality = _('Week') + elif strength <= 0.66: + quality = _('Medium') + else: + quality = _('Excellent') + return quality + + def _password_generate(id_extension): config = app.get_config('setting', prefix=PREFIX) dialog = _create_dialog(id_extension) @@ -121,7 +131,9 @@ def _password_generate(id_extension): dialog.chk_punctuation.value = punctuation dialog.txt_length.value = length - dialog.txt_password.value = _generate(dialog) + stats = PasswordStats(_generate(dialog)) + dialog.txt_password.value = stats.password + dialog.lbl_quality.value = _get_quality(stats.strength()) dialog.open() return @@ -171,6 +183,7 @@ class Controllers(object): def _new_password(self, save=True): stats = PasswordStats(_generate(self.d)) self.d.txt_password.value = stats.password + self.d.lbl_quality.value = _get_quality(stats.strength()) if save: self._save_config() return @@ -203,13 +216,14 @@ class Controllers(object): @app.catch_exception def _create_dialog(id_extension): BUTTON_WH = 16 + CHK_HEIGHT = 10 CHK_WIDTH = 25 attr = dict( Name = 'Dialog', Title = _('Generate Password'), Width = 200, - Height = 100, + Height = 120, ) dialog = app.create_dialog(attr) dialog.id = id_extension @@ -266,7 +280,7 @@ def _create_dialog(id_extension): Spin = True, Value = 25, ValueStep = 1, - ValueMin = 10, + ValueMin = 5, ValueMax = 100, ) dialog.add_control(attr) @@ -276,7 +290,7 @@ def _create_dialog(id_extension): Name = 'chk_letters', Label = 'A-Z', Width = CHK_WIDTH, - Height = BUTTON_WH, + Height = CHK_HEIGHT, ) dialog.add_control(attr) @@ -285,7 +299,7 @@ def _create_dialog(id_extension): Name = 'chk_letters2', Label = 'a-z', Width = CHK_WIDTH, - Height = BUTTON_WH, + Height = CHK_HEIGHT, ) dialog.add_control(attr) @@ -294,7 +308,7 @@ def _create_dialog(id_extension): Name = 'chk_digits', Label = '0-9', Width = CHK_WIDTH, - Height = BUTTON_WH, + Height = CHK_HEIGHT, ) dialog.add_control(attr) @@ -303,7 +317,31 @@ def _create_dialog(id_extension): Name = 'chk_punctuation', Label = string.punctuation, Width = CHK_WIDTH * 4, + Height = CHK_HEIGHT, + ) + dialog.add_control(attr) + + attr = dict( + Type = 'Label', + Name = 'lbl_title_quality', + Label = _('Password Quality:'), + Width = 75, Height = BUTTON_WH, + Border = app.Border.BORDER, + Align = app.RIGHT, + VerticalAlign = app.MIDDLE, + ) + dialog.add_control(attr) + + attr = dict( + Type = 'Label', + Name = 'lbl_quality', + Label = _('Poor'), + Width = 35, + Height = BUTTON_WH, + Border = app.Border.BORDER, + Align = app.CENTER, + VerticalAlign = app.MIDDLE, ) dialog.add_control(attr) @@ -338,6 +376,9 @@ def _create_dialog(id_extension): dialog.chk_digits.move(dialog.chk_letters2, x=3, y=0) dialog.chk_punctuation.move(dialog.chk_digits, x=3, y=0) + dialog.lbl_title_quality.move(dialog.chk_letters) + dialog.lbl_quality.move(dialog.lbl_title_quality, x=3, y=0) + dialog.center(dialog.cmd_insert, y=-5) dialog.center(dialog.cmd_close, y=-5) dialog.center((dialog.cmd_close, dialog.cmd_insert))