class documentation
Class to manage loading and running apps dynamically.
| Method | __del__ |
Cleanup loaded apps on deletion |
| Method | __init__ |
Initialize the AppLoader with a view manager. |
| Method | cleanup |
Remove all app modules from sys.modules |
| Method | list |
List available apps in the picoware/apps directory or subdirectory. |
| Method | list |
List all loaded apps. |
| Method | load |
Load an app module dynamically and verify its required methods. |
| Method | load |
Add a VFS path to sys.path so modules can be imported directly. |
| Method | run |
Run the currently loaded app |
| Method | start |
Start a specific app. |
| Method | stop |
Stop the current app |
| Method | switch |
Switch to a different app. |
| Instance Variable | current |
Reference to the currently running app module. |
| Instance Variable | loaded |
Dictionary to cache loaded app modules, keyed by app name. |
| Instance Variable | view |
The view manager instance for display and storage access. |
| Instance Variable | _vfs |
Flag indicating whether the VFS is ready for app loading. |
Initialize the AppLoader with a view manager.
| Parameters | |
viewViewManager | The view manager instance for display and storage access. |
mountbool | Whether to mount the VFS for app loading. Defaults to False. |
List available apps in the picoware/apps directory or subdirectory.
| Parameters | |
subdirectory:str | Optional subdirectory within picoware/apps. Defaults to "". |
| Returns | |
list[str] | Names of apps with .py or .mpy extensions, sorted alphabetically. |
Load an app module dynamically and verify its required methods.
| Parameters | |
appstr | Name of the app module to load (without extension). |
subdirectory:str | Optional subdirectory within picoware/apps. Defaults to "". |
| Returns | |
object or None | The loaded app module, or None if loading failed. |
| Raises | |
RuntimeError | If the VFS is not ready or not mounted. |
AttributeError | If the app module is missing a required method. |
Add a VFS path to sys.path so modules can be imported directly.
Mounts the SD card and adds the given VFS path so modules can be imported with a bare import statement. Useful for testing in Thonny or when manually importing from a specific location.
| Parameters | |
modulestr | Path relative to the VFS root, e.g. "/picoware/apps". |
| Returns | |
bool | True if the path was added to sys.path, False otherwise. |
Start a specific app.
| Parameters | |
appstr | Name of the app module to start. |
| Returns | |
bool | True if the app started successfully, False otherwise. |