Add GUI
This commit is contained in:
19
gui/_io.py
Normal file
19
gui/_io.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
import queue
|
||||
|
||||
|
||||
class _QueueWriter(io.TextIOBase):
|
||||
"""Redirect sys.stdout / sys.stderr into a Queue for the Logs panel."""
|
||||
|
||||
def __init__(self, q: queue.Queue[str]) -> None:
|
||||
self._q = q
|
||||
|
||||
def write(self, text: str) -> int: # type: ignore[override]
|
||||
if text:
|
||||
self._q.put(text)
|
||||
return len(text)
|
||||
|
||||
def flush(self) -> None:
|
||||
pass
|
||||
Reference in New Issue
Block a user