mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-09 07:48:57 +00:00
Merge pull request #303 from PR0M3TH3AN/codex/fix-premature-screen-wipe-during-entry-add
Improve TUI interaction timing
This commit is contained in:
@@ -188,6 +188,13 @@ class PasswordManager:
|
||||
self.locked = False
|
||||
self.update_activity()
|
||||
|
||||
def pause(self, prompt: str = "Press Enter to continue...") -> None:
|
||||
"""Wait for the user to press Enter before proceeding."""
|
||||
try:
|
||||
input(colored(prompt, "cyan"))
|
||||
except (EOFError, KeyboardInterrupt):
|
||||
print()
|
||||
|
||||
def initialize_fingerprint_manager(self):
|
||||
"""
|
||||
Initializes the FingerprintManager.
|
||||
@@ -936,6 +943,7 @@ class PasswordManager:
|
||||
f"Failed to post updated index to Nostr: {nostr_error}",
|
||||
exc_info=True,
|
||||
)
|
||||
self.pause()
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"Error during password generation: {e}", exc_info=True)
|
||||
@@ -1027,6 +1035,7 @@ class PasswordManager:
|
||||
f"Failed to post updated index to Nostr: {nostr_error}",
|
||||
exc_info=True,
|
||||
)
|
||||
self.pause()
|
||||
break
|
||||
except ValueError as err:
|
||||
print(colored(f"Error: {err}", "red"))
|
||||
@@ -1073,6 +1082,7 @@ class PasswordManager:
|
||||
f"Failed to post updated index to Nostr: {nostr_error}",
|
||||
exc_info=True,
|
||||
)
|
||||
self.pause()
|
||||
except Exception as e:
|
||||
logging.error(f"Error during SSH key setup: {e}", exc_info=True)
|
||||
print(colored(f"Error: Failed to add SSH key: {e}", "red"))
|
||||
@@ -1119,6 +1129,7 @@ class PasswordManager:
|
||||
f"Failed to post updated index to Nostr: {nostr_error}",
|
||||
exc_info=True,
|
||||
)
|
||||
self.pause()
|
||||
except Exception as e:
|
||||
logging.error(f"Error during seed phrase setup: {e}", exc_info=True)
|
||||
print(colored(f"Error: Failed to add seed phrase: {e}", "red"))
|
||||
@@ -1169,6 +1180,7 @@ class PasswordManager:
|
||||
f"Failed to post updated index to Nostr: {nostr_error}",
|
||||
exc_info=True,
|
||||
)
|
||||
self.pause()
|
||||
except Exception as e:
|
||||
logging.error(f"Error during PGP key setup: {e}", exc_info=True)
|
||||
print(colored(f"Error: Failed to add PGP key: {e}", "red"))
|
||||
@@ -1210,6 +1222,7 @@ class PasswordManager:
|
||||
f"Failed to post updated index to Nostr: {nostr_error}",
|
||||
exc_info=True,
|
||||
)
|
||||
self.pause()
|
||||
except Exception as e:
|
||||
logging.error(f"Error during Nostr key setup: {e}", exc_info=True)
|
||||
print(colored(f"Error: Failed to add Nostr key: {e}", "red"))
|
||||
|
@@ -51,6 +51,7 @@ def test_handle_add_totp(monkeypatch, capsys):
|
||||
)
|
||||
monkeypatch.setattr("builtins.input", lambda *args, **kwargs: next(inputs))
|
||||
monkeypatch.setattr(pm, "sync_vault", lambda: None)
|
||||
monkeypatch.setattr(pm, "pause", lambda *a, **k: None)
|
||||
|
||||
pm.handle_add_totp()
|
||||
out = capsys.readouterr().out
|
||||
|
@@ -66,6 +66,7 @@ def test_manager_workflow(monkeypatch):
|
||||
]
|
||||
)
|
||||
monkeypatch.setattr("builtins.input", lambda *args, **kwargs: next(inputs))
|
||||
monkeypatch.setattr(pm, "pause", lambda *a, **k: None)
|
||||
|
||||
pm.handle_add_password()
|
||||
assert pm.is_dirty is False
|
||||
|
Reference in New Issue
Block a user