From 4847b1c78b4cb96aadd24ffcbd9c616125316e77 Mon Sep 17 00:00:00 2001 From: chrys Date: Mon, 26 Mar 2018 13:22:29 +0200 Subject: [PATCH] prioriy to input --- .../screenDriver/ptyDriver.py | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/fenrirscreenreader/screenDriver/ptyDriver.py b/src/fenrirscreenreader/screenDriver/ptyDriver.py index 7d2ea300..c90f4af7 100644 --- a/src/fenrirscreenreader/screenDriver/ptyDriver.py +++ b/src/fenrirscreenreader/screenDriver/ptyDriver.py @@ -130,7 +130,22 @@ class driver(screenDriver): if self.signalPipe[0] in r: os.read(self.signalPipe[0], 1) lines, columns = self.resizeTerminal(self.p_out) - terminal.resize(lines, columns) + terminal.resize(lines, columns) + # input + if sys.stdin in r: + if debug: + print('pre stdin') + try: + msgBytes = self.readAll(sys.stdin.fileno()) + eventQueue.put({"Type":fenrirEventType.ByteInput, + "Data":msgBytes + }) + except (EOFError, OSError): + active.value = False + break + #self.injectTextToScreen(msgBytes) + if debug: + print('after stdin') # output if self.p_out in r: if debug: @@ -150,22 +165,7 @@ class driver(screenDriver): "Data":screen_utils.createScreenEventData(terminal.dump()) }) if debug: - print('after p_out') - # input - if sys.stdin in r: - if debug: - print('pre stdin') - try: - msgBytes = self.readAll(sys.stdin.fileno()) - eventQueue.put({"Type":fenrirEventType.ByteInput, - "Data":msgBytes - }) - except (EOFError, OSError): - active.value = False - break - #self.injectTextToScreen(msgBytes) - if debug: - print('after stdin') + print('after p_out') except Exception as e: # Process died? print(e) active.value = False