From 6d98d4b1258e084ea16296eabca641ed773097ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armin=20K=C3=B6hler?= Date: Mon, 12 Mar 2012 06:48:14 +0100 Subject: [PATCH] add possibility to change bible meta data and the possibility to change the preferred bible language per bible - including first steps to edit the book names of the bible --- openlp/plugins/bibles/forms/__init__.py | 3 +- .../plugins/bibles/forms/editbibledialog.py | 171 ++++++++++++++++++ openlp/plugins/bibles/forms/editbibleform.py | 151 ++++++++++++++++ openlp/plugins/bibles/lib/db.py | 33 ++++ openlp/plugins/bibles/lib/manager.py | 52 +++++- openlp/plugins/bibles/lib/mediaitem.py | 37 +++- 6 files changed, 435 insertions(+), 12 deletions(-) create mode 100644 openlp/plugins/bibles/forms/editbibledialog.py create mode 100644 openlp/plugins/bibles/forms/editbibleform.py diff --git a/openlp/plugins/bibles/forms/__init__.py b/openlp/plugins/bibles/forms/__init__.py index 89bfbfff3..86f28592d 100644 --- a/openlp/plugins/bibles/forms/__init__.py +++ b/openlp/plugins/bibles/forms/__init__.py @@ -55,6 +55,7 @@ from booknameform import BookNameForm from languageform import LanguageForm from bibleimportform import BibleImportForm from bibleupgradeform import BibleUpgradeForm +from editbibleform import EditBibleForm __all__ = [u'BookNameForm', u'LanguageForm', u'BibleImportForm', - u'BibleUpgradeForm'] + u'BibleUpgradeForm', u'EditBibleForm'] diff --git a/openlp/plugins/bibles/forms/editbibledialog.py b/openlp/plugins/bibles/forms/editbibledialog.py new file mode 100644 index 000000000..ce64e90c9 --- /dev/null +++ b/openlp/plugins/bibles/forms/editbibledialog.py @@ -0,0 +1,171 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import build_icon, translate +from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box +from openlp.plugins.bibles.lib import LanguageSelection, BibleStrings +from openlp.plugins.bibles.lib.db import BiblesResourcesDB + + +class Ui_EditBibleDialog(object): + def setupUi(self, editBibleDialog): + editBibleDialog.setObjectName(u'editBibleDialog') + editBibleDialog.resize(650, 400) + editBibleDialog.setWindowIcon( + build_icon(u':/icon/openlp-logo-16x16.png')) + editBibleDialog.setModal(True) + self.dialogLayout = QtGui.QVBoxLayout(editBibleDialog) + self.dialogLayout.setSpacing(8) + self.dialogLayout.setContentsMargins(8, 8, 8, 8) + self.dialogLayout.setObjectName(u'dialogLayout') + self.bibleTabWidget = QtGui.QTabWidget(editBibleDialog) + self.bibleTabWidget.setObjectName(u'BibleTabWidget') + # Meta tab + self.metaTab = QtGui.QWidget() + self.metaTab.setObjectName(u'metaTab') + self.metaTabLayout = QtGui.QFormLayout(self.metaTab) + self.metaTabLayout.setObjectName(u'metaTabLayout') + self.versionNameLabel = QtGui.QLabel(self.metaTab) + self.versionNameLabel.setObjectName(u'versionNameLabel') + self.metaTabLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.versionNameLabel) + self.versionNameEdit = QtGui.QLineEdit(self.metaTab) + self.versionNameEdit.setObjectName(u'versionNameEdit') + self.versionNameLabel.setBuddy(self.versionNameEdit) + self.metaTabLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.versionNameEdit) + self.copyrightLabel = QtGui.QLabel(self.metaTab) + self.copyrightLabel.setObjectName(u'copyrightLabel') + self.metaTabLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.copyrightLabel) + self.copyrightEdit = QtGui.QLineEdit(self.metaTab) + self.copyrightEdit.setObjectName(u'copyrightEdit') + self.copyrightLabel.setBuddy(self.copyrightEdit) + self.metaTabLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.copyrightEdit) + self.permissionsLabel = QtGui.QLabel(self.metaTab) + self.permissionsLabel.setObjectName(u'permissionsLabel') + self.metaTabLayout.setWidget(2, QtGui.QFormLayout.LabelRole, + self.permissionsLabel) + self.permissionsEdit = QtGui.QLineEdit(self.metaTab) + self.permissionsEdit.setObjectName(u'permissionsEdit') + self.permissionsLabel.setBuddy(self.permissionsEdit) + self.metaTabLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.permissionsEdit) + self.languageSelectionLabel = QtGui.QLabel(self.metaTab) + self.languageSelectionLabel.setObjectName(u'languageSelectionLabel') + self.metaTabLayout.setWidget(3, QtGui.QFormLayout.LabelRole, + self.languageSelectionLabel) + self.languageSelectionComboBox = QtGui.QComboBox(self.metaTab) + self.languageSelectionComboBox.setObjectName( + u'languageSelectionComboBox') + self.languageSelectionComboBox.addItems([u'', u'', u'', u'']) + self.metaTabLayout.setWidget(3, QtGui.QFormLayout.FieldRole, + self.languageSelectionComboBox) + self.bibleTabWidget.addTab(self.metaTab, u'') + # Book name tab + self.bookNameTab = QtGui.QWidget() + self.bookNameTab.setObjectName(u'bookNameTab') + self.bookNameTabLayout = QtGui.QHBoxLayout(self.bookNameTab) + self.bookNameTabLayout.setObjectName(u'bookNameTabLayout') + self.scrollArea = QtGui.QScrollArea(self.bookNameTab) + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName(u'scrollArea') + self.scrollArea.setHorizontalScrollBarPolicy( + QtCore.Qt.ScrollBarAlwaysOff) + self.bookNameGroupBox = QtGui.QWidget(self.scrollArea) + self.bookNameGroupBox.setObjectName(u'bookNameGroupBox') + self.bookNameGroupBoxLayout = QtGui.QFormLayout(self.bookNameGroupBox) + self.bookNameGroupBoxLayout.setObjectName(u'bookNameGroupBoxLayout') + self.bookNameLabel = {} + self.bookNameEdit= {} + x = 0 + for book in BiblesResourcesDB.get_books(): + self.bookNameLabel[book[u'abbreviation']] = QtGui.QLabel( + self.bookNameGroupBox) + self.bookNameLabel[book[u'abbreviation']].setObjectName( + u'bookNameLabel[%s]' % book[u'abbreviation']) + self.bookNameGroupBoxLayout.setWidget(x, + QtGui.QFormLayout.LabelRole, + self.bookNameLabel[book[u'abbreviation']]) + self.bookNameEdit[book[u'abbreviation']] = QtGui.QLineEdit( + self.bookNameGroupBox) + self.bookNameEdit[book[u'abbreviation']].setObjectName( + u'bookNameEdit[%s]' % book[u'abbreviation']) + self.bookNameGroupBoxLayout.setWidget(x, + QtGui.QFormLayout.FieldRole, + self.bookNameEdit[book[u'abbreviation']]) + x = x+1 + self.scrollArea.setWidget(self.bookNameGroupBox) + self.bookNameTabLayout.addWidget(self.scrollArea) + self.bibleTabWidget.addTab(self.bookNameTab, u'') + # Last few bits + self.dialogLayout.addWidget(self.bibleTabWidget) + self.buttonBox = create_accept_reject_button_box(editBibleDialog) + self.dialogLayout.addWidget(self.buttonBox) + self.retranslateUi(editBibleDialog) + QtCore.QMetaObject.connectSlotsByName(editBibleDialog) + + + def retranslateUi(self, editBibleDialog): + self.booknames = BibleStrings().Booknames + editBibleDialog.setWindowTitle( + translate('BiblesPlugin.EditBibleForm', 'Song Editor')) + self.bibleTabWidget.setTabText( + self.bibleTabWidget.indexOf(self.metaTab), + translate('SongsPlugin.EditBibleForm', 'License Details')) + self.versionNameLabel.setText( + translate('BiblesPlugin.EditBibleForm', 'Version name:')) + self.copyrightLabel.setText( + translate('BiblesPlugin.EditBibleForm', 'Copyright:')) + self.permissionsLabel.setText( + translate('BiblesPlugin.EditBibleForm', 'Permissions:')) + self.bibleTabWidget.setTabText( + self.bibleTabWidget.indexOf(self.bookNameTab), + translate('SongsPlugin.EditBibleForm', 'Custom Book Names')) + self.languageSelectionLabel.setText( + translate('BiblesPlugin.EditBibleForm', 'Bookname language:')) + self.languageSelectionComboBox.setItemText(0, + translate('BiblesPlugin.EditBibleForm', 'General Settings')) + self.languageSelectionComboBox.setItemText(LanguageSelection.Bible+1, + translate('BiblesPlugin.EditBibleForm', 'Bible language')) + self.languageSelectionComboBox.setItemText( + LanguageSelection.Application+1, + translate('BiblesPlugin.EditBibleForm', 'Application language')) + self.languageSelectionComboBox.setItemText(LanguageSelection.English+1, + translate('BiblesPlugin.EditBibleForm', 'English')) + self.languageSelectionComboBox.setToolTip( + translate('BiblesPlugin.EditBibleForm', 'Multiple options:\n ' + 'General Settings - the option choosen in settings section\n' + 'Bible language - the language in which the bible book names ' + 'was imported\n Application language - the language you have ' + 'choosen for Openlp\n English - use always English booknames')) + for book in BiblesResourcesDB.get_books(): + self.bookNameLabel[book[u'abbreviation']].setText( + u'%s:' % unicode(self.booknames[book[u'abbreviation']])) diff --git a/openlp/plugins/bibles/forms/editbibleform.py b/openlp/plugins/bibles/forms/editbibleform.py new file mode 100644 index 000000000..27ec0e3a6 --- /dev/null +++ b/openlp/plugins/bibles/forms/editbibleform.py @@ -0,0 +1,151 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +import logging + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import PluginStatus, Receiver, MediaType, translate, \ + create_separated_list +from openlp.core.lib.ui import UiStrings, critical_error_message_box +from openlp.core.utils import AppLocation +from editbibledialog import Ui_EditBibleDialog +from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, BiblesResourcesDB + +log = logging.getLogger(__name__) + +class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog): + """ + Class to manage the editing of a bible + """ + log.info(u'%s EditBibleForm loaded', __name__) + + def __init__(self, mediaitem, parent, manager): + """ + Constructor + """ + QtGui.QDialog.__init__(self, parent) + self.mediaitem = mediaitem + + # can this be automated? + self.width = 400 + self.setupUi(self) + self.manager = manager + + def loadBible(self, bible): + """ + Loads a bible. + + ``bible`` + The name of the bible. + """ + log.debug(u'Load Bible') + self.bible = bible + self.versionNameEdit.setText( + self.manager.get_meta_data(self.bible, u'Version').value) + self.copyrightEdit.setText( + self.manager.get_meta_data(self.bible, u'Copyright').value) + self.permissionsEdit.setText( + self.manager.get_meta_data(self.bible, u'Permissions').value) + self.bookname_language = self.manager.get_meta_data( + self.bible, u'Bookname language') + if self.bookname_language: + self.languageSelectionComboBox.setCurrentIndex( + int(self.bookname_language.value)+1) + self.books = {} + for book in BiblesResourcesDB.get_books(): + self.books[book[u'abbreviation']] = self.manager.get_book_by_id( + self.bible, book[u'id']) + if self.books[book[u'abbreviation']]: + self.bookNameEdit[book[u'abbreviation']].setText( + self.books[book[u'abbreviation']].custom_name) + else: + self.bookNameGroupBoxLayout.removeWidget( + self.bookNameLabel[book[u'abbreviation']]) + self.bookNameLabel[book[u'abbreviation']].setParent(None) + self.bookNameGroupBoxLayout.removeWidget( + self.bookNameEdit[book[u'abbreviation']]) + self.bookNameEdit[book[u'abbreviation']].setParent(None) + + def reject(self): + """ + Exit Dialog and do not save + """ + log.debug (u'BibleEditForm.reject') + self.bible = None + QtGui.QDialog.reject(self) + + def accept(self): + """ + Exit Dialog and save data + """ + log.debug(u'BibleEditForm.accept') + self.version = unicode(self.versionNameEdit.text()) + self.copyright = unicode(self.copyrightEdit.text()) + self.permissions = unicode(self.permissionsEdit.text()) + self.bookname_language = \ + self.languageSelectionComboBox.currentIndex()-1 + if self.validateInput(): + self.manager.update_meta_data(self.bible, self.version, + self.copyright, self.permissions, self.bookname_language) + for abbr, book in self.books.iteritems(): + if book: + custom_name = unicode(self.bookNameEdit[abbr].text()) + if book.custom_name != custom_name: + book.custom_name = custom_name + self.manager.update_book(self.bible, book) + self.bible = None + QtGui.QDialog.accept(self) + + def validateInput(self): + """ + Validate the Input before saving. + """ + if not self.version: + critical_error_message_box(UiStrings().EmptyField, + translate('BiblesPlugin.BibleEditForm', + 'You need to specify a version name for your Bible.')) + self.versionNameEdit.setFocus() + return False + elif not self.copyright: + critical_error_message_box(UiStrings().EmptyField, + translate('BiblesPlugin.BibleEditForm', + 'You need to set a copyright for your Bible. ' + 'Bibles in the Public Domain need to be marked as such.')) + self.copyrightEdit.setFocus() + return False + elif self.manager.exists(self.version) and \ + self.manager.get_meta_data(self.bible, u'Version').value != \ + self.version: + critical_error_message_box( + translate('BiblesPlugin.BibleEditForm', 'Bible Exists'), + translate('BiblesPlugin.BibleEditForm', + 'This Bible already exists. Please import ' + 'a different Bible or first delete the existing one.')) + self.versionNameEdit.setFocus() + return False + return True diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index b419bebc0..e7b30c01a 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -81,6 +81,7 @@ def init_schema(url): Column(u'book_reference_id', types.Integer, index=True), Column(u'testament_reference_id', types.Integer), Column(u'name', types.Unicode(50), index=True), + #Column(u'custom_name', types.Unicode(50), index=True), ) verse_table = Table(u'verse', metadata, Column(u'id', types.Integer, primary_key=True, index=True), @@ -205,6 +206,18 @@ class BibleDB(QtCore.QObject, Manager): self.save_object(book) return book + def update_book(self, book): + """ + Update a book in the database. + + ``book`` + The book object + """ + log.debug(u'BibleDB.update_book("%s")', book.name) + if self.save_object(book): + return True + return False + def delete_book(self, db_book): """ Delete a book from the database. @@ -286,6 +299,26 @@ class BibleDB(QtCore.QObject, Manager): log.debug(u'BibleDB.save_meta("%s/%s")', key, value) self.save_object(BibleMeta.populate(key=key, value=value)) + def update_meta(self, key, value): + """ + Utility method to update BibleMeta objects in a Bible database. + + ``key`` + The key for this instance. + + ``value`` + The value for this instance. + """ + if not isinstance(value, unicode): + value = unicode(value) + log.debug(u'BibleDB.update_meta("%s/%s")', key, value) + meta = self.get_object(BibleMeta, key) + if meta: + meta.value = value + self.save_object(meta) + else: + self.save_object(BibleMeta.populate(key=key, value=value)) + def get_book(self, book): """ Return a book object from the database. diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index c9f564b2c..46cfae6b8 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -31,7 +31,8 @@ import os from PyQt4 import QtCore from openlp.core.lib import Receiver, SettingsManager, translate -from openlp.core.lib.ui import critical_error_message_box +from openlp.core.lib.ui import critical_error_message_box, \ + create_accept_reject_button_box from openlp.core.utils import AppLocation, delete_file from openlp.plugins.bibles.lib import parse_reference, \ get_reference_separator, LanguageSelection @@ -141,13 +142,14 @@ class BibleManager(object): BibleDB class. """ log.debug(u'Reload bibles') - files = SettingsManager.get_files(self.settingsSection, self.suffix) - if u'alternative_book_names.sqlite' in files: - files.remove(u'alternative_book_names.sqlite') - log.debug(u'Bible Files %s', files) + self.files = SettingsManager.get_files(self.settingsSection, + self.suffix) + if u'alternative_book_names.sqlite' in self.files: + self.files.remove(u'alternative_book_names.sqlite') + log.debug(u'Bible Files %s', self.files) self.db_cache = {} self.old_bible_databases = [] - for filename in files: + for filename in self.files: bible = BibleDB(self.parent, path=self.path, file=filename) name = bible.get_name() # Remove corrupted files. @@ -204,6 +206,22 @@ class BibleManager(object): self.db_cache[name] = importer return importer + def delete_bible(self, name): + """ + Delete a bible completly. + + ``name`` + The name of the bible. + """ + for filename in self.files: + bible = BibleDB(self.parent, path=self.path, file=filename) + # Remove the bible files + if name == bible.get_name(): + bible.session.close() + if delete_file(os.path.join(self.path, filename)): + return True + return False + def get_bibles(self): """ Returns a dict with all available Bibles. @@ -400,18 +418,38 @@ class BibleManager(object): """ Saves the bibles meta data. """ - log.debug(u'save_meta data %s,%s, %s,%s', + log.debug(u'save_meta data %s, %s, %s, %s', bible, version, copyright, permissions) self.db_cache[bible].create_meta(u'Version', version) self.db_cache[bible].create_meta(u'Copyright', copyright) self.db_cache[bible].create_meta(u'Permissions', permissions) + def update_meta_data(self, bible, version, copyright, permissions, + bookname_language): + """ + Saves the bibles meta data. + """ + log.debug(u'update_meta data %s, %s, %s, %s', + bible, version, copyright, permissions) + self.db_cache[bible].update_meta(u'Version', version) + self.db_cache[bible].update_meta(u'Copyright', copyright) + self.db_cache[bible].update_meta(u'Permissions', permissions) + self.db_cache[bible].update_meta(u'Bookname language', + bookname_language) + def get_meta_data(self, bible, key): """ Returns the meta data for a given key. """ log.debug(u'get_meta %s,%s', bible, key) return self.db_cache[bible].get_object(BibleMeta, key) + + def update_book(self, bible, book): + """ + Update a book of the bible. + """ + log.debug(u'BibleManager.update_book("%s", "%s")', bible, book.name) + self.db_cache[bible].update_book(book) def exists(self, name): """ diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 976ff6106..980d8d94d 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -36,9 +36,10 @@ from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.ui import UiStrings, add_widget_completer, \ media_item_combo_box, critical_error_message_box, \ find_and_set_in_combo_box, build_icon -from openlp.plugins.bibles.forms import BibleImportForm +from openlp.plugins.bibles.forms import BibleImportForm, EditBibleForm from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \ - VerseReferenceList, get_reference_separator, LanguageSelection, BibleStrings + VerseReferenceList, get_reference_separator, LanguageSelection, \ + BibleStrings from openlp.plugins.bibles.lib.db import BiblesResourcesDB log = logging.getLogger(__name__) @@ -109,8 +110,8 @@ class BibleMediaItem(MediaManagerItem): MediaManagerItem.requiredIcons(self) self.hasImportIcon = True self.hasNewIcon = False - self.hasEditIcon = False - self.hasDeleteIcon = False + self.hasEditIcon = True + self.hasDeleteIcon = True self.addToServiceItem = False def addSearchTab(self, prefix, name): @@ -532,6 +533,34 @@ class BibleMediaItem(MediaManagerItem): if self.import_wizard.exec_(): self.reloadBibles() + def onEditClick(self): + if self.quickTab.isVisible(): + bible = unicode(self.quickVersionComboBox.currentText()) + elif self.advancedTab.isVisible(): + bible = unicode(self.advancedVersionComboBox.currentText()) + if bible != u'': + self.editBibleForm = EditBibleForm(self, self.plugin.formparent, + self.plugin.manager) + self.editBibleForm.loadBible(bible) + if self.editBibleForm.exec_(): + self.reloadBibles() + + def onDeleteClick(self): + if self.quickTab.isVisible(): + bible = unicode(self.quickVersionComboBox.currentText()) + elif self.advancedTab.isVisible(): + bible = unicode(self.advancedVersionComboBox.currentText()) + if bible != u'': + if QtGui.QMessageBox.question(self, UiStrings().ConfirmDelete, + unicode(translate('BiblesPlugin.MediaItem', + 'Are you sure you want to delete "%s"?')) % bible, + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | + QtGui.QMessageBox.No), + QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No: + return + self.plugin.manager.delete_bible(bible) + self.reloadBibles() + def onSearchTabBarCurrentChanged(self, index): if index == 0: self.advancedTab.setVisible(False)