@ -6,7 +6,10 @@ from common.basedir import BASEDIR
class TextWindow ( ) :
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 :
try :
self . text_proc = subprocess . Popen ( [ " ./text " , s ] ,
self . text_proc = subprocess . Popen ( [ " ./text " , s ] ,
stdin = subprocess . PIPE ,
stdin = subprocess . PIPE ,
@ -19,7 +22,6 @@ class TextWindow():
if self . text_proc is not None :
if self . text_proc is not None :
self . text_proc . poll ( )
self . text_proc . poll ( )
return self . text_proc . returncode
return self . text_proc . returncode
return None
return None
def __enter__ ( self ) :
def __enter__ ( self ) :
@ -31,6 +33,7 @@ class TextWindow():
self . text_proc = None
self . text_proc = None
def wait_for_exit ( self ) :
def wait_for_exit ( self ) :
if self . text_proc is not None :
while True :
while True :
if self . get_status ( ) == 1 :
if self . get_status ( ) == 1 :
return
return
@ -43,29 +46,6 @@ class TextWindow():
self . close ( )
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__ " :
if __name__ == " __main__ " :
text = """ Traceback (most recent call last):
text = """ Traceback (most recent call last):
File " ./controlsd.py " , line 608 , in < module >
File " ./controlsd.py " , line 608 , in < module >