super().__init__(**kwargs)
self._client_mngrs: dict[str, _ClientWindowsManager] = {}
- def _new_window(self, win_class, **kwargs) -> Window:
- new_idx = len(self._windows)
- win = win_class(idx=new_idx, term=self._term, _q_out=self._q_out,
- **kwargs)
- self._windows += [win]
- self._switch_window(new_idx)
- return win
-
def for_client_do(self, client_id: str, todo: str, **kwargs) -> None:
'Forward todo to appropriate ClientTuiMgr.'
if client_id not in self._client_mngrs:
self._client_mngrs[client_id] = _ClientWindowsManager(
new_window=lambda cls, **kwargs: self._new_window(
- cls, client_id=client_id, **kwargs))
+ cls, _q_out=self._q_out, client_id=client_id, **kwargs))
client_data = self._client_mngrs[client_id]
method = getattr(client_data, todo)
if method(**kwargs) or signature(method).return_annotation is None:
super().__init__(**kwargs)
self._term = term
self._window_idx = 0
- self._windows = [Window(idx=self._window_idx, term=self._term)]
+ self._windows: list[Window] = []
+ self._new_window()
self._log = Logger(
lambda msg: # pylint: disable=unnecessary-lambda # to keep …
self.window.log.append(msg)) # … up-to-date _what_ window's .log
self._set_screen()
signal(SIGWINCH, lambda *_: self._set_screen())
+ def _new_window(self, win_class=Window, **kwargs) -> Window:
+ new_idx = len(self._windows)
+ win = win_class(idx=new_idx, term=self._term, **kwargs)
+ self._windows += [win]
+ if new_idx != self._window_idx:
+ self._switch_window(new_idx)
+ return win
+
def redraw_affected(self) -> None:
'On focused window call .draw_tainted, then flush screen.'
self.window.draw_tainted()