Skip to content

Commit

Permalink
Bugfix: Allow custom generators to be toggled on/off
Browse files Browse the repository at this point in the history
  • Loading branch information
deanishe committed Aug 1, 2015
1 parent c1247f9 commit bb23cae
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
Binary file not shown.
7 changes: 5 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
Features to add:
Improvements:

New features:
- Allow default strength to be a bit value, e.g. `64b`

Optional features:
Bugs:

___________________
Archive:
- Can't disable user-defined generators. @done(15-08-01 00:39) @project(Bugs)
- Make word-based passwords work better with specific lengths. @done(15-07-28 13:19) @project(Features to add)
- Implement configuration @done(15-07-28 11:34) @project(Features to add)
4 changes: 4 additions & 0 deletions src/generators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ def get_generators():
import_generators(builtin_dir)

for klass in get_subclasses(PassGenBase):
# Ignore base classes
if klass.__name__ == 'WordGenBase':
continue

try:
inst = klass()
log.debug('Loaded generator : `%s`', inst.name)
Expand Down
10 changes: 5 additions & 5 deletions src/pwgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,19 +268,16 @@ def do_generate(self):
# log.debug('[%s] %s', g.id_, g.password())
if mode == 'length':
pw, entropy = g.password(length=pw_length)
# subtitle = 'Strength : %0.2f // %s' % (entropy, g.description)
else:
pw, entropy = g.password(strength=pw_strength)

if wf.settings.get('strength_bar'):
strength = pw_strength_meter(entropy)
else:
strength = 'Strength : %0.1f bits' % entropy
strength = 'Strength : %0.1f bits //' % entropy

subtitle = ('%s // Length : %d // %s' %
subtitle = ('%s Length : %d // %s' %
(strength, len(pw), g.description))
# subtitle = ('Strength : %0.2f // Length : %d // %s' %
# (entropy, len(pw), g.description))

wf.add_item(pw,
subtitle,
Expand Down Expand Up @@ -450,6 +447,9 @@ def do_toggle(self):
print('Turned strength bar {0}'.format(mode))

else: # Generator toggles

self.load_user_generators()

gen = None
for g in get_generators():
if g.id_ == gen_id:
Expand Down
2 changes: 1 addition & 1 deletion src/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2
1.2.1

0 comments on commit bb23cae

Please sign in to comment.