Skip to content

Commit

Permalink
proxy terminal fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Feb 28, 2023
1 parent af4246e commit 81fec9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions xthulu/terminal/proxy_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ def __call__(self, *args, **kwargs):
self.pipe_master.send((f"!CALL{self.attr}", args, kwargs))

return self.pipe_master.recv()

def __str__(self):
return self.__call__()
7 changes: 5 additions & 2 deletions xthulu/terminal/proxy_terminal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Proxied blessed.Terminal"""

# type checking
from typing import Any, Callable
from typing import Any

# stdlib
from asyncio import IncompleteReadError, TimeoutError, Queue, wait_for
Expand Down Expand Up @@ -50,6 +50,9 @@ class ProxyTerminal:
location: contextlib._GeneratorContextManager[Any]
raw: contextlib._GeneratorContextManager[Any]

# other type hints for non-callable proxies
normal: str

def __init__(
self,
stdin: Queue[bytes],
Expand All @@ -69,7 +72,7 @@ def __init__(
self._pixel_width = pixel_width
self._pixel_height = pixel_height

def __getattr__(self, attr: str) -> Callable[..., str]:
def __getattr__(self, attr: str) -> TerminalProxyCall:
@contextlib.contextmanager
def proxy_contextmanager(*args, **kwargs):
# we send special '!CTX' header, which means we
Expand Down

0 comments on commit 81fec9a

Please sign in to comment.