add image paths

This commit is contained in:
2025-11-01 16:13:14 +08:00
parent 290324b5e4
commit d002ffb9e8
15 changed files with 242 additions and 181 deletions

View File

@ -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,