The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
refactor(app): 提取窗口置顶逻辑到单独的方法 bringWindowToTop
XiaoYouChR34b52150cc7c
diff --git a/app/common/methods.py b/app/common/methods.pyindex ddf9100f..fbf2d155 100644--- a/app/common/methods.py+++ b/app/common/methods.py@@ -262,4 +262,13 @@ def getLinkInfo(url:str, headers:dict, fileName:str="", verify:bool=False, proxyfileName = f"downloaded_file{int(time_ns())}.{content_type}"logger.debug(f"方法4获取文件名成功, 文件名:{fileName}")- return url, fileName, fileSize\ No newline at end of file+ return url, fileName, fileSize+++def bringWindowToTop(window):+ window.show()+ if window.isMinimized():+ window.showNormal()+ # 激活窗口,使其显示在最前面+ window.activateWindow()+ window.raise_()\ No newline at end of filediff --git a/app/components/custom_tray.py b/app/components/custom_tray.pyindex 4506a169..ba69003f 100644--- a/app/components/custom_tray.py+++ b/app/components/custom_tray.py@@ -5,6 +5,8 @@ from qfluentwidgets import FluentIcon as FIFfrom qfluentwidgets.common.screen import getCurrentScreenGeometryfrom qfluentwidgets.components.material import AcrylicMenu+from app.common.methods import bringWindowToTop+class FixedAcrylicSystemTrayMenu(AcrylicMenu):""" 修复背景获取偏移、位置偏移的问题 """@@ -56,11 +58,7 @@ class CustomSystemTrayIcon(QSystemTrayIcon):self.messageClicked.connect(self.__onShowActionTriggered)def __onShowActionTriggered(self):- self.parent().show()- if self.parent().isMinimized():- self.parent().showNormal()- # 激活窗口,使其显示在最前面- self.parent().activateWindow()+ bringWindowToTop(self.parent())def __onAllStartActionTriggered(self):self.parent().taskInterface.allStartTasks()diff --git a/app/view/main_window.py b/app/view/main_window.pyindex a516386d..1e2e04b7 100644--- a/app/view/main_window.py+++ b/app/view/main_window.py@@ -17,7 +17,7 @@ from .setting_interface import SettingInterfacefrom .task_interface import TaskInterfacefrom ..common.config import cfg, Headers, attachmentTypesfrom ..common.custom_socket import GhostDownloaderSocketServer-from ..common.methods import getLinkInfo+from ..common.methods import getLinkInfo, bringWindowToTopfrom ..common.signal_bus import signalBusfrom ..components.add_task_dialog import AddTaskOptionDialogfrom ..components.custom_tray import CustomSystemTrayIcon@@ -304,10 +304,5 @@ class MainWindow(MSFluentWindow):returnans = '\n'.join(results)logger.debug(f"Clipboard changed: {ans}")- self.__bringToTop()+ bringWindowToTop(self)self.__setUrlsAndShowAddTaskBox(ans)-- def __bringToTop(self):- self.showNormal()- self.activateWindow()- self.raise_()