UI Improvements

This commit is contained in:
2025-10-13 15:02:13 -04:00
parent 21370898a4
commit 864ae04db5
730 changed files with 10917 additions and 128 deletions
+7 -5
View File
@@ -17,11 +17,13 @@
import logging
from typing import Any, List, Optional, Union
from utils.utils import get_sanitized_input
logger = logging.getLogger(__name__)
from typing import List, Optional, Union, Any, Callable
import logging
from typing import Callable
logger = logging.getLogger(__name__)
@@ -63,7 +65,7 @@ class Selector:
if allow_multiple:
while True:
choice = input("Select an item by number (or Q to finish): ").strip().lower()
choice = get_sanitized_input("Select an item by number (or Q to finish): ").strip().lower()
if choice == "q":
break
try:
@@ -83,7 +85,7 @@ class Selector:
return selected if selected else None
else:
try:
choice = int(input("Select one item by number: "))
choice = int(get_sanitized_input("Select one item by number: "))
if 1 <= choice <= len(sorted_items):
selected_item = sorted_items[choice - 1]
logger.info(f"Selected: {label_func(selected_item)}")
@@ -144,7 +146,7 @@ class Selector:
allow_quit: bool = False
) -> Optional[Any]:
while True:
user_input = input(prompt).strip().lower()
user_input = get_sanitized_input(prompt).strip().lower()
if allow_quit and user_input == "q":
logger.info("User opted to quit value selection.")
return None
@@ -163,7 +165,7 @@ class Selector:
@staticmethod
def confirm(prompt: str = "Are you sure? (Y/N): ") -> bool:
while True:
response = input(prompt).strip().lower()
response = get_sanitized_input(prompt).strip().lower()
if response in ["y", "yes"]:
logger.info("User confirmed action.")
return True