diff --git a/tools/check_cowork_screen.py b/tools/check_cowork_screen.py index 5e54e74..5da12c4 100644 --- a/tools/check_cowork_screen.py +++ b/tools/check_cowork_screen.py @@ -87,6 +87,21 @@ def main() -> int: fails.append(f"thieu nut {name} tren thanh cong cu") print(f"nut tren thanh cong cu: {c.skills_btn.text()!r}, {c._new_btn.text()!r}") + # the drawing gives Cowork two columns; History lives in the rail's RECENTS + # and its pane arrives folded to the strip the drawing keeps + w = win.workspace + sb = w._sidebar + print(f"vao Cowork: History gap={sb.is_collapsed()} rong={sb.width()}px") + if not sb.is_collapsed(): + fails.append("pane Lich su mo san — man Cowork thanh 3 cot") + w.show_history_pane() + app.processEvents() + print(f"sau 'Tat ca project…': History gap={sb.is_collapsed()} rong={sb.width()}px") + if sb.is_collapsed(): + fails.append("'Tat ca project…' khong mo duoc pane Lich su") + w._on_history_fold(True) + app.processEvents() + # one heading on the files panel, with the chevron at its right — the # drawing has "TỆP ĐẦU RA (3) ›" and nothing above it from PySide6.QtCore import QPoint as _QP diff --git a/ui/workspace_tab.py b/ui/workspace_tab.py index 82dbb9c..6ea23c3 100644 --- a/ui/workspace_tab.py +++ b/ui/workspace_tab.py @@ -110,6 +110,9 @@ class WorkspaceTab(QWidget): super().__init__() self.ctx = ctx self._current_id = "" + # True once the user asks for the full History panel; until then Cowork + # opens with it folded, as the drawing lays the screen out. + self._history_opened = False # Shared widgets embedded as per-project sub-tabs (None in unit tests # that only drive project management). self._cowork = cowork @@ -311,11 +314,16 @@ class WorkspaceTab(QWidget): sb = self._sidebar sb.open_chat.connect(self._on_sidebar_open) sb.new_chat.connect(self._on_sidebar_new) - sb.collapse_requested.connect(lambda: self._set_sidebar_collapsed(True)) - sb.expand_requested.connect(lambda: self._set_sidebar_collapsed(False)) + sb.collapse_requested.connect(lambda: self._on_history_fold(True)) + sb.expand_requested.connect(lambda: self._on_history_fold(False)) sb.refresh_requested.connect(self._on_sidebar_refresh) sb.history_changed.connect(self._reload_threads) + def _on_history_fold(self, collapsed: bool) -> None: + """Remember what the user chose, so switching screens does not undo it.""" + self._history_opened = not collapsed + self._set_sidebar_collapsed(collapsed) + def _set_sidebar_collapsed(self, collapsed: bool) -> None: """Collapse/expand History sidebar and redistribute splitter space so the Cowork chat area fills the freed width (same pattern as @@ -404,11 +412,14 @@ class WorkspaceTab(QWidget): narrow = getattr(self, "_is_narrow", False) if self._sidebar is not None: self._sidebar.setVisible(on_cowork) - # Auto-expand History when entering Cowork — unless the window is too - # narrow to hold it, in which case expanding it here would undo the - # fold made moments earlier and clip the chat again. - if on_cowork: - self._sidebar.set_collapsed(narrow) + # The drawing gives Cowork two columns — the transcript and the + # files panel — and moves history to the rail's RECENTS. Its own + # "Vấn đề" note is that three panes squeezed the conversation below + # 60% of the width. So History arrives folded to its strip: the + # chevron the drawing keeps, one click from the full panel, and + # "Tất cả project…" in RECENTS opens it outright. + if on_cowork and not self._history_opened: + self._sidebar.set_collapsed(True) # QSplitter ignores hidden panes, but the freed width isn't handed to # the remaining panes deterministically — set explicit sizes after any # pane toggle (same lesson as _set_projects_collapsed). @@ -702,6 +713,7 @@ class WorkspaceTab(QWidget): filters, pin, rename, multi-select delete and the context menu all still live in this panel. """ + self._history_opened = True self._set_sidebar_collapsed(False) self._show_cowork_tab()