feat(ai-outfit): button palette matching the print module (§19.11)
Panel had no stylesheet -> all buttons rendered native gray. Add
setObjectName('aiOutfitPanel') + _apply_styles() with QSS scoped to
#aiOutfitPanel (so dialogs keep native buttons): primary blue for 开始生成
(aiStartBtn, mirrors 开始批量导出/打开文件夹), quiet red for 停止生成 and the 话术
删除 (aiStopBtn/aiPromptDeleteBtn, mirrors 删除), secondary gray for the rest.
docs/11 §10.5 + tasks §19.11. Offscreen grab verified; full suite (12) green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -158,6 +158,7 @@ class AiOutfitPanel(QWidget):
|
||||
# -- construction ---------------------------------------------------
|
||||
|
||||
def _build_ui(self):
|
||||
self.setObjectName("aiOutfitPanel")
|
||||
outer = QVBoxLayout(self)
|
||||
outer.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
@@ -171,6 +172,57 @@ class AiOutfitPanel(QWidget):
|
||||
splitter.setStretchFactor(2, 0)
|
||||
splitter.setSizes([360, 540, 400])
|
||||
outer.addWidget(splitter)
|
||||
self._apply_styles()
|
||||
|
||||
def _apply_styles(self):
|
||||
"""Button palette mirroring the 添加印花 widgets (docs/11 §10.5).
|
||||
|
||||
Scoped under #aiOutfitPanel so QMessageBox/QInputDialog buttons keep the
|
||||
native look. Blue = the single primary action (开始生成); red = stop/delete;
|
||||
everything else is the neutral secondary used across the print panels.
|
||||
"""
|
||||
self.setStyleSheet("""
|
||||
#aiOutfitPanel QPushButton {
|
||||
font-size: 12px;
|
||||
padding: 4px 10px;
|
||||
border: 1px solid #d6d6d6;
|
||||
border-radius: 3px;
|
||||
background: #f0f0f0;
|
||||
color: #202020;
|
||||
}
|
||||
#aiOutfitPanel QPushButton:hover { background: #e0e0e0; }
|
||||
#aiOutfitPanel QPushButton:pressed { background: #d0d0d0; }
|
||||
#aiOutfitPanel QPushButton:disabled { color: #aaaaaa; background: #f7f7f7; }
|
||||
|
||||
#aiOutfitPanel QPushButton#aiStartBtn {
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
border: none;
|
||||
background: #0078d4;
|
||||
}
|
||||
#aiOutfitPanel QPushButton#aiStartBtn:hover { background: #106ebe; }
|
||||
#aiOutfitPanel QPushButton#aiStartBtn:pressed { background: #005a9e; }
|
||||
#aiOutfitPanel QPushButton#aiStartBtn:disabled {
|
||||
color: #aaaaaa; background: #f7f7f7;
|
||||
}
|
||||
|
||||
#aiOutfitPanel QPushButton#aiStopBtn,
|
||||
#aiOutfitPanel QPushButton#aiPromptDeleteBtn {
|
||||
color: #c42b1c;
|
||||
background: #f0f0f0;
|
||||
border: 1px solid #d6d6d6;
|
||||
}
|
||||
#aiOutfitPanel QPushButton#aiStopBtn:hover,
|
||||
#aiOutfitPanel QPushButton#aiPromptDeleteBtn:hover {
|
||||
background: #fde7e9; border-color: #c42b1c;
|
||||
}
|
||||
#aiOutfitPanel QPushButton#aiStopBtn:pressed,
|
||||
#aiOutfitPanel QPushButton#aiPromptDeleteBtn:pressed { background: #f9d4d7; }
|
||||
#aiOutfitPanel QPushButton#aiStopBtn:disabled,
|
||||
#aiOutfitPanel QPushButton#aiPromptDeleteBtn:disabled {
|
||||
color: #aaaaaa; background: #f7f7f7; border-color: #d6d6d6;
|
||||
}
|
||||
""")
|
||||
|
||||
def _build_left(self):
|
||||
scroll = QScrollArea()
|
||||
@@ -207,6 +259,8 @@ class AiOutfitPanel(QWidget):
|
||||
for text, slot in (("新建", self._prompt_new), ("另存为", self._prompt_save_as),
|
||||
("重命名", self._prompt_rename), ("删除", self._prompt_delete)):
|
||||
b = QPushButton(text)
|
||||
if text == "删除":
|
||||
b.setObjectName("aiPromptDeleteBtn")
|
||||
b.clicked.connect(slot)
|
||||
trow.addWidget(b)
|
||||
pv.addLayout(trow)
|
||||
@@ -378,10 +432,11 @@ class AiOutfitPanel(QWidget):
|
||||
|
||||
run_row = QHBoxLayout()
|
||||
self._start_btn = QPushButton("开始生成")
|
||||
self._start_btn.setObjectName("primaryBtn")
|
||||
self._start_btn.setObjectName("aiStartBtn")
|
||||
self._start_btn.clicked.connect(self._start)
|
||||
run_row.addWidget(self._start_btn)
|
||||
self._stop_btn = QPushButton("停止生成")
|
||||
self._stop_btn.setObjectName("aiStopBtn")
|
||||
self._stop_btn.setEnabled(False)
|
||||
self._stop_btn.clicked.connect(self._stop)
|
||||
run_row.addWidget(self._stop_btn)
|
||||
|
||||
Reference in New Issue
Block a user