Files
cowork-local/tools/check_cowork_screen.py
T
Nam Pham Dinh ThanhandClaude Opus 5 7d9a4e2378 Close the remaining gaps on Project and Cowork against the wireframes
Re-read both drawings element by element rather than by eye. Five things were
still wrong.

Cowork headed itself "Cowork" — the screen's own name, which the rail already
shows — where the drawing puts the THREAD's title. The title now follows the
conversation, falling back to the screen name for a chat that has none yet;
ChatPanel notifies on load, on reset and when a title is first derived from the
opening turn.

Its files panel read "Tệp đầu ra"; every section heading in the drawings is
caps, so it matches the rail and Monitoring now.

Project kept its three-line explanation above the panes on every visit. The
drawing heads a populated screen with the title alone and gives the text to the
EMPTY state instead, which is where it is actually needed — so it shows only
when there is no project yet.

The workspace path sat as grey caption text where the drawing shows a field. A
read-only line edit looks like one and lets the path be selected and copied.

And Lưu project sat directly under the folder row; the drawing floats it at the
foot of the panel, so a stretch went in above it.

Checked against the control inventory, not just the picture: "Nén" and "Thư mục
Local…" are marked giữ nguyên tại chỗ, so they stay in the status strip even
though the drawing's status line is text only.

New check_cowork_screen; check_project_screen gains the three points. Both
mutation-tested — pinning the title back to tr("cowork.title") and making the
hint unconditional each fail.

23/23 checkers pass. The Qt teardown segfault is still around: check_no_hscroll
took it 1 run in 3, after printing its verdict.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 15:38:46 +09:00

100 lines
3.4 KiB
Python

"""Workspace ▸ Cowork against its wireframe (section 5).
The drawing heads the screen with the THREAD's title — "Gom số liệu doanh thu",
not the word "Cowork" — with the model beside it, Skills and Cuộc trò chuyện mới
on the right, and a caps TỆP ĐẦU RA (n) panel down the side.
"""
from __future__ import annotations
import os
import sys
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO.parent))
sys.path.insert(0, str(Path(__file__).resolve().parent))
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
from capture_screens import ( # noqa: E402
_apply_theme, _freeze_schedulers, _isolate_home, _load_fonts)
def main() -> int:
sandbox = _isolate_home()
from PySide6.QtWidgets import QApplication
app = QApplication([])
_load_fonts()
_freeze_schedulers()
_apply_theme(app)
from cowork_local.config import CONFIG_DIR
assert str(sandbox) in str(CONFIG_DIR), f"isolation failed: {CONFIG_DIR}"
from seed_demo_data import seed
seed()
from cowork_local.app import MainWindow
from cowork_local.config import AppConfig
from cowork_local.core.history import list_conversations, load_conversation
from cowork_local.i18n import set_language, tr
from cowork_local.state import AppContext
set_language("vi")
win = MainWindow(AppContext(AppConfig.load()), user_name="local")
win.resize(1920, 1000)
win.show()
app.processEvents()
win._goto(win._ROW_WORKSPACE, win.workspace._cowork_tab_idx)
app.processEvents()
c = win.cowork
fails = []
# a new thread has no title yet, so the screen name stands in
print(f"chua mo thread: tieu de={c._title_lbl.text()!r}")
if not c._title_lbl.text().strip():
fails.append("tieu de trong khi chua mo thread")
convs = list_conversations()
if not convs:
fails.append("khong co hoi thoai de kiem")
else:
conv = load_conversation(Path(convs[0]["path"]))
c.load_conversation(conv)
app.processEvents()
want = conv.get("title", "")
print(f"sau khi mo thread: tieu de={c._title_lbl.text()!r} (thread={want!r})")
if want and c._title_lbl.text() != want:
fails.append(f"tieu de khong theo thread: {c._title_lbl.text()!r} != {want!r}")
if c._title_lbl.text() == tr("cowork.title") and want:
fails.append("tieu de van la ten man hinh")
# the files panel is a caps section carrying its own count
head = c.output_section.header.text()
print(f"pane tep dau ra: {head!r}")
body = head.lstrip("▾▸ ").split(" (")[0]
if body != body.upper():
fails.append(f"tieu de pane chua viet hoa: {head!r}")
if "(" not in head:
fails.append("tieu de pane khong kem so luong")
# toolbar keeps both actions the drawing shows
for name, btn in (("Skills", c.skills_btn), ("chat moi", c._new_btn)):
if not btn.isVisible():
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}")
print()
for f in fails:
print("FAIL " + f)
print("PASS man Cowork khop ban ve" if not fails else f"{len(fails)} problem(s)")
sys.stdout.flush()
os._exit(1 if fails else 0)
if __name__ == "__main__":
raise SystemExit(main())