The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
refactor(clipboard): 优化剪贴板监听功能
XiaoYouChRf14670301b08
diff --git a/app/common/config.py b/app/common/config.pyindex f3fba8f8..6990bd55 100644--- a/app/common/config.py+++ b/app/common/config.py@@ -55,7 +55,6 @@ class Config(QConfig):maxBlockNum = RangeConfigItem("Download", "MaxBlockNum", 8, RangeValidator(1, 256))autoSpeedUp = ConfigItem("Download", "AutoSpeedUp", True, BoolValidator())proxyServer = ConfigItem("Download", "ProxyServer", "Auto", ProxyValidator())- clipboardListenerCard = ConfigItem("Download", "ClipboardListener", True, BoolValidator())# browserenableBrowserExtension = ConfigItem("Browser", "EnableBrowserExtension", False, BoolValidator())@@ -70,6 +69,7 @@ class Config(QConfig):# softwarecheckUpdateAtStartUp = ConfigItem("Software", "CheckUpdateAtStartUp", True, BoolValidator())autoRun = ConfigItem("Software", "AutoRun", False, BoolValidator())+ enableClipboardListener = ConfigItem("Software", "ClipboardListener", True, BoolValidator())geometry = ConfigItem("Software", "Geometry", "Default", GeometryValidator(), GeometrySerializer()) # 保存程序的位置和大小, Validator 在 mainWindow 中设置# 程序运行路径appPath = "./"diff --git a/app/view/main_window.py b/app/view/main_window.pyindex e66a9dc5..8ef262eb 100644--- a/app/view/main_window.py+++ b/app/view/main_window.py@@ -62,6 +62,9 @@ class MainWindow(MSFluentWindow):# add items to navigation interfaceself.initNavigation()+ # 允许拖拽+ self.setAcceptDrops(True)+# 设置背景特效self.applyBackgroundEffectByCfg()@@ -86,27 +89,41 @@ class MainWindow(MSFluentWindow):else:historyFile.touch()- # 启动浏览器扩展服务器+ # 启动浏览器扩展服务器和剪切板监听器self.browserExtensionServer = None+ self.clipboard = None- if cfg.enableBrowserExtension.value == True:+ if cfg.enableBrowserExtension.value:self.runBrowserExtensionServer()+ if cfg.enableClipboardListener.value:+ self.runClipboardListener()+# 创建托盘self.tray = CustomSystemTrayIcon(self)self.tray.show()# 检查更新- if cfg.checkUpdateAtStartUp.value == True:+ if cfg.checkUpdateAtStartUp.value:checkUpdate(self)self.splashScreen.finish()self.dropTimmer = QTimer()self.dropTimmer.timeout.connect(self.__showAddTaskBox)- self.clipboard = QApplication.clipboard()- self.clipboard.dataChanged.connect(self.__clipboardChanged)++self.urlsText = ''+ def runClipboardListener(self):+ if not self.clipboard:+ self.clipboard = QApplication.clipboard()+ self.clipboard.dataChanged.connect(self.__clipboardChanged)++ def stopClipboardListener(self):+ self.clipboard.dataChanged.disconnect(self.__clipboardChanged)+ self.clipboard.deleteLater()+ self.clipboard = None+def runBrowserExtensionServer(self):if not self.browserExtensionServer:self.browserExtensionServer = GhostDownloaderSocketServer(self)@@ -269,7 +286,7 @@ class MainWindow(MSFluentWindow):return Falsedef __clipboardChanged(self):- if not cfg.clipboardListenerCard.value:+ if not cfg.enableClipboardListener.value:returntext = self.clipboard.text()if text.isspace():diff --git a/app/view/setting_interface.py b/app/view/setting_interface.pyindex 40407ba7..38214da8 100644--- a/app/view/setting_interface.py+++ b/app/view/setting_interface.py@@ -319,7 +319,7 @@ class SettingInterface(SmoothScrollArea):FIF.PASTE,"剪贴板监听","剪贴板监听器将自动检测剪贴板中的链接并添加下载任务",- configItem=cfg.clipboardListenerCard,+ configItem=cfg.enableClipboardListener,parent=self.updateSoftwareGroup)@@ -437,6 +437,12 @@ class SettingInterface(SmoothScrollArea):if not value:self.window().stopBrowserExtensionServer()+ def __onClipboardListenerCardChecked(self, value: bool):+ if value:+ self.window().runClipboardListener()+ else:+ self.window().stopClipboardListener()+def __onInstallExtensionCardClicked(self):""" install extension card clicked slot """fileResolve, type = QFileDialog.getSaveFileName(self, "选择导出路径", "./Extension.crx", "Chromium Extension(*.crx)")diff --git a/main.py b/main.pyindex 52d3c814..5802f981 100644--- a/main.py+++ b/main.py@@ -113,7 +113,6 @@ if sys.platform == "linux":# create main windoww = MainWindow()-w.setAcceptDrops(True)# loading pluginspluginsPath=os.path.join(cfg.appPath, "plugins")