add image paths
This commit is contained in:
95
utils/image_paths.py
Normal file
95
utils/image_paths.py
Normal file
@ -0,0 +1,95 @@
|
||||
# image_paths.py
|
||||
# 所有图片的资源路径常量
|
||||
class ImagePaths:
|
||||
# 功能:AI相关
|
||||
AI_DETECT = ":/icons/images/AI检测.png"
|
||||
|
||||
# 功能:传送带相关
|
||||
CONVEYOR = ":/icons/images/传送带.png"
|
||||
CONVEYOR_GEAR = ":/icons/images/传送带齿轮.png"
|
||||
CONVEYOR_ARROW_RIGHT1 = ":/icons/images/传送带箭头按钮右1.png"
|
||||
CONVEYOR_ARROW_RIGHT2 = ":/icons/images/传送带箭头按钮右2.png"
|
||||
CONVEYOR_ARROW_LEFT1 = ":/icons/images/传送带箭头按钮左1.png"
|
||||
CONVEYOR_ARROW_LEFT2 = ":/icons/images/传送带箭头按钮左2.png"
|
||||
|
||||
# 功能:底部控件相关
|
||||
BOTTOM_BACKGROUND = ":/icons/images/底部背景.png"
|
||||
BOTTOM_SHORT_BTN1 = ":/icons/images/底部短按钮1.png"
|
||||
BOTTOM_SHORT_BTN2 = ":/icons/images/底部短按钮2.png"
|
||||
BOTTOM_SYSTEM_RED = ":/icons/images/底部系统状态红.png"
|
||||
BOTTOM_SYSTEM_YELLOW = ":/icons/images/底部系统状态黄.png"
|
||||
BOTTOM_SYSTEM_GREEN = ":/icons/images/底部系统状态绿.png"
|
||||
BOTTOM_LONG_BTN1 = ":/icons/images/底部长按钮1.png"
|
||||
BOTTOM_LONG_BTN2 = ":/icons/images/底部长按钮2.png"
|
||||
|
||||
# 功能:拱相关(模具车部分)
|
||||
ARCH1 = ":/icons/images/拱1.png"
|
||||
ARCH2 = ":/icons/images/拱2.png"
|
||||
ARCH3 = ":/icons/images/拱3.png"
|
||||
|
||||
# 功能:搅拌机相关
|
||||
MIXER = ":/icons/images/搅拌机.png"
|
||||
MIXER_PADDLE = ":/icons/images/搅拌桨.png"
|
||||
|
||||
# 功能:刷新/状态相关
|
||||
INTERFACE_REFRESH = ":/icons/images/界面刷新.png"
|
||||
OFFLINE = ":/icons/images/离线.png"
|
||||
ONLINE = ":/icons/images/在线.png"
|
||||
|
||||
# 功能:料斗相关
|
||||
HOPPER1 = ":/icons/images/料斗1.png"
|
||||
HOPPER2 = ":/icons/images/料斗2.png"
|
||||
HOPPER_CLAMP_RIGHT = ":/icons/images/料斗夹具右.png"
|
||||
HOPPER_CLAMP_LEFT = ":/icons/images/料斗夹具左.png"
|
||||
HOPPER_STATUS_RED = ":/icons/images/料斗状态红.png"
|
||||
HOPPER_STATUS_YELLOW = ":/icons/images/料斗状态黄.png"
|
||||
HOPPER_STATUS_GREEN = ":/icons/images/料斗状态绿.png"
|
||||
ARCH_BREAK = ":/icons/images/破拱.png"
|
||||
|
||||
# 功能:任务相关
|
||||
TASK_PLAN_BACKGROUND = ":/icons/images/任务计划背景.png"
|
||||
TASK_RECT1 = ":/icons/images/任务矩形1.png"
|
||||
TASK_RECT2 = ":/icons/images/任务矩形2.png"
|
||||
TASK_RECT3 = ":/icons/images/任务矩形3.png"
|
||||
TASK_RECT4 = ":/icons/images/任务矩形4.png"
|
||||
TASK_RECT5 = ":/icons/images/任务矩形5.png"
|
||||
TASK_REFRESH = ":/icons/images/任务刷新.png"
|
||||
TASK_INFO_BACKGROUND1 = ":/icons/images/任务信息背景1.png"
|
||||
TASK_INFO_SEPARATOR = ":/icons/images/任务信息分隔.png"
|
||||
TASK_INFO_DETAIL_BTN1 = ":/icons/images/任务信息详情按钮1.png"
|
||||
TASK_INFO_DETAIL_BTN2 = ":/icons/images/任务信息详情按钮2.png"
|
||||
TASK_INFO_SELECT_BTN1 = ":/icons/images/任务信息选择按钮1.png"
|
||||
TASK_INFO_SELECT_BTN2 = ":/icons/images/任务信息选择按钮2.png"
|
||||
|
||||
# 功能:视频相关
|
||||
VIDEO_BACKGROUND = ":/icons/images/视频背景.png"
|
||||
VIDEO_TITLE_BACKGROUND = ":/icons/images/视频标题背景.png"
|
||||
VIDEO_FRAME_BACKGROUND = ":/icons/images/视频框背景.png"
|
||||
VIDEO_CAMERA_MARK = ":/icons/images/视频摄像头标志.png"
|
||||
|
||||
# 功能:标题/Logo相关
|
||||
TEXT_TITLE_BG = ":/icons/images/文字标题底.png"
|
||||
SYSTEM_LOGO = ":/icons/images/系统logo.png"
|
||||
SYSTEM_TOTAL_TITLE = ":/icons/images/系统总标题.png"
|
||||
|
||||
# 功能:系统相关
|
||||
SYSTEM_RESET = ":/icons/images/系统复位.png"
|
||||
SYSTEM_START = ":/icons/images/系统启动.png"
|
||||
SYSTEM_SETTING_BG1 = ":/icons/images/系统设置背景1.png"
|
||||
SYSTEM_SETTING_BG2 = ":/icons/images/系统设置背景2.png"
|
||||
SYSTEM_DATA_CENTER_BG1 = ":/icons/images/系统数据中心背景1.png"
|
||||
SYSTEM_DATA_CENTER_BG2 = ":/icons/images/系统数据中心背景2.png"
|
||||
SYSTEM_STOP = ":/icons/images/系统停止.png"
|
||||
SYSTEM_MSG_BACKGROUND = ":/icons/images/系统消息背景.png"
|
||||
SYSTEM_MSG_HORN = ":/icons/images/系统消息喇叭.png"
|
||||
SYSTEM_USER_CENTER_BG1 = ":/icons/images/系统用户中心背景1.png"
|
||||
SYSTEM_USER_CENTER_BG2 = ":/icons/images/系统用户中心背景2.png"
|
||||
SYSTEM_CENTER_POPUP_BG = ":/icons/images/系统中心弹窗背景.png"
|
||||
SYSTEM_MAIN_NAV = ":/icons/images/系统主界面导航栏.png"
|
||||
|
||||
# 功能:通用按钮相关
|
||||
ROUND_BTN_BG1 = ":/icons/images/圆形按钮背景1.png"
|
||||
ROUND_BTN_BG2 = ":/icons/images/圆形按钮背景2.png"
|
||||
|
||||
# 功能:主界面相关
|
||||
MAIN_INTERFACE_BACKGROUND = ":/icons/images/主界面背景.png"
|
||||
@ -18,6 +18,9 @@ from .widgets.production_progress_widget import ProductionProgressWidget
|
||||
from .widgets.vibration_video_widget import VibrationVideoWidget
|
||||
from .widgets.bottom_control_widget import BottomControlWidget
|
||||
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
|
||||
class MainWindow(QWidget):
|
||||
def __init__(self):
|
||||
@ -64,7 +67,7 @@ class MainWindow(QWidget):
|
||||
|
||||
# 设置主界面背景图片
|
||||
try:
|
||||
self.background_image = QImage(":/icons/images/主界面背景.png")
|
||||
self.background_image = QImage(ImagePaths.MAIN_INTERFACE_BACKGROUND)
|
||||
if self.background_image.isNull():
|
||||
raise Exception("图片为空,可能路径错误或格式不支持")
|
||||
# print("图片加载成功")
|
||||
@ -100,7 +103,7 @@ class MainWindow(QWidget):
|
||||
from busisness.blls import ArtifactBll, PDRecordBll
|
||||
artifact_dal = ArtifactBll()
|
||||
artifacts = artifact_dal.get_artifact_task()
|
||||
print("\n打印artifacts数据:")
|
||||
# print("\n打印artifacts数据:")
|
||||
for i, artifact in enumerate(artifacts):
|
||||
# 如果是数据类对象,转换为字典输出
|
||||
# print(artifact.MouldCode)
|
||||
@ -115,7 +118,7 @@ class MainWindow(QWidget):
|
||||
pdrecord_dal = PDRecordBll()
|
||||
pdrecords = pdrecord_dal.get_PD_record()
|
||||
# print(pdrecords[0].MouldCode)
|
||||
print("\n打印pdrecords数据:")
|
||||
# print("\n打印pdrecords数据:")
|
||||
for i, record in enumerate(pdrecords):
|
||||
# 如果是数据类对象,转换为字典输出
|
||||
# print(record.__dict__["MouldCode"])
|
||||
|
||||
@ -3,6 +3,7 @@ from PySide6.QtGui import QPixmap
|
||||
from PySide6.QtCore import Qt, QPropertyAnimation, Property
|
||||
import os
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
# 拱形进度条
|
||||
class OverlapArcProgress(QWidget):
|
||||
@ -107,7 +108,7 @@ class ArcProgressWidget(QWidget):
|
||||
super().__init__()
|
||||
# 加载ArcProgressWidget背景图
|
||||
# 添加了 拱3.png 作为背景图
|
||||
bg_img = ":/icons/images/拱3.png" # 需要修改为实际的图片的路径
|
||||
bg_img = ImagePaths.ARCH3 # 需要修改为实际的图片的路径
|
||||
# self.setStyleSheet(f"background-image: url({bg_img}); background-repeat: no-repeat; background-position: center;")
|
||||
self.bg_pixmap = QPixmap(bg_img)
|
||||
# self.setStyleSheet("background-color: red;")
|
||||
@ -132,10 +133,10 @@ class ArcProgressWidget(QWidget):
|
||||
self.arc_title_label = QLabel("振捣模具车", self)
|
||||
self.arc_title_label.setFixedSize(555, 29)
|
||||
self.arc_title_label.setAlignment(Qt.AlignCenter)
|
||||
self.arc_title_label.setStyleSheet("""
|
||||
self.arc_title_label.setStyleSheet(f"""
|
||||
color: #0bffff;
|
||||
font-size: 18px;
|
||||
background-image: url(:/icons/images/文字标题底.png);
|
||||
background-image: url({ImagePaths.TEXT_TITLE_BG});
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
margin: 4px auto;
|
||||
@ -155,8 +156,8 @@ class ArcProgressWidget(QWidget):
|
||||
|
||||
# 3. 在容器内添加所有标签和拱形进度条(用setGeometry定位)
|
||||
# 创建拱形进度条控件
|
||||
arc_bg_img = ":/icons/images/拱2.png" # 替换为实际路径
|
||||
arc_fg_img = ":/icons/images/拱1.png" # 替换为实际路径
|
||||
arc_bg_img = ImagePaths.ARCH2 # 替换为实际路径
|
||||
arc_fg_img = ImagePaths.ARCH1 # 替换为实际路径
|
||||
self.arc_progress = OverlapArcProgress(arc_bg_img, arc_fg_img, container)
|
||||
|
||||
# 显示环号的标签
|
||||
|
||||
@ -4,6 +4,7 @@ from PySide6.QtGui import QPixmap, QPainter, QFont, QPen
|
||||
from PySide6.QtCore import Qt, QDateTime, QEvent, QSize
|
||||
from view.widgets.switch_button import SwitchButton
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
class BottomControlWidget(QWidget):
|
||||
def __init__(self, parent=None):
|
||||
@ -12,7 +13,7 @@ class BottomControlWidget(QWidget):
|
||||
|
||||
def initUI(self):
|
||||
# 1. 加载背景图并设置控件尺寸
|
||||
bg_path = ":/icons/images/底部背景.png"
|
||||
bg_path = ImagePaths.BOTTOM_BACKGROUND
|
||||
self.bg_pixmap = QPixmap(bg_path)
|
||||
if self.bg_pixmap.isNull():
|
||||
print("警告:底部背景.png 加载失败,请检查路径!")
|
||||
@ -28,26 +29,26 @@ class BottomControlWidget(QWidget):
|
||||
# 3. 逐个添加组件
|
||||
## 3.1 系统诊断按钮(带状态图)
|
||||
self.diagnosis_btn = self.createDiagnosisButton("系统诊断",
|
||||
":/icons/images/底部短按钮1.png",
|
||||
":/icons/images/底部短按钮2.png")
|
||||
ImagePaths.BOTTOM_SHORT_BTN1,
|
||||
ImagePaths.BOTTOM_SHORT_BTN2)
|
||||
main_layout.addWidget(self.diagnosis_btn)
|
||||
|
||||
## 3.2 系统状态消息按钮(长按钮)
|
||||
self.status_msg_btn = self.createLongButton("系统状态消息",
|
||||
":/icons/images/底部长按钮1.png",
|
||||
":/icons/images/底部长按钮2.png")
|
||||
ImagePaths.BOTTOM_LONG_BTN1,
|
||||
ImagePaths.BOTTOM_LONG_BTN2)
|
||||
main_layout.addWidget(self.status_msg_btn)
|
||||
|
||||
## 3.3 预警消息列表按钮(长按钮)
|
||||
self.warning_list_btn = self.createLongButton("预警消息列表",
|
||||
":/icons/images/底部长按钮1.png",
|
||||
":/icons/images/底部长按钮2.png")
|
||||
ImagePaths.BOTTOM_LONG_BTN1,
|
||||
ImagePaths.BOTTOM_LONG_BTN2)
|
||||
main_layout.addWidget(self.warning_list_btn)
|
||||
|
||||
## 3.4 系统中心按钮(短按钮,无状态图)
|
||||
self.center_btn = self.createShortButton("系统中心",
|
||||
":/icons/images/底部短按钮1.png",
|
||||
":/icons/images/底部短按钮2.png")
|
||||
ImagePaths.BOTTOM_SHORT_BTN1,
|
||||
ImagePaths.BOTTOM_SHORT_BTN2)
|
||||
main_layout.addWidget(self.center_btn)
|
||||
|
||||
## 3.5 自动模式(文字+开关)
|
||||
@ -88,7 +89,7 @@ class BottomControlWidget(QWidget):
|
||||
|
||||
# 2. 状态图标(作为按钮的子控件,单独定位)
|
||||
self.status_icon = QLabel(btn)
|
||||
status_pix = QPixmap(":/icons/images/底部系统状态绿.png")
|
||||
status_pix = QPixmap(ImagePaths.BOTTOM_SYSTEM_GREEN)
|
||||
if not status_pix.isNull():
|
||||
self.status_icon.setFixedSize(status_pix.width(), status_pix.height())
|
||||
self.status_icon.setPixmap(status_pix)
|
||||
@ -119,12 +120,12 @@ class BottomControlWidget(QWidget):
|
||||
|
||||
return btn
|
||||
|
||||
def setStatusIcon(self, status, count=0):
|
||||
"""切换状态图标并显示数量"""
|
||||
def set_system_status(self, status, count=0):
|
||||
"""设置系统诊断按钮的状态图标并显示数量"""
|
||||
icon_map = {
|
||||
"normal": ":/icons/images/底部系统状态绿.png",
|
||||
"warning": ":/icons/images/底部系统状态黄.png",
|
||||
"error": ":/icons/images/底部系统状态红.png"
|
||||
"normal": ImagePaths.BOTTOM_SYSTEM_GREEN, # 正常情况
|
||||
"warning": ImagePaths.BOTTOM_SYSTEM_YELLOW, # 警告情况
|
||||
"error": ImagePaths.BOTTOM_SYSTEM_RED # 异常情况
|
||||
}
|
||||
pixmap_path = icon_map.get(status, icon_map["normal"])
|
||||
pixmap = QPixmap(pixmap_path)
|
||||
@ -232,7 +233,7 @@ class BottomControlWidget(QWidget):
|
||||
|
||||
def createAutoModeWidget(self):
|
||||
"""创建自动模式组件"""
|
||||
bg_img = ":/icons/images/底部短按钮1.png"
|
||||
bg_img = ImagePaths.BOTTOM_SHORT_BTN1
|
||||
bg_pix = QPixmap(bg_img)
|
||||
if bg_pix.isNull():
|
||||
print(f"警告:{bg_img} 加载失败")
|
||||
@ -285,7 +286,7 @@ if __name__ == "__main__":
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
widget = BottomControlWidget()
|
||||
widget.setStatusIcon("error", 33)
|
||||
widget.set_system_status("error", 33)
|
||||
widget.show()
|
||||
sys.exit(app.exec())
|
||||
|
||||
@ -2,6 +2,7 @@ from PySide6.QtWidgets import QPushButton
|
||||
from PySide6.QtGui import QPainter, QFont, Qt, QPixmap, QColor
|
||||
from PySide6.QtCore import QRectF
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
# 用于 开、拱 等功能按钮
|
||||
class CircularButton(QPushButton):
|
||||
@ -12,8 +13,8 @@ class CircularButton(QPushButton):
|
||||
self.setFixedSize(41, 41)
|
||||
|
||||
# 加载背景图片
|
||||
self.normal_pixmap = QPixmap(":/icons/images/圆形按钮背景1.png") # 正常状态图片 需要修改为实际的路径
|
||||
self.hover_pixmap = QPixmap(":/icons/images/圆形按钮背景2.png") # hover状态图片 需要修改为实际的路径
|
||||
self.normal_pixmap = QPixmap(ImagePaths.ROUND_BTN_BG1) # 正常状态图片 需要修改为实际的路径
|
||||
self.hover_pixmap = QPixmap(ImagePaths.ROUND_BTN_BG2) # hover状态图片 需要修改为实际的路径
|
||||
|
||||
# 确保图片加载成功(可选:添加错误处理)
|
||||
if self.normal_pixmap.isNull():
|
||||
@ -25,6 +26,9 @@ class CircularButton(QPushButton):
|
||||
self.is_hover = False
|
||||
self.normal_text_color = QColor(6, 224, 239)
|
||||
self.hover_text_color = QColor(3, 20, 100)
|
||||
|
||||
# 设置按钮手势
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
|
||||
# 去除默认样式
|
||||
self.setStyleSheet("background: transparent; border: none;")
|
||||
|
||||
@ -11,6 +11,7 @@ from PySide6.QtGui import QPixmap
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
# 传送系统控件 (包括传送带 和 料斗)
|
||||
class ConveyorSystemWidget(QWidget):
|
||||
@ -51,7 +52,7 @@ class ConveyorSystemWidget(QWidget):
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
# 外框图片
|
||||
outer_img = ":/icons/images/料斗1.png"
|
||||
outer_img = ImagePaths.HOPPER1
|
||||
outer_pixmap = QPixmap(outer_img)
|
||||
if outer_pixmap.isNull():
|
||||
print(f"警告:图片 {outer_img} 加载失败,请检查路径!")
|
||||
@ -70,7 +71,7 @@ class ConveyorSystemWidget(QWidget):
|
||||
layout.addWidget(upper_bg_widget, alignment=Qt.AlignCenter)
|
||||
|
||||
# 内框图片
|
||||
inner_img = ":/icons/images/料斗2.png"
|
||||
inner_img = ImagePaths.HOPPER2
|
||||
inner_pixmap = QPixmap(inner_img)
|
||||
if not inner_pixmap.isNull():
|
||||
upper_inner_label = QLabel(upper_bg_widget)
|
||||
@ -86,7 +87,7 @@ class ConveyorSystemWidget(QWidget):
|
||||
group.setObjectName("conveyorGroup")
|
||||
|
||||
# 1. 加载传送带图片,设置group的尺寸和背景
|
||||
conveyor_path = ":/icons/images/传送带.png" # 需要替换为实际的路径
|
||||
conveyor_path = ImagePaths.CONVEYOR # 需要替换为实际的路径
|
||||
conveyor_pix = QPixmap(conveyor_path)
|
||||
if conveyor_pix.isNull():
|
||||
print("警告:传送带图片加载失败!请检查图片路径是否正确!")
|
||||
@ -109,7 +110,7 @@ class ConveyorSystemWidget(QWidget):
|
||||
|
||||
# 3. 左侧齿轮(直接放在group的布局里,层级在背景之上)
|
||||
left_gear = QLabel(group)
|
||||
left_gear_pix = QPixmap(":/icons/images/传送带齿轮.png")
|
||||
left_gear_pix = QPixmap(ImagePaths.CONVEYOR_GEAR)
|
||||
if left_gear_pix.isNull():
|
||||
print("警告:左侧齿轮图片加载失败!")
|
||||
else:
|
||||
@ -120,7 +121,7 @@ class ConveyorSystemWidget(QWidget):
|
||||
|
||||
# 4. 右侧齿轮(通过addStretch推到最右边)
|
||||
right_gear = QLabel(group)
|
||||
right_gear_pix = QPixmap(":/icons/images/传送带齿轮.png")
|
||||
right_gear_pix = QPixmap(ImagePaths.CONVEYOR_GEAR)
|
||||
if right_gear_pix.isNull():
|
||||
print("警告:右侧齿轮图片加载失败!")
|
||||
else:
|
||||
@ -139,40 +140,42 @@ class ConveyorSystemWidget(QWidget):
|
||||
# 左侧按钮
|
||||
self.left_btn = QPushButton()
|
||||
self.left_btn.setFixedSize(25, 25)
|
||||
self.left_btn.setCursor(Qt.PointingHandCursor)
|
||||
self.left_btn.setStyleSheet(
|
||||
"""
|
||||
QPushButton {
|
||||
background-image: url(:/icons/images/传送带箭头按钮左1.png);
|
||||
f"""
|
||||
QPushButton {{
|
||||
background-image: url({ImagePaths.CONVEYOR_ARROW_LEFT1});
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
border: none;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-image: url(:/icons/images/传送带箭头按钮左2.png);
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-image: url(:/icons/images/传送带箭头按钮左2.png);
|
||||
}
|
||||
}}
|
||||
QPushButton:hover {{
|
||||
background-image: url({ImagePaths.CONVEYOR_ARROW_LEFT2});
|
||||
}}
|
||||
QPushButton:pressed {{
|
||||
background-image: url({ImagePaths.CONVEYOR_ARROW_LEFT2});
|
||||
}}
|
||||
"""
|
||||
)
|
||||
|
||||
# 右侧按钮
|
||||
self.right_btn = QPushButton()
|
||||
self.right_btn.setFixedSize(25, 25)
|
||||
self.right_btn.setCursor(Qt.PointingHandCursor)
|
||||
self.right_btn.setStyleSheet(
|
||||
"""
|
||||
QPushButton {
|
||||
background-image: url(:/icons/images/传送带箭头按钮右1.png);
|
||||
f"""
|
||||
QPushButton {{
|
||||
background-image: url({ImagePaths.CONVEYOR_ARROW_RIGHT1});
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
border: none;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-image: url(:/icons/images/传送带箭头按钮右2.png);
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-image: url(:/icons/images/传送带箭头按钮右2.png);
|
||||
}
|
||||
}}
|
||||
QPushButton:hover {{
|
||||
background-image: url({ImagePaths.CONVEYOR_ARROW_RIGHT2});
|
||||
}}
|
||||
QPushButton:pressed {{
|
||||
background-image: url({ImagePaths.CONVEYOR_ARROW_RIGHT2});
|
||||
}}
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ from .circular_button import CircularButton
|
||||
from .clamp_widget import ClampWidget
|
||||
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
class HopperWidget(QWidget):
|
||||
# 上料斗破拱信号
|
||||
@ -66,10 +67,10 @@ class HopperWidget(QWidget):
|
||||
self.upper_title_label.setAlignment(Qt.AlignCenter)
|
||||
# self.upper_title_label.setStyleSheet("color: #2fd3f2; font-size: 14px; font-weight: bold;")
|
||||
# self.upper_title_label.setStyleSheet("color: #0bffff; font-size: 18px;")
|
||||
self.upper_title_label.setStyleSheet("""
|
||||
self.upper_title_label.setStyleSheet(f"""
|
||||
color: #0bffff;
|
||||
font-size: 18px;
|
||||
background-image: url(:/icons/images/文字标题底.png);
|
||||
background-image: url({ImagePaths.TEXT_TITLE_BG});
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
margin-bottom: 4px;
|
||||
@ -77,7 +78,7 @@ class HopperWidget(QWidget):
|
||||
layout.addWidget(self.upper_title_label, alignment=Qt.AlignCenter)
|
||||
|
||||
# 加载外框图片
|
||||
outer_img = ":/icons/images/料斗1.png"
|
||||
outer_img = ImagePaths.HOPPER1
|
||||
outer_pixmap = QPixmap(outer_img)
|
||||
if outer_pixmap.isNull():
|
||||
print(f"警告:图片 {outer_img} 加载失败,请检查路径!")
|
||||
@ -93,7 +94,7 @@ class HopperWidget(QWidget):
|
||||
|
||||
|
||||
# 内框图片(上位)
|
||||
inner_img = ":/icons/images/料斗2.png"
|
||||
inner_img = ImagePaths.HOPPER2
|
||||
inner_pixmap = QPixmap(inner_img)
|
||||
if not inner_pixmap.isNull():
|
||||
self.upper_inner_label = QLabel(self.upper_bg_widget)
|
||||
@ -102,7 +103,7 @@ class HopperWidget(QWidget):
|
||||
self.upper_inner_label.move(14, 9)
|
||||
|
||||
# 状态图片(上位,绿色)
|
||||
status_img = ":/icons/images/料斗状态绿.png"
|
||||
status_img = ImagePaths.HOPPER_STATUS_GREEN
|
||||
status_pixmap = QPixmap(status_img)
|
||||
if not status_pixmap.isNull():
|
||||
status_pixmap = status_pixmap.scaled(13, 13, Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
||||
@ -113,7 +114,7 @@ class HopperWidget(QWidget):
|
||||
self.upper_status_label.setStyleSheet("background: none;")
|
||||
|
||||
# 破拱图片(上位)
|
||||
arch_img = ":/icons/images/破拱.png"
|
||||
arch_img = ImagePaths.ARCH_BREAK
|
||||
arch_pixmap = QPixmap(arch_img)
|
||||
if not arch_pixmap.isNull():
|
||||
arch_pixmap = arch_pixmap.scaled(16, 13, Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
||||
@ -139,34 +140,6 @@ class HopperWidget(QWidget):
|
||||
self.upper_extra_label.setFixedSize(120, 29)
|
||||
self.upper_extra_label.move(outer_width//2 - 60, outer_height//2 - 13)
|
||||
|
||||
# 料斗夹具图片(上位)
|
||||
# clamp_img = "料斗夹具.png"
|
||||
# clamp_pixmap = QPixmap(clamp_img)
|
||||
# if not clamp_pixmap.isNull():
|
||||
# self.upper_clamp_label = QLabel()
|
||||
# self.upper_clamp_label.setPixmap(clamp_pixmap)
|
||||
# self.upper_clamp_label.setFixedSize(clamp_pixmap.width(), clamp_pixmap.height())
|
||||
# layout.addWidget(self.upper_clamp_label, alignment=Qt.AlignCenter)
|
||||
|
||||
# 料斗夹具图片(上位,固定152x60尺寸,图片自适应缩放)
|
||||
# 注意:目前由于给出的 料斗夹具图片尺寸大了,只能够先缩放,后期图片对了,可以用上面的
|
||||
# clamp_img = "料斗夹具.png"
|
||||
# clamp_pixmap = QPixmap(clamp_img)
|
||||
# if not clamp_pixmap.isNull():
|
||||
# self.upper_clamp_label = QLabel()
|
||||
# # 1. 固定QLabel尺寸为152x60 51,84
|
||||
# self.upper_clamp_label.setFixedSize(152, 60)
|
||||
# # 2. 图片缩放到152x60(保持比例,平滑缩放)
|
||||
# scaled_pixmap = clamp_pixmap.scaled(
|
||||
# 152, 60,
|
||||
# Qt.KeepAspectRatio, # 保持图片原始比例,避免变形
|
||||
# Qt.SmoothTransformation # 平滑缩放,提升显示效果
|
||||
# )
|
||||
# self.upper_clamp_label.setPixmap(scaled_pixmap)
|
||||
# # 3. 确保图片在QLabel中居中显示
|
||||
# self.upper_clamp_label.setAlignment(Qt.AlignCenter)
|
||||
# layout.addWidget(self.upper_clamp_label, alignment=Qt.AlignCenter)
|
||||
|
||||
# 夹具容器
|
||||
self.upper_clamp_widget = ClampWidget()
|
||||
layout.addWidget(self.upper_clamp_widget, alignment=Qt.AlignCenter)
|
||||
@ -246,10 +219,10 @@ class HopperWidget(QWidget):
|
||||
self.lower_title_label.setAlignment(Qt.AlignCenter)
|
||||
# self.lower_title_label.setStyleSheet("color: #2fd3f2; font-size: 14px; font-weight: bold;")
|
||||
# self.lower_title_label.setStyleSheet("color: #0bffff; font-size: 18px;")
|
||||
self.lower_title_label.setStyleSheet("""
|
||||
self.lower_title_label.setStyleSheet(f"""
|
||||
color: #0bffff;
|
||||
font-size: 18px;
|
||||
background-image: url(:/icons/images/文字标题底.png);
|
||||
background-image: url({ImagePaths.TEXT_TITLE_BG});
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
margin-bottom: 4px;
|
||||
@ -257,7 +230,7 @@ class HopperWidget(QWidget):
|
||||
layout.addWidget(self.lower_title_label, alignment=Qt.AlignCenter)
|
||||
|
||||
# 加载外框图片
|
||||
outer_img = ":/icons/images/料斗1.png"
|
||||
outer_img = ImagePaths.HOPPER1
|
||||
outer_pixmap = QPixmap(outer_img)
|
||||
if outer_pixmap.isNull():
|
||||
print(f"警告:图片 {outer_img} 加载失败,请检查路径!")
|
||||
@ -272,7 +245,7 @@ class HopperWidget(QWidget):
|
||||
layout.addWidget(self.lower_bg_widget, alignment=Qt.AlignCenter)
|
||||
|
||||
# 内框图片(下位)
|
||||
inner_img = ":/icons/images/料斗2.png"
|
||||
inner_img = ImagePaths.HOPPER2
|
||||
inner_pixmap = QPixmap(inner_img)
|
||||
if not inner_pixmap.isNull():
|
||||
self.lower_inner_label = QLabel(self.lower_bg_widget)
|
||||
@ -281,7 +254,7 @@ class HopperWidget(QWidget):
|
||||
self.lower_inner_label.move(14, 9)
|
||||
|
||||
# 状态图片(下位)
|
||||
status_img = ":/icons/images/料斗状态绿.png"
|
||||
status_img = ImagePaths.HOPPER_STATUS_GREEN
|
||||
status_pixmap = QPixmap(status_img)
|
||||
if not status_pixmap.isNull():
|
||||
status_pixmap = status_pixmap.scaled(13, 13, Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
||||
@ -292,7 +265,7 @@ class HopperWidget(QWidget):
|
||||
self.lower_status_label.setStyleSheet("background: none;")
|
||||
|
||||
# 破拱图片(下位)
|
||||
arch_img = ":/icons/images/破拱.png"
|
||||
arch_img = ImagePaths.ARCH_BREAK
|
||||
arch_pixmap = QPixmap(arch_img)
|
||||
if not arch_pixmap.isNull():
|
||||
arch_pixmap = arch_pixmap.scaled(16, 13, Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
||||
@ -322,33 +295,6 @@ class HopperWidget(QWidget):
|
||||
# self.lower_extra_label.move(outer_width//2 - 46, outer_height//2 - 20)
|
||||
self.lower_extra_label.move(outer_width//2 - 60, outer_height//2 - 13)
|
||||
|
||||
# 料斗夹具图片(下位)
|
||||
# clamp_img = "料斗夹具.png"
|
||||
# clamp_pixmap = QPixmap(clamp_img)
|
||||
# if not clamp_pixmap.isNull():
|
||||
# self.lower_clamp_label = QLabel()
|
||||
# self.lower_clamp_label.setPixmap(clamp_pixmap)
|
||||
# self.lower_clamp_label.setFixedSize(clamp_pixmap.width(), clamp_pixmap.height())
|
||||
# layout.addWidget(self.lower_clamp_label, alignment=Qt.AlignCenter)
|
||||
|
||||
# 目前由于给出的 料斗夹具图片尺寸大了,只能够先缩放,后期图片对了,可以用上面的
|
||||
# clamp_img = "料斗夹具.png"
|
||||
# clamp_pixmap = QPixmap(clamp_img)
|
||||
# if not clamp_pixmap.isNull():
|
||||
# self.lower_clamp_label = QLabel()
|
||||
# # 1. 固定QLabel尺寸为152x60
|
||||
# self.lower_clamp_label.setFixedSize(152, 60)
|
||||
# # 2. 图片缩放到152x60(保持比例,平滑缩放)
|
||||
# scaled_pixmap = clamp_pixmap.scaled(
|
||||
# 152, 60,
|
||||
# Qt.KeepAspectRatio, # 保持图片原始比例,避免变形
|
||||
# Qt.SmoothTransformation # 平滑缩放,提升显示效果
|
||||
# )
|
||||
# self.lower_clamp_label.setPixmap(scaled_pixmap)
|
||||
# # 3. 确保图片在QLabel中居中显示
|
||||
# self.lower_clamp_label.setAlignment(Qt.AlignCenter)
|
||||
# layout.addWidget(self.lower_clamp_label, alignment=Qt.AlignCenter)
|
||||
|
||||
# 夹具容器
|
||||
self.lower_clamp_widget = ClampWidget()
|
||||
layout.addWidget( self.lower_clamp_widget, alignment=Qt.AlignCenter)
|
||||
@ -405,9 +351,9 @@ class HopperWidget(QWidget):
|
||||
# 状态-图片路径映射
|
||||
# 注意:需要替换为实际的图片路径
|
||||
status_img_map = {
|
||||
0: ":/icons/images/料斗状态绿.png",
|
||||
1: ":/icons/images/料斗状态黄.png",
|
||||
2: ":/icons/images/料斗状态红.png"
|
||||
0: ImagePaths.HOPPER_STATUS_GREEN,
|
||||
1: ImagePaths.HOPPER_STATUS_YELLOW,
|
||||
2: ImagePaths.HOPPER_STATUS_RED
|
||||
}
|
||||
img_path = status_img_map[status]
|
||||
|
||||
@ -435,9 +381,9 @@ class HopperWidget(QWidget):
|
||||
|
||||
# 注意:需要替换为实际的图片路径
|
||||
status_img_map = {
|
||||
0: ":/icons/images/料斗状态绿.png",
|
||||
1: ":/icons/images/料斗状态黄.png",
|
||||
2: ":/icons/images/料斗状态红.png"
|
||||
0: ImagePaths.HOPPER_STATUS_GREEN,
|
||||
1: ImagePaths.HOPPER_STATUS_YELLOW,
|
||||
2: ImagePaths.HOPPER_STATUS_RED
|
||||
}
|
||||
img_path = status_img_map[status]
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ from PySide6.QtGui import QPixmap, QFont
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
class MixerWidget(QWidget):
|
||||
def __init__(self, parent=None):
|
||||
@ -19,8 +20,8 @@ class MixerWidget(QWidget):
|
||||
self.text_label.setFixedSize(100, 23)
|
||||
self.text_label.setFont(QFont("Arial", 14)) # 设置字体大小为16px
|
||||
self.text_label.setAlignment(Qt.AlignCenter)
|
||||
self.text_label.setStyleSheet("""
|
||||
background-image: url(:/icons/images/文字标题底.png);
|
||||
self.text_label.setStyleSheet(f"""
|
||||
background-image: url({ImagePaths.TEXT_TITLE_BG});
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
color: #0bffff; /* 可根据需求调整文字颜色 */
|
||||
@ -29,13 +30,13 @@ class MixerWidget(QWidget):
|
||||
|
||||
# 2. 创建搅拌机设备及搅拌桨图标
|
||||
self.device_label = QLabel()
|
||||
device_pixmap = QPixmap(":/icons/images/搅拌机.png")
|
||||
device_pixmap = QPixmap(ImagePaths.MIXER)
|
||||
self.device_label.setPixmap(device_pixmap)
|
||||
layout.addWidget(self.device_label, alignment=Qt.AlignLeft)
|
||||
|
||||
# 3. 叠加两个搅拌桨图标
|
||||
self.blade1 = QLabel(self.device_label) # 从左往右第一个搅拌桨
|
||||
blade1_pixmap = QPixmap(":/icons/images/搅拌桨.png")
|
||||
blade1_pixmap = QPixmap(ImagePaths.MIXER_PADDLE)
|
||||
self.blade1.setPixmap(blade1_pixmap)
|
||||
self.blade1.move(
|
||||
(device_pixmap.width() - blade1_pixmap.width()) // 2 - 26,
|
||||
@ -43,7 +44,7 @@ class MixerWidget(QWidget):
|
||||
)
|
||||
|
||||
self.blade2 = QLabel(self.device_label)
|
||||
blade2_pixmap = QPixmap(":/icons/images/搅拌桨.png") # 从左往右第二个搅拌桨
|
||||
blade2_pixmap = QPixmap(ImagePaths.MIXER_PADDLE) # 从左往右第二个搅拌桨
|
||||
self.blade2.setPixmap(blade2_pixmap)
|
||||
self.blade2.move(
|
||||
(device_pixmap.width() - blade2_pixmap.width()) // 2 + 31,
|
||||
|
||||
@ -7,12 +7,13 @@ from .switch_button import SwitchButton
|
||||
import sys
|
||||
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
class PlanWidget(QWidget):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
# 加载背景图
|
||||
self.bg_pixmap = QPixmap(":/icons/images/任务计划背景.png")
|
||||
self.bg_pixmap = QPixmap(ImagePaths.TASK_PLAN_BACKGROUND)
|
||||
self.setFixedSize(self.bg_pixmap.size())
|
||||
|
||||
# 存储可修改控件的字典
|
||||
@ -33,7 +34,7 @@ class PlanWidget(QWidget):
|
||||
row1_layout = QHBoxLayout()
|
||||
row1_layout.setSpacing(0)
|
||||
status_icon1 = QLabel()
|
||||
status_icon1.setPixmap(QPixmap(":/icons/images/任务矩形4.png"))
|
||||
status_icon1.setPixmap(QPixmap(ImagePaths.TASK_RECT4))
|
||||
status_icon1.setFixedSize(6, 6)
|
||||
row1_layout.addWidget(status_icon1)
|
||||
row1_layout.addSpacing(4)
|
||||
@ -52,7 +53,7 @@ class PlanWidget(QWidget):
|
||||
# 第二行:计划方量
|
||||
row2_layout = QHBoxLayout()
|
||||
status_icon2 = QLabel()
|
||||
status_icon2.setPixmap(QPixmap(":/icons/images/任务矩形1.png"))
|
||||
status_icon2.setPixmap(QPixmap(ImagePaths.TASK_RECT1))
|
||||
status_icon2.setFixedSize(6, 6)
|
||||
row2_layout.addWidget(status_icon2)
|
||||
|
||||
@ -70,7 +71,7 @@ class PlanWidget(QWidget):
|
||||
row3_layout = QHBoxLayout()
|
||||
status_icon3 = QLabel()
|
||||
status_icon3.setFixedSize(6, 6)
|
||||
status_icon3.setPixmap(QPixmap(":/icons/images/任务矩形2.png"))
|
||||
status_icon3.setPixmap(QPixmap(ImagePaths.TASK_RECT2))
|
||||
row3_layout.addWidget(status_icon3)
|
||||
row3_layout.addSpacing(4)
|
||||
|
||||
@ -89,7 +90,7 @@ class PlanWidget(QWidget):
|
||||
row4_layout = QHBoxLayout()
|
||||
status_icon4 = QLabel()
|
||||
status_icon4.setFixedSize(6, 6)
|
||||
status_icon4.setPixmap(QPixmap(":/icons/images/任务矩形3.png"))
|
||||
status_icon4.setPixmap(QPixmap(ImagePaths.TASK_RECT3))
|
||||
row4_layout.addWidget(status_icon4)
|
||||
|
||||
row4_layout.addSpacing(4)
|
||||
@ -106,7 +107,7 @@ class PlanWidget(QWidget):
|
||||
# 第五行:自动派单
|
||||
row5_layout = QHBoxLayout()
|
||||
status_icon5 = QLabel()
|
||||
status_icon5.setPixmap(QPixmap(":/icons/images/任务矩形5.png"))
|
||||
status_icon5.setPixmap(QPixmap(ImagePaths.TASK_RECT5))
|
||||
status_icon5.setFixedSize(6, 6)
|
||||
row5_layout.addWidget(status_icon5)
|
||||
row5_layout.addSpacing(4)
|
||||
|
||||
@ -5,6 +5,7 @@ import sys
|
||||
import datetime
|
||||
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
class DeviceStatusPopup(QDialog):
|
||||
def __init__(self, parent=None):
|
||||
@ -95,7 +96,7 @@ class DeviceStatusPopup(QDialog):
|
||||
|
||||
def update_connection_status(self, status: str):
|
||||
"""更新连接状态,切换显示图片"""
|
||||
img_path = ":/icons/images/在线.png" if status == "在线" else ":/icons/images/离线.png"
|
||||
img_path = ImagePaths.ONLINE if status == "在线" else ImagePaths.OFFLINE
|
||||
pixmap = QPixmap(img_path)
|
||||
self.status_img.setPixmap(pixmap.scaled(
|
||||
self.status_img.width(),
|
||||
|
||||
@ -4,6 +4,7 @@ from PySide6.QtCore import QSize, Qt
|
||||
import sys
|
||||
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
class SystemButtonWidget(QWidget):
|
||||
def __init__(self):
|
||||
@ -41,11 +42,11 @@ class SystemButtonWidget(QWidget):
|
||||
# 创建按钮列表(图标+文字)
|
||||
# 注意:需要替换为实际的图片路径
|
||||
buttons_info = [
|
||||
("系统启动", ":/icons/images/系统启动.png"),
|
||||
("系统停止", ":/icons/images/系统停止.png"),
|
||||
("系统复位", ":/icons/images/系统复位.png"),
|
||||
("AI检测", ":/icons/images/AI检测.png"),
|
||||
("任务刷新", ":/icons/images/任务刷新.png")
|
||||
("系统启动", ImagePaths.SYSTEM_START),
|
||||
("系统停止", ImagePaths.SYSTEM_STOP),
|
||||
("系统复位", ImagePaths.SYSTEM_RESET),
|
||||
("AI检测", ImagePaths.AI_DETECT),
|
||||
("任务刷新", ImagePaths.TASK_REFRESH)
|
||||
]
|
||||
|
||||
# 存放按钮控件的字典
|
||||
|
||||
@ -5,6 +5,7 @@ from PySide6.QtCore import Qt, Signal, QPropertyAnimation, QEasingCurve, QRect
|
||||
import sys
|
||||
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
class CustomButton(QPushButton):
|
||||
def __init__(self, text, normal_icon, active_icon, parent=None):
|
||||
@ -69,7 +70,7 @@ class SystemCenterDialog(QDialog):
|
||||
self.setWindowOpacity(0.0) # 初始状态为完全透明,实现动画效果
|
||||
|
||||
# 加载背景图
|
||||
self.background = QPixmap(":/icons/images/系统中心弹窗背景.png")
|
||||
self.background = QPixmap(ImagePaths.SYSTEM_CENTER_POPUP_BG)
|
||||
if self.background.isNull():
|
||||
print("警告:系统中心弹窗背景.png 加载失败!")
|
||||
self.setFixedSize(220, 200)
|
||||
@ -83,9 +84,9 @@ class SystemCenterDialog(QDialog):
|
||||
main_layout.setAlignment(Qt.AlignCenter)
|
||||
|
||||
# 创建按钮并绑定信号发射
|
||||
self.sys_btn = CustomButton("系统设置", ":/icons/images/系统设置背景1.png", ":/icons/images/系统设置背景2.png")
|
||||
self.data_btn = CustomButton("数据中心", ":/icons/images/系统数据中心背景1.png", ":/icons/images/系统数据中心背景2.png")
|
||||
self.user_btn = CustomButton("用户中心", ":/icons/images/系统用户中心背景1.png", ":/icons/images/系统用户中心背景2.png")
|
||||
self.sys_btn = CustomButton("系统设置", ImagePaths.SYSTEM_SETTING_BG1, ImagePaths.SYSTEM_SETTING_BG2)
|
||||
self.data_btn = CustomButton("数据中心", ImagePaths.SYSTEM_DATA_CENTER_BG1, ImagePaths.SYSTEM_DATA_CENTER_BG2)
|
||||
self.user_btn = CustomButton("用户中心", ImagePaths.SYSTEM_USER_CENTER_BG1, ImagePaths.SYSTEM_USER_CENTER_BG2)
|
||||
|
||||
# 按钮点击 → 发射对应信号(dialog不处理业务逻辑,只传递事件)
|
||||
self.sys_btn.clicked.connect(self.sys_setting_clicked.emit)
|
||||
|
||||
@ -3,6 +3,7 @@ from PySide6.QtGui import QPixmap, QFont, QPainter
|
||||
from PySide6.QtCore import Qt, QTimer, QDateTime
|
||||
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
# 自定义消息容器, 显示系统消息
|
||||
class MsgContainer(QWidget):
|
||||
@ -11,7 +12,7 @@ class MsgContainer(QWidget):
|
||||
self.setFixedSize(770, 24)
|
||||
|
||||
# 加载消息区域背景图
|
||||
self.bg_pixmap = QPixmap(":/icons/images/系统消息背景.png") # 替换为实际路径
|
||||
self.bg_pixmap = QPixmap(ImagePaths.SYSTEM_MSG_BACKGROUND) # 替换为实际路径
|
||||
if self.bg_pixmap.isNull():
|
||||
print("警告:系统消息背景.png 加载失败")
|
||||
|
||||
@ -24,7 +25,7 @@ class MsgContainer(QWidget):
|
||||
self.msg_icon = QLabel()
|
||||
self.msg_icon.setFixedSize(13, 18)
|
||||
# self.msg_icon.setStyleSheet("background-color:red;")
|
||||
self.msg_icon.setPixmap(QPixmap(":/icons/images/系统消息喇叭.png")) # 替换为实际路径
|
||||
self.msg_icon.setPixmap(QPixmap(ImagePaths.SYSTEM_MSG_HORN)) # 替换为实际路径
|
||||
msg_layout.addWidget(self.msg_icon, alignment=Qt.AlignVCenter | Qt.AlignLeft)
|
||||
|
||||
# 消息文本
|
||||
@ -53,7 +54,7 @@ class SystemNavBar(QWidget):
|
||||
self.setFixedSize(1280, 80)
|
||||
|
||||
# 1. 加载背景图
|
||||
self.bg_pixmap = QPixmap(":/icons/images/系统主界面导航栏.png") # 替换为实际图片路径
|
||||
self.bg_pixmap = QPixmap(ImagePaths.SYSTEM_MAIN_NAV) # 替换为实际图片路径
|
||||
if self.bg_pixmap.isNull():
|
||||
print("警告:背景图加载失败,请检查路径!")
|
||||
|
||||
@ -70,11 +71,11 @@ class SystemNavBar(QWidget):
|
||||
# 系统logo
|
||||
self.logo = QLabel()
|
||||
self.logo.setFixedSize(53, 53)
|
||||
self.logo.setPixmap(QPixmap(":/icons/images/系统logo.png"))
|
||||
self.logo.setPixmap(QPixmap(ImagePaths.SYSTEM_LOGO))
|
||||
left_layout.addWidget(self.logo, alignment=Qt.AlignTop)
|
||||
# 系统总标题
|
||||
self.title = QLabel()
|
||||
self.title.setPixmap(QPixmap(":/icons/images/系统总标题.png"))
|
||||
self.title.setPixmap(QPixmap(ImagePaths.SYSTEM_TOTAL_TITLE))
|
||||
left_layout.addWidget(self.title, alignment=Qt.AlignCenter)
|
||||
main_layout.addWidget(left_container, alignment=Qt.AlignTop)
|
||||
|
||||
|
||||
@ -5,13 +5,14 @@ from PySide6.QtGui import QPainter, QPixmap, QFont
|
||||
import sys
|
||||
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
# 任务控件,如:管片任务、派单任务
|
||||
class TaskWidget(QWidget):
|
||||
def __init__(self, taskTitle:str, parent=None):
|
||||
super().__init__(parent)
|
||||
# 设置Widget大小与背景图一致
|
||||
self.bg_pixmap = QPixmap(":/icons/images/任务信息背景1.png")
|
||||
self.bg_pixmap = QPixmap(ImagePaths.TASK_INFO_BACKGROUND1)
|
||||
self.setFixedSize(self.bg_pixmap.size())
|
||||
|
||||
# 主布局(垂直)
|
||||
@ -36,9 +37,9 @@ class TaskWidget(QWidget):
|
||||
self.task_controls = {} # 结构:{"task1": {"volume_label": xxx, "time_label": xxx, ...}, ...}
|
||||
|
||||
# 三条任务条目
|
||||
self._add_task("task1", "SHRB1-3", ":/icons/images/任务矩形1.png")
|
||||
self._add_task("task2", "SHRB2-3", ":/icons/images/任务矩形2.png")
|
||||
self._add_task("task3", "SHRB1-3", ":/icons/images/任务矩形3.png")
|
||||
self._add_task("task1", "SHRB1-3", ImagePaths.TASK_RECT1)
|
||||
self._add_task("task2", "SHRB2-3", ImagePaths.TASK_RECT2)
|
||||
self._add_task("task3", "SHRB1-3", ImagePaths.TASK_RECT3)
|
||||
|
||||
def paintEvent(self, event):
|
||||
"""绘制背景图片"""
|
||||
@ -71,14 +72,14 @@ class TaskWidget(QWidget):
|
||||
select_btn = QPushButton()
|
||||
select_btn.setFixedSize(14, 14)
|
||||
select_btn.setCursor(Qt.PointingHandCursor)
|
||||
select_btn.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-image: url(:/icons/images/任务信息选择按钮1.png);
|
||||
select_btn.setStyleSheet(f"""
|
||||
QPushButton {{
|
||||
background-image: url({ImagePaths.TASK_INFO_SELECT_BTN1});
|
||||
border: none;
|
||||
}
|
||||
QPushButton:checked {
|
||||
background-image: url(:/icons/images/任务信息选择按钮2.png);
|
||||
}
|
||||
}}
|
||||
QPushButton:checked {{
|
||||
background-image: url({ImagePaths.TASK_INFO_SELECT_BTN2});
|
||||
}}
|
||||
""")
|
||||
select_btn.setCheckable(True)
|
||||
controls["select_btn"] = select_btn
|
||||
@ -95,18 +96,18 @@ class TaskWidget(QWidget):
|
||||
detail_btn.setText("详情")
|
||||
detail_btn.setFixedSize(46, 26)
|
||||
detail_btn.setCursor(Qt.PointingHandCursor)
|
||||
detail_btn.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-image: url(:/icons/images/任务信息详情按钮1.png);
|
||||
detail_btn.setStyleSheet(f"""
|
||||
QPushButton {{
|
||||
background-image: url({ImagePaths.TASK_INFO_DETAIL_BTN1});
|
||||
border: none;
|
||||
color: #3bfff8;
|
||||
font-size: 16px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-image: url(:/icons/images/任务信息详情按钮2.png);
|
||||
}}
|
||||
QPushButton:hover {{
|
||||
background-image: url({ImagePaths.TASK_INFO_DETAIL_BTN2});
|
||||
color: #001c83;
|
||||
font-size: 16px;
|
||||
}
|
||||
}}
|
||||
""")
|
||||
detail_btn.clicked.connect(lambda: self._show_detail_dialog(task_name)) # 详情按钮槽函数
|
||||
controls["detail_btn"] = detail_btn
|
||||
@ -144,7 +145,7 @@ class TaskWidget(QWidget):
|
||||
# 分隔线
|
||||
item_layout.setSpacing(5)
|
||||
separator = QLabel()
|
||||
separator.setPixmap(QPixmap(":/icons/images/任务信息分隔.png"))
|
||||
separator.setPixmap(QPixmap(ImagePaths.TASK_INFO_SEPARATOR))
|
||||
separator.setFixedSize(196, 1)
|
||||
item_layout.addWidget(separator)
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ import sys
|
||||
from .switch_button import SwitchButton
|
||||
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
|
||||
class VideoStream(QObject):
|
||||
@ -196,14 +197,14 @@ class CameraModule(QWidget):
|
||||
self.title_label.setText(f"{self.camera_name}视频")
|
||||
self.title_label.setObjectName("cameraTitleLabel")
|
||||
self.title_label.setStyleSheet(
|
||||
"""
|
||||
#cameraTitleLabel {
|
||||
f"""
|
||||
#cameraTitleLabel {{
|
||||
font-size: 18px;
|
||||
color: #16ffff;
|
||||
background-image: url(":/icons/images/视频标题背景.png");
|
||||
background-image: url({ImagePaths.VIDEO_TITLE_BACKGROUND});
|
||||
min-width: 180px;
|
||||
padding-left: 12px;
|
||||
}
|
||||
}}
|
||||
"""
|
||||
)
|
||||
|
||||
@ -251,10 +252,10 @@ class CameraModule(QWidget):
|
||||
# "background-color: #011d6b; border: none;"
|
||||
# ) # 明确视频显示背景色
|
||||
self.video_container.setStyleSheet(
|
||||
"""
|
||||
#videoContainer {
|
||||
border-image: url(":/icons/images/视频框背景.png");
|
||||
}
|
||||
f"""
|
||||
#videoContainer {{
|
||||
border-image: url({ImagePaths.VIDEO_FRAME_BACKGROUND});
|
||||
}}
|
||||
"""
|
||||
)
|
||||
video_layout = QVBoxLayout(self.video_container)
|
||||
@ -289,7 +290,7 @@ class CameraModule(QWidget):
|
||||
|
||||
# 加载视频重新连接图片
|
||||
try:
|
||||
pixmap = QPixmap(":/icons/images/界面刷新.png")
|
||||
pixmap = QPixmap(ImagePaths.INTERFACE_REFRESH)
|
||||
if not pixmap.isNull():
|
||||
self.reset_button.setIcon(QIcon(pixmap))
|
||||
self.reset_button.setIconSize(pixmap.size())
|
||||
@ -373,7 +374,7 @@ class VideoTitleWidget(QWidget):
|
||||
|
||||
# 图标标签
|
||||
self.icon_label = QLabel()
|
||||
self.icon_label.setPixmap(QPixmap(":/icons/images/视频摄像头标志.png")) # 需要换为实际的图片的路径
|
||||
self.icon_label.setPixmap(QPixmap(ImagePaths.VIDEO_CAMERA_MARK)) # 需要换为实际的图片的路径
|
||||
self.icon_label.setStyleSheet("background-color: transparent;")
|
||||
self.icon_label.setFixedSize(23, 16)
|
||||
self.icon_label.setScaledContents(True)
|
||||
@ -391,7 +392,7 @@ class VibrationVideoWidget(QWidget):
|
||||
# 1. 加载背景图片(替换为你的图片路径)
|
||||
self.background_image = QImage() # 初始化图片对象
|
||||
# 注意:图片路径需正确,建议使用绝对路径或项目相对路径
|
||||
self.background_path = ":/icons/images/视频背景.png" # 你的背景图片路径
|
||||
self.background_path = ImagePaths.VIDEO_BACKGROUND # 你的背景图片路径
|
||||
if not self.background_image.load(self.background_path):
|
||||
# 图片加载失败时的容错处理(显示红色背景作为提示)
|
||||
print(f"警告:无法加载背景图片 {self.background_path}")
|
||||
|
||||
Reference in New Issue
Block a user