Feature/fsg gamma team ui fix #3
@@ -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)
|
||||
|
||||
+12
-4
@@ -532,6 +532,8 @@ class WorkspaceTab(QWidget):
|
||||
row_to_select = 0
|
||||
for i, p in enumerate(list_projects()):
|
||||
chats, tasks = counts.get(p.project_id, (0, 0))
|
||||
# No text on the item: the row widget paints the name, and setting
|
||||
# both drew it twice, one string ghosting the other.
|
||||
item = QListWidgetItem()
|
||||
item.setData(Qt.UserRole, p.project_id)
|
||||
if p.description:
|
||||
@@ -622,10 +624,16 @@ class WorkspaceTab(QWidget):
|
||||
|
||||
# ---- rail integration -------------------------------------------------
|
||||
def project_choices(self):
|
||||
"""(name, project_id) for the rail picker, in the list's own order."""
|
||||
return [(self.project_list.item(i).text(),
|
||||
self.project_list.item(i).data(Qt.UserRole))
|
||||
for i in range(self.project_list.count())]
|
||||
"""(name, project_id) for the rail picker, in the list's own order.
|
||||
|
||||
Read from the store, which is what the list is built from — reading
|
||||
item.text() coupled the picker to how a row happens to be drawn, and
|
||||
when rows became widgets the picker went blank: every project showed
|
||||
as a bare folder glyph with no name.
|
||||
"""
|
||||
from ..core.projects import list_projects
|
||||
|
||||
return [(p.name, p.project_id) for p in list_projects()]
|
||||
|
||||
def selected_project_id(self) -> str:
|
||||
return self._selected_id()
|
||||
|
||||
Reference in New Issue
Block a user