fix-ui-restore-task-status-categories
Core regression / Python core and release configuration (push) Successful in 15s
Core regression / JavaScript syntax (push) Successful in 3s
Core regression / Python core and release configuration (pull_request) Successful in 16s
Core regression / JavaScript syntax (pull_request) Successful in 4s

This commit is contained in:
阿白叔 committed 2026-11-03 11:02:27 +08:00
1 parent ba1d50cdfc
commit 63835afba8
6 files changed
+137 -7

No files matched your search

@@ -117,7 +117,6 @@ class TrialTaskCenterWindow(MaterialMainWindow):
self.resize(1280, 880)
self.setStyleSheet(APP_STYLESHEET)
self.task_list = TaskList(self.open_task)
self.task_list.filter.currentTextChanged.connect(self._refresh_task_list)
self.task_list.recycle_button.toggled.connect(self._refresh_task_list)
self.task_list.new_button.clicked.connect(self._new_task)
self.task_list.edit_button.clicked.connect(self._edit_task)
@@ -484,7 +483,8 @@ class TrialTaskCenterWindow(MaterialMainWindow):
self.project_summary.refresh_button.setEnabled(not busy and bool(
self._task_id if read_failed else context and not context.legacy))
self.task_list.list.setEnabled(not self._workers or self._batch_stop is not None)
self.task_list.filter.setEnabled(not self._workers or self._batch_stop is not None)
self.task_list.filter.setEnabled((not self._workers or self._batch_stop is not None)
and not self.task_list.recycle_button.isChecked())
self.task_list.search.setEnabled(not self._workers or self._batch_stop is not None)
self.task_list.recycle_button.setEnabled(not busy)
self.task_list.select_all_button.setEnabled(not busy and bool(self.task_list.list.count()))
@@ -508,8 +508,9 @@ class TrialTaskCenterWindow(MaterialMainWindow):
for button in (self.task_list.up_button, self.task_list.down_button):
button.setEnabled(grouped and not busy and not group_active
and self.task_list.sort.currentData() == 'execution'
and self.task_list.filter.currentData() == 'all'
and not self.task_list.search.text().strip())
button.setToolTip('清空搜索并切换到执行顺序后,可调整本批任务的执行位置。')
button.setToolTip('清空搜索、选择全部任务并切换到执行顺序后,可调整本批任务的执行位置。')
if not self._message:
self.run_panel.operator_band.setText(state.message)
if self._loading and not self._message:
@@ -79,9 +79,11 @@ class TaskList(QWidget):
self.recycle_button.setCheckable(True)
self.count = QLabel(objectName='taskCount')
self.filter = QComboBox(objectName="taskFilter")
self.filter.addItems(("进行中", "已完成", "已删除"))
self.filter.setVisible(False)
self.filter.setMaximumHeight(0)
for label, key, picture in (('全部任务', 'all', 'grid'), ('未完成', 'unfinished', 'clock'),
('已完成', 'completed', 'check-circle'), ('失败', 'failed', 'warning')):
self.filter.addItem(icon(picture), label, key)
self.filter.setAccessibleName('任务状态分类')
self.filter.setToolTip('未完成包括待配置、待执行、执行中、已暂停和失败的任务;分类只筛选显示。')
self.list = QListWidget(objectName="taskList")
self.list.setItemDelegate(TaskItemDelegate(self.list))
self.list.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
@@ -137,6 +139,7 @@ class TaskList(QWidget):
layout.setSpacing(11)
layout.addLayout(heading)
layout.addWidget(self.search)
layout.addWidget(self.filter)
layout.addLayout(batch)
layout.addLayout(selection)
layout.addWidget(self.list, 1)
@@ -152,6 +155,7 @@ class TaskList(QWidget):
self.select_all_button.clicked.connect(self.select_all_tasks)
self.clear_selection_button.clicked.connect(self.clear_task_selection)
self.search.textChanged.connect(self._render)
self.filter.currentIndexChanged.connect(self._render)
self.sort.currentIndexChanged.connect(self._render)
def current_task_id(self) -> str | None:
@@ -202,6 +206,11 @@ class TaskList(QWidget):
query = self.search.text().strip().casefold().replace('\\', '/')
tasks = [task for task in self._tasks if query in ' '.join(str(getattr(task, name, '') or '')
for name in ('name', 'discovery_root', 'note')).casefold().replace('\\', '/')]
category = self.filter.currentData()
if not self.recycle_button.isChecked() and category != 'all':
tasks = [task for task in tasks if
(task.status.value not in {'completed', 'deleted'} if category == 'unfinished'
else task.status.value == category)]
mode = self.sort.currentData()
if mode.startswith('name_'):
tasks.sort(key=lambda task: tuple(int(part) if part.isdigit() else part