77import _thread
88import traceback
99
10- from mpos import ui
1110import mpos .info
11+ import mpos .ui
1212
1313# Run the script in the current thread:
1414def execute_script (script_source , is_file , is_launcher , is_graphical ):
@@ -26,20 +26,20 @@ def execute_script(script_source, is_file, is_launcher, is_graphical):
2626 else : # is_graphical
2727 if is_launcher :
2828 prevscreen = None
29- newscreen = ui .rootscreen
29+ newscreen = mpos . ui .rootscreen
3030 else :
3131 prevscreen = lv .screen_active ()
3232 newscreen = lv .obj ()
3333 newscreen .set_size (lv .pct (100 ),lv .pct (100 ))
3434 lv .screen_load (newscreen )
3535 script_globals = {
3636 'lv' : lv ,
37- 'NOTIFICATION_BAR_HEIGHT' : ui .NOTIFICATION_BAR_HEIGHT , # for apps that want to leave space for notification bar
37+ 'NOTIFICATION_BAR_HEIGHT' : mpos . ui .NOTIFICATION_BAR_HEIGHT , # for apps that want to leave space for notification bar
3838 'appscreen' : newscreen ,
3939 'start_app' : start_app , # for launcher apps
4040 'parse_manifest' : parse_manifest , # for launcher apps
4141 'restart_launcher' : restart_launcher , # for appstore apps
42- 'show_launcher' : ui .show_launcher , # for apps that want to show the launcher
42+ 'show_launcher' : mpos . ui .show_launcher , # for apps that want to show the launcher
4343 'CURRENT_OS_VERSION' : mpos .info .CURRENT_OS_VERSION , # for osupdate
4444 '__name__' : "__main__"
4545 }
@@ -54,7 +54,7 @@ def execute_script(script_source, is_file, is_launcher, is_graphical):
5454 tb = getattr (e , '__traceback__' , None )
5555 traceback .print_exception (type (e ), e , tb )
5656 print (f"Thread { thread_id } : script { compile_name } finished" )
57- # Note that newscreen isn't deleted, as it might still be foreground, or it might be ui.rootscreen
57+ # Note that newscreen isn't deleted, as it might still be foreground, or it might be mpos. ui.rootscreen
5858 except Exception as e :
5959 print (f"Thread { thread_id } : error:" )
6060 tb = getattr (e , '__traceback__' , None )
@@ -73,7 +73,7 @@ def execute_script_new_thread(scriptname, is_file, is_launcher, is_graphical):
7373 print ("main.py: execute_script_new_thread(): error starting new thread thread: " , e )
7474
7575def start_app_by_name (app_name , is_launcher = False ):
76- ui .set_foreground_app (app_name )
76+ mpos . ui .set_foreground_app (app_name )
7777 custom_app_dir = f"apps/{ app_name } "
7878 builtin_app_dir = f"builtin/apps/{ app_name } "
7979 try :
@@ -84,16 +84,16 @@ def start_app_by_name(app_name, is_launcher=False):
8484
8585def start_app (app_dir , is_launcher = False ):
8686 print (f"main.py start_app({ app_dir } ,{ is_launcher } " )
87- ui .set_foreground_app (app_dir ) # would be better to store only the app name...
87+ mpos . ui .set_foreground_app (app_dir ) # would be better to store only the app name...
8888 manifest_path = f"{ app_dir } /META-INF/MANIFEST.JSON"
8989 app = parse_manifest (manifest_path )
9090 start_script_fullpath = f"{ app_dir } /{ app .entrypoint } "
9191 execute_script_new_thread (start_script_fullpath , True , is_launcher , True )
9292 # Launchers have the bar, other apps don't have it
9393 if is_launcher :
94- ui .open_bar ()
94+ mpos . ui .open_bar ()
9595 else :
96- ui .close_bar ()
96+ mpos . ui .close_bar ()
9797
9898
9999def restart_launcher ():
0 commit comments