From 6a4850a9a27b8bbe04526f53440c08da9d4e76fa Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Tue, 23 Dec 2025 22:34:53 +0100 Subject: [PATCH] Doom app: auto start if only one option --- .../apps/com.micropythonos.doom/assets/doom.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/internal_filesystem/apps/com.micropythonos.doom/assets/doom.py b/internal_filesystem/apps/com.micropythonos.doom/assets/doom.py index 0956e727..bbfe8a9a 100644 --- a/internal_filesystem/apps/com.micropythonos.doom/assets/doom.py +++ b/internal_filesystem/apps/com.micropythonos.doom/assets/doom.py @@ -93,15 +93,21 @@ class Doom(Activity): # Hide status label if we have files self.status_label.add_flag(lv.obj.FLAG.HIDDEN) + # If only one WAD file, auto-start it + if len(all_wads) == 1: + print(f"refresh_wad_list: Only one WAD file found, auto-starting: {all_wads[0]}") + self.start_wad_file(all_wads[0]) + return + # Populate list with WAD files print(f"refresh_wad_list: Populating list with {len(all_wads)} WAD files") for wad_file in all_wads: button = self.wadlist.add_button(None, wad_file) - button.add_event_cb(lambda e, f=wad_file: self.wad_selected_cb(f), lv.EVENT.CLICKED, None) + button.add_event_cb(lambda e, f=wad_file: self.start_wad_file(f), lv.EVENT.CLICKED, None) - def wad_selected_cb(self, wad_file): - """Handle WAD file selection from list""" - print(f"wad_selected_cb: WAD file selected: {wad_file}") + def start_wad_file(self, wad_file): + """Start a WAD file (called from list selection or auto-start)""" + print(f"start_wad_file: WAD file selected: {wad_file}") wadfile_path = self.doomdir + '/' + wad_file # Do it in a separate task so the UI doesn't hang (shows progress, status_label) and the serial console keeps showing prints TaskManager.create_task(self.start_wad(self.bootfile_prefix, self.bootfile_to_write, wadfile_path))