refactor: 拆分页面 UI 模块 (#3)
This commit is contained in:
@@ -24,3 +24,84 @@
|
||||
注意:本页唯一会产生外部后果(真的去操作手机、可能下单)的命令是
|
||||
“开始自动获取”。其余操作全部只读本地数据库。
|
||||
"""
|
||||
|
||||
from PyQt5.QtWidgets import (
|
||||
QGridLayout,
|
||||
QHBoxLayout,
|
||||
QSizePolicy,
|
||||
QVBoxLayout,
|
||||
QWidget,
|
||||
)
|
||||
from qfluentwidgets import (
|
||||
CaptionLabel,
|
||||
CardWidget,
|
||||
FluentIcon as FIF,
|
||||
LineEdit,
|
||||
PrimaryPushButton,
|
||||
SubtitleLabel,
|
||||
TitleLabel,
|
||||
)
|
||||
|
||||
|
||||
class PDDTaskPage(QWidget):
|
||||
"""商品与规格配置页。"""
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setObjectName("pddTaskPage")
|
||||
|
||||
self.goodsInput = LineEdit(self)
|
||||
self.goodsInput.setPlaceholderText("输入拼多多商品链接或商品 ID")
|
||||
self.goodsInput.setClearButtonEnabled(True)
|
||||
self.goodsInput.setAccessibleName("商品链接或商品 ID")
|
||||
|
||||
self.colorInput = LineEdit(self)
|
||||
self.colorInput.setPlaceholderText("例如:黑色")
|
||||
self.colorInput.setClearButtonEnabled(True)
|
||||
self.colorInput.setAccessibleName("目标颜色")
|
||||
|
||||
self.sizeInput = LineEdit(self)
|
||||
self.sizeInput.setPlaceholderText("例如:L")
|
||||
self.sizeInput.setClearButtonEnabled(True)
|
||||
self.sizeInput.setAccessibleName("目标尺码")
|
||||
|
||||
self.startButton = PrimaryPushButton(FIF.PLAY, "开始任务", self)
|
||||
self.startButton.setAccessibleName("开始自动购买任务")
|
||||
self.statusLabel = CaptionLabel("等待启动", self)
|
||||
|
||||
card = CardWidget(self)
|
||||
card.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||
cardLayout = QVBoxLayout(card)
|
||||
cardLayout.setContentsMargins(24, 20, 24, 22)
|
||||
cardLayout.setSpacing(12)
|
||||
cardLayout.addWidget(SubtitleLabel("创建任务", card))
|
||||
cardLayout.addWidget(CaptionLabel("商品链接 / ID", card))
|
||||
cardLayout.addWidget(self.goodsInput)
|
||||
|
||||
specLayout = QGridLayout()
|
||||
specLayout.setHorizontalSpacing(16)
|
||||
specLayout.setVerticalSpacing(8)
|
||||
specLayout.addWidget(CaptionLabel("颜色", card), 0, 0)
|
||||
specLayout.addWidget(CaptionLabel("尺码", card), 0, 1)
|
||||
specLayout.addWidget(self.colorInput, 1, 0)
|
||||
specLayout.addWidget(self.sizeInput, 1, 1)
|
||||
specLayout.setColumnStretch(0, 1)
|
||||
specLayout.setColumnStretch(1, 1)
|
||||
cardLayout.addLayout(specLayout)
|
||||
|
||||
actionLayout = QHBoxLayout()
|
||||
actionLayout.setContentsMargins(0, 6, 0, 0)
|
||||
actionLayout.addWidget(self.statusLabel)
|
||||
actionLayout.addStretch(1)
|
||||
actionLayout.addWidget(self.startButton)
|
||||
cardLayout.addLayout(actionLayout)
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
layout.setContentsMargins(36, 30, 36, 36)
|
||||
layout.setSpacing(16)
|
||||
layout.addWidget(TitleLabel("pdd任务", self))
|
||||
# description = BodyLabel("配置商品与目标规格,然后启动自动化任务。", self)
|
||||
# description.setWordWrap(True)
|
||||
# layout.addWidget(description)
|
||||
layout.addWidget(card)
|
||||
layout.addStretch(1)
|
||||
|
||||
Reference in New Issue
Block a user