def reject(self): idx = self.stack.currentIndex() if idx > 0: if confirm_delete(_('Are you sure? Any unsaved changes will be lost.'), 'confirm-cancel-edit-custom-recipe'): self.stack.setCurrentIndex(0) return Dialog.reject(self)
def remove_cover(self): if not confirm_delete( _('Are you sure you want to delete the cover permanently?'), 'book-details-confirm-cover-remove', parent=self): return id_ = self.data.get('id', None) self.pixmap = self.default_pixmap self.do_layout() self.update() if id_ is not None: self.cover_removed.emit(id_)
def remove(self): idx = self.view.currentIndex() if idx.isValid(): if confirm_delete(_( 'Are you sure you want to permanently remove this recipe?' ), 'remove-custom-recipe', parent=self): self.model.remove((idx.row(), )) self.select_row() if self.model.rowCount() == 0: self.stacks.setCurrentIndex(0)