mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
add progress dialog for media delete
This commit is contained in:
parent
c4eca03dd8
commit
888d8b5dee
1 changed files with 15 additions and 4 deletions
19
aqt/main.py
19
aqt/main.py
|
@ -1148,10 +1148,21 @@ will be lost. Continue?"""))
|
|||
_("Delete unused media?")):
|
||||
return
|
||||
mdir = self.col.media.dir()
|
||||
for f in unused:
|
||||
path = os.path.join(mdir, f)
|
||||
if os.path.exists(path):
|
||||
send2trash(path)
|
||||
self.progress.start(immediate=True)
|
||||
try:
|
||||
lastProgress = 0
|
||||
for c, f in enumerate(unused):
|
||||
path = os.path.join(mdir, f)
|
||||
if os.path.exists(path):
|
||||
send2trash(path)
|
||||
|
||||
now = time.time()
|
||||
if now - lastProgress >= 0.3:
|
||||
lastProgress = now
|
||||
label = _("Deleted %s files...") % (c+1)
|
||||
self.progress.update(label)
|
||||
finally:
|
||||
self.progress.finish()
|
||||
tooltip(_("Deleted."))
|
||||
diag.close()
|
||||
|
||||
|
|
Loading…
Reference in a new issue