Say the download started before the first byte arrives

Opening the connection takes ten or twenty seconds, and the byte counts
under the model box only start after it. Until then the line read "X has
not been downloaded yet" beside a button that had just turned into Stop,
so a download that was running looked like a click that had not landed.

The stop had the same gap the other way round: should_stop is read
between blocks, and the wait for the server to answer is not between
blocks, so pressing Stop during it changed nothing on screen either.
This commit is contained in:
2026-09-05 11:37:19 +03:00
parent 06e578d901
commit e282e6b0cf
3 changed files with 32 additions and 0 deletions
+9
View File
@@ -701,12 +701,21 @@ class LocalModelBox(QGroupBox):
def _download(self):
if self._downloading:
self._stop = True
# The flag is only read between blocks, and the wait for the server
# to answer is not between blocks: a click during it changes
# nothing on screen for as long as the connection takes.
self.status.setText(t("Stopping…"))
return
item = self._current_item()
if item is None:
return
self._downloading, self._stop = True, False
self._refresh_buttons()
# Opening the connection can take ten or twenty seconds, and the first
# byte counts are what the line below would otherwise wait for. Left
# saying "not downloaded yet" beside a button that now reads Stop, a
# download that started looks like a click that did not register.
self.status.setText(t("Starting the download…"))
def work():
try: