add progress dialog for media delete

This commit is contained in:
Damien Elmes 2019-08-17 18:32:39 +10:00
parent c4eca03dd8
commit 888d8b5dee

View file

@ -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()