fix: winfo_viewable durch explizites Flag ersetzen, unbenutzte Imports entfernen
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import queue
|
import queue
|
||||||
from unittest.mock import MagicMock, patch
|
|
||||||
|
|
||||||
import tqdm as tqdm_module
|
import tqdm as tqdm_module
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,10 @@ def load_model_with_progress(
|
|||||||
pct_var = tk.StringVar(value="0 %")
|
pct_var = tk.StringVar(value="0 %")
|
||||||
ttk.Label(frame, textvariable=pct_var).pack(anchor=tk.E, pady=(2, 0))
|
ttk.Label(frame, textvariable=pct_var).pack(anchor=tk.E, pady=(2, 0))
|
||||||
|
|
||||||
|
_dialog_shown = False
|
||||||
|
|
||||||
def poll() -> None:
|
def poll() -> None:
|
||||||
|
nonlocal _dialog_shown
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
msg = q.get_nowait()
|
msg = q.get_nowait()
|
||||||
@@ -107,8 +110,9 @@ def load_model_with_progress(
|
|||||||
root.quit()
|
root.quit()
|
||||||
return
|
return
|
||||||
# Erste echte Meldung → Dialog anzeigen
|
# Erste echte Meldung → Dialog anzeigen
|
||||||
if not root.winfo_viewable():
|
if not _dialog_shown:
|
||||||
root.deiconify()
|
root.deiconify()
|
||||||
|
_dialog_shown = True
|
||||||
# UI aktualisieren
|
# UI aktualisieren
|
||||||
file_var.set(msg["file"])
|
file_var.set(msg["file"])
|
||||||
if msg["total"] > 0:
|
if msg["total"] > 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user