Keep the project picker reachable while the rail is collapsed
The picker was hidden outright at 54px, on the grounds that a combo box there could only show a stub of a name. True, but it left the collapsed rail with no way to change project at all — and the audit page's own inventory of the 11 collapsible controls says the rail's fold "giữ nguyên toàn bộ". A folder QToolButton stands in for it: same items, and choosing one moves the combo, so _on_rail_project_pick stays the single code path. Its tooltip carries the current project name, which the combo could not have shown anyway. It matches the + button's width and drops its menu arrow — at 42px the arrow would take a third of the row to say nothing. check_nav now collapses the rail and requires a reachable picker whose menu matches the combo item for item, then picks a row and asserts the project actually changed. Hiding the button fails it. 15/15 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
ac29f519cc
commit
bcdfe43c7c
@@ -289,6 +289,37 @@ def main() -> int:
|
||||
print(f"provider dang chon : {win.provider_combo.currentText()!r}")
|
||||
print(f"tai khoan : {win.account_lbl.text()!r}")
|
||||
|
||||
# Collapsing the rail must not take the project picker away with it: at
|
||||
# 54px the combo cannot show a name, so a folder button stands in for it.
|
||||
if not win._nav_collapsed:
|
||||
win._toggle_nav()
|
||||
app.processEvents()
|
||||
mini = getattr(win, "nav_project_btn", None)
|
||||
if mini is None or mini.isHidden():
|
||||
fails.append("thu gon rail xong khong con cach nao doi project")
|
||||
else:
|
||||
mini.menu().aboutToShow.emit()
|
||||
app.processEvents()
|
||||
menu_items = [a.text() for a in mini.menu().actions()]
|
||||
combo_items = [win.nav_project.itemText(i)
|
||||
for i in range(win.nav_project.count())]
|
||||
if menu_items != combo_items:
|
||||
fails.append(f"menu project khi thu gon lech voi combo: "
|
||||
f"{menu_items} vs {combo_items}")
|
||||
elif len(menu_items) > 1:
|
||||
before = win.workspace.selected_project_id()
|
||||
# Any row but the one already selected, or nothing would change.
|
||||
row = (win.nav_project.currentIndex() + 1) % len(menu_items)
|
||||
mini.menu().actions()[row].trigger()
|
||||
app.processEvents()
|
||||
after = win.workspace.selected_project_id()
|
||||
if after == before:
|
||||
fails.append("chon project tu menu thu gon khong doi project")
|
||||
else:
|
||||
print(f"doi project khi thu gon: {before} -> {after}")
|
||||
win._toggle_nav()
|
||||
app.processEvents()
|
||||
|
||||
print()
|
||||
print(f"tong dong dieu huong: {n_total} + nut Cai dat")
|
||||
if fails:
|
||||
|
||||
Reference in New Issue
Block a user