From 95e73b141ca8f3618701ff59658ef519353cc7c0 Mon Sep 17 00:00:00 2001 From: Chandler J Date: Fri, 12 Apr 2024 20:44:47 -0600 Subject: major changes: - Can now save/load themes which entails the color scheme and wallpaper - Can now use themes to load colors independent of background image - refactoring to make code less bad --- src/get_args.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/get_args.py') diff --git a/src/get_args.py b/src/get_args.py index ebdf464..da6476e 100644 --- a/src/get_args.py +++ b/src/get_args.py @@ -7,15 +7,16 @@ def get_args(args, walls_dir) -> tuple: # arguments that can be passed into program initialize = False reconfigure = False - color_save = None + theme = None VALID_ARGS = ['-r', '-p', '--initialize', '--reconfigure'] + if '-p' in args: index = args.index('-p') - if os.path.isfile(args[index + 1]): - color_save = manage_saves.load_color_palette(args[index + 1]) - else: - print('invalid arguments. -p should be followed by a color palette save') - exit(2) + isFile = os.path.isfile(args[index + 1]) + if isFile == True: + print("reached") + theme = manage_saves.load_theme(args[index + 1]) + if '-r' in args: img_path = user_interface.pickRandomWallpaper(walls_dir) @@ -24,13 +25,13 @@ def get_args(args, walls_dir) -> tuple: if not os.path.exists(img_path) and\ args[1] not in VALID_ARGS: print(f'[bold red]ERROR: invalid image path {os.getcwd()}/{args[1]}') - exit(3) + exit(2) if '--initialize' in args: initialize = True if '--reconfigure' in args: reconfigure = True - return img_path, initialize, reconfigure, color_save + return img_path, initialize, reconfigure, theme def usage(args) -> None: print(f"""Instant Rice - An automatic theming utilitiy -- cgit v1.2.3