Merge branch 'main' into zdy

This commit is contained in:
David Chang
2023-12-25 20:29:20 +08:00
80 changed files with 835 additions and 90 deletions

View File

@@ -8,6 +8,7 @@ import os.path
from typing import Dict, List
from typing import Any
class SetupController:
def __init__( self
, http_server: str
@@ -41,10 +42,10 @@ class SetupController:
assert hasattr(self, setup_function)
getattr(self, setup_function)(**parameters)
#self._download_setup(config)
#self._change_wallpaper(config)
# self._download_setup(config)
# self._change_wallpaper(config)
# self._tidy_desktop(config) todo: implement this
#self._open_setup(config)
# self._open_setup(config)
# can add other setup steps
def _download_setup(self, files: List[Dict[str, str]]):
@@ -57,11 +58,11 @@ class SetupController:
}
"""
#if not config:
#return
#if not 'download' in config:
#return
#for url, path in config['download']:
# if not config:
# return
# if not 'download' in config:
# return
# for url, path in config['download']:
for f in files:
url: str = f["url"]
path: str = f["path"]
@@ -119,12 +120,12 @@ class SetupController:
print("An error occurred while trying to send the request:", e)
def _change_wallpaper_setup(self, path: str):
#if not config:
#return
#if not 'wallpaper' in config:
#return
# if not config:
# return
# if not 'wallpaper' in config:
# return
#path = config['wallpaper']
# path = config['wallpaper']
if not path:
raise Exception(f"Setup Wallpaper - Invalid path ({path}).")
@@ -147,11 +148,11 @@ class SetupController:
raise NotImplementedError
def _open_setup(self, path: str):
#if not config:
#return
#if not 'open' in config:
#return
#for path in config['open']:
# if not config:
# return
# if not 'open' in config:
# return
# for path in config['open']:
if not path:
raise Exception(f"Setup Open - Invalid path ({path}).")