diff --git a/install.sh b/install.sh index 99abfcda..953b985d 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,5 @@ ~/sources/lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py fs cp boot.py :/boot.py ~/sources/lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py fs cp main.py :/main.py +~/sources/lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py fs cp launcher.py :/launcher.py ~/sources/lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py reset diff --git a/launcher.py b/launcher.py index d77deb2a..b55a9717 100644 --- a/launcher.py +++ b/launcher.py @@ -22,19 +22,20 @@ def parse_manifest(manifest_path): # Function to load PNG icon def load_icon(icon_path): try: - image = lv.image(lv.screen_active()) + image = lv.image(subwindow) image.set_src(icon_path) return image except Exception as e: print(f"Error loading icon {icon_path}: {e}") # Fallback: create a placeholder image - image = lv.image(lv.screen_active()) + image = lv.image(subwindow) image.set_src(lv.SYMBOL.DUMMY) # Or use a default image return image # Function to handle icon/label click def on_app_click(event, app_name, app_dir): + print("it clicked") if event.get_code() == lv.EVENT.CLICKED: print(f"Launching app: {app_name} ({app_dir})") @@ -50,7 +51,7 @@ def create_app_launcher(): print("Error accessing /apps directory") return # Create a container for the grid - cont = lv.obj(lv.screen_active()) + cont = lv.obj(subwindow) cont.set_size(lv.pct(100), lv.pct(100)) cont.set_style_pad_all(10, 0) cont.set_style_border_width(0, 0) @@ -85,8 +86,10 @@ def create_app_launcher(): label.align(lv.ALIGN.BOTTOM_MID, 0, 0) label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) # Add click event to both icon and label - image.add_event_cb(lambda e: on_app_click(e, app_name, app_dir), lv.EVENT.CLICKED, None) - label.add_event_cb(lambda e: on_app_click(e, app_name, app_dir), lv.EVENT.CLICKED, None) + #image.add_event_cb(lambda e: on_app_click(e, app_name, app_dir), lv.EVENT.CLICKED, None) + #label.add_event_cb(lambda e: on_app_click(e, app_name, app_dir), lv.EVENT.CLICKED, None) + #app_cont.add_event_cb(lambda e: print("nice"), lv.EVENT.CLICKED, None) + app_cont.add_event_cb(lambda e: on_app_click(e, app_name, app_dir), lv.EVENT.CLICKED, None) # Run the app launcher diff --git a/main.py b/main.py index 69fd2086..68335110 100644 --- a/main.py +++ b/main.py @@ -390,6 +390,7 @@ print("Launcher script exiting") """ -run_app(launcher_script,False,False) +#run_app(launcher_script,False,False) +run_app("/launcher.py",True,False)