@@ -12,7 +12,7 @@ def set_softinput(*args) -> None:
1212
1313Window .on_restore (Clock .schedule_once (set_softinput , 0.1 ))
1414
15- from kivy .properties import StringProperty
15+ from kivy .properties import StringProperty , BooleanProperty
1616
1717from carbonkivy .app import CarbonApp
1818from carbonkivy .uix .screenmanager import CScreenManager
@@ -29,6 +29,8 @@ class KvDeveloperClient(CarbonApp):
2929
3030 status = StringProperty ()
3131
32+ running = BooleanProperty (None , allownone = True )
33+
3234 def __init__ (self , * args , ** kwargs ) -> None :
3335 super (KvDeveloperClient , self ).__init__ (* args , ** kwargs )
3436 self .load_all_kv_files (os .path .join (self .directory , "View" ))
@@ -54,30 +56,18 @@ def referrer(self, destination: str = None) -> None:
5456 if self .manager_screens .current != destination :
5557 self .manager_screens .current = destination
5658
59+ def on_resume (self ):
60+ self .running = False
61+ return super ().on_resume ()
62+
5763 def launch (self , server_url : str , * args ) -> None :
5864 self .launcher = ApplicationLauncher (server_url = server_url , entrypoint = "main.py" , app_name = "Demo" )
5965 self .launcher .launch_app ()
66+ self .running = True
6067 self .launcher = None
6168
6269
6370if __name__ == "__main__" :
6471 app = KvDeveloperClient ()
6572 app .run ()
66- import sys
67- from kivy .utils import platform
68-
69- if platform == "android" :
70- from jnius import autoclass
71- activity = autoclass ("org.kivy.android.PythonActivity" ).mActivity
72- log_dir = activity .getExternalFilesDir (None ).getAbsolutePath ()
73- else :
74- log_dir = os .path .expanduser ("~/AppLogs" )
75-
76- os .makedirs (log_dir , exist_ok = True )
77-
78- log_file_path = os .path .join (log_dir , "app_log.txt" )
79- sys .stdout = open (log_file_path , "a" )
80- sys .stderr = sys .stdout
81-
82- print ("[LOG] Logging started." )
8373
0 commit comments