def __init__(self, gui, ids, callback): from calibre.gui2.dialogs.progress import ProgressDialog QObject.__init__(self, gui) self.model = gui.library_view.model() self.ids = ids self.permanent = False if can_recycle and len(ids) > 100: if question_dialog( gui, _('Are you sure?'), '<p>' + _('You are trying to delete {0} books. ' 'Sending so many files to the {1}' ' <b>can be slow</b>. Should calibre skip the' ' {1}? If you click Yes the files' ' will be <b>permanently deleted</b>.').format( len(ids), trash_name()), add_abort_button=True): self.permanent = True self.gui = gui self.failures = [] self.deleted_ids = [] self.callback = callback single_shot(self.delete_one) self.pd = ProgressDialog(_('Deleting...'), parent=gui, cancelable=False, min=0, max=len(self.ids), icon='trash.png') self.pd.setModal(True) self.pd.show()
def option_parser(get_parser, args): p = get_parser( _('''\ %prog remove ids Remove the books identified by ids from the database. ids should be a comma separated \ list of id numbers (you can get id numbers by using the search command). For example, \ 23,34,57-85 (when specifying a range, the last number in the range is not included). ''')) p.add_option('--permanent', default=False, action='store_true', help=_('Do not use the {}').format(trash_name())) return p