Skip to content

The only downloader you need. 下载器的集大成者。

去除多余的Aysncio.Lock, 优化 import。

XiaoYouChR4b102cfcdd92
diff --git a/app/common/download_task.py b/app/common/download_task.py
index 2f021514..7ad11020 100644
--- a/app/common/download_task.py
+++ b/app/common/download_task.py
@@ -104,7 +104,6 @@ class DownloadTask(QThread):
self.client = httpx.AsyncClient(headers=Headers, verify=False,
proxy=getProxy(), limits=httpx.Limits(max_connections=256))
- self.fileLock = asyncio.Lock()
self.__tempThread = Thread(target=self.__getLinkInfo, daemon=True) # TODO 获取文件名和文件大小的线程等信息, 暂时使用线程方式
self.__tempThread.start()
@@ -305,10 +304,9 @@ class DownloadTask(QThread):
if worker.endPos <= worker.process:
break
if chunk:
- async with self.fileLock: # 必须加锁!
- self.file.seek(worker.process)
- self.file.write(chunk)
- worker.process += 65536
+ self.file.seek(worker.process)
+ self.file.write(chunk)
+ worker.process += 65536
if worker.process >= worker.endPos:
worker.process = worker.endPos
diff --git a/app/components/Ui_UpdateDialog.py b/app/components/Ui_UpdateDialog.py
index 02dee808..0720df5f 100644
--- a/app/components/Ui_UpdateDialog.py
+++ b/app/components/Ui_UpdateDialog.py
@@ -9,11 +9,11 @@
################################################################################
from PySide6.QtCore import (QCoreApplication, QMetaObject)
-from PySide6.QtWidgets import (QFrame, QHBoxLayout,
+from PySide6.QtWidgets import (QHBoxLayout,
QSizePolicy, QVBoxLayout, QAbstractItemView)
from qfluentwidgets import (PillPushButton, PrimaryPushButton, PushButton, StrongBodyLabel,
- SubtitleLabel, TextEdit, TableWidget, TitleLabel, FluentIcon)
+ SubtitleLabel, TextEdit, TableWidget, FluentIcon)
class Ui_UpdateDialog(object):
def setupUi(self, UpdateDialog):
diff --git a/app/view/main_window.py b/app/view/main_window.py
index e8f7b3f7..cd20bf95 100644
--- a/app/view/main_window.py
+++ b/app/view/main_window.py
@@ -19,6 +19,7 @@ from ..components.add_task_dialog import AddTaskOptionDialog
from ..components.custom_tray import CustomSystemTrayIcon
from ..components.update_dialog import checkUpdate
+
class CustomSplashScreen(SplashScreen):
def finish(self):