target.term.flush()
-@dataclass
-class _SetScreenEvent(TuiEvent):
-
- def affect(self, target: 'BaseTui') -> None:
- target.term.calc_geometry()
- for window in target.windows:
- window.set_geometry()
- super().affect(target)
-
-
class _YX(NamedTuple):
y: int
x: int
def affect(self, target: 'BaseTui') -> None:
if self.payload[0] == _CHAR_RESIZE:
- _SetScreenEvent().affect(target)
+ target.set_screen()
return
if self.payload in _KEYBINDINGS:
cmd_data = _KEYBINDINGS[self.payload]
self.log = Logger(
lambda msg: # pylint: disable=unnecessary-lambda # to keep …
self.window.log.append(msg)) # … up-to-date _what_ window's .log
- self._put(_SetScreenEvent())
+ self.set_screen()
+ signal(SIGWINCH, lambda *_: self.set_screen())
+
+ def set_screen(self) -> None:
+ 'Calc screen geometry into .windows, fully draw front one and flush.'
+ self.term.calc_geometry()
+ for window in self.windows:
+ window.set_geometry()
+ self.window.draw()
+ self.term.flush()
def cmd_name_to_cmd(self, cmd_name: str) -> Optional[Callable]:
'Map cmd_name to executable TUI element method.'
@contextmanager
def setup(self) -> Generator:
'Combine multiple contexts into one and run keypress loop.'
- signal(SIGWINCH, lambda *_: self._put(_SetScreenEvent()))
self.clear()
with (self._blessed.raw(),
self._blessed.fullscreen(),