增加解除占用功能
This commit is contained in:
@@ -3,6 +3,7 @@ import os
|
||||
import time
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtWidgets import QApplication
|
||||
from PyQt6.QtGui import QIcon
|
||||
from db.database import init_db
|
||||
from ui.dock import PanelWindow, _set_autostart
|
||||
from ui.ball import FloatBall, BALL_SIZE
|
||||
@@ -21,6 +22,18 @@ def get_resource_path(relative_path):
|
||||
return os.path.join(os.path.abspath("."), relative_path)
|
||||
# ==========================================================
|
||||
|
||||
def _set_windows_app_user_model_id(appid: str):
|
||||
"""让任务栏图标/分组按 AppID 识别(开发态避免显示 Python 图标)。"""
|
||||
if sys.platform != "win32":
|
||||
return
|
||||
try:
|
||||
import ctypes
|
||||
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(appid)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def _wake_existing_or_exit() -> bool:
|
||||
"""
|
||||
Windows 单实例:
|
||||
@@ -75,6 +88,15 @@ def main():
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
app.setQuitOnLastWindowClosed(False)
|
||||
_set_windows_app_user_model_id("niumasoftware")
|
||||
|
||||
# 任务栏/窗口图标:开发态用 ico;打包后也能通过资源路径找到
|
||||
try:
|
||||
ico_path = get_resource_path("logo.ico")
|
||||
if os.path.exists(ico_path):
|
||||
app.setWindowIcon(QIcon(ico_path))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
init_db()
|
||||
theme.load()
|
||||
|
||||
Reference in New Issue
Block a user