(run_)in_terminal tests, now migration begins

This commit is contained in:
MaXFeeD
2025-04-06 12:56:47 +03:00
parent ff4e8d4feb
commit 1e5db34267
+6 -1
View File
@@ -180,6 +180,10 @@ def simple_async_test():
whitespace = Window(height=1) whitespace = Window(height=1)
progress = Progress("What are we doing?") progress = Progress("What are we doing?")
def do_action():
# XXX: patch_stdout is more than 3x time slower, so in_terminal is preffered
run_in_terminal(lambda: print("\n".join(f"aboba {offset + 1}" for offset in range(50))))
contents = [ contents = [
task1.content, task1.content,
task1.description, task1.description,
@@ -190,7 +194,7 @@ def simple_async_test():
checkbox, checkbox,
HorizontalLine(), HorizontalLine(),
Editable("What do you want? ", hint="Modding Tools+ Subscription"), Editable("What do you want? ", hint="Modding Tools+ Subscription"),
Button("Confirm", lambda: checkbox.interact()), Button("Confirm", do_action),
whitespace, whitespace,
Interactable("Don't forget to subscribe, leave comment and like our work. Money produced from those events goes to Inner Core development!"), Interactable("Don't forget to subscribe, leave comment and like our work. Money produced from those events goes to Inner Core development!"),
Debugger(), Debugger(),
@@ -261,6 +265,7 @@ def simple_async_test():
from datetime import datetime, timedelta from datetime import datetime, timedelta
from prompt_toolkit.application import run_in_terminal
from prompt_toolkit.buffer import Buffer, BufferEventHandler from prompt_toolkit.buffer import Buffer, BufferEventHandler
from prompt_toolkit.document import Document from prompt_toolkit.document import Document
from prompt_toolkit.filters import (Condition, FilterOrBool, has_focus, from prompt_toolkit.filters import (Condition, FilterOrBool, has_focus,