Merge pull request #338 from Aqueminivan/master

Added file counts when deleting media
This commit is contained in:
Damien Elmes 2019-10-20 09:46:14 +10:00 committed by GitHub
commit e2475244d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1104,10 +1104,12 @@ will be lost. Continue?"""))
if warnings:
report += "\n".join(warnings) + "\n"
if unused:
numberOfUnusedFilesLabel = len(unused)
if report:
report += "\n\n\n"
report += _(
"In media folder but not used by any cards:")
report += ngettext("%d file found in media folder not used by any cards:",
"%d files found in media folder not used by any cards:",
numberOfUnusedFilesLabel) % numberOfUnusedFilesLabel
report += "\n" + "\n".join(unused)
if nohave:
if report:
@ -1158,12 +1160,18 @@ will be lost. Continue?"""))
now = time.time()
if now - lastProgress >= 0.3:
numberOfRemainingFilesToBeDeleted = len(unused) - c
lastProgress = now
label = _("Deleted %s files...") % (c+1)
label = ngettext("%d file remaining...",
"%d files remaining...",
numberOfRemainingFilesToBeDeleted) % numberOfRemainingFilesToBeDeleted
self.progress.update(label)
finally:
self.progress.finish()
tooltip(_("Deleted."))
numberOfFilesDeleted = c + 1
tooltip(ngettext("Deleted %d file.",
"Deleted %d files.",
numberOfFilesDeleted) % numberOfFilesDeleted)
diag.close()
def onStudyDeck(self):