def on_app_chosen(self, app="schdevtools"): super().on_app_chosen(app) def _create_webview(): self.create_webview() Runnable(_create_webview)()
def on_clock(self, dt): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) result = sock.connect_ex(("127.0.0.1", 8000)) print("python:pytigon:clock") if result == 0: def _create_webview(): self.create_webview() Runnable(_create_webview)() return False else: return True
def create_webview(self): global FRAGMENT callback = PytigonWebViewClientCallback(self) fragment = PytigonWebViewFragment() start_url = "file://" + self.base_path + "/static/android/loader.html" fragment.set_callback_info(callback, self.base_path, start_url, self.app) fragmentManager = ACTIVITY.getFragmentManager() fragmentTransaction = fragmentManager.beginTransaction() v = ACTIVITY.getWindow().getDecorView().getRootView() v.setId(1234) fragmentTransaction.add(1234, fragment, "PytigonWebView") fragmentTransaction.addToBackStack("PytigonFrag") fragmentTransaction.commit() FRAGMENT = True def _start_service(): self.start_service() Runnable(_start_service)()
def run(f, *args, **kwargs): # args/kwargs to runnable was a bug, fixed in master Runnable(f)(args, kwargs)