for stream in (STREAM_SERVER, STREAM_RAW):
self._new_window(stream)
- def _if_privmsg_update_prefix(self, win: _ClientWindow) -> None:
- if isinstance(win, _PrivmsgWindow):
- win.prompt.update_prefix(
- **{k: getattr(self, k)
- for k in _PrivmsgPromptWidget.prefix_update_keys()})
+ def _prompt_update(self, win: _PrivmsgWindow) -> None:
+ to_set = win.prompt.prefix_update_keys()
+ win.prompt.update_prefix(**{k: getattr(self, k) for k in to_set})
def _new_window(self, stream: str) -> _ClientWindow:
win_class = (_PrivmsgWindow if stream[0:1] != STREAM_PREFIX_META
else _ClientWindow)
win = self._tui_new_window(win_class, stream=stream)
- self._if_privmsg_update_prefix(win)
+ if isinstance(win, _PrivmsgWindow):
+ self._prompt_update(win)
self.windows += [win]
return win
setattr(self, k, v)
tainteds = False
if _PrivmsgPromptWidget.prefix_update_keys() & set(kwargs.keys()):
- for win in self.windows:
- self._if_privmsg_update_prefix(win)
+ for win in [w for w in self.windows
+ if isinstance(w, _PrivmsgWindow)]:
+ self._prompt_update(win)
+ tainteds |= win.prompt.tainted
tainteds = True
return tainteds