hide unused media dialog after deletion

This commit is contained in:
Damien Elmes 2012-01-30 08:03:39 +09:00
parent 2796b9eaf8
commit dd2891b5ba

View file

@ -877,13 +877,14 @@ Your edits have left some cards empty. Do you want to delete them?"""))
b = QPushButton(_("Deleted Unused")) b = QPushButton(_("Deleted Unused"))
b.setAutoDefault(False) b.setAutoDefault(False)
box.addButton(b, QDialogButtonBox.ActionRole) box.addButton(b, QDialogButtonBox.ActionRole)
b.connect(b, SIGNAL("clicked()"), lambda u=unused: self.deleteUnused(u)) b.connect(
b, SIGNAL("clicked()"), lambda u=unused, d=diag: self.deleteUnused(u, d))
diag.connect(box, SIGNAL("rejected()"), diag, SLOT("reject()")) diag.connect(box, SIGNAL("rejected()"), diag, SLOT("reject()"))
diag.setMinimumHeight(400) diag.setMinimumHeight(400)
diag.setMinimumWidth(500) diag.setMinimumWidth(500)
diag.exec_() diag.exec_()
def deleteUnused(self, unused): def deleteUnused(self, unused, diag):
if not askUser( if not askUser(
_("Delete unused media? This operation can not be undone.")): _("Delete unused media? This operation can not be undone.")):
return return
@ -892,6 +893,7 @@ Your edits have left some cards empty. Do you want to delete them?"""))
path = os.path.join(mdir, f) path = os.path.join(mdir, f)
os.unlink(path) os.unlink(path)
tooltip("Deleted.") tooltip("Deleted.")
diag.close()
# System specific code # System specific code
########################################################################## ##########################################################################