mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 07:07:13 -05: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?")):
|
_("Delete unused media?")):
|
||||||
return
|
return
|
||||||
mdir = self.col.media.dir()
|
mdir = self.col.media.dir()
|
||||||
for f in unused:
|
self.progress.start(immediate=True)
|
||||||
path = os.path.join(mdir, f)
|
try:
|
||||||
if os.path.exists(path):
|
lastProgress = 0
|
||||||
send2trash(path)
|
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."))
|
tooltip(_("Deleted."))
|
||||||
diag.close()
|
diag.close()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue