|
|
|
@ -6,7 +6,10 @@ from common.basedir import BASEDIR |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TextWindow(): |
|
|
|
|
def __init__(self, s): |
|
|
|
|
def __init__(self, s, noop=False): |
|
|
|
|
# text window is only implemented for android currently |
|
|
|
|
self.text_proc = None |
|
|
|
|
if not noop: |
|
|
|
|
try: |
|
|
|
|
self.text_proc = subprocess.Popen(["./text", s], |
|
|
|
|
stdin=subprocess.PIPE, |
|
|
|
@ -19,7 +22,6 @@ class TextWindow(): |
|
|
|
|
if self.text_proc is not None: |
|
|
|
|
self.text_proc.poll() |
|
|
|
|
return self.text_proc.returncode |
|
|
|
|
|
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
def __enter__(self): |
|
|
|
@ -31,6 +33,7 @@ class TextWindow(): |
|
|
|
|
self.text_proc = None |
|
|
|
|
|
|
|
|
|
def wait_for_exit(self): |
|
|
|
|
if self.text_proc is not None: |
|
|
|
|
while True: |
|
|
|
|
if self.get_status() == 1: |
|
|
|
|
return |
|
|
|
@ -43,29 +46,6 @@ class TextWindow(): |
|
|
|
|
self.close() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FakeTextWindow(TextWindow): |
|
|
|
|
def __init__(self, s): # pylint: disable=super-init-not-called |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
def get_status(self): |
|
|
|
|
return 1 |
|
|
|
|
|
|
|
|
|
def wait_for_exit(self): |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
def __enter__(self): |
|
|
|
|
return self |
|
|
|
|
|
|
|
|
|
def update(self, _): |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
def close(self): |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
def __exit__(self, exc_type, exc_value, traceback): |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
text = """Traceback (most recent call last): |
|
|
|
|
File "./controlsd.py", line 608, in <module> |
|
|
|
|