27 lines
938 B
Python
27 lines
938 B
Python
from PySide6.QtWidgets import QWidget
|
|
from PySide6.QtCore import QThread, Signal # 只需要导入QThread和Signal即可
|
|
from typing import List
|
|
from busisness.blls import ArtifactBll
|
|
from busisness.models import ArtifactInfoModel
|
|
|
|
class ArtifactInfoQueryThread(QThread):
|
|
# 定义信号:子线程查询完成
|
|
query_finished = Signal(List[ArtifactInfoModel])
|
|
# 定义信号:发送错误信息
|
|
query_error = Signal(str)
|
|
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
def run(self):
|
|
try:
|
|
artifact_dal = ArtifactBll()
|
|
artifacts = artifact_dal.get_artifact_task()
|
|
|
|
if artifacts:
|
|
# 查询完成,发射信号
|
|
self.query_finished.emit(artifacts)
|
|
else:
|
|
raise ValueError("未查询到有效数据")
|
|
except Exception as e:
|
|
self.query_error.emit(f"更新管片任务数据失败: {str(e)}") |