The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
fix(TaskCard): 修复未知大小任务完成后卡片刷新崩溃
XiaoYouChR984d0fe3c076
diff --git a/CONTEXT.md b/CONTEXT.mdindex 528e3880..21fcb4e2 100644--- a/CONTEXT.md+++ b/CONTEXT.md@@ -714,3 +714,7 @@ initialized in `run()`, never serialized.built in unclear combination. Resolved: use the specific verb that names theactual operation (load, fetch, probe, parse, build, select, or anoun-returning method).+- `fileSize == 0` means both "size unknown" (`SpecialFileSize.UNKNOWN`) and a+ legitimately empty file — the model cannot tell them apart. Unresolved;+ existing code works around it (`updateStatus` backfills only when+ `receivedBytes > 0`; the HTTP probe treats sizes 0 and 1 as pseudo-unknown).diff --git a/app/view/cards/task_cards.py b/app/view/cards/task_cards.pyindex 3fd34526..47746664 100644--- a/app/view/cards/task_cards.py+++ b/app/view/cards/task_cards.py@@ -229,6 +229,7 @@ class UniversalTaskCard(TaskCard):self.progressBar.setError(False)if self.statusLabel.isVisible():self.statusLabel.hide()+ self.progressBar.show()self.speedLabel.show()self.etaLabel.show()self.sizeLabel.show()@@ -239,11 +240,11 @@ class UniversalTaskCard(TaskCard):self.etaLabel.setText("--")elif task.status == TaskStatus.COMPLETED:+ self.progressBar.pause()+ self.progressBar.hide()if task.fileSize > 0:- self.progressBar.hide()self.sizeLabel.setText(toReadableSize(task.fileSize))else:- self.progressBar.stop()self.sizeLabel.hide()self._fileMissing = task.hasOutputFile and not Path(task.outputPath).exists()if self._fileMissing:@@ -261,7 +262,7 @@ class UniversalTaskCard(TaskCard):self._refreshIcon()elif task.status == TaskStatus.FAILED:- self.progressBar.error()+ self.progressBar.setError(True)error = task.lastErrorif error:from PySide6.QtCore import QCoreApplicationdiff --git a/features/ftp_pack/cards.py b/features/ftp_pack/cards.pyindex bcb42ebe..565f10a9 100644--- a/features/ftp_pack/cards.py+++ b/features/ftp_pack/cards.py@@ -77,7 +77,7 @@ class FtpTaskCard(UniversalTaskCard):def refresh(self, force: bool = False) -> None:super().refresh(force=force)- hasMultipleFiles = self.task.files and len(self.task.files) > 1+ hasMultipleFiles = bool(self.task.files and len(self.task.files) > 1)self.selectFilesButton.setVisible(hasMultipleFiles)self.selectFilesButton.setEnabled(self.task.status != TaskStatus.RUNNING)diff --git a/features/http_pack/cards.py b/features/http_pack/cards.pyindex b60ca813..b385202f 100644--- a/features/http_pack/cards.py+++ b/features/http_pack/cards.py@@ -49,9 +49,6 @@ class SegmentedProgressBar(QWidget):self._isPaused = Falseself.update()- def error(self) -> bool:- return self._isError-def pause(self):self._isPaused = Trueself.update()@@ -97,6 +94,6 @@ class SegmentedProgressBar(QWidget):class HttpTaskCard(UniversalTaskCard):def _buildProgressBar(self) -> QWidget:step = self.task.steps[0] if self.task.steps else None- if isinstance(step, HttpTaskStep) and step.canUseRangeRequests and step.subworkerCount > 1:+ if isinstance(step, HttpTaskStep) and step.canUseRangeRequests and step.fileSize > 0 and step.subworkerCount > 1:return SegmentedProgressBar(step, self)return super()._buildProgressBar()