From c1bddef3357216417065019b8a53533406292352 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 23 Sep 2025 21:24:59 +0200 Subject: [PATCH] Minor refactor. --- ircplom/client_tui.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ircplom/client_tui.py b/ircplom/client_tui.py index 41ea1e1..b6b2722 100644 --- a/ircplom/client_tui.py +++ b/ircplom/client_tui.py @@ -308,8 +308,7 @@ class _ClientWindowsManager: 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} @@ -339,8 +338,6 @@ class _ClientWindowsManager: 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] @@ -354,6 +351,8 @@ class _ClientWindowsManager: 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 -- 2.30.2