The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
新增自定义背景材质功能
XiaoYouChRdc2c99bcba1d
diff --git a/app/common/config.py b/app/common/config.pyindex 9a3ad016..c5952e45 100644--- a/app/common/config.py+++ b/app/common/config.py@@ -23,7 +23,6 @@ class ProxyValidator(ConfigValidator):def correct(self, value) -> str:return value if self.validate(value) else "Auto"-class Config(QConfig):""" Config of application """# download@@ -33,12 +32,15 @@ class Config(QConfig):maxBlockNum = RangeConfigItem("Download", "MaxBlockNum", 32, RangeValidator(1, 256))proxyServer = ConfigItem("Download", "ProxyServer", "Auto", ProxyValidator())+# browserenableBrowserExtension = ConfigItem("Browser", "EnableBrowserExtension", False, BoolValidator())- # main window+ # personalization+ # backgroundEffect = OptionsConfigItem("Personalization", "BackgroundEffect", "Mica", OptionsValidator(["Acrylic", "Mica", "MicaBlur", "MicaAlt", "Transparent", "Aero", "None"]))+ backgroundEffect = OptionsConfigItem("Personalization", "BackgroundEffect", "Mica", OptionsValidator(["Acrylic", "Mica", "MicaBlur", "MicaAlt", "Aero"]))dpiScale = OptionsConfigItem(- "MainWindow", "DpiScale", "Auto", OptionsValidator([1, 1.25, 1.5, 1.75, 2, "Auto"]), restart=True)+ "Personalization", "DpiScale", "Auto", OptionsValidator([1, 1.25, 1.5, 1.75, 2, "Auto"]), restart=True)# softwarecheckUpdateAtStartUp = ConfigItem("Software", "CheckUpdateAtStartUp", True, BoolValidator())diff --git a/app/view/main_window.py b/app/view/main_window.pyindex cd20bf95..c066b229 100644--- a/app/view/main_window.py+++ b/app/view/main_window.py@@ -1,5 +1,6 @@# coding: utf-8import ctypes+from ctypes import byref, c_intfrom pathlib import Pathimport darkdetect@@ -57,6 +58,9 @@ class MainWindow(MSFluentWindow):# add items to navigation interfaceself.initNavigation()+ # 设置背景特效+ self.applyBackgroundEffectByCfg()+# 创建检测主题色更改线程self.themeChangedListener = ThemeChangedListener(self)self.themeChangedListener.themeChanged.connect(self.toggleTheme)@@ -111,13 +115,32 @@ class MainWindow(MSFluentWindow):def toggleTheme(self, callback: str):if callback == 'Dark': # PySide6 特性,需要重试setTheme(Theme.DARK, save=False)- QTimer.singleShot(100, lambda: self.windowEffect.setMicaEffect(self.winId(), True))- QTimer.singleShot(200, lambda: self.windowEffect.setMicaEffect(self.winId(), True))- QTimer.singleShot(300, lambda: self.windowEffect.setMicaEffect(self.winId(), True))+ if cfg.backgroundEffect.value in ['Mica', 'MicaBlur', 'MicaAlt']:+ QTimer.singleShot(100, self.applyBackgroundEffectByCfg)+ QTimer.singleShot(200, self.applyBackgroundEffectByCfg)+ QTimer.singleShot(300, self.applyBackgroundEffectByCfg)elif callback == 'Light':setTheme(Theme.LIGHT, save=False)+ self.applyBackgroundEffectByCfg()++ def applyBackgroundEffectByCfg(self): # 不应设置 _isMicaEnabled 的值+ self.windowEffect.removeBackgroundEffect(self.winId())++ if cfg.backgroundEffect.value == 'Acrylic':+ self.windowEffect.setAcrylicEffect(self.winId(), "F2F2F230" if darkdetect.isDark() else "00000030")+ elif cfg.backgroundEffect.value == 'Mica':+ self.windowEffect.setMicaEffect(self.winId(), darkdetect.isDark())+ elif cfg.backgroundEffect.value == 'MicaBlur':+ self.windowEffect.setMicaEffect(self.winId(), darkdetect.isDark())+ self.windowEffect.DwmSetWindowAttribute(self.winId(), 38, byref(c_int(3)), 4)+ elif cfg.backgroundEffect.value == 'MicaAlt':+ self.windowEffect.setMicaEffect(self.winId(), darkdetect.isDark(), True)+ elif cfg.backgroundEffect.value == 'Aero':+ self.windowEffect.setAeroEffect(self.winId())++def initNavigation(self):# add navigation itemsself.addSubInterface(self.taskInterface, FIF.DOWNLOAD, "任务列表")diff --git a/app/view/setting_interface.py b/app/view/setting_interface.pyindex b1d7d10a..b958b2c1 100644--- a/app/view/setting_interface.py+++ b/app/view/setting_interface.py@@ -8,9 +8,9 @@ from PySide6.QtGui import QDesktopServicesfrom PySide6.QtWidgets import QWidget, QFileDialog, QVBoxLayout, QApplication, QButtonGroup, QHBoxLayout, QSpacerItem, \QSizePolicyfrom qfluentwidgets import FluentIcon as FIF, InfoBarPosition, ExpandGroupSettingCard, ConfigItem, \- BodyLabel, RadioButton, ComboBox, LineEdit+ BodyLabel, RadioButton, ComboBox, LineEdit, ComboBoxSettingCardfrom qfluentwidgets import InfoBar-from qfluentwidgets import (SettingCardGroup, SwitchSettingCard, OptionsSettingCard, PushSettingCard,+from qfluentwidgets import (SettingCardGroup, SwitchSettingCard, PushSettingCard,HyperlinkCard, PrimaryPushSettingCard, ScrollArea,setTheme, RangeSettingCard)@@ -254,7 +254,16 @@ class SettingInterface(ScrollArea):# self.tr('Change the theme color of you application'),# self.personalGroup# )- self.zoomCard = OptionsSettingCard(+ self.backgroundEffectCard = ComboBoxSettingCard(+ cfg.backgroundEffect,+ FIF.BRUSH,+ "窗口背景透明材质",+ "设置窗口背景透明效果和透明材质",+ texts=["Acrylic", "Mica", "MicaBlur", "MicaAlt", "Aero"],+ parent=self.personalGroup+ )++ self.zoomCard = ComboBoxSettingCard(cfg.dpiScale,FIF.ZOOM,"界面缩放",@@ -352,6 +361,7 @@ class SettingInterface(ScrollArea):self.browserGroup.addSettingCard(self.installExtensionCard)# self.personalGroup.addSettingCard(self.themeCard)# self.personalGroup.addSettingCard(self.themeColorCard)+ self.personalGroup.addSettingCard(self.backgroundEffectCard)self.personalGroup.addSettingCard(self.zoomCard)# self.personalGroup.addSettingCard(self.languageCard)@@ -391,6 +401,10 @@ class SettingInterface(ScrollArea):cfg.set(cfg.downloadFolder, folder)self.downloadFolderCard.setContent(folder)+ def __onBackgroundEffectCardChanged(self, option):+ """ background effect card changed slot """+ self.window().applyBackgroundEffectByCfg()+def __onBrowserExtensionCardChecked(self, value: bool):if value: # enableself.window().runBrowserExtensionServer()@@ -445,14 +459,14 @@ class SettingInterface(ScrollArea):with open(f"/home/{os.getlogin()}/.config/autostart/gd3.desktop", "w", encoding="utf-8") as f:_ = (f"""[Desktop Entry]-Type=Application-Version={VERSION}-Name=Ghost Downloader 3-Comment=A multi-threading downloader with QThread based on PySide6-Exec="{QApplication.applicationFilePath()}" --silence-StartupNotify=false-Terminal=false-""")+ Type=Application+ Version={VERSION}+ Name=Ghost Downloader 3+ Comment=A multi-threading downloader with QThread based on PySide6+ Exec="{QApplication.applicationFilePath()}" --silence+ StartupNotify=false+ Terminal=false+ """)print(_)f.write(_)f.flush()@@ -491,6 +505,9 @@ Terminal=falseself.browserExtensionCard.checkedChanged.connect(self.__onBrowserExtensionCardChecked)self.installExtensionCard.clicked.connect(self.__onInstallExtensionCardClicked)+ # personalization+ self.backgroundEffectCard.comboBox.currentIndexChanged.connect(self.__onBackgroundEffectCardChanged)+# softwareself.autoRunCard.checkedChanged.connect(self.__onAutoRunCardChecked)