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?")): _("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()