Skip to content

Commit

Permalink
Merge pull request #13 from zevlee/change-save-settings
Browse files Browse the repository at this point in the history
Change when settings are saved
  • Loading branch information
zevlee authored Oct 30, 2022
2 parents 96c1950 + 4e68f79 commit 6b3f369
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,16 @@ def _generate_password(self):
generated = password.generate_password()
self.password.set_text(generated)
self.password_length.set_text(f"Length: {len(generated)}")
# Save the settings used to generate the password
# Save the settings used to generate the password if changed
for k, v in zip(
["lst", "mnw", "mxw", "wrd", "sep", "cap", "num", "sym"],
[lst, mnw, mxw, wrd, sep, cap, num, sym]
):
self.config[k] = v
with open(join(Utils.CONFIG_DIR, "settings.json"), "w") as c:
c.write(dumps(self.config))
c.close()
if Utils.read_config("settings.json") != self.config:
with open(join(Utils.CONFIG_DIR, "settings.json"), "w") as c:
c.write(dumps(self.config))
c.close()

def on_generate_clicked(self, button):
"""
Expand Down

0 comments on commit 6b3f369

Please sign in to comment.