home · contact · privacy
Minor refactor.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 23 Sep 2025 19:24:59 +0000 (21:24 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 23 Sep 2025 19:24:59 +0000 (21:24 +0200)
ircplom/client_tui.py

index 41ea1e1a5983b454c6ecfbf6a2a16ce86110f38f..b6b27229a83daa83c35fc250d2da906c2148e623 100644 (file)
@@ -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