Restore the two gating rules the redesign dropped, and put the dot back in its corner
A1 — hiding the assistant from the dot. The old build kept a chevron button beside the dot wired to _hide_to_edge; the redesign moved that action into the panel's ⋯ menu, so hiding went from one click to open-panel → ⋯ → Ẩn. The drawing has no button there (26px, no text, no chevron), so the reach comes back as a right-click on the dot, with the tooltip saying so. A2 — per-part cost. Folding Input/Output/Cache into the total tile's sub-line carried their token counts but not their prices, which live only on those three cards, so the cost breakdown left the screen entirely. The wireframe asks for the tiles anyway — "$0.31 Tổng chi phí · 57 lượt / 395.4K Tổng token / 292.8K Input / 102.7K Output / 108.9K Cache" — so they are back as tiles, each with its price, and the turn count rides on the cost tile's label as drawn. The dot on Cowork. _update_dock_guard lifted it whenever a composer existed, testing only the vertical axis. On a wide window the composer ends at the chat column's right edge — x=1688 against a dot at x=1892 — so the dot rose 156px to clear something that was never under it, and Cowork became the one screen where it was not in the corner. It now lifts only when the two actually overlap: 18px from the bottom at 1936px wide, still lifted at 1200 and 900 where the composer does reach under it. Also: open_tooltip and show_tooltip still said "App Assistant" after the rename. check_dock_corner covers the corner rule at three widths and fails if the lift comes back unconditionally. 18/18 checkers pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
16406f863f
commit
a0cef768c9
@@ -0,0 +1,94 @@
|
||||
"""The assistant dot sits in the bottom-right corner — unless the composer is
|
||||
genuinely underneath it.
|
||||
|
||||
It used to lift on Cowork whenever a composer existed, measured only on the
|
||||
vertical axis. On a wide window the composer stops at the chat column's right
|
||||
edge, far short of the dot, so the dot rose 156px for nothing and Cowork was
|
||||
the one screen where it was not in the corner.
|
||||
"""
|
||||
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.i18n import set_language
|
||||
from cowork_local.state import AppContext
|
||||
|
||||
set_language("vi")
|
||||
win = MainWindow(AppContext(AppConfig.load()), user_name="local")
|
||||
win.show()
|
||||
dock = win.help_agent
|
||||
fails = []
|
||||
|
||||
def gap_and_overlap(width, height):
|
||||
win.resize(width, height)
|
||||
app.processEvents()
|
||||
win._goto(win._ROW_WORKSPACE, win.workspace._cowork_tab_idx)
|
||||
app.processEvents()
|
||||
comp = win.cowork.composer
|
||||
origin = comp.mapTo(win, comp.rect().topLeft())
|
||||
dleft = dock.x() - win.mapToGlobal(win.rect().topLeft()).x()
|
||||
overlaps = (dleft + dock.width() > origin.x()
|
||||
and dleft < origin.x() + comp.width())
|
||||
gap = win.height() - (dock.y() + dock.height())
|
||||
return gap, overlaps, origin.x() + comp.width(), dleft
|
||||
|
||||
# baseline: every other screen
|
||||
win.resize(1936, 1048)
|
||||
app.processEvents()
|
||||
win._goto(win._ROW_WORKSPACE, win.workspace._project_tab_idx)
|
||||
app.processEvents()
|
||||
corner = win.height() - (dock.y() + dock.height())
|
||||
print(f"man thuong : cach day {corner}px")
|
||||
|
||||
for w, h in ((1936, 1048), (1200, 800), (900, 700)):
|
||||
gap, over, comp_right, dleft = gap_and_overlap(w, h)
|
||||
print(f"Cowork {w}x{h:<5}: cach day {gap:>4}px | composer het o x={comp_right} "
|
||||
f"| cham o x={dleft} | chong nhau={over}")
|
||||
if over and gap <= corner:
|
||||
fails.append(f"{w}x{h}: composer nam duoi cham ma cham khong duoc nang")
|
||||
if not over and gap != corner:
|
||||
fails.append(f"{w}x{h}: khong chong nhau ma cham van lech "
|
||||
f"({gap}px thay vi {corner}px)")
|
||||
|
||||
print()
|
||||
for f in fails:
|
||||
print("FAIL " + f)
|
||||
print("PASS cham o goc, chi nang khi that su bi che" 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())
|
||||
Reference in New Issue
Block a user