The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
Revert "添加窗口边框颜色 Accent 功能, 修复 Win 11 Mica 系列特效异常的 Bug, 修复多余的 Win7 Aero 效果渲染."
XiaoYouChR83f99bc3662e
diff --git a/app/common/methods.py b/app/common/methods.pyindex 794da5e7..50d94760 100644--- a/app/common/methods.py+++ b/app/common/methods.py@@ -39,19 +39,6 @@ def isGreaterEqualWin11():""" determine if the windows version ≥ Win11 """return isGreaterEqualWin10() and sys.getwindowsversion().build >= 22000-def isBorderAccentColorOpen():- """ Check whether the border accent color is open """- if not isGreaterEqualWin11():- return False-- from winreg import OpenKey, HKEY_CURRENT_USER, KEY_READ, QueryValueEx, CloseKey-- key = OpenKey(HKEY_CURRENT_USER, r"SOFTWARE\Microsoft\Windows\DWM", 0, KEY_READ)- value, _ = QueryValueEx(key, "ColorPrevalence")- CloseKey(key)-- return bool(value)-def isAbleToShowToast():return sys.platform == 'win32' and sys.getwindowsversion().build >= 16299 # 高于 Win10 1709diff --git a/app/common/windows_window_effect.py b/app/common/windows_window_effect.pydeleted file mode 100644index a349c3bf..00000000--- a/app/common/windows_window_effect.py+++ /dev/null@@ -1,111 +0,0 @@-import warnings-from ctypes import c_int-from ctypes.wintypes import DWORD-from sys import getwindowsversion--from PySide6.QtGui import QColor-from _ctypes import byref, pointer-from qframelesswindow.utils.win32_utils import isGreaterEqualWin11, isCompositionEnabled, isGreaterEqualWin8_1-from qframelesswindow.windows import WindowsWindowEffect-from qframelesswindow.windows.c_structures import MARGINS, WINDOWCOMPOSITIONATTRIB, ACCENT_STATE---class WindowsWindowEffect(WindowsWindowEffect):-- def addShadowEffect(self, hWnd):- """ Add DWM shadow to window-- Parameters- ----------- hWnd: int or `sip.voidptr`- Window handle- """- if not isCompositionEnabled():- return-- hWnd = int(hWnd)- margins = MARGINS(1, 0, 0, 0) # 防止 Windows 7 渲染多余的 Aero 效果- self.DwmExtendFrameIntoClientArea(hWnd, byref(margins))-- def setAeroEffect(self, hWnd):- """ Add the aero effect to the window-- Parameters- ----------- hWnd: int or `sip.voidptr`- Window handle- """- hWnd = int(hWnd)- if isGreaterEqualWin8_1():- self.winCompAttrData.Attribute = WINDOWCOMPOSITIONATTRIB.WCA_ACCENT_POLICY.value- self.accentPolicy.AccentState = ACCENT_STATE.ACCENT_ENABLE_BLURBEHIND.value- self.SetWindowCompositionAttribute(hWnd, pointer(self.winCompAttrData))- else:- margins = MARGINS(-1, -1, -1, -1)- self.DwmExtendFrameIntoClientArea(hWnd, byref(margins))-- def setBorderAccentColor(self, hWnd, color:QColor):- """ Set the border color of the window"""-- # if not isGreaterEqualWin10():- # return-- hWnd = int(hWnd)- colorref = DWORD(color.red() | (color.green() << 8) | (color.blue() << 16))- self.DwmSetWindowAttribute(hWnd,- 34,- byref(colorref),- 4)-- def removeBorderAccentColor(self, hWnd):- """ Remove the border color of the window"""-- # if not isGreaterEqualWin10():- # return-- hWnd = int(hWnd)- self.DwmSetWindowAttribute(hWnd,- 34,- byref(DWORD(0xFFFFFFFF)),- 4)-- def setMicaEffect(self, hWnd, isDarkMode=False, isAlt=False, isBlur=False):- """ Add the mica effect to the window (Win11 only)-- Parameters- ----------- hWnd: int or `sip.voidptr`- Window handle-- isDarkMode: bool- whether to use dark mode mica effect-- isAlt: bool- whether to enable mica alt effect- """- if not isGreaterEqualWin11():- warnings.warn("The mica effect is only available on Win11")- return-- hWnd = int(hWnd)- margins = MARGINS(16777215, 16777215, 0, 0)- self.DwmExtendFrameIntoClientArea(hWnd, byref(margins))-- self.winCompAttrData.Attribute = WINDOWCOMPOSITIONATTRIB.WCA_ACCENT_POLICY.value- self.accentPolicy.AccentState = ACCENT_STATE.ACCENT_ENABLE_HOSTBACKDROP.value- self.SetWindowCompositionAttribute(hWnd, pointer(self.winCompAttrData))-- if isDarkMode:- self.winCompAttrData.Attribute = WINDOWCOMPOSITIONATTRIB.WCA_USEDARKMODECOLORS.value- self.SetWindowCompositionAttribute(hWnd, pointer(self.winCompAttrData))-- if getwindowsversion().build < 22523:- self.DwmSetWindowAttribute(hWnd, 1029, byref(c_int(1)), 4)- else:- if isBlur:- _ = 3- else:- _ = 4 if isAlt else 2- self.DwmSetWindowAttribute(hWnd, 38, byref(c_int(_)), 4)-- self.DwmSetWindowAttribute(hWnd, 20, byref(c_int(1*isDarkMode)), 4)\ No newline at end of filediff --git a/app/view/main_window.py b/app/view/main_window.pyindex d0f38a92..a91ded35 100644--- a/app/view/main_window.py+++ b/app/view/main_window.py@@ -1,7 +1,7 @@# coding: utf-8+import ctypesimport pickleimport sys-from ctypes.wintypes import MSGfrom pathlib import Pathimport darkdetect@@ -9,14 +9,14 @@ from PySide6.QtCore import QSize, QThread, Signal, QTimer, QPropertyAnimation, Qfrom PySide6.QtGui import QIcon, QDragEnterEvent, QDropEvent, QKeySequence, QDesktopServices, QColor, Qtfrom PySide6.QtWidgets import QApplication, QGraphicsOpacityEffectfrom loguru import logger-from qfluentwidgets import FluentIcon as FIF, setTheme, Theme, themeColor, isDarkTheme+from qfluentwidgets import FluentIcon as FIF, setTheme, Theme, isDarkThemefrom qfluentwidgets import NavigationItemPosition, MSFluentWindow, SplashScreenfrom .setting_interface import SettingInterfacefrom .task_interface import TaskInterfacefrom ..common.config import cfg, Headers, attachmentTypes, FEEDBACK_URLfrom ..common.custom_socket import GhostDownloaderSocketServer-from ..common.methods import getLinkInfo, bringWindowToTop, addDownloadTask, showMessageBox, isBorderAccentColorOpen, \+from ..common.methods import getLinkInfo, bringWindowToTop, addDownloadTask, showMessageBox, \isGreaterEqualWin10, isLessThanWin10, isGreaterEqualWin11from ..common.signal_bus import signalBusfrom ..components.add_task_dialog import AddTaskOptionDialog@@ -64,14 +64,6 @@ class MainWindow(MSFluentWindow):def __init__(self):super().__init__()- # replace WindowsWindowEffect- if isGreaterEqualWin10():- from ..common.windows_window_effect import WindowsWindowEffect- self.windowEffect = WindowsWindowEffect(self.winId())-- if isBorderAccentColorOpen():- self.windowEffect.setBorderAccentColor(self.winId(), themeColor())-self.setMicaEffectEnabled(False)self.initWindow()@@ -318,19 +310,13 @@ class MainWindow(MSFluentWindow):def nativeEvent(self, eventType, message):# 处理窗口重复打开事件if eventType == "windows_generic_MSG":- msg = MSG.from_address(message.__int__())+ msg = ctypes.wintypes.MSG.from_address(message.__int__())# WIN_USER = 1024if msg.message == 1024 + 1:bringWindowToTop(self)return True, 0- if msg.message == 7 and isBorderAccentColorOpen():- self.windowEffect.setBorderAccentColor(self.winId(), themeColor())-- if msg.message == 8 and isBorderAccentColorOpen():- self.windowEffect.removeBorderAccentColor(self.winId())-return super().nativeEvent(eventType, message)def dragEnterEvent(self, event: QDragEnterEvent):diff --git a/requirements.txt b/requirements.txtindex 2a151d53..8a7b8096 100644--- a/requirements.txt+++ b/requirements.txt@@ -1,5 +1,6 @@PySide6-Fluent-Widgets>=1.7.4-PySide6==6.7.2 # Qt 6.7.3 on Windows Has Internationalization Issues, Frameless Window Support in Qt 6.8+ Feels Buggy+pysidesix-frameless-window>=0.7.0+PySide6==6.9.0 # Qt 6.7.3 on Windows Has Internationalization Issues, Frameless Window Support in Qt 6.8+ Feels Buggyloguruhttpx[socks]nuitka==2.6.7diff --git a/resources/i18n/gd3.en_US.ts b/resources/i18n/gd3.en_US.tsindex 4229be97..ba375dd6 100644--- a/resources/i18n/gd3.en_US.ts+++ b/resources/i18n/gd3.en_US.ts@@ -213,27 +213,27 @@<context><name>MainWindow</name><message>- <location filename="../../app/view/main_window.py" line="232"/>+ <location filename="../../app/view/main_window.py" line="244"/><source>任务列表</source><translation>Task List</translation></message><message>- <location filename="../../app/view/main_window.py" line="235"/>+ <location filename="../../app/view/main_window.py" line="247"/><source>新建任务</source><translation>New Task</translation></message><message>- <location filename="../../app/view/main_window.py" line="244"/>+ <location filename="../../app/view/main_window.py" line="256"/><source>设置</source><translation>Settings</translation></message><message>- <location filename="../../app/view/main_window.py" line="288"/>+ <location filename="../../app/view/main_window.py" line="300"/><source>意料之外的错误!</source><translation>Unexpected Error!</translation></message><message>- <location filename="../../app/view/main_window.py" line="289"/>+ <location filename="../../app/view/main_window.py" line="301"/><source>错误消息已写入粘贴板和日志。是否报告?</source><translation>Error message copied to clipboard and logged. Report it?</translation></message>@@ -591,13 +591,13 @@</message><message><location filename="../../app/components/task_card.py" line="109"/>- <location filename="../../app/components/task_card.py" line="316"/>+ <location filename="../../app/components/task_card.py" line="317"/><source>任务已经暂停</source><translation>Task paused</translation></message><message><location filename="../../app/components/task_card.py" line="111"/>- <location filename="../../app/components/task_card.py" line="212"/>+ <location filename="../../app/components/task_card.py" line="213"/><source>排队中...</source><translation>Queuing...</translation></message>@@ -612,67 +612,67 @@<translation>Task initialization failed</translation></message><message>- <location filename="../../app/components/task_card.py" line="243"/>+ <location filename="../../app/components/task_card.py" line="244"/><source>打开文件夹</source><translation>Open Folder</translation></message><message>- <location filename="../../app/components/task_card.py" line="245"/>+ <location filename="../../app/components/task_card.py" line="246"/><source>复制文件</source><translation>Copy File</translation></message><message>- <location filename="../../app/components/task_card.py" line="247"/>+ <location filename="../../app/components/task_card.py" line="248"/><source>复制链接</source><translation>Copy Link</translation></message><message>- <location filename="../../app/components/task_card.py" line="249"/>+ <location filename="../../app/components/task_card.py" line="250"/><source>重新下载</source><translation>Redownload</translation></message><message>- <location filename="../../app/components/task_card.py" line="338"/>+ <location filename="../../app/components/task_card.py" line="339"/><source>任务正在开始</source><translation>Task starting</translation></message><message>- <location filename="../../app/components/task_card.py" line="448"/>+ <location filename="../../app/components/task_card.py" line="449"/><source>完成时间: </source><translation>Completion time: </translation></message><message>- <location filename="../../app/components/task_card.py" line="448"/>+ <location filename="../../app/components/task_card.py" line="449"/><source>文件已被删除</source><translation>File deleted</translation></message><message>- <location filename="../../app/components/task_card.py" line="502"/>+ <location filename="../../app/components/task_card.py" line="503"/><source>正在校验 </source><translation>Verifying </translation></message><message>- <location filename="../../app/components/task_card.py" line="502"/>+ <location filename="../../app/components/task_card.py" line="503"/><source>, 请稍后...</source><translation>, please wait...</translation></message><message>- <location filename="../../app/components/task_card.py" line="515"/>+ <location filename="../../app/components/task_card.py" line="516"/><source>校验完成,文件的 </source><translation>Verification complete, file's </translation></message><message>- <location filename="../../app/components/task_card.py" line="515"/>+ <location filename="../../app/components/task_card.py" line="516"/><source> 是: </source><translation> is: </translation></message><message>- <location filename="../../app/components/task_card.py" line="524"/>+ <location filename="../../app/components/task_card.py" line="525"/><source>选择校验算法</source><translation>Select Verification Algorithm</translation></message><message>- <location filename="../../app/components/task_card.py" line="524"/>+ <location filename="../../app/components/task_card.py" line="525"/><source>请选择一个校验算法:</source><translation>Please select a verification algorithm:</translation></message>@@ -772,22 +772,22 @@<context><name>Ui_PlanTaskDialog</name><message>- <location filename="../../app/components/Ui_PlanTaskDialog.py" line="59"/>+ <location filename="../../app/components/Ui_PlanTaskDialog.py" line="58"/><source>设置计划任务</source><translation>Schedule Task</translation></message><message>- <location filename="../../app/components/Ui_PlanTaskDialog.py" line="60"/>+ <location filename="../../app/components/Ui_PlanTaskDialog.py" line="59"/><source>关机</source><translation>Shutdown</translation></message><message>- <location filename="../../app/components/Ui_PlanTaskDialog.py" line="61"/>+ <location filename="../../app/components/Ui_PlanTaskDialog.py" line="60"/><source>退出程序</source><translation>Exit</translation></message><message>- <location filename="../../app/components/Ui_PlanTaskDialog.py" line="62"/>+ <location filename="../../app/components/Ui_PlanTaskDialog.py" line="61"/><source>打开</source><translation>Open</translation></message>@@ -795,22 +795,22 @@<context><name>Ui_UpdateDialog</name><message>- <location filename="../../app/components/Ui_UpdateDialog.py" line="108"/>+ <location filename="../../app/components/Ui_UpdateDialog.py" line="107"/><source>检测到新版本</source><translation>New Version Detected</translation></message><message>- <location filename="../../app/components/Ui_UpdateDialog.py" line="109"/>+ <location filename="../../app/components/Ui_UpdateDialog.py" line="108"/><source>捐赠</source><translation>Donate</translation></message><message>- <location filename="../../app/components/Ui_UpdateDialog.py" line="110"/>+ <location filename="../../app/components/Ui_UpdateDialog.py" line="109"/><source>稍后再说</source><translation>Remind Me Later</translation></message><message>- <location filename="../../app/components/Ui_UpdateDialog.py" line="111"/>+ <location filename="../../app/components/Ui_UpdateDialog.py" line="110"/><source>下载此版本</source><translation>Download This Version</translation></message>diff --git a/resources/i18n/gd3.zh_CN.ts b/resources/i18n/gd3.zh_CN.tsindex 5b8018d1..8c1b02ed 100644--- a/resources/i18n/gd3.zh_CN.ts+++ b/resources/i18n/gd3.zh_CN.ts@@ -213,51 +213,51 @@<context><name>MainWindow</name><message>- <location filename="../../app/view/main_window.py" line="232"/>+ <location filename="../../app/view/main_window.py" line="244"/><source>任务列表</source><translation>任务列表</translation></message><message>- <location filename="../../app/view/main_window.py" line="235"/>+ <location filename="../../app/view/main_window.py" line="247"/><source>新建任务</source><translation>新建任务</translation></message><message>- <location filename="../../app/view/main_window.py" line="244"/>+ <location filename="../../app/view/main_window.py" line="256"/><source>设置</source><translation>设置</translation></message><message>- <location filename="../../app/view/main_window.py" line="288"/>+ <location filename="../../app/view/main_window.py" line="300"/><source>意料之外的错误!</source><translation>意料之外的错误!</translation></message><message>- <location filename="../../app/view/main_window.py" line="289"/>+ <location filename="../../app/view/main_window.py" line="301"/><source>错误消息已写入粘贴板和日志。是否报告?</source><translation>错误消息已写入粘贴板和日志。是否报告?</translation></message></context><context>- <name>MessageBoxBase</name>+ <name>MessageBox</name><message><source>OK</source>- <translation>确定</translation>+ <translation type="vanished">确定</translation></message><message><source>Cancel</source>- <translation>取消</translation>+ <translation type="vanished">取消</translation></message></context><context>- <name>MessageBox</name>+ <name>MessageBoxBase</name><message><source>OK</source>- <translation>确定</translation>+ <translation type="vanished">确定</translation></message><message><source>Cancel</source>- <translation>取消</translation>+ <translation type="vanished">取消</translation></message></context><context>@@ -613,13 +613,13 @@</message><message><location filename="../../app/components/task_card.py" line="109"/>- <location filename="../../app/components/task_card.py" line="316"/>+ <location filename="../../app/components/task_card.py" line="317"/><source>任务已经暂停</source><translation>任务已经暂停</translation></message><message><location filename="../../app/components/task_card.py" line="111"/>- <location filename="../../app/components/task_card.py" line="212"/>+ <location filename="../../app/components/task_card.py" line="213"/><source>排队中...</source><translation>排队中...</translation></message>@@ -634,67 +634,67 @@<translation>任务初始化失败</translation></message><message>- <location filename="../../app/components/task_card.py" line="243"/>+ <location filename="../../app/components/task_card.py" line="244"/><source>打开文件夹</source><translation>打开文件夹</translation></message><message>- <location filename="../../app/components/task_card.py" line="245"/>+ <location filename="../../app/components/task_card.py" line="246"/><source>复制文件</source><translation>复制文件</translation></message><message>- <location filename="../../app/components/task_card.py" line="247"/>+ <location filename="../../app/components/task_card.py" line="248"/><source>复制链接</source><translation>复制链接</translation></message><message>- <location filename="../../app/components/task_card.py" line="249"/>+ <location filename="../../app/components/task_card.py" line="250"/><source>重新下载</source><translation>重新下载</translation></message><message>- <location filename="../../app/components/task_card.py" line="338"/>+ <location filename="../../app/components/task_card.py" line="339"/><source>任务正在开始</source><translation>任务正在开始</translation></message><message>- <location filename="../../app/components/task_card.py" line="448"/>+ <location filename="../../app/components/task_card.py" line="449"/><source>完成时间: </source><translation>完成时间: </translation></message><message>- <location filename="../../app/components/task_card.py" line="448"/>+ <location filename="../../app/components/task_card.py" line="449"/><source>文件已被删除</source><translation>文件已被删除</translation></message><message>- <location filename="../../app/components/task_card.py" line="502"/>+ <location filename="../../app/components/task_card.py" line="503"/><source>正在校验 </source><translation>正在校验 </translation></message><message>- <location filename="../../app/components/task_card.py" line="502"/>+ <location filename="../../app/components/task_card.py" line="503"/><source>, 请稍后...</source><translation>, 请稍后...</translation></message><message>- <location filename="../../app/components/task_card.py" line="515"/>+ <location filename="../../app/components/task_card.py" line="516"/><source>校验完成,文件的 </source><translation>校验完成,文件的 </translation></message><message>- <location filename="../../app/components/task_card.py" line="515"/>+ <location filename="../../app/components/task_card.py" line="516"/><source> 是: </source><translation> 是: </translation></message><message>- <location filename="../../app/components/task_card.py" line="524"/>+ <location filename="../../app/components/task_card.py" line="525"/><source>选择校验算法</source><translation>选择校验算法</translation></message><message>- <location filename="../../app/components/task_card.py" line="524"/>+ <location filename="../../app/components/task_card.py" line="525"/><source>请选择一个校验算法:</source><translation>请选择一个校验算法:</translation></message>@@ -794,22 +794,22 @@<context><name>Ui_PlanTaskDialog</name><message>- <location filename="../../app/components/Ui_PlanTaskDialog.py" line="59"/>+ <location filename="../../app/components/Ui_PlanTaskDialog.py" line="58"/><source>设置计划任务</source><translation>设置计划任务</translation></message><message>- <location filename="../../app/components/Ui_PlanTaskDialog.py" line="60"/>+ <location filename="../../app/components/Ui_PlanTaskDialog.py" line="59"/><source>关机</source><translation>关机</translation></message><message>- <location filename="../../app/components/Ui_PlanTaskDialog.py" line="61"/>+ <location filename="../../app/components/Ui_PlanTaskDialog.py" line="60"/><source>退出程序</source><translation>退出程序</translation></message><message>- <location filename="../../app/components/Ui_PlanTaskDialog.py" line="62"/>+ <location filename="../../app/components/Ui_PlanTaskDialog.py" line="61"/><source>打开</source><translation>打开</translation></message>@@ -817,22 +817,22 @@<context><name>Ui_UpdateDialog</name><message>- <location filename="../../app/components/Ui_UpdateDialog.py" line="108"/>+ <location filename="../../app/components/Ui_UpdateDialog.py" line="107"/><source>检测到新版本</source><translation>检测到新版本</translation></message><message>- <location filename="../../app/components/Ui_UpdateDialog.py" line="109"/>+ <location filename="../../app/components/Ui_UpdateDialog.py" line="108"/><source>捐赠</source><translation>捐赠</translation></message><message>- <location filename="../../app/components/Ui_UpdateDialog.py" line="110"/>+ <location filename="../../app/components/Ui_UpdateDialog.py" line="109"/><source>稍后再说</source><translation>稍后再说</translation></message><message>- <location filename="../../app/components/Ui_UpdateDialog.py" line="111"/>+ <location filename="../../app/components/Ui_UpdateDialog.py" line="110"/><source>下载此版本</source><translation>下载此版本</translation></message>