From daa40915a0bc35ea3417fd58555688c9c55e2c46 Mon Sep 17 00:00:00 2001 From: pmp-p Date: Thu, 16 Nov 2023 17:52:15 +0100 Subject: [PATCH] better handling of raw mode switch --- pygbag/__main__.py | 2 ++ pygbag/support/cross/aio/toplevel.py | 13 +++++++++++++ scripts/build-rootfs.sh | 6 +++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/pygbag/__main__.py b/pygbag/__main__.py index d33fd59..d41e5af 100644 --- a/pygbag/__main__.py +++ b/pygbag/__main__.py @@ -103,6 +103,8 @@ def truc(*argv, **kw): fakehost.window.console = NoOp("platform.window.console") fakehost.window.console.log = print fakehost.window.get_terminal_console = truc + fakehost.window.RAW_MODE = 0 + import aio.filelike diff --git a/pygbag/support/cross/aio/toplevel.py b/pygbag/support/cross/aio/toplevel.py index 7299f19..9496a07 100644 --- a/pygbag/support/cross/aio/toplevel.py +++ b/pygbag/support/cross/aio/toplevel.py @@ -210,6 +210,16 @@ def prompt(self): embed.prompt() async def interact(self): + + # in raw mode we don't want that loop to read input + import sys + from platform import window + + if sys.platform in ('emscripten','wasi') and not aio.cross.simulator: + raw_mix = True + else: + raw_mix = False + # multiline input clumsy sentinel last_line = "" @@ -227,6 +237,9 @@ async def interact(self): while not aio.exit: await asyncio.sleep(0) + #if raw_mix: + if window.RAW_MODE: + continue if aio.exit: return diff --git a/scripts/build-rootfs.sh b/scripts/build-rootfs.sh index bffa36c..8b0d057 100755 --- a/scripts/build-rootfs.sh +++ b/scripts/build-rootfs.sh @@ -111,13 +111,17 @@ try: except: print('_curses not built') +#rich +import getpass +import fractions + #nurses_2 import tty # cffi import copy -# datetime +# datetime import datetime import _strptime