generated from hulk/gd32f4xx_template_cmake_vscode
Heater: segmented PID (full-power / slow-band / overtemp-cutoff) + 2s/5pct PWM
This commit is contained in:
+23
-2
@@ -46,7 +46,7 @@ if getattr(sys, "frozen", False) and os.name == "nt":
|
||||
pass
|
||||
|
||||
from PySide6.QtCore import QPointF, QRectF, Qt, QTimer
|
||||
from PySide6.QtGui import QColor, QFont, QPainter, QPainterPath, QPen, QPalette
|
||||
from PySide6.QtGui import QColor, QFont, QIcon, QPainter, QPainterPath, QPen, QPalette
|
||||
from PySide6.QtWidgets import (
|
||||
QApplication, QHBoxLayout, QLabel, QMainWindow, QMessageBox, QPlainTextEdit,
|
||||
QScrollArea, QSplitter, QVBoxLayout, QWidget,
|
||||
@@ -60,7 +60,7 @@ import config
|
||||
import filmforge_rs485 as ff
|
||||
|
||||
APP_NAME = "FilmForge"
|
||||
APP_VERSION = "0.2.6"
|
||||
APP_VERSION = "0.2.7"
|
||||
REPO_URL = "https://gitea.hulk.wang/hulk/FilmForge"
|
||||
MONO = QFont("Consolas", 10)
|
||||
CHIP_IDLE = "#666666"
|
||||
@@ -364,6 +364,9 @@ class App(QMainWindow):
|
||||
self._system_palette = app.palette() if app else QPalette()
|
||||
self._system_style = app.styleSheet() if app else ""
|
||||
self.setWindowTitle(f"{APP_NAME} v{APP_VERSION} — 热压模具温控监视台")
|
||||
icon = _icon_path() # 标题栏图标(run_gui 另设 app 级 + 任务栏标识)
|
||||
if os.path.exists(icon):
|
||||
self.setWindowIcon(QIcon(icon))
|
||||
self.resize(1440, 920)
|
||||
self.setMinimumSize(1150, 720)
|
||||
|
||||
@@ -1326,6 +1329,15 @@ def _single_instance():
|
||||
return True
|
||||
|
||||
|
||||
def _icon_path():
|
||||
"""窗口图标路径: 打包版取 _MEIPASS(build_exe.py --add-data 内嵌), 源码版取 logos/。"""
|
||||
bundled = os.path.join(getattr(sys, "_MEIPASS", ""), "filmforge.ico")
|
||||
if os.path.exists(bundled):
|
||||
return bundled
|
||||
return os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||
"logos", "filmforge.ico")
|
||||
|
||||
|
||||
def run_gui(auto_close=0):
|
||||
if not _single_instance():
|
||||
app = QApplication.instance() or QApplication(sys.argv)
|
||||
@@ -1333,6 +1345,15 @@ def run_gui(auto_close=0):
|
||||
return
|
||||
app = QApplication.instance() or QApplication(sys.argv)
|
||||
app.setApplicationName(APP_NAME)
|
||||
if os.name == "nt":
|
||||
try: # 任务栏独立标识: 缺省时任务栏可能沿用宿主默认图标并错误分组
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
|
||||
"hulk.FilmForge.GUI")
|
||||
except Exception:
|
||||
pass
|
||||
icon = _icon_path()
|
||||
if os.path.exists(icon):
|
||||
app.setWindowIcon(QIcon(icon)) # 主窗/弹窗/任务栏统一图标
|
||||
setTheme(Theme.AUTO)
|
||||
window = App(auto_close)
|
||||
window.show()
|
||||
|
||||
Reference in New Issue
Block a user