Compare commits

...
Author SHA1 Message Date
yusufipek e282e6b0cf 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.
2026-09-05 11:37:19 +03:00
3 changed files with 32 additions and 0 deletions
+1
View File
@@ -793,6 +793,7 @@ TR = {
"İndirildi, sürüm {version}. Vulkan sürümü yoktu, bu sürüm işlemcide çalışıyor.",
"Fetching the model list…": "Model listesi çekiliyor…",
"Downloading…": "İndiriliyor…",
"Starting the download…": "İndirme başlatılıyor…",
"Downloading: {done} of {total}{share}": "İndiriliyor: {done} / {total}{share}",
"Download stopped.": "İndirme durduruldu.",
"Ready: {name}.": "Hazır: {name}.",
+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:
+22
View File
@@ -1336,6 +1336,28 @@ class LocalModels(DikteTest):
self.assertIn("10", box.program_label.text())
self.assertIn("20", box.status.text())
def test_a_download_says_something_before_the_first_byte(self):
# Opening the connection takes ten or twenty seconds, and the byte
# counts only start after it. The line underneath still read "has not
# been downloaded yet" beside a button that now said Stop, so a
# download that had started looked like a click that had not landed.
box = self.window(cfg.Config()).local_llm
box.load("", "ggml-org/SmolLM3-3B-GGUF")
box.repo.blockSignals(True)
box.repo.setCurrentText("ggml-org/SmolLM3-3B-GGUF")
box.repo.blockSignals(False)
box._on_listed([("models", [self._item("SmolLM3-Q4_K_M.gguf")],
"ggml-org/SmolLM3-3B-GGUF")], "")
with mock.patch.object(settings_ui.threading, "Thread"):
box._download()
self.assertIn("Starting", box.status.text())
# And the same again for the stop, which is read between blocks and so
# not read at all while the connection is still being opened.
with mock.patch.object(settings_ui.threading, "Thread"):
box._download()
self.assertTrue(box._stop)
self.assertIn("Stopping", box.status.text())
def test_a_long_model_name_is_not_cut_in_half(self):
# The list under a combo box takes the box's width and elides what does
# not fit, in the middle: "ggml-org/Qwen....7B-Base-GGUF".