mirror of
https://github.com/KenanZhu/AutoLibrary.git
synced 2026-06-18 23:43:02 +08:00
feat(ALTimerTaskWidget): 新增定时器任务状态 - 执行失败
This commit is contained in:
@@ -36,6 +36,7 @@ class TimerTaskStatus(Enum):
|
|||||||
READY = "已就绪"
|
READY = "已就绪"
|
||||||
RUNNING = "执行中"
|
RUNNING = "执行中"
|
||||||
EXECUTED = "已执行"
|
EXECUTED = "已执行"
|
||||||
|
ERROR = "执行失败"
|
||||||
OUTDATED = "已过期"
|
OUTDATED = "已过期"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,9 @@ class TimerTaskItemWidget(QWidget):
|
|||||||
case TimerTaskStatus.EXECUTED:
|
case TimerTaskStatus.EXECUTED:
|
||||||
TaskStatusText = "已执行"
|
TaskStatusText = "已执行"
|
||||||
TaskStatusColor = "#4CAF50"
|
TaskStatusColor = "#4CAF50"
|
||||||
|
case TimerTaskStatus.ERROR:
|
||||||
|
TaskStatusText = "执行失败"
|
||||||
|
TaskStatusColor = "#FF5722"
|
||||||
case TimerTaskStatus.OUTDATED:
|
case TimerTaskStatus.OUTDATED:
|
||||||
TaskStatusText = "已过期"
|
TaskStatusText = "已过期"
|
||||||
TaskStatusColor = "#FF5722"
|
TaskStatusColor = "#FF5722"
|
||||||
@@ -315,6 +318,7 @@ class ALTimerTaskWidget(QWidget, Ui_ALTimerTaskWidget):
|
|||||||
pending = 0
|
pending = 0
|
||||||
in_queue = 0
|
in_queue = 0
|
||||||
executed = 0
|
executed = 0
|
||||||
|
invalid = 0
|
||||||
total = len(self.__timer_tasks)
|
total = len(self.__timer_tasks)
|
||||||
for timer_task in self.__timer_tasks:
|
for timer_task in self.__timer_tasks:
|
||||||
if timer_task["status"] == TimerTaskStatus.PENDING:
|
if timer_task["status"] == TimerTaskStatus.PENDING:
|
||||||
@@ -324,10 +328,14 @@ class ALTimerTaskWidget(QWidget, Ui_ALTimerTaskWidget):
|
|||||||
in_queue += 1
|
in_queue += 1
|
||||||
elif timer_task["status"] == TimerTaskStatus.EXECUTED:
|
elif timer_task["status"] == TimerTaskStatus.EXECUTED:
|
||||||
executed += 1
|
executed += 1
|
||||||
|
elif timer_task["status"] == TimerTaskStatus.ERROR\
|
||||||
|
or timer_task["status"] == TimerTaskStatus.OUTDATED:
|
||||||
|
invalid += 1
|
||||||
self.TotalTaskLabel.setText(f"总任务:{total}")
|
self.TotalTaskLabel.setText(f"总任务:{total}")
|
||||||
self.PendingTaskLabel.setText(f"待执行:{pending}")
|
self.PendingTaskLabel.setText(f"待执行:{pending}")
|
||||||
self.InQueueTaskLabel.setText(f"队列中:{in_queue}")
|
self.InQueueTaskLabel.setText(f"队列中:{in_queue}")
|
||||||
self.ExecutedTaskLabel.setText(f"已执行:{executed}")
|
self.ExecutedTaskLabel.setText(f"已执行:{executed}")
|
||||||
|
self.InvalidTaskLabel.setText(f"无效的:{invalid}")
|
||||||
|
|
||||||
|
|
||||||
def updateTimerTaskList(
|
def updateTimerTaskList(
|
||||||
@@ -470,3 +478,14 @@ class ALTimerTaskWidget(QWidget, Ui_ALTimerTaskWidget):
|
|||||||
if task["task_uuid"] == timer_task["task_uuid"]:
|
if task["task_uuid"] == timer_task["task_uuid"]:
|
||||||
task["status"] = TimerTaskStatus.EXECUTED
|
task["status"] = TimerTaskStatus.EXECUTED
|
||||||
self.timerTasksChanged.emit()
|
self.timerTasksChanged.emit()
|
||||||
|
|
||||||
|
@Slot(dict)
|
||||||
|
def onTimerTaskIsError(
|
||||||
|
self,
|
||||||
|
timer_task: dict
|
||||||
|
):
|
||||||
|
|
||||||
|
for task in self.__timer_tasks:
|
||||||
|
if task["task_uuid"] == timer_task["task_uuid"]:
|
||||||
|
task["status"] = TimerTaskStatus.ERROR
|
||||||
|
self.timerTasksChanged.emit()
|
||||||
|
|||||||
@@ -137,6 +137,30 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="InvalidTaskLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>70</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>25</width>
|
||||||
|
<height>70</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QLabel {
|
||||||
|
color: #FF5722
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>无效的:0</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="TimerTaskSpaceFrame">
|
<widget class="QFrame" name="TimerTaskSpaceFrame">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
|
|||||||
Reference in New Issue
Block a user