Skip to content

Commit 18c78f1

Browse files
Doom app: simplify further
1 parent 0743cce commit 18c78f1

File tree

1 file changed

+2
-9
lines changed
  • internal_filesystem/apps/com.micropythonos.doom/assets

1 file changed

+2
-9
lines changed

internal_filesystem/apps/com.micropythonos.doom/assets/doom.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,12 @@ def refresh_wad_list(self):
110110
warning = self.get_file_size_warning(self.bootfile_prefix + self.doomdir + '/' + wad_file)
111111
button_text = wad_file + warning
112112
button = self.wadlist.add_button(None, button_text)
113-
button.add_event_cb(lambda e, f=wad_file: TaskManager.create_task(self.start_wad_file(f)), lv.EVENT.CLICKED, None)
113+
button.add_event_cb(lambda e, p=self.doomdir + '/' + wad_file: TaskManager.create_task(self.start_wad(self.bootfile_prefix, self.bootfile_to_write, p)), lv.EVENT.CLICKED, None)
114114

115115
# If only one WAD file, auto-start it
116116
if len(all_wads) == 1:
117117
print(f"refresh_wad_list: Only one WAD file found, auto-starting: {all_wads[0]}")
118-
TaskManager.create_task(self.start_wad_file(all_wads[0]))
119-
120-
async def start_wad_file(self, wad_file):
121-
"""Start a WAD file (called from list selection or auto-start)"""
122-
print(f"start_wad_file: WAD file selected: {wad_file}")
123-
wadfile_path = self.bootfile_prefix + self.doomdir + '/' + wad_file
124-
# Do it in a separate task so the UI doesn't hang (shows progress, status_label) and the serial console keeps showing prints
125-
await self.start_wad(self.bootfile_prefix, self.bootfile_to_write, wadfile_path)
118+
TaskManager.create_task(self.start_wad(self.bootfile_prefix, self.bootfile_to_write, self.doomdir + '/' + all_wads[0]))
126119

127120
def mkdir(self, dirname):
128121
# Would be better to only create it if it doesn't exist

0 commit comments

Comments
 (0)