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