forked from openlp/openlp
Head
This commit is contained in:
commit
1c48bfab67
@ -80,8 +80,7 @@ class BiblePlugin(Plugin):
|
|||||||
self.exportBibleItem = QtGui.QAction(export_menu)
|
self.exportBibleItem = QtGui.QAction(export_menu)
|
||||||
self.exportBibleItem.setObjectName(u'exportBibleItem')
|
self.exportBibleItem.setObjectName(u'exportBibleItem')
|
||||||
export_menu.addAction(self.exportBibleItem)
|
export_menu.addAction(self.exportBibleItem)
|
||||||
self.exportBibleItem.setText(translate(
|
self.exportBibleItem.setText(translate('BiblesPlugin', '&Bible'))
|
||||||
'BiblesPlugin', '&Bible'))
|
|
||||||
self.exportBibleItem.setVisible(False)
|
self.exportBibleItem.setVisible(False)
|
||||||
|
|
||||||
def onBibleImportClick(self):
|
def onBibleImportClick(self):
|
||||||
@ -97,7 +96,6 @@ class BiblePlugin(Plugin):
|
|||||||
def usesTheme(self, theme):
|
def usesTheme(self, theme):
|
||||||
"""
|
"""
|
||||||
Called to find out if the bible plugin is currently using a theme.
|
Called to find out if the bible plugin is currently using a theme.
|
||||||
|
|
||||||
Returns True if the theme is being used, otherwise returns False.
|
Returns True if the theme is being used, otherwise returns False.
|
||||||
"""
|
"""
|
||||||
if self.settings_tab.bible_theme == theme:
|
if self.settings_tab.bible_theme == theme:
|
||||||
|
@ -407,21 +407,21 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.initialiseChapterVerse(bible, book[u'name'],
|
self.initialiseChapterVerse(bible, book[u'name'],
|
||||||
book[u'chapters'])
|
book[u'chapters'])
|
||||||
|
|
||||||
def initialiseChapterVerse(self, bible, book, chapters):
|
def initialiseChapterVerse(self, bible, book, chapter_count):
|
||||||
log.debug(u'initialiseChapterVerse %s, %s', bible, book)
|
log.debug(u'initialiseChapterVerse %s, %s', bible, book)
|
||||||
self.chapters_from = chapters
|
self.chapter_count = chapter_count
|
||||||
self.verses = self.parent.manager.get_verse_count(bible, book, 1)
|
verse_count = self.parent.manager.get_verse_count(bible, book, 1)
|
||||||
if self.verses == 0:
|
if verse_count == 0:
|
||||||
self.AdvancedSearchButton.setEnabled(False)
|
self.AdvancedSearchButton.setEnabled(False)
|
||||||
self.AdvancedMessage.setText(
|
self.AdvancedMessage.setText(
|
||||||
translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.'))
|
translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.'))
|
||||||
else:
|
else:
|
||||||
self.AdvancedSearchButton.setEnabled(True)
|
self.AdvancedSearchButton.setEnabled(True)
|
||||||
self.AdvancedMessage.setText(u'')
|
self.AdvancedMessage.setText(u'')
|
||||||
self.adjustComboBox(1, self.chapters_from, self.AdvancedFromChapter)
|
self.adjustComboBox(1, self.chapter_count, self.AdvancedFromChapter)
|
||||||
self.adjustComboBox(1, self.chapters_from, self.AdvancedToChapter)
|
self.adjustComboBox(1, self.chapter_count, self.AdvancedToChapter)
|
||||||
self.adjustComboBox(1, self.verses, self.AdvancedFromVerse)
|
self.adjustComboBox(1, verse_count, self.AdvancedFromVerse)
|
||||||
self.adjustComboBox(1, self.verses, self.AdvancedToVerse)
|
self.adjustComboBox(1, verse_count, self.AdvancedToVerse)
|
||||||
|
|
||||||
def onAdvancedVersionComboBox(self):
|
def onAdvancedVersionComboBox(self):
|
||||||
self.initialiseBible(
|
self.initialiseBible(
|
||||||
@ -435,44 +435,65 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.AdvancedBookComboBox.itemData(item).toInt()[0])
|
self.AdvancedBookComboBox.itemData(item).toInt()[0])
|
||||||
|
|
||||||
def onAdvancedFromVerse(self):
|
def onAdvancedFromVerse(self):
|
||||||
frm = int(self.AdvancedFromVerse.currentText())
|
chapter_from = int(self.AdvancedFromChapter.currentText())
|
||||||
chapter_frm = int(self.AdvancedFromChapter.currentText())
|
|
||||||
chapter_to = int(self.AdvancedToChapter.currentText())
|
chapter_to = int(self.AdvancedToChapter.currentText())
|
||||||
if chapter_frm == chapter_to:
|
if chapter_from == chapter_to:
|
||||||
bible = unicode(self.AdvancedVersionComboBox.currentText())
|
bible = unicode(self.AdvancedVersionComboBox.currentText())
|
||||||
book = unicode(self.AdvancedBookComboBox.currentText())
|
book = unicode(self.AdvancedBookComboBox.currentText())
|
||||||
verses = self.parent.manager.get_verse_count(bible, book, chapter_to)
|
verse_from = int(self.AdvancedFromVerse.currentText())
|
||||||
self.adjustComboBox(frm, verses, self.AdvancedToVerse)
|
verse_count = self.parent.manager.get_verse_count(bible, book,
|
||||||
|
chapter_to)
|
||||||
|
self.adjustComboBox(verse_from, verse_count,
|
||||||
|
self.AdvancedToVerse, True)
|
||||||
|
|
||||||
def onAdvancedToChapter(self):
|
def onAdvancedToChapter(self):
|
||||||
chapter_frm = int(self.AdvancedFromChapter.currentText())
|
|
||||||
chapter_to = int(self.AdvancedToChapter.currentText())
|
|
||||||
bible = unicode(self.AdvancedVersionComboBox.currentText())
|
bible = unicode(self.AdvancedVersionComboBox.currentText())
|
||||||
book = unicode(self.AdvancedBookComboBox.currentText())
|
book = unicode(self.AdvancedBookComboBox.currentText())
|
||||||
verses = self.parent.manager.get_verse_count(bible, book, chapter_to)
|
chapter_from = int(self.AdvancedFromChapter.currentText())
|
||||||
if chapter_frm != chapter_to:
|
chapter_to = int(self.AdvancedToChapter.currentText())
|
||||||
self.adjustComboBox(1, verses, self.AdvancedToVerse)
|
verse_from = int(self.AdvancedFromVerse.currentText())
|
||||||
|
verse_to = int(self.AdvancedToVerse.currentText())
|
||||||
|
verse_count = self.parent.manager.get_verse_count(bible, book,
|
||||||
|
chapter_to)
|
||||||
|
if chapter_from == chapter_to and verse_from > verse_to:
|
||||||
|
self.adjustComboBox(verse_from, verse_count, self.AdvancedToVerse)
|
||||||
else:
|
else:
|
||||||
frm = int(self.AdvancedFromVerse.currentText())
|
self.adjustComboBox(1, verse_count, self.AdvancedToVerse)
|
||||||
to = int(self.AdvancedToVerse.currentText())
|
|
||||||
if to < frm:
|
|
||||||
self.adjustComboBox(frm, verses, self.AdvancedToVerse)
|
|
||||||
|
|
||||||
def onAdvancedFromChapter(self):
|
def onAdvancedFromChapter(self):
|
||||||
bible = unicode(self.AdvancedVersionComboBox.currentText())
|
bible = unicode(self.AdvancedVersionComboBox.currentText())
|
||||||
book = unicode(self.AdvancedBookComboBox.currentText())
|
book = unicode(self.AdvancedBookComboBox.currentText())
|
||||||
chapter_frm = int(self.AdvancedFromChapter.currentText())
|
chapter_from = int(self.AdvancedFromChapter.currentText())
|
||||||
self.adjustComboBox(chapter_frm, self.chapters_from,
|
chapter_to = int(self.AdvancedToChapter.currentText())
|
||||||
|
verse_count = self.parent.manager.get_verse_count(bible, book,
|
||||||
|
chapter_from)
|
||||||
|
self.adjustComboBox(1, verse_count, self.AdvancedFromVerse)
|
||||||
|
if chapter_from > chapter_to:
|
||||||
|
self.adjustComboBox(1, verse_count, self.AdvancedToVerse)
|
||||||
|
self.adjustComboBox(chapter_from, self.chapter_count,
|
||||||
self.AdvancedToChapter)
|
self.AdvancedToChapter)
|
||||||
verse = self.parent.manager.get_verse_count(bible, book, chapter_frm)
|
elif chapter_from == chapter_to:
|
||||||
self.adjustComboBox(1, verse, self.AdvancedToVerse)
|
self.adjustComboBox(chapter_from, self.chapter_count,
|
||||||
self.adjustComboBox(1, verse, self.AdvancedFromVerse)
|
self.AdvancedToChapter)
|
||||||
|
self.adjustComboBox(1, verse_count, self.AdvancedToVerse, True)
|
||||||
|
else:
|
||||||
|
self.adjustComboBox(chapter_from, self.chapter_count,
|
||||||
|
self.AdvancedToChapter, True)
|
||||||
|
|
||||||
def adjustComboBox(self, range_from, range_to, combo):
|
def adjustComboBox(self, range_from, range_to, combo, restore=False):
|
||||||
|
"""
|
||||||
|
``restore``
|
||||||
|
If True, then the combo's currentText will be restored after
|
||||||
|
adjusting (if possible).
|
||||||
|
"""
|
||||||
log.debug(u'adjustComboBox %s, %s, %s', combo, range_from, range_to)
|
log.debug(u'adjustComboBox %s, %s, %s', combo, range_from, range_to)
|
||||||
|
if restore:
|
||||||
|
old_text = unicode(combo.currentText())
|
||||||
combo.clear()
|
combo.clear()
|
||||||
for i in range(int(range_from), int(range_to) + 1):
|
for i in range(int(range_from), int(range_to) + 1):
|
||||||
combo.addItem(unicode(i))
|
combo.addItem(unicode(i))
|
||||||
|
if restore and combo.findText(old_text) != -1:
|
||||||
|
combo.setCurrentIndex(combo.findText(old_text))
|
||||||
|
|
||||||
def onAdvancedSearchButton(self):
|
def onAdvancedSearchButton(self):
|
||||||
log.debug(u'Advanced Search Button pressed')
|
log.debug(u'Advanced Search Button pressed')
|
||||||
|
Loading…
Reference in New Issue
Block a user