Refactor: Move theme and display settings to a dedicated Settings menu
All checks were successful
Build Tamigo CLI / Build Linux Binary (pull_request) Successful in 53s
Build Tamigo CLI / Build Windows Binary (pull_request) Successful in 44s

This commit is contained in:
Daniel Dybing
2026-03-14 11:53:53 +01:00
parent d0196fefd0
commit b100533e03

View File

@@ -315,14 +315,10 @@ def main():
def menu(client):
while True:
show_zero = current_config.get("show_zero_hours", False)
toggle_text = "HIDE ZERO-HOUR DAYS" if show_zero else "SHOW ZERO-HOUR DAYS"
if current_theme_name != "fallout":
toggle_text = "Hide zero-hour days" if show_zero else "Show zero-hour days"
settings_text = "SETTINGS" if current_theme_name == "fallout" else "Settings"
choice = questionary.select(
"SELECT ACTION:" if current_theme_name == "fallout" else "What would you like to do?",
choices=["Calculate actual work days", "Export hours worked", "Show profile info", "Switch UI Theme", toggle_text, "Logout and Exit"],
choices=["Calculate actual work days", "Export hours worked", "Show profile info", settings_text, "Logout and Exit"],
style=theme_data["questionary"]
).ask()
@@ -331,7 +327,28 @@ def menu(client):
elif choice == "Show profile info":
if client.user_info: console.print_json(data=client.user_info)
else: console.print("[error]ERROR: NO PROFILE INFO.[/error]")
elif choice == "Switch UI Theme":
elif choice == settings_text:
settings_menu()
else:
console.print("[highlight]SYSTEM SHUTDOWN...[/highlight]" if current_theme_name == "fallout" else "Exiting...")
break
def settings_menu():
while True:
show_zero = current_config.get("show_zero_hours", False)
toggle_text = "HIDE ZERO-HOUR DAYS" if current_theme_name == "fallout" else "Hide zero-hour days"
if not show_zero:
toggle_text = "SHOW ZERO-HOUR DAYS" if current_theme_name == "fallout" else "Show zero-hour days"
back_text = "BACK" if current_theme_name == "fallout" else "Back"
choice = questionary.select(
"SELECT SETTING:" if current_theme_name == "fallout" else "Settings:",
choices=["Switch UI Theme", toggle_text, back_text],
style=theme_data["questionary"]
).ask()
if choice == "Switch UI Theme":
new_theme = "normal" if current_theme_name == "fallout" else "fallout"
apply_theme(new_theme)
console.print(f"[success]UI THEME SET TO: {new_theme.upper()}[/success]")
@@ -341,7 +358,6 @@ def menu(client):
state = "VISIBLE" if not show_zero else "HIDDEN"
console.print(f"[success]ZERO-HOUR DAYS ARE NOW {state}.[/success]" if current_theme_name == "fallout" else f"[success]Zero-hour days are now {state.lower()}.[/success]")
else:
console.print("[highlight]SYSTEM SHUTDOWN...[/highlight]" if current_theme_name == "fallout" else "Exiting...")
break
if __name__ == "__main__":