Compare commits

..
Author SHA1 Message Date
阿白叔 63999b7bfd fix: explain empty task searches and filters (#33 D4)
Core regression / Python core, intervention UI and release configuration (push) Waiting to run
Core regression / JavaScript syntax (push) Waiting to run
Core regression / Python core, intervention UI and release configuration (pull_request) Waiting to run
Core regression / JavaScript syntax (pull_request) Waiting to run
2026-11-25 09:48:10 +08:00
abaishu0730 46deb9cec8 Merge pull request 'feat: 升级 DeepSeek Harness 并支持运行时更新' (#32) from codex/dsh-runtime-update into main
Core regression / Python core, intervention UI and release configuration (push) Failing after 20m55s
Core regression / JavaScript syntax (push) Successful in 10s
2026-11-20 17:21:04 +08:00
2 changed files with 37 additions and 1 deletions

No files matched your search

@@ -79,6 +79,10 @@ class TaskList(QWidget):
self.recycle_button = QPushButton('回收站', objectName='taskRecycleBin')
self.recycle_button.setCheckable(True)
self.count = QLabel(objectName='taskCount')
self.empty_hint = QLabel(objectName='taskEmptyHint')
self.empty_hint.setTextFormat(Qt.TextFormat.PlainText)
self.empty_hint.setWordWrap(True)
self.empty_hint.hide()
self.filter = QComboBox(objectName="taskFilter")
for label, key, picture in (('全部任务', 'all', 'grid'), ('未完成', 'unfinished', 'clock'),
('待开始', 'pending', 'clock'), ('执行中', 'running', 'clock'),
@@ -146,6 +150,7 @@ class TaskList(QWidget):
layout.addWidget(self.filter)
layout.addLayout(batch)
layout.addLayout(selection)
layout.addWidget(self.empty_hint)
layout.addWidget(self.list, 1)
layout.addWidget(self.queue_button)
layout.addLayout(footer)
@@ -254,6 +259,17 @@ class TaskList(QWidget):
if getattr(task, "task_id") == selected:
self.list.setCurrentItem(item)
hidden = selected and self.current_task_id() is None
self.count.setText(f'{len(tasks)} / {len(self._tasks)} 个任务' + (' · 当前任务已隐藏' if hidden else ''))
if not tasks:
category_text = self.filter.currentText() if category != 'all' and not self.recycle_button.isChecked() else ''
if not self._tasks:
hint = '回收站为空。' if self.recycle_button.isChecked() else '暂无任务,点击“新建任务”导入工程。'
elif query:
scope = f'“{category_text}”中' if category_text else ''
hint = f'{scope}未找到与“{self.search.text().strip()}”匹配的任务。'
else:
hint = f'暂无“{category_text}”任务。'
self.empty_hint.setText(hint)
self.empty_hint.setVisible(not tasks)
self.count.setText(f'匹配 {len(tasks)} / 共 {len(self._tasks)} 个任务' + (' · 当前任务已隐藏' if hidden else ''))
self._update_selection_state()
self.view_changed.emit()
+20
View File
@@ -27,6 +27,26 @@ def visible_ids(panel):
return [panel.list.item(index).data(Qt.ItemDataRole.UserRole) for index in range(panel.list.count())]
def test_empty_list_explains_search_filter_and_initial_state(navigation, qtbot):
panel, tasks, opened = navigation
panel.populate(tasks[:1])
qtbot.keyClicks(panel.search, 'zzzz_no_match')
assert panel.empty_hint.isVisible()
assert 'zzzz_no_match' in panel.empty_hint.text()
assert '匹配 0 / 共 1 个任务' in panel.count.text()
panel.filter.setCurrentIndex(panel.filter.findData('completed'))
assert '已完成' in panel.empty_hint.text() and 'zzzz_no_match' in panel.empty_hint.text()
panel.search.clear()
assert '已完成' in panel.empty_hint.text()
panel.filter.setCurrentIndex(panel.filter.findData('all'))
assert not panel.empty_hint.isVisible() and len(visible_ids(panel)) == 1
panel.populate(())
assert '新建任务' in panel.empty_hint.text()
panel.recycle_button.setChecked(True)
panel.populate(())
assert '回收站' in panel.empty_hint.text()
@pytest.mark.parametrize(('category','expected'),[
('all',['draft','ready','running','paused','completed','failed','blocked']),
('unfinished',['draft','ready','running','paused','failed','blocked']),