forked from openlp/openlp
Add Web Bibles to Advanced Tab and other nice features
bzr-revno: 600
This commit is contained in:
commit
0cbd5f16fa
@ -206,63 +206,72 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
if self.hasFileIcon:
|
if self.hasFileIcon:
|
||||||
self.addToolbarButton(
|
self.addToolbarButton(
|
||||||
translate(
|
translate(
|
||||||
self.TranslationContext, u'Load ' + self.PluginTextShort),
|
self.TranslationContext, u'Load %s' % self.PluginTextShort),
|
||||||
translate(
|
translate(
|
||||||
self.TranslationContext,
|
self.TranslationContext,
|
||||||
u'Load a new ' + self.PluginTextShort),
|
u'Load a new %s' % self.PluginTextShort),
|
||||||
u':' + self.IconPath + u'_load.png', self.onFileClick,
|
u':%s_load.png' % self.IconPath,
|
||||||
self.PluginTextShort + u'FileItem')
|
self.onFileClick,
|
||||||
|
u'%sFileItem' %self.PluginTextShort)
|
||||||
## New Button ##
|
## New Button ##
|
||||||
if self.hasNewIcon:
|
if self.hasNewIcon:
|
||||||
self.addToolbarButton(
|
self.addToolbarButton(
|
||||||
translate(
|
translate(
|
||||||
self.TranslationContext, u'New ' + self.PluginTextShort),
|
self.TranslationContext, u'New %s' % self.PluginTextShort),
|
||||||
translate(
|
translate(
|
||||||
self.TranslationContext,
|
self.TranslationContext,
|
||||||
u'Add a new ' + self.PluginTextShort),
|
u'Add a new %s' % self.PluginTextShort),
|
||||||
u':' + self.IconPath + u'_new.png', self.onNewClick,
|
u':%s_new.png' % self.IconPath,
|
||||||
self.PluginTextShort + u'NewItem')
|
self.onNewClick,
|
||||||
|
u'%sNewItem' % self.PluginTextShort)
|
||||||
## Edit Button ##
|
## Edit Button ##
|
||||||
if self.hasEditIcon:
|
if self.hasEditIcon:
|
||||||
self.addToolbarButton(
|
self.addToolbarButton(
|
||||||
translate(
|
translate(
|
||||||
self.TranslationContext, u'Edit ' + self.PluginTextShort),
|
self.TranslationContext, u'Edit %s' % self.PluginTextShort),
|
||||||
translate(
|
translate(
|
||||||
self.TranslationContext,
|
self.TranslationContext,
|
||||||
u'Edit the selected ' + self.PluginTextShort),
|
u'Edit the selected %s' % self.PluginTextShort),
|
||||||
u':' + self.IconPath + u'_edit.png', self.onEditClick,
|
u':%s_edit.png' % self.IconPath,
|
||||||
self.PluginTextShort + u'EditItem')
|
self.onEditClick,
|
||||||
|
u'%sEditItem' % self.PluginTextShort)
|
||||||
## Delete Button ##
|
## Delete Button ##
|
||||||
if self.hasDeleteIcon:
|
if self.hasDeleteIcon:
|
||||||
self.addToolbarButton(
|
self.addToolbarButton(
|
||||||
translate(
|
translate(
|
||||||
self.TranslationContext, u'Delete ' + self.PluginTextShort),
|
self.TranslationContext, u'Delete %s' % self.PluginTextShort),
|
||||||
translate(self.TranslationContext, u'Delete the selected item'),
|
translate(self.TranslationContext, u'Delete the selected item'),
|
||||||
u':' + self.IconPath + u'_delete.png', self.onDeleteClick,
|
u':%s_delete.png' % self.IconPath,
|
||||||
self.PluginTextShort + u'DeleteItem')
|
self.onDeleteClick,
|
||||||
|
u'%sDeleteItem' % self.PluginTextShort)
|
||||||
## Separator Line ##
|
## Separator Line ##
|
||||||
self.addToolbarSeparator()
|
self.addToolbarSeparator()
|
||||||
## Preview ##
|
## Preview ##
|
||||||
self.addToolbarButton(
|
self.addToolbarButton(
|
||||||
translate(
|
translate(
|
||||||
self.TranslationContext, u'Preview ' + self.PluginTextShort),
|
self.TranslationContext, u'Preview %s' % self.PluginTextShort),
|
||||||
translate(self.TranslationContext, u'Preview the selected item'),
|
translate(self.TranslationContext, u'Preview the selected item'),
|
||||||
u':/system/system_preview.png', self.onPreviewClick, u'PreviewItem')
|
u':/system/system_preview.png',
|
||||||
|
self.onPreviewClick,
|
||||||
|
u'PreviewItem')
|
||||||
## Live Button ##
|
## Live Button ##
|
||||||
self.addToolbarButton(
|
self.addToolbarButton(
|
||||||
translate(self.TranslationContext, u'Go Live'),
|
translate(self.TranslationContext, u'Go Live'),
|
||||||
translate(self.TranslationContext, u'Send the selected item live'),
|
translate(self.TranslationContext, u'Send the selected item live'),
|
||||||
u':/system/system_live.png', self.onLiveClick, u'LiveItem')
|
u':/system/system_live.png',
|
||||||
|
self.onLiveClick,
|
||||||
|
u'LiveItem')
|
||||||
## Add to service Button ##
|
## Add to service Button ##
|
||||||
self.addToolbarButton(
|
self.addToolbarButton(
|
||||||
translate(
|
translate(
|
||||||
self.TranslationContext,
|
self.TranslationContext,
|
||||||
u'Add ' + self.PluginTextShort + u' To Service'),
|
u'Add %s to Service' % self.PluginTextShort),
|
||||||
translate(
|
translate(
|
||||||
self.TranslationContext,
|
self.TranslationContext,
|
||||||
u'Add the selected item(s) to the service'),
|
u'Add the selected item(s) to the service'),
|
||||||
u':/system/system_add.png', self.onAddClick,
|
u':/system/system_add.png',
|
||||||
self.PluginTextShort + u'AddItem')
|
self.onAddClick,
|
||||||
|
u'%sAddServiceItem' % self.PluginTextShort)
|
||||||
|
|
||||||
def addListViewToToolBar(self):
|
def addListViewToToolBar(self):
|
||||||
#Add the List widget
|
#Add the List widget
|
||||||
|
@ -28,6 +28,8 @@ from datetime import datetime
|
|||||||
from registry import Registry
|
from registry import Registry
|
||||||
from confighelper import ConfigHelper
|
from confighelper import ConfigHelper
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
__all__ = ['Registry', 'ConfigHelper']
|
__all__ = ['Registry', 'ConfigHelper']
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -40,7 +42,7 @@ def check_latest_version(config, current_version):
|
|||||||
if lastTest != thisTest:
|
if lastTest != thisTest:
|
||||||
version_string = u''
|
version_string = u''
|
||||||
req = urllib2.Request(u'http://www.openlp.org/files/version.txt')
|
req = urllib2.Request(u'http://www.openlp.org/files/version.txt')
|
||||||
req.add_header(u'User-Agent', u'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')
|
req.add_header(u'User-Agent', u'OpenLP%s' % current_version)
|
||||||
try:
|
try:
|
||||||
handle = urllib2.urlopen(req, None, 1)
|
handle = urllib2.urlopen(req, None, 1)
|
||||||
html = handle.read()
|
html = handle.read()
|
||||||
|
@ -127,12 +127,18 @@ class BibleDBImpl(BibleCommon):
|
|||||||
verse = self.session.query(Verse).join(Book).filter(
|
verse = self.session.query(Verse).join(Book).filter(
|
||||||
Book.name == bookname).filter(
|
Book.name == bookname).filter(
|
||||||
Verse.chapter == chapter).order_by(Verse.verse.desc()).first()
|
Verse.chapter == chapter).order_by(Verse.verse.desc()).first()
|
||||||
|
if verse == None:
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
return verse.verse
|
return verse.verse
|
||||||
|
|
||||||
def get_max_bible_book_chapter(self, bookname):
|
def get_max_bible_book_chapter(self, bookname):
|
||||||
log.debug(u'get_max_bible_book_chapter %s', bookname)
|
log.debug(u'get_max_bible_book_chapter %s', bookname)
|
||||||
verse = self.session.query(Verse).join(Book).filter(
|
verse = self.session.query(Verse).join(Book).filter(
|
||||||
Book.name == bookname).order_by(Verse.chapter.desc()).first()
|
Book.name == bookname).order_by(Verse.chapter.desc()).first()
|
||||||
|
if verse == None:
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
return verse.chapter
|
return verse.chapter
|
||||||
|
|
||||||
def get_bible_book(self, bookname):
|
def get_bible_book(self, bookname):
|
||||||
|
@ -104,7 +104,8 @@ class BibleCommon(object):
|
|||||||
urllib2.install_opener(opener)
|
urllib2.install_opener(opener)
|
||||||
xml_string = u''
|
xml_string = u''
|
||||||
req = urllib2.Request(urlstring)
|
req = urllib2.Request(urlstring)
|
||||||
req.add_header(u'User-Agent', u'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')
|
#Make us look like an IE Browser on XP to stop blocking by web site
|
||||||
|
req.add_header(u'User-Agent', u'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)')
|
||||||
try:
|
try:
|
||||||
handle = urllib2.urlopen(req)
|
handle = urllib2.urlopen(req)
|
||||||
html = handle.read()
|
html = handle.read()
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from openlp.core.lib import translate
|
||||||
|
|
||||||
from bibleOSISimpl import BibleOSISImpl
|
from bibleOSISimpl import BibleOSISImpl
|
||||||
from bibleCSVimpl import BibleCSVImpl
|
from bibleCSVimpl import BibleCSVImpl
|
||||||
from bibleDBimpl import BibleDBImpl
|
from bibleDBimpl import BibleDBImpl
|
||||||
@ -55,6 +57,7 @@ class BibleManager(object):
|
|||||||
"""
|
"""
|
||||||
self.config = config
|
self.config = config
|
||||||
log.debug(u'Bible Initialising')
|
log.debug(u'Bible Initialising')
|
||||||
|
self.web = translate(u'BibleManager', u'Web')
|
||||||
# dict of bible database objects
|
# dict of bible database objects
|
||||||
self.bible_db_cache = None
|
self.bible_db_cache = None
|
||||||
# dict of bible http readers
|
# dict of bible http readers
|
||||||
@ -83,6 +86,8 @@ class BibleManager(object):
|
|||||||
self.bible_http_cache = {}
|
self.bible_http_cache = {}
|
||||||
# books of the bible with testaments
|
# books of the bible with testaments
|
||||||
self.book_testaments = {}
|
self.book_testaments = {}
|
||||||
|
# books of the bible with chapter count
|
||||||
|
self.book_chapters = []
|
||||||
# books of the bible with abbreviation
|
# books of the bible with abbreviation
|
||||||
self.book_abbreviations = {}
|
self.book_abbreviations = {}
|
||||||
self.web_bibles_present = False
|
self.web_bibles_present = False
|
||||||
@ -126,6 +131,7 @@ class BibleManager(object):
|
|||||||
p = line.split(u',')
|
p = line.split(u',')
|
||||||
self.book_abbreviations[p[0]] = p[1].replace(u'\n', '')
|
self.book_abbreviations[p[0]] = p[1].replace(u'\n', '')
|
||||||
self.book_testaments[p[0]] = p[2].replace(u'\n', '')
|
self.book_testaments[p[0]] = p[2].replace(u'\n', '')
|
||||||
|
self.book_chapters.append({u'book':p[0], u'total':p[3].replace(u'\n', '')})
|
||||||
log.debug(u'Bible Initialised')
|
log.debug(u'Bible Initialised')
|
||||||
|
|
||||||
def process_dialog(self, dialogobject):
|
def process_dialog(self, dialogobject):
|
||||||
@ -247,33 +253,34 @@ class BibleManager(object):
|
|||||||
``BibleMode.Full`` this method returns all the Bibles for the
|
``BibleMode.Full`` this method returns all the Bibles for the
|
||||||
Advanced Search, and when the mode is ``BibleMode.Partial``
|
Advanced Search, and when the mode is ``BibleMode.Partial``
|
||||||
this method returns all the bibles for the Quick Search.
|
this method returns all the bibles for the Quick Search.
|
||||||
|
|
||||||
c
|
|
||||||
"""
|
"""
|
||||||
log.debug(u'get_bibles')
|
log.debug(u'get_bibles')
|
||||||
bible_list = []
|
bible_list = []
|
||||||
for bible_name, bible_object in self.bible_db_cache.iteritems():
|
for bible_name, bible_object in self.bible_db_cache.iteritems():
|
||||||
if mode == BibleMode.Full:
|
if self.bible_http_cache[bible_name] is not None:
|
||||||
bible_list.append(bible_name)
|
bible_name = u'%s (%s)' % (bible_name, self.web)
|
||||||
else:
|
|
||||||
if self.bible_http_cache[bible_name] is None:
|
|
||||||
# we do not have an http bible
|
|
||||||
bible_list.append(bible_name)
|
bible_list.append(bible_name)
|
||||||
return bible_list
|
return bible_list
|
||||||
|
|
||||||
def get_bible_books(self,bible):
|
def is_bible_web(self, bible):
|
||||||
"""
|
pos_end = bible.find(u' (%s)' % self.web)
|
||||||
Returns a list of the books of the bible from the database
|
if pos_end != -1:
|
||||||
"""
|
return True, bible[:pos_end]
|
||||||
log.debug(u'get_bible_books %s', bible)
|
return False, bible
|
||||||
return self.bible_db_cache[bible].get_bible_books()
|
|
||||||
|
|
||||||
def get_book_chapter_count(self, bible, book):
|
def get_bible_books(self):
|
||||||
|
"""
|
||||||
|
Returns a list of the books of the bible
|
||||||
|
"""
|
||||||
|
log.debug(u'get_bible_books')
|
||||||
|
return self.book_chapters
|
||||||
|
|
||||||
|
def get_book_chapter_count(self, book):
|
||||||
"""
|
"""
|
||||||
Returns the number of Chapters for a given book
|
Returns the number of Chapters for a given book
|
||||||
"""
|
"""
|
||||||
log.debug(u'get_book_chapter_count %s, %s', bible, book)
|
log.debug(u'get_book_chapter_count %s', book)
|
||||||
return self.bible_db_cache[bible].get_max_bible_book_chapter(book)
|
return self.book_chapters[book]
|
||||||
|
|
||||||
def get_book_verse_count(self, bible, book, chapter):
|
def get_book_verse_count(self, bible, book, chapter):
|
||||||
"""
|
"""
|
||||||
@ -281,6 +288,16 @@ c
|
|||||||
book and chapterMaxBibleBookVerses
|
book and chapterMaxBibleBookVerses
|
||||||
"""
|
"""
|
||||||
log.debug(u'get_book_verse_count %s,%s,%s', bible, book, chapter)
|
log.debug(u'get_book_verse_count %s,%s,%s', bible, book, chapter)
|
||||||
|
web, bible = self.is_bible_web(bible)
|
||||||
|
if web:
|
||||||
|
count = self.bible_db_cache[bible].get_max_bible_book_verses(
|
||||||
|
book, chapter)
|
||||||
|
if count == 0:
|
||||||
|
text = self.get_verse_text(bible, book, chapter, chapter, 1, 1)
|
||||||
|
count = self.bible_db_cache[bible].get_max_bible_book_verses(
|
||||||
|
book, chapter)
|
||||||
|
return count
|
||||||
|
else:
|
||||||
return self.bible_db_cache[bible].get_max_bible_book_verses(
|
return self.bible_db_cache[bible].get_max_bible_book_verses(
|
||||||
book, chapter)
|
book, chapter)
|
||||||
|
|
||||||
@ -290,6 +307,7 @@ c
|
|||||||
book and chapterMaxBibleBookVerses
|
book and chapterMaxBibleBookVerses
|
||||||
"""
|
"""
|
||||||
log.debug(u'get_verses_from_text %s,%s', bible, versetext)
|
log.debug(u'get_verses_from_text %s,%s', bible, versetext)
|
||||||
|
web, bible = self.is_bible_web(bible)
|
||||||
return self.bible_db_cache[bible].get_verses_from_text(versetext)
|
return self.bible_db_cache[bible].get_verses_from_text(versetext)
|
||||||
|
|
||||||
def save_meta_data(self, bible, version, copyright, permissions):
|
def save_meta_data(self, bible, version, copyright, permissions):
|
||||||
@ -307,6 +325,7 @@ c
|
|||||||
Returns the meta data for a given key
|
Returns the meta data for a given key
|
||||||
"""
|
"""
|
||||||
log.debug(u'get_meta %s,%s', bible, key)
|
log.debug(u'get_meta %s,%s', bible, key)
|
||||||
|
web, bible = self.is_bible_web(bible)
|
||||||
return self.bible_db_cache[bible].get_meta(key)
|
return self.bible_db_cache[bible].get_meta(key)
|
||||||
|
|
||||||
def get_verse_text(self, bible, bookname, schapter, echapter, sverse,
|
def get_verse_text(self, bible, bookname, schapter, echapter, sverse,
|
||||||
@ -327,6 +346,7 @@ c
|
|||||||
bible, bookname, schapter, echapter, sverse, everse)
|
bible, bookname, schapter, echapter, sverse, everse)
|
||||||
# check to see if book/chapter exists fow HTTP bibles and load cache
|
# check to see if book/chapter exists fow HTTP bibles and load cache
|
||||||
# if necessary
|
# if necessary
|
||||||
|
web, bible = self.is_bible_web(bible)
|
||||||
if self.bible_http_cache[bible] is not None:
|
if self.bible_http_cache[bible] is not None:
|
||||||
book = self.bible_db_cache[bible].get_bible_book(bookname)
|
book = self.bible_db_cache[bible].get_bible_book(bookname)
|
||||||
if book is None:
|
if book is None:
|
||||||
|
@ -54,7 +54,8 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.ServiceItemIconName = u':/media/bible_image.png'
|
self.ServiceItemIconName = u':/media/bible_image.png'
|
||||||
self.servicePath = None
|
self.servicePath = None
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
self.search_results = {} # place to store the search results
|
# place to store the search results
|
||||||
|
self.search_results = {}
|
||||||
QtCore.QObject.connect(Receiver().get_receiver(),
|
QtCore.QObject.connect(Receiver().get_receiver(),
|
||||||
QtCore.SIGNAL(u'openlpreloadbibles'), self.reloadBibles)
|
QtCore.SIGNAL(u'openlpreloadbibles'), self.reloadBibles)
|
||||||
|
|
||||||
@ -180,6 +181,9 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab)
|
self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab)
|
||||||
self.AdvancedSecondBibleComboBox.setObjectName(u'SecondBible')
|
self.AdvancedSecondBibleComboBox.setObjectName(u'SecondBible')
|
||||||
self.AdvancedVerticalLayout.addWidget(self.AdvancedSecondBibleComboBox)
|
self.AdvancedVerticalLayout.addWidget(self.AdvancedSecondBibleComboBox)
|
||||||
|
self.AdvancedMessage = QtGui.QLabel(self.QuickTab)
|
||||||
|
self.AdvancedMessage.setObjectName(u'AdvancedMessage')
|
||||||
|
self.AdvancedVerticalLayout.addWidget(self.AdvancedMessage)
|
||||||
self.SearchTabWidget.addTab(self.AdvancedTab, u'Advanced')
|
self.SearchTabWidget.addTab(self.AdvancedTab, u'Advanced')
|
||||||
# Add the search tab widget to the page layout
|
# Add the search tab widget to the page layout
|
||||||
self.PageLayout.addWidget(self.SearchTabWidget)
|
self.PageLayout.addWidget(self.SearchTabWidget)
|
||||||
@ -242,6 +246,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def setQuickMessage(self, text):
|
def setQuickMessage(self, text):
|
||||||
self.QuickMessage.setText(translate(u'BibleMediaItem', unicode(text)))
|
self.QuickMessage.setText(translate(u'BibleMediaItem', unicode(text)))
|
||||||
|
self.AdvancedMessage.setText(translate(u'BibleMediaItem', unicode(text)))
|
||||||
Receiver().send_message(u'process_events')
|
Receiver().send_message(u'process_events')
|
||||||
#minor delay to get the events processed
|
#minor delay to get the events processed
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
@ -276,9 +281,11 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
unicode(self.AdvancedVersionComboBox.currentText()))
|
unicode(self.AdvancedVersionComboBox.currentText()))
|
||||||
|
|
||||||
def onAdvancedBookComboBox(self):
|
def onAdvancedBookComboBox(self):
|
||||||
|
item = int(self.AdvancedBookComboBox.currentIndex())
|
||||||
self.initialiseChapterVerse(
|
self.initialiseChapterVerse(
|
||||||
unicode(self.AdvancedVersionComboBox.currentText()),
|
unicode(self.AdvancedVersionComboBox.currentText()),
|
||||||
unicode(self.AdvancedBookComboBox.currentText()))
|
unicode(self.AdvancedBookComboBox.currentText()),
|
||||||
|
self.AdvancedBookComboBox.itemData(item).toInt()[0])
|
||||||
|
|
||||||
def onNewClick(self):
|
def onNewClick(self):
|
||||||
self.bibleimportform = BibleImportForm(
|
self.bibleimportform = BibleImportForm(
|
||||||
@ -291,14 +298,14 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.adjustComboBox(frm, self.verses, self.AdvancedToVerse)
|
self.adjustComboBox(frm, self.verses, self.AdvancedToVerse)
|
||||||
|
|
||||||
def onAdvancedToChapter(self):
|
def onAdvancedToChapter(self):
|
||||||
text1 = self.AdvancedFromChapter.currentText()
|
text1 = unicode(self.AdvancedFromChapter.currentText())
|
||||||
text2 = self.AdvancedToChapter.currentText()
|
text2 = unicode(self.AdvancedToChapter.currentText())
|
||||||
if text1 != text2:
|
if text1 != text2:
|
||||||
bible = unicode(self.AdvancedVersionComboBox.currentText())
|
bible = unicode(self.AdvancedVersionComboBox.currentText())
|
||||||
book = unicode(self.AdvancedBookComboBox.currentText())
|
book = unicode(self.AdvancedBookComboBox.currentText())
|
||||||
# get the verse count for new chapter
|
# get the verse count for new chapter
|
||||||
verses = self.parent.biblemanager.get_book_verse_count(
|
verses = self.parent.biblemanager.get_book_verse_count(
|
||||||
bible, book, int(text2))[0]
|
bible, book, int(text2))
|
||||||
self.adjustComboBox(1, verses, self.AdvancedToVerse)
|
self.adjustComboBox(1, verses, self.AdvancedToVerse)
|
||||||
|
|
||||||
def onAdvancedSearchButton(self):
|
def onAdvancedSearchButton(self):
|
||||||
@ -318,11 +325,10 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
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())
|
||||||
cf = self.AdvancedFromChapter.currentText()
|
cf = int(self.AdvancedFromChapter.currentText())
|
||||||
self.adjustComboBox(cf, self.chapters_from, self.AdvancedToChapter)
|
self.adjustComboBox(cf, self.chapters_from, self.AdvancedToChapter)
|
||||||
# get the verse count for new chapter
|
# get the verse count for new chapter
|
||||||
vse = self.parent.biblemanager.get_book_verse_count(bible, book,
|
vse = self.parent.biblemanager.get_book_verse_count(bible, book, cf)
|
||||||
int(cf))[0]
|
|
||||||
self.adjustComboBox(1, vse, self.AdvancedFromVerse)
|
self.adjustComboBox(1, vse, self.AdvancedFromVerse)
|
||||||
self.adjustComboBox(1, vse, self.AdvancedToVerse)
|
self.adjustComboBox(1, vse, self.AdvancedToVerse)
|
||||||
|
|
||||||
@ -432,30 +438,38 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def initialiseBible(self, bible):
|
def initialiseBible(self, bible):
|
||||||
log.debug(u'initialiseBible %s', bible)
|
log.debug(u'initialiseBible %s', bible)
|
||||||
books = self.parent.biblemanager.get_bible_books(unicode(bible))
|
book_data = self.parent.biblemanager.get_bible_books()
|
||||||
self.AdvancedBookComboBox.clear()
|
self.AdvancedBookComboBox.clear()
|
||||||
first = True
|
first = True
|
||||||
for book in books:
|
for book in book_data:
|
||||||
self.AdvancedBookComboBox.addItem(book.name)
|
row = self.AdvancedBookComboBox.count()
|
||||||
|
self.AdvancedBookComboBox.addItem(book[u'book'])
|
||||||
|
self.AdvancedBookComboBox.setItemData(row, QtCore.QVariant(book[u'total']))
|
||||||
if first:
|
if first:
|
||||||
first = False
|
first = False
|
||||||
self.initialiseChapterVerse(bible, book.name)
|
self.initialiseChapterVerse(bible, book[u'book'], book[u'total'])
|
||||||
|
|
||||||
def initialiseChapterVerse(self, bible, book):
|
def initialiseChapterVerse(self, bible, book, chapters):
|
||||||
log.debug(u'initialiseChapterVerse %s, %s', bible, book)
|
log.debug(u'initialiseChapterVerse %s, %s', bible, book)
|
||||||
self.chapters_from = self.parent.biblemanager.get_book_chapter_count(
|
self.chapters_from = chapters
|
||||||
bible, book)
|
|
||||||
self.verses = self.parent.biblemanager.get_book_verse_count(bible,
|
self.verses = self.parent.biblemanager.get_book_verse_count(bible,
|
||||||
book, 1)
|
book, 1)
|
||||||
|
if self.verses == 0:
|
||||||
|
self.AdvancedSearchButton.setEnabled(False)
|
||||||
|
self.AdvancedMessage.setText(
|
||||||
|
translate(u'BibleMediaItem', u'Bible not fully loaded'))
|
||||||
|
else:
|
||||||
|
self.AdvancedSearchButton.setEnabled(True)
|
||||||
|
self.AdvancedMessage.setText(u'')
|
||||||
self.adjustComboBox(1, self.chapters_from, self.AdvancedFromChapter)
|
self.adjustComboBox(1, self.chapters_from, self.AdvancedFromChapter)
|
||||||
self.adjustComboBox(1, self.chapters_from, self.AdvancedToChapter)
|
self.adjustComboBox(1, self.chapters_from, self.AdvancedToChapter)
|
||||||
self.adjustComboBox(1, self.verses, self.AdvancedFromVerse)
|
self.adjustComboBox(1, self.verses, self.AdvancedFromVerse)
|
||||||
self.adjustComboBox(1, self.verses, self.AdvancedToVerse)
|
self.adjustComboBox(1, self.verses, self.AdvancedToVerse)
|
||||||
|
|
||||||
def adjustComboBox(self, frm, to, combo):
|
def adjustComboBox(self, range_from, range_to, combo):
|
||||||
log.debug(u'adjustComboBox %s, %s, %s', combo, frm, to)
|
log.debug(u'adjustComboBox %s, %s, %s', combo, range_from, range_to)
|
||||||
combo.clear()
|
combo.clear()
|
||||||
for i in range(int(frm), int(to) + 1):
|
for i in range(int(range_from), int(range_to) + 1):
|
||||||
combo.addItem(unicode(i))
|
combo.addItem(unicode(i))
|
||||||
|
|
||||||
def displayResults(self, bible):
|
def displayResults(self, bible):
|
||||||
|
@ -1,66 +1,66 @@
|
|||||||
Genesis,ge,1
|
Genesis,Gen,1,50
|
||||||
Exodus,ex,1
|
Exodus,Exod,1,40
|
||||||
Leviticus,le,1
|
Leviticus,Lev,1,27
|
||||||
Numbers,nu,1
|
Numbers,Num,1,36
|
||||||
Deuteronomy,de,1
|
Deuteronomy,Deut,1,34
|
||||||
Joshua,jos,1
|
Joshua,Josh,1,24
|
||||||
Judges,jud,1
|
Judges,Judg,1,21
|
||||||
Ruth,ru,1
|
Ruth,Ruth,1,4
|
||||||
1 Samual,1sa,1
|
1 Samual,1Sam,1,31
|
||||||
2 Samual,2sa,1
|
2 Samual,2Sam,1,24
|
||||||
1 Kings,1ki,1
|
1 Kings,1Kgs,1,22
|
||||||
2 Kings,2ki,1
|
2 Kings,2Kgs,1,25
|
||||||
1 Chronicles,1ch,1
|
1 Chronicles,1Chr,1,29
|
||||||
2 Chronicles,2ch,1
|
2 Chronicles,2Chr,1,36
|
||||||
Ezra,ezr,1
|
Ezra,Esra,1,10
|
||||||
Nehemiah,ne,1
|
Nehemiah,Neh,1,13
|
||||||
Esther,es,1
|
Esther,Esth,1,10
|
||||||
Job,job,1
|
Job,Job,1,42
|
||||||
Psalms,ps,1
|
Psalms,Ps,1,150
|
||||||
Proverbs,pr,1
|
Proverbs,Prov,1,31
|
||||||
Ecclesiastes,ec,1
|
Ecclesiastes,Eccl,1,12
|
||||||
Song of Songs,so,1
|
Song of Songs,Song,1,8
|
||||||
Isaiah,isa,1
|
Isaiah,Isa,1,66
|
||||||
Jeremiah,jer,1
|
Jeremiah,Jer,1,5
|
||||||
Lamentations,la,1
|
Lamentations,Lam,1,5
|
||||||
Ezekiel,exe,1
|
Ezekiel,Ezek,1,48
|
||||||
Daniel,da,1
|
Daniel,Dan,1,12
|
||||||
Hosea,ho,1
|
Hosea,Hos,1,14
|
||||||
Joel,joe,1
|
Joel,Joel,1,3
|
||||||
Amos,am,1
|
Amos,Amos,1,9
|
||||||
Obad,ob,1
|
Obad,Obad,1,1
|
||||||
Jonah,Jonah,1
|
Jonah,Jonah,1,4
|
||||||
Micah,mic,1
|
Micah,Mic,1,7
|
||||||
Naham,na,1
|
Naham,Nah,1,3
|
||||||
Habakkuk,hab,1
|
Habakkuk,Hab,1,3
|
||||||
Zephaniah,zep,1
|
Zephaniah,Zeph,1,3
|
||||||
Haggai,hag,1
|
Haggai,Hag,1,2
|
||||||
Zechariah,zec,1
|
Zechariah,Zech,1,3
|
||||||
Malachi,mal,1
|
Malachi,Mal,1,4
|
||||||
Matthew,mt,2
|
Matthew,Matt,2,28
|
||||||
Mark,mk,2
|
Mark,Mark,2,16
|
||||||
Luke,lu,2
|
Luke,Luke,2,24
|
||||||
John,joh,2
|
John,John,2,21
|
||||||
Acts,ac,2
|
Acts,Acts,2,28
|
||||||
Romans,ro,2
|
Romans,Rom,2,16
|
||||||
1 Corinthans,1co,2
|
1 Corinthans,1Cor,2,16
|
||||||
2 Corinthans,2co,2
|
2 Corinthans,2Cor,2,13
|
||||||
Galatians,ga,2
|
Galatians,Gal,2,6
|
||||||
Ephesians,eph,2
|
Ephesians,Eph,2,6
|
||||||
Philippians,php,2
|
Philippians,Phil,2,4
|
||||||
Colossians,col,2
|
Colossians,Col,2,4
|
||||||
1 Thessalonians,1th,2
|
1 Thessalonians,1Thess,2,5
|
||||||
2 Thessalonians,2th,2
|
2 Thessalonians,2Thess,2,3
|
||||||
1 Timothy,1ti,2
|
1 Timothy,1Tim,2,6
|
||||||
2 Timothy,2ti,2
|
2 Timothy,2Tim,2,4
|
||||||
Titus,tit,2
|
Titus,Titus,2,3
|
||||||
Philemon,phm,2
|
Philemon,Phlm,2,1
|
||||||
Hebrews,heb,2
|
Hebrews,Heb,2,13
|
||||||
James,jas,2
|
James,Jas,2,5
|
||||||
1 Peter,1pe,2
|
1 Peter,1Pet,2,5
|
||||||
2 Peter,2pe,2
|
2 Peter,2Pet,2,3
|
||||||
1 John,1jo,2
|
1 John,1John,2,5
|
||||||
2 John,2jo,2
|
2 John,2John,2,1
|
||||||
3 John,3jo,2
|
3 John,3John,2,1
|
||||||
Jude,jude,2
|
Jude,Jude,2,1
|
||||||
Revelation,re,2
|
Revelation,Rev,2,22
|
||||||
|
|
Loading…
Reference in New Issue
Block a user