feat: new-version hint text left of the gear (replaces red button)
Show a low-key blue, clickable "发现新版本 vX.Y.Z" label just left of the ⚙ 配置 button when an update is found (hidden otherwise), instead of recoloring the button red. Matches docs/07 §4.3. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+22
-7
@@ -112,6 +112,14 @@ class MainWindow(QMainWindow):
|
||||
layout.addWidget(self._tab_bar)
|
||||
layout.addStretch()
|
||||
|
||||
# "New version" hint, just left of the gear; hidden until found (docs/07 §4.3)
|
||||
self._update_hint = QPushButton("")
|
||||
self._update_hint.setObjectName("updateHint")
|
||||
self._update_hint.setCursor(Qt.PointingHandCursor)
|
||||
self._update_hint.setVisible(False)
|
||||
self._update_hint.clicked.connect(self._open_settings)
|
||||
layout.addWidget(self._update_hint)
|
||||
|
||||
# Right-aligned utility entry — not a numbered workflow step (docs/07 §4.3)
|
||||
self._settings_btn = QPushButton("⚙ 配置")
|
||||
self._settings_btn.setObjectName("settingsBtn")
|
||||
@@ -175,12 +183,11 @@ class MainWindow(QMainWindow):
|
||||
self._set_update_indicator(True, info.version)
|
||||
|
||||
def _set_update_indicator(self, available, version=""):
|
||||
self._settings_btn.setText("⚙ 配置 ●" if available else "⚙ 配置")
|
||||
self._settings_btn.setProperty("hasUpdate", bool(available))
|
||||
self._settings_btn.setToolTip(
|
||||
"发现新版本 v{},点击进入设置更新".format(version) if available else "")
|
||||
self._settings_btn.style().unpolish(self._settings_btn)
|
||||
self._settings_btn.style().polish(self._settings_btn)
|
||||
"""Show/hide the blue 'new version' hint left of the gear button."""
|
||||
if available:
|
||||
self._update_hint.setText("发现新版本 v{}".format(version))
|
||||
self._update_hint.setToolTip("点击进入设置更新")
|
||||
self._update_hint.setVisible(bool(available))
|
||||
|
||||
def _create_work_area(self):
|
||||
"""Horizontal splitter: left material panel | canvas | right params."""
|
||||
@@ -589,7 +596,15 @@ class MainWindow(QMainWindow):
|
||||
padding: 4px 14px;
|
||||
}
|
||||
#settingsBtn:hover { color: #0078d4; background: #e8f0fb; }
|
||||
#settingsBtn[hasUpdate="true"] { color: #c42b1c; font-weight: bold; }
|
||||
#updateHint {
|
||||
font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
|
||||
font-size: 12px;
|
||||
color: #0078d4;
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
#updateHint:hover { text-decoration: underline; }
|
||||
|
||||
/* Work splitter */
|
||||
QSplitter#workSplitter::handle {
|
||||
|
||||
Reference in New Issue
Block a user