增加解除占用功能

This commit is contained in:
2026-04-08 00:07:40 +08:00
parent 005fc3a77c
commit ff8aa0269d
9 changed files with 823 additions and 8 deletions
+18 -4
View File
@@ -318,10 +318,14 @@ class PanelWindow(QWidget):
self.setWindowTitle(app_title())
# 默认不置顶;仅图钉开启时与悬浮球一并置顶(见 _apply_pin_window_layer)
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
# 任务栏/开始菜单图标:使用项目 logo.png
logo_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "logo.png")
if os.path.exists(logo_path):
self.setWindowIcon(QIcon(logo_path))
# 任务栏/开始菜单图标:优先 ico,其次 png
base_dir = os.path.dirname(os.path.dirname(__file__))
logo_ico = os.path.join(base_dir, "logo.ico")
logo_png = os.path.join(base_dir, "logo.png")
if os.path.exists(logo_ico):
self.setWindowIcon(QIcon(logo_ico))
elif os.path.exists(logo_png):
self.setWindowIcon(QIcon(logo_png))
self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
self.setAcceptDrops(True)
self.setMinimumSize(MIN_W, MIN_H)
@@ -512,6 +516,7 @@ class PanelWindow(QWidget):
("管理员运行 CMD", "fa5s.terminal", self._open_admin_cmd),
("管理员运行 PowerShell", "fa5b.windows", self._open_admin_powershell),
("打开默认浏览器", "fa5s.globe", self._open_default_browser),
("解除占用", "fa5s.unlock", self._open_unlocker),
]
def _build_ui(self):
@@ -958,6 +963,15 @@ class PanelWindow(QWidget):
import webbrowser
webbrowser.open("https://www.baidu.com")
def _open_unlocker(self):
try:
from ui.unlocker import UnlockDialog
except Exception as e:
dialog_style.warning(self, "无法打开解除占用工具", f"加载模块失败:{e}")
return
dlg = UnlockDialog(self)
dlg.exec()
def _open_wechat_multi(self):
from ui.wechat_multi import WechatMultiDialog
dlg = WechatMultiDialog(self)