sp-hydra-veil-gui/gui/v2/actions/flags.py
2026-06-13 16:19:11 -04:00

63 lines
1.9 KiB
Python
Executable file

from gui.v2.actions.config import load_gui_config, save_gui_config, default_gui_config
def has_shown_systemwide_prompt(gui_config_file):
config = load_gui_config(gui_config_file)
if not config:
return False
return config.get("systemwide", {}).get("prompt_shown", False)
def mark_systemwide_prompt_shown(gui_config_file):
config = load_gui_config(gui_config_file)
if config is None:
config = default_gui_config()
if "systemwide" not in config:
config["systemwide"] = {}
config["systemwide"]["prompt_shown"] = True
save_gui_config(gui_config_file, config)
def has_shown_fast_mode_prompt(gui_config_file):
config = load_gui_config(gui_config_file)
if not config:
return False
return config.get("fast_mode", {}).get("prompt_shown", False)
def mark_fast_mode_prompt_shown(gui_config_file):
config = load_gui_config(gui_config_file)
if config is None:
config = default_gui_config()
if "fast_mode" not in config:
config["fast_mode"] = {}
config["fast_mode"]["prompt_shown"] = True
save_gui_config(gui_config_file, config)
def set_fast_mode_enabled(gui_config_file, enabled):
config = load_gui_config(gui_config_file)
if config is None:
config = default_gui_config()
if "registrations" not in config:
config["registrations"] = {}
config["registrations"]["fast_registration_enabled"] = bool(enabled)
save_gui_config(gui_config_file, config)
def check_first_launch(gui_config_file):
config = load_gui_config(gui_config_file)
if config is None:
config = default_gui_config()
is_first_launch = not config.get(
"first_launch", {}).get("completed", False)
if is_first_launch:
if "first_launch" not in config:
config["first_launch"] = {}
config["first_launch"]["completed"] = True
save_gui_config(gui_config_file, config)
return True
else:
return False