Merge 5e1ca52e35 into 508a0f5b87
This commit is contained in:
commit
be7a769b8c
3 changed files with 53 additions and 39 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import supervisor
|
||||
from adafruit_argv_file import read_argv, write_argv
|
||||
import adafruit_pathlib as pathlib
|
||||
import storage
|
||||
|
||||
supervisor.runtime.autoreload = False
|
||||
|
|
@ -44,4 +45,7 @@ else:
|
|||
if supervisor.runtime.display is None:
|
||||
supervisor.set_next_code_file("code.py")
|
||||
else:
|
||||
for next_code_file in ("/sd/boot_animation.py", "boot_animation.py"):
|
||||
if pathlib.Path(next_code_file).exists():
|
||||
supervisor.set_next_code_file("boot_animation.py")
|
||||
break
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@ import audiobusio
|
|||
import adafruit_pathlib as pathlib
|
||||
|
||||
launcher_config = {}
|
||||
if pathlib.Path("launcher.conf.json").exists():
|
||||
with open("launcher.conf.json", "r") as f:
|
||||
launcher_config = json.load(f)
|
||||
for launcher_config_path in ("launcher.conf.json", "/sd/launcher.conf.json"):
|
||||
if pathlib.Path(launcher_config_path).exists():
|
||||
with open(launcher_config_path, "r") as f:
|
||||
launcher_config = launcher_config | json.load(f)
|
||||
|
||||
BOX_SIZE = (235, 107)
|
||||
TARGET_FPS = 70
|
||||
|
|
|
|||
21
src/code.py
21
src/code.py
|
|
@ -69,9 +69,10 @@ if display.width > 360:
|
|||
scale = 2
|
||||
|
||||
launcher_config = {}
|
||||
if pathlib.Path("launcher.conf.json").exists():
|
||||
with open("launcher.conf.json", "r") as f:
|
||||
launcher_config = json.load(f)
|
||||
for launcher_config_path in ("launcher.conf.json", "/sd/launcher.conf.json"):
|
||||
if pathlib.Path(launcher_config_path).exists():
|
||||
with open(launcher_config_path, "r") as f:
|
||||
launcher_config = launcher_config | json.load(f)
|
||||
if "palette" not in launcher_config:
|
||||
launcher_config["palette"] = {}
|
||||
|
||||
|
|
@ -174,12 +175,19 @@ scaled_group.append(menu_title_txt)
|
|||
|
||||
app_titles = []
|
||||
apps = []
|
||||
app_path = pathlib.Path("/apps")
|
||||
app_paths = (
|
||||
pathlib.Path("/apps"),
|
||||
pathlib.Path("/sd/apps")
|
||||
)
|
||||
|
||||
pages = [{}]
|
||||
|
||||
cur_file_index = 0
|
||||
|
||||
for app_path in app_paths:
|
||||
if not app_path.exists():
|
||||
continue
|
||||
|
||||
for path in app_path.iterdir():
|
||||
print(path)
|
||||
|
||||
|
|
@ -223,8 +231,9 @@ if "favorites" in launcher_config:
|
|||
for favorite_app in reversed(launcher_config["favorites"]):
|
||||
print("checking favorite", favorite_app)
|
||||
for app in apps:
|
||||
print(f"checking app: {app["dir"]}")
|
||||
if app["dir"] == f"/apps/{favorite_app}":
|
||||
app_name = str(app["dir"].absolute()).split("/")[-1]
|
||||
print(f"checking app: {app_name}")
|
||||
if app_name == favorite_app:
|
||||
apps.remove(app)
|
||||
apps.insert(0, app)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue