mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-09 15:58:48 +00:00
Merge pull request #534 from PR0M3TH3AN/codex/add-color-categories-and-notification-helper
Add notification drainage and new color scheme categories
This commit is contained in:
18
src/main.py
18
src/main.py
@@ -27,6 +27,7 @@ from utils import (
|
|||||||
pause,
|
pause,
|
||||||
clear_and_print_fingerprint,
|
clear_and_print_fingerprint,
|
||||||
)
|
)
|
||||||
|
import queue
|
||||||
from local_bip85.bip85 import Bip85Error
|
from local_bip85.bip85 import Bip85Error
|
||||||
|
|
||||||
|
|
||||||
@@ -100,6 +101,22 @@ def confirm_action(prompt: str) -> bool:
|
|||||||
print(colored("Please enter 'Y' or 'N'.", "red"))
|
print(colored("Please enter 'Y' or 'N'.", "red"))
|
||||||
|
|
||||||
|
|
||||||
|
def drain_notifications(pm: PasswordManager) -> None:
|
||||||
|
"""Display all queued notifications."""
|
||||||
|
queue_obj = getattr(pm, "notifications", None)
|
||||||
|
if queue_obj is None:
|
||||||
|
return
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
note = queue_obj.get_nowait()
|
||||||
|
except queue.Empty:
|
||||||
|
break
|
||||||
|
category = note.level.lower()
|
||||||
|
if category not in ("info", "warning", "error"):
|
||||||
|
category = "info"
|
||||||
|
print(color_text(note.message, category))
|
||||||
|
|
||||||
|
|
||||||
def handle_switch_fingerprint(password_manager: PasswordManager):
|
def handle_switch_fingerprint(password_manager: PasswordManager):
|
||||||
"""
|
"""
|
||||||
Handles switching the active fingerprint.
|
Handles switching the active fingerprint.
|
||||||
@@ -932,6 +949,7 @@ def display_menu(
|
|||||||
for handler in logging.getLogger().handlers:
|
for handler in logging.getLogger().handlers:
|
||||||
handler.flush()
|
handler.flush()
|
||||||
print(color_text(menu, "menu"))
|
print(color_text(menu, "menu"))
|
||||||
|
drain_notifications(password_manager)
|
||||||
try:
|
try:
|
||||||
choice = timed_input(
|
choice = timed_input(
|
||||||
"Enter your choice (1-8) or press Enter to exit: ",
|
"Enter your choice (1-8) or press Enter to exit: ",
|
||||||
|
@@ -20,6 +20,9 @@ _COLOR_MAP = {
|
|||||||
"index": "yellow",
|
"index": "yellow",
|
||||||
"menu": "cyan",
|
"menu": "cyan",
|
||||||
"stats": "green",
|
"stats": "green",
|
||||||
|
"info": "cyan",
|
||||||
|
"warning": "yellow",
|
||||||
|
"error": "red",
|
||||||
"default": "white",
|
"default": "white",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user