self._tui_new_window = tui_new_window
self.db = _TuiClientDb()
self.windows: list[_ClientWindow] = []
- for scope in (_LogScope.DEBUG, _LogScope.RAW):
- self._new_win(scope)
+ self._new_win(_LogScope.DEBUG)
def _new_win(self, scope: _LogScope, chatname: str = '') -> _ClientWindow:
kwargs = {'scope': scope, 'log': self.log, 'win_cls': _ClientWindow}
elif scope == _LogScope.CHAT:
ret = [w for w in self.windows
if isinstance(w, _ChatWindow) and w.chatname == id_]
- if (not ret):
- ret += [self._new_win(_LogScope.CHAT, chatname=id_)]
elif scope == _LogScope.USER:
chan_names = [c for c, v in self.db.channels.items()
if id_ in v.user_ids]
elif scope == _LogScope.USER_NO_CHANNELS:
ret = [w for w in self.windows_for(_LogScope.USER, id_)
if isinstance(w, _QueryWindow)]
+ if (not ret) and scope in {_LogScope.CHAT, _LogScope.RAW}:
+ ret += [self._new_win(scope, id_)]
ret.sort(key=lambda w: w.idx)
return ret