forked from openlp/openlp
BibleGateway - Download files and add to selections
This commit is contained in:
parent
19e8682bf8
commit
ccb54e4faf
@ -250,8 +250,6 @@ class Ui_BibleImportDialog(object):
|
|||||||
self.LocationComboBox.setItemText(0, self.trUtf8(u'Crosswalk'))
|
self.LocationComboBox.setItemText(0, self.trUtf8(u'Crosswalk'))
|
||||||
self.LocationComboBox.setItemText(1, self.trUtf8(u'BibleGateway'))
|
self.LocationComboBox.setItemText(1, self.trUtf8(u'BibleGateway'))
|
||||||
self.BibleLabel.setText(self.trUtf8(u'Bible:'))
|
self.BibleLabel.setText(self.trUtf8(u'Bible:'))
|
||||||
self.BibleComboBox.setItemText(1, self.trUtf8(u'NIV'))
|
|
||||||
self.BibleComboBox.setItemText(2, self.trUtf8(u'KJV'))
|
|
||||||
self.ProxyGroupBox.setTitle(self.trUtf8(u'Proxy Settings (Optional)'))
|
self.ProxyGroupBox.setTitle(self.trUtf8(u'Proxy Settings (Optional)'))
|
||||||
self.AddressLabel.setText(self.trUtf8(u'Proxy Address:'))
|
self.AddressLabel.setText(self.trUtf8(u'Proxy Address:'))
|
||||||
self.UsernameLabel.setText(self.trUtf8(u'Username:'))
|
self.UsernameLabel.setText(self.trUtf8(u'Username:'))
|
||||||
|
@ -58,20 +58,21 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
|||||||
filepath = os.path.abspath(os.path.join(filepath, u'..',
|
filepath = os.path.abspath(os.path.join(filepath, u'..',
|
||||||
u'resources', u'crosswalkbooks.csv'))
|
u'resources', u'crosswalkbooks.csv'))
|
||||||
fbibles=open(filepath, 'r')
|
fbibles=open(filepath, 'r')
|
||||||
self.cw_bible_versions = {}
|
self.cwBibleVersions = {}
|
||||||
for line in fbibles:
|
for line in fbibles:
|
||||||
p = line.split(u',')
|
p = line.split(u',')
|
||||||
self.cw_bible_versions[p[0]] = p[1].replace(u'\n', u'')
|
self.cwBibleVersions [p[0]] = p[1].replace(u'\n', u'')
|
||||||
#Load and store BibleGateway Bibles
|
#Load and store BibleGateway Bibles
|
||||||
filepath = os.path.split(os.path.abspath(__file__))[0]
|
filepath = os.path.split(os.path.abspath(__file__))[0]
|
||||||
filepath = os.path.abspath(os.path.join(filepath, u'..',
|
filepath = os.path.abspath(os.path.join(filepath, u'..',
|
||||||
u'resources', u'biblegateway.csv'))
|
u'resources', u'biblegateway.csv'))
|
||||||
fbibles=open(filepath, 'r')
|
fbibles=open(filepath, 'r')
|
||||||
self.bg_bible_versions = {}
|
self.bgBibleVersions = {}
|
||||||
for line in fbibles:
|
for line in fbibles:
|
||||||
p = line.split(u',')
|
p = line.split(u',')
|
||||||
self.bg_bible_versions[p[0]] = p[1].replace(u'\n', u'')
|
self.bgBibleVersions [p[0]] = p[1].replace(u'\n', u'')
|
||||||
self.loadBibleCombo(self.cw_bible_versions)
|
self.loadBibleCombo(self.cwBibleVersions )
|
||||||
|
self.cwActive = True
|
||||||
|
|
||||||
def loadBibleCombo(self, biblesList):
|
def loadBibleCombo(self, biblesList):
|
||||||
self.BibleComboBox.clear()
|
self.BibleComboBox.clear()
|
||||||
@ -167,9 +168,11 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
|||||||
|
|
||||||
def onLocationComboBoxSelected(self, value):
|
def onLocationComboBoxSelected(self, value):
|
||||||
if value == 0:
|
if value == 0:
|
||||||
self.loadBibleCombo(self.cw_bible_versions)
|
self.loadBibleCombo(self.cwBibleVersions )
|
||||||
|
self.cwActive = True
|
||||||
else:
|
else:
|
||||||
self.loadBibleCombo(self.bg_bible_versions)
|
self.loadBibleCombo(self.bgBibleVersions )
|
||||||
|
self.cwActive = False
|
||||||
self.checkHttp()
|
self.checkHttp()
|
||||||
|
|
||||||
def onBibleComboBoxSelected(self, value):
|
def onBibleComboBoxSelected(self, value):
|
||||||
@ -230,7 +233,11 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
|||||||
else:
|
else:
|
||||||
# set a value as it will not be needed
|
# set a value as it will not be needed
|
||||||
self.setMax(1)
|
self.setMax(1)
|
||||||
bible = self.cw_bible_versions[
|
if self.cwActive:
|
||||||
|
bible = self.cwBibleVersions [
|
||||||
|
unicode(self.BibleComboBox.currentText())]
|
||||||
|
else:
|
||||||
|
bible = self.bgBibleVersions [
|
||||||
unicode(self.BibleComboBox.currentText())]
|
unicode(self.BibleComboBox.currentText())]
|
||||||
loaded = self.biblemanager.register_http_bible(
|
loaded = self.biblemanager.register_http_bible(
|
||||||
unicode(self.BibleComboBox.currentText()),
|
unicode(self.BibleComboBox.currentText()),
|
||||||
|
@ -50,12 +50,11 @@ class BGExtract(BibleCommon):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'get_bible_chapter %s,%s,%s',
|
log.debug(u'get_bible_chapter %s,%s,%s',
|
||||||
version, bookname, chapter)
|
version, bookname, chapter)
|
||||||
version=u'nasb'
|
|
||||||
urlstring = \
|
urlstring = \
|
||||||
u'http://www.biblegateway.com/passage/?search=%s %s&version=%s' % \
|
u'http://www.biblegateway.com/passage/?search=%s+%d&version=%s' % \
|
||||||
(bookname, unicode(chapter) , version)
|
(bookname, chapter, version)
|
||||||
|
log.debug(u'BibleGateway urm = %s' % urlstring)
|
||||||
xml_string = self._get_web_text(urlstring, self.proxyurl)
|
xml_string = self._get_web_text(urlstring, self.proxyurl)
|
||||||
#print xml_string
|
|
||||||
verseSearch = u'<sup class=\"versenum'
|
verseSearch = u'<sup class=\"versenum'
|
||||||
verseFootnote = u'<sup class=\'footnote'
|
verseFootnote = u'<sup class=\'footnote'
|
||||||
verse = 1
|
verse = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user