Skip to content

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

修复暂停卡住的问题,修复重启软件后文件名显示异常的问题

XiaoYouChRcae001c020e3
diff --git a/app/components/custom_tray.py b/app/components/custom_tray.py
index 6ad813b4..671c4444 100644
--- a/app/components/custom_tray.py
+++ b/app/components/custom_tray.py
@@ -6,7 +6,7 @@ from qfluentwidgets.components.material import AcrylicMenu
class FixedAcrylicSystemTrayMenu(AcrylicMenu):
- """ 修复背景获取便宜的问题 """
+ """ 修复背景获取偏移的问题 """
def showEvent(self, e):
super().showEvent(e)
@@ -78,14 +78,15 @@ class CustomSystemTrayIcon(QSystemTrayIcon):
for i in self.parent().taskInterface.cards:
if i.status == 'working':
for j in i.task.workers:
- try:
- j.file.close()
- except AttributeError as e:
- logger.info(f"Task:{i.task.fileName}, users operate too quickly!, thread {i} error: {e}")
- except Exception as e:
- logger.warning(
- f"Task:{i.task.fileName}, it seems that cannot cancel thread {i} occupancy of the file, error: {e}")
+ # try:
+ # j.file.close()
+ # except AttributeError as e:
+ # logger.info(f"Task:{i.task.fileName}, users operate too quickly!, thread {i} error: {e}")
+ # except Exception as e:
+ # logger.warning(
+ # f"Task:{i.task.fileName}, it seems that cannot cancel thread {i} occupancy of the file, error: {e}")
j.terminate()
+
i.task.terminate()
QApplication.quit()
diff --git a/app/components/task_card.py b/app/components/task_card.py
index 34ad8106..64066131 100644
--- a/app/components/task_card.py
+++ b/app/components/task_card.py
@@ -76,6 +76,11 @@ class TaskCard(CardWidget, Ui_TaskCard):
if not self.status == "finished": # 不是已完成的任务才要进行的操作
if name:
self.task = DownloadTask(url, maxBlockNum, path, name)
+
+ self.__onTaskInited()
+ if self.status == "paused":
+ self.speedLable.setText("任务已经暂停")
+
else:
self.task = DownloadTask(url, maxBlockNum, path)
@@ -153,12 +158,13 @@ class TaskCard(CardWidget, Ui_TaskCard):
try:
for i in self.task.workers:
- try:
- i.file.close()
- except Exception as e:
- logger.warning(
- f"Task:{self.fileName}, it seems that cannot cancel thread {i} occupancy of the file, error: {e}")
+ # try:
+ # i.file.close()
+ # except Exception as e:
+ # logger.warning(
+ # f"Task:{self.fileName}, it seems that cannot cancel thread {i} occupancy of the file, error: {e}")
i.terminate()
+
self.task.terminate()
# 改变记录状态