Skip to content

Commit 281c937

Browse files
Fix imports on esp32
Weirdly enough, these worked on desktop but not esp32...
1 parent ba21d86 commit 281c937

File tree

1 file changed

+8
-14
lines changed
  • internal_filesystem/lib/mpos

1 file changed

+8
-14
lines changed

internal_filesystem/lib/mpos/main.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
import task_handler
22
import _thread
33
import lvgl as lv
4-
import mpos
4+
55
import mpos.apps
6-
import mpos.config
76
import mpos.ui
8-
9-
from .content.package_manager import PackageManager
10-
from .ui.appearance_manager import AppearanceManager
11-
from .ui.display_metrics import DisplayMetrics
12-
137
import mpos.ui.topmenu
14-
from .task_manager import TaskManager
158

9+
from mpos import AppearanceManager, DisplayMetrics, PackageManager, SharedPreferences, TaskManager
1610

1711
# White text on black logo works (for dark mode) and can be inverted (for light mode)
1812
logo_white = "M:builtin/res/mipmap-mdpi/MicroPythonOS-logo-white-long-w296.png" # from the MPOS-logo repo
@@ -80,7 +74,7 @@ def detect_board():
8074
fs_drv = lv.fs_drv_t()
8175
mpos.fs_driver.fs_register(fs_drv, 'M')
8276

83-
prefs = mpos.config.SharedPreferences("com.micropythonos.settings")
77+
prefs = SharedPreferences("com.micropythonos.settings")
8478

8579
AppearanceManager.init(prefs)
8680
init_rootscreen()
@@ -145,7 +139,7 @@ def custom_exception_handler(e):
145139
async def asyncio_repl():
146140
print("Starting very limited asyncio REPL task. To stop all asyncio tasks and go to real REPL, do: import mpos ; mpos.TaskManager.stop()")
147141
await aiorepl.task()
148-
mpos.TaskManager.create_task(asyncio_repl()) # only gets started when mpos.TaskManager.start() is created
142+
TaskManager.create_task(asyncio_repl()) # only gets started after TaskManager.start()
149143

150144
async def ota_rollback_cancel():
151145
try:
@@ -157,11 +151,11 @@ async def ota_rollback_cancel():
157151
if not started_launcher:
158152
print(f"WARNING: launcher {launcher_app} failed to start, not cancelling OTA update rollback")
159153
else:
160-
mpos.TaskManager.create_task(ota_rollback_cancel()) # only gets started when mpos.TaskManager() is created
154+
TaskManager.create_task(ota_rollback_cancel()) # only gets started after TaskManager.start()
161155

162156
try:
163-
mpos.TaskManager.start() # do this at the end because it doesn't return
157+
TaskManager.start() # do this at the end because it doesn't return
164158
except KeyboardInterrupt as k:
165-
print(f"mpos.TaskManager() got KeyboardInterrupt, falling back to REPL shell...") # only works if no aiorepl is running
159+
print(f"TaskManager.start() got KeyboardInterrupt, falling back to REPL shell...") # only works if no aiorepl is running
166160
except Exception as e:
167-
print(f"mpos.TaskManager() got exception: {e}")
161+
print(f"TaskManager.start() got exception: {e}")

0 commit comments

Comments
 (0)