Fix the rail picker going nameless — my own regression from the row rework
Giving each project row a widget left the QListWidgetItem with no text, and project_choices() read exactly that. So the rail's picker listed every project as a bare "📁 " with nothing after it, and the more projects there were the more identical blanks you got. Reported after creating a second one. Setting the text back on the item is not the fix: with a transparent row widget on top, the name paints twice, one string ghosting the other — visible in a render. project_choices() now reads list_projects(), the same source the list is built from, so the picker no longer depends on how a row happens to be drawn. check_project_screen creates a project and requires project_choices() to return non-empty names and the picker to show each of them. Pointing it back at item.text() fails it. 22/22 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
9393fc1748
commit
300c10711e
@@ -103,6 +103,26 @@ def main() -> int:
|
||||
fails.append(f"thieu nhan {label!r}")
|
||||
print(f"nhan form: {want}")
|
||||
|
||||
# 5. the rail's picker must name the projects. It reads project_choices(),
|
||||
# which used to read item.text() — and when rows became widgets the item
|
||||
# text went empty, so every entry showed as a bare folder glyph. Creating
|
||||
# a project is when a user notices, so create one here.
|
||||
before = [n for n, _pid in w.project_choices()]
|
||||
w._create()
|
||||
app.processEvents()
|
||||
choices = w.project_choices()
|
||||
picker = [win.nav_project.itemText(i) for i in range(win.nav_project.count())]
|
||||
print(f"project_choices: {[n for n, _p in choices][:4]}")
|
||||
print(f"picker hien thi: {picker[:4]}")
|
||||
if any(not name.strip() for name, _pid in choices):
|
||||
fails.append("project_choices tra ve ten rong")
|
||||
if len(choices) <= len(before):
|
||||
fails.append("tao project moi khong vao danh sach")
|
||||
for name, _pid in choices:
|
||||
if not any(name in text for text in picker):
|
||||
fails.append(f"picker khong hien ten {name!r}")
|
||||
break
|
||||
|
||||
print()
|
||||
for f in fails:
|
||||
print("FAIL " + f)
|
||||
|
||||
Reference in New Issue
Block a user