forked from openlp/openlp
Add more bible sources and improve handling
bzr-revno: 631
This commit is contained in:
commit
d93551caf3
@ -53,6 +53,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
|||||||
|
|
||||||
def insertTab(self, tab, location):
|
def insertTab(self, tab, location):
|
||||||
log.debug(u'Inserting %s tab' % tab.title())
|
log.debug(u'Inserting %s tab' % tab.title())
|
||||||
|
#13 : There are 3 tables currently and locations starts at -10
|
||||||
self.SettingsTabWidget.insertTab(location + 13, tab, tab.title())
|
self.SettingsTabWidget.insertTab(location + 13, tab, tab.title())
|
||||||
|
|
||||||
def removeTab(self, name):
|
def removeTab(self, name):
|
||||||
|
@ -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:'))
|
||||||
|
@ -50,21 +50,43 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
|||||||
self.bible_type = None
|
self.bible_type = None
|
||||||
self.barmax = 0
|
self.barmax = 0
|
||||||
self.tabWidget.setCurrentIndex(0)
|
self.tabWidget.setCurrentIndex(0)
|
||||||
|
self.cwBibleVersions = {}
|
||||||
|
self.bgBibleVersions = {}
|
||||||
self.AddressEdit.setText(self.config.get_config(u'proxy_address', u''))
|
self.AddressEdit.setText(self.config.get_config(u'proxy_address', u''))
|
||||||
self.UsernameEdit.setText(self.config.get_config(u'proxy_username',u''))
|
self.UsernameEdit.setText(self.config.get_config(u'proxy_username',u''))
|
||||||
self.PasswordEdit.setText(self.config.get_config(u'proxy_password',u''))
|
self.PasswordEdit.setText(self.config.get_config(u'proxy_password',u''))
|
||||||
|
#Load and store Crosswalk 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'crosswalkbooks.csv'))
|
u'resources', u'crosswalkbooks.csv'))
|
||||||
fbibles=open(filepath, 'r')
|
try:
|
||||||
self.bible_versions = {}
|
fbibles = open(filepath, 'r')
|
||||||
self.BibleComboBox.clear()
|
|
||||||
self.BibleComboBox.addItem(u'')
|
|
||||||
for line in fbibles:
|
for line in fbibles:
|
||||||
p = line.split(u',')
|
p = line.split(u',')
|
||||||
self.bible_versions[p[0]] = p[1].replace(u'\n', u'')
|
self.cwBibleVersions[p[0]] = p[1].replace(u'\n', u'')
|
||||||
self.BibleComboBox.addItem(unicode(p[0]))
|
except:
|
||||||
|
log.exception(u'Crosswalk resources missing')
|
||||||
|
#Load and store BibleGateway Bibles
|
||||||
|
filepath = os.path.split(os.path.abspath(__file__))[0]
|
||||||
|
filepath = os.path.abspath(os.path.join(filepath, u'..',
|
||||||
|
u'resources', u'biblegateway.csv'))
|
||||||
|
try:
|
||||||
|
fbibles = open(filepath, 'r')
|
||||||
|
for line in fbibles:
|
||||||
|
p = line.split(u',')
|
||||||
|
self.bgBibleVersions[p[0]] = p[1].replace(u'\n', u'')
|
||||||
|
except:
|
||||||
|
log.exception(u'Biblegateway resources missing')
|
||||||
|
self.loadBibleCombo(self.cwBibleVersions)
|
||||||
|
self.cwActive = True
|
||||||
|
|
||||||
|
def loadBibleCombo(self, biblesList):
|
||||||
|
self.BibleComboBox.clear()
|
||||||
|
self.BibleComboBox.addItem(u'')
|
||||||
|
for bible in biblesList:
|
||||||
|
row = self.BibleComboBox.count()
|
||||||
|
self.BibleComboBox.addItem(unicode(self.trUtf8(bible)))
|
||||||
|
self.BibleComboBox.setItemData(row, QtCore.QVariant(bible))
|
||||||
|
|
||||||
#Combo Boxes
|
#Combo Boxes
|
||||||
QtCore.QObject.connect(self.LocationComboBox,
|
QtCore.QObject.connect(self.LocationComboBox,
|
||||||
@ -101,7 +123,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
|||||||
|
|
||||||
def onVersesFileButtonClicked(self):
|
def onVersesFileButtonClicked(self):
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(
|
filename = QtGui.QFileDialog.getOpenFileName(
|
||||||
self, self.trUtf8(u'Open file'), self.config.get_last_dir(1))
|
self, self.trUtf8(u'Open Bible Verses file'),
|
||||||
|
self.config.get_last_dir(1))
|
||||||
if filename != u'':
|
if filename != u'':
|
||||||
self.VerseLocationEdit.setText(filename)
|
self.VerseLocationEdit.setText(filename)
|
||||||
self.config.set_last_dir(filename, 1)
|
self.config.set_last_dir(filename, 1)
|
||||||
@ -109,7 +132,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
|||||||
|
|
||||||
def onBooksFileButtonClicked(self):
|
def onBooksFileButtonClicked(self):
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(
|
filename = QtGui.QFileDialog.getOpenFileName(
|
||||||
self, self.trUtf8(u'Open file'), self.config.get_last_dir(2))
|
self, self.trUtf8(u'Open Bible Books file'),
|
||||||
|
self.config.get_last_dir(2))
|
||||||
if filename != u'':
|
if filename != u'':
|
||||||
self.BooksLocationEdit.setText(filename)
|
self.BooksLocationEdit.setText(filename)
|
||||||
self.config.set_last_dir(filename, 2)
|
self.config.set_last_dir(filename, 2)
|
||||||
@ -117,7 +141,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
|||||||
|
|
||||||
def onOsisFileButtonClicked(self):
|
def onOsisFileButtonClicked(self):
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(
|
filename = QtGui.QFileDialog.getOpenFileName(
|
||||||
self, self.trUtf8(u'Open file'), self.config.get_last_dir(3))
|
self, self.trUtf8(u'Open OSIS import file'),
|
||||||
|
self.config.get_last_dir(3))
|
||||||
if filename != u'':
|
if filename != u'':
|
||||||
self.OSISLocationEdit.setText(filename)
|
self.OSISLocationEdit.setText(filename)
|
||||||
self.config.set_last_dir(filename, 3)
|
self.config.set_last_dir(filename, 3)
|
||||||
@ -150,12 +175,19 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
|
|||||||
self.config.set_config(
|
self.config.set_config(
|
||||||
u'proxy_password', unicode(self.PasswordEdit.displayText()))
|
u'proxy_password', unicode(self.PasswordEdit.displayText()))
|
||||||
|
|
||||||
def onLocationComboBoxSelected(self):
|
def onLocationComboBoxSelected(self, value):
|
||||||
|
if value == 0:
|
||||||
|
self.loadBibleCombo(self.cwBibleVersions)
|
||||||
|
self.cwActive = True
|
||||||
|
else:
|
||||||
|
self.loadBibleCombo(self.bgBibleVersions)
|
||||||
|
self.cwActive = False
|
||||||
self.checkHttp()
|
self.checkHttp()
|
||||||
|
|
||||||
def onBibleComboBoxSelected(self):
|
def onBibleComboBoxSelected(self, value):
|
||||||
self.checkHttp()
|
self.checkHttp()
|
||||||
self.BibleNameEdit.setText(unicode(self.BibleComboBox.currentText()))
|
self.BibleNameEdit.setText(unicode(self.BibleComboBox.currentText()))
|
||||||
|
self.VersionNameEdit.setText(unicode(self.BibleComboBox.currentText()))
|
||||||
|
|
||||||
def onCancelButtonClicked(self):
|
def onCancelButtonClicked(self):
|
||||||
# tell import to stop
|
# tell import to stop
|
||||||
@ -210,7 +242,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.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
|
||||||
@ -68,13 +67,15 @@ class BGExtract(BibleCommon):
|
|||||||
verseText = u''
|
verseText = u''
|
||||||
versePos = xml_string.find(u'</sup>', versePos) + 6
|
versePos = xml_string.find(u'</sup>', versePos) + 6
|
||||||
i = xml_string.find(verseSearch, versePos + 1)
|
i = xml_string.find(verseSearch, versePos + 1)
|
||||||
|
# Not sure if this is needed now
|
||||||
if i == -1:
|
if i == -1:
|
||||||
i = xml_string.find(u'</div', versePos + 1)
|
i = xml_string.find(u'</div', versePos + 1)
|
||||||
j = xml_string.find(u'<strong', versePos + 1)
|
j = xml_string.find(u'<strong', versePos + 1)
|
||||||
if j > 0 and j < i:
|
if j > 0 and j < i:
|
||||||
i = j
|
i = j
|
||||||
verseText = xml_string[versePos + 7 : i ]
|
verseText = xml_string[versePos + 7 : i ]
|
||||||
bible[verse] = self._clean_text(verseText) # store the verse
|
# store the verse
|
||||||
|
bible[verse] = self._clean_text(verseText)
|
||||||
versePos = -1
|
versePos = -1
|
||||||
else:
|
else:
|
||||||
verseText = xml_string[versePos: i]
|
verseText = xml_string[versePos: i]
|
||||||
@ -85,8 +86,10 @@ class BGExtract(BibleCommon):
|
|||||||
start_tag = verseText.find(verseFootnote)
|
start_tag = verseText.find(verseFootnote)
|
||||||
# Chop off verse and start again
|
# Chop off verse and start again
|
||||||
xml_string = xml_string[i:]
|
xml_string = xml_string[i:]
|
||||||
versePos = xml_string.find(verseSearch) #look for the next verse
|
#look for the next verse
|
||||||
bible[verse] = self._clean_text(verseText) # store the verse
|
versePos = xml_string.find(verseSearch)
|
||||||
|
# store the verse
|
||||||
|
bible[verse] = self._clean_text(verseText)
|
||||||
verse += 1
|
verse += 1
|
||||||
return SearchResults(bookname, chapter, bible)
|
return SearchResults(bookname, chapter, bible)
|
||||||
|
|
||||||
|
@ -66,15 +66,7 @@ class BibleManager(object):
|
|||||||
self.bibleSuffix = u'sqlite'
|
self.bibleSuffix = u'sqlite'
|
||||||
self.dialogobject = None
|
self.dialogobject = None
|
||||||
self.reload_bibles()
|
self.reload_bibles()
|
||||||
|
self.media = None
|
||||||
def set_media_manager(self, media):
|
|
||||||
"""
|
|
||||||
Sets the reference to the media manager.
|
|
||||||
|
|
||||||
``media``
|
|
||||||
The reference to the media manager.
|
|
||||||
"""
|
|
||||||
self.media = media
|
|
||||||
|
|
||||||
def reload_bibles(self):
|
def reload_bibles(self):
|
||||||
log.debug(u'Reload bibles')
|
log.debug(u'Reload bibles')
|
||||||
|
@ -268,7 +268,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
def initialise(self):
|
def initialise(self):
|
||||||
log.debug(u'bible manager initialise')
|
log.debug(u'bible manager initialise')
|
||||||
self.loadBibles()
|
self.loadBibles()
|
||||||
self.parent.biblemanager.set_media_manager(self)
|
self.parent.biblemanager.media = self
|
||||||
self.configUpdated()
|
self.configUpdated()
|
||||||
log.debug(u'bible manager initialise complete')
|
log.debug(u'bible manager initialise complete')
|
||||||
|
|
||||||
|
80
openlp/plugins/bibles/resources/biblegateway.csv
Normal file
80
openlp/plugins/bibles/resources/biblegateway.csv
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
Amuzgo de Guerrero,AMU
|
||||||
|
Arabic Life Application Bible,ALAB
|
||||||
|
Bulgarian Bible,BULG
|
||||||
|
1940 Bulgarian Bible,BG1940
|
||||||
|
Chinanteco de Comaltepec,CCO
|
||||||
|
Cakchiquel Occidental,CKW
|
||||||
|
Haitian Creole Version,HCV
|
||||||
|
Slovo na cestu,SNC
|
||||||
|
Dette er Biblen på dansk,DN1933
|
||||||
|
Hoffnung für Alle,HOF
|
||||||
|
Luther Bibel 1545,LUTH1545
|
||||||
|
New International Version,NIV
|
||||||
|
New American Standard Bible,NASB
|
||||||
|
The Message,MSG
|
||||||
|
Amplified Bible,AMP
|
||||||
|
New Living Translation,NLT
|
||||||
|
King James Version,KJV
|
||||||
|
English Standard Version,ESV
|
||||||
|
Contemporary English Version,CEV
|
||||||
|
New King James Version,NKJV
|
||||||
|
New Century Version,NCV
|
||||||
|
21st Century King James Version,KJ21
|
||||||
|
American Standard Version,ASV
|
||||||
|
Young's Literal Translation,YLT
|
||||||
|
Darby Translation,DARBY
|
||||||
|
Holman Christian Standard Bible,HCSB
|
||||||
|
New International Reader's Version,NIRV
|
||||||
|
Wycliffe New Testament,WYC
|
||||||
|
Worldwide English (New Testament),WE
|
||||||
|
New International Version - UK,NIVUK
|
||||||
|
Today's New International Version,TNIV
|
||||||
|
Reina-Valera 1960,RVR1960
|
||||||
|
Nueva Versión Internacional,NVI
|
||||||
|
Reina-Valera 1995,RVR1995
|
||||||
|
Castilian,CST
|
||||||
|
Reina-Valera Antigua,RVA
|
||||||
|
Biblia en Lenguaje Sencillo,BLS
|
||||||
|
La Biblia de las Américas,LBLA
|
||||||
|
Louis Segond,LSG
|
||||||
|
La Bible du Semeur,BDS
|
||||||
|
1881 Westcott-Hort New Testament,WHNU
|
||||||
|
1550 Stephanus New Testament,TR1550
|
||||||
|
1894 Scrivener New Testament,TR1894
|
||||||
|
The Westminster Leningrad Codex,WLC
|
||||||
|
Hiligaynon Bible,HLGN
|
||||||
|
Croatian Bible,CRO
|
||||||
|
Hungarian Károli,KAR
|
||||||
|
Icelandic Bible,ICELAND
|
||||||
|
La Nuova Diodati,LND
|
||||||
|
La Parola è Vita,LM
|
||||||
|
Jacalteco, Oriental,JAC
|
||||||
|
Kekchi,KEK
|
||||||
|
Korean Bible,KOREAN
|
||||||
|
Maori Bible,MAORI
|
||||||
|
Macedonian New Testament,MNT
|
||||||
|
Mam, Central,MVC
|
||||||
|
Mam de Todos Santos Chuchumatán,MVJ
|
||||||
|
Reimer 2001,REIMER
|
||||||
|
Náhuatl de Guerrero,NGU
|
||||||
|
Het Boek,HTB
|
||||||
|
Det Norsk Bibelselskap 1930,DNB1930
|
||||||
|
Levande Bibeln,LB
|
||||||
|
O Livro,OL
|
||||||
|
João Ferreira de Almeida Atualizada,AA
|
||||||
|
Quiché, Centro Occidental,QUT
|
||||||
|
Romanian,RMNN
|
||||||
|
Romanian,TLCR
|
||||||
|
Russian Synodal Version,RUSV
|
||||||
|
Slovo Zhizny,SZ
|
||||||
|
Nádej pre kazdého,NPK
|
||||||
|
Albanian Bible,ALB
|
||||||
|
Levande Bibeln,SVL
|
||||||
|
Svenska 1917,SV1917
|
||||||
|
Swahili New Testament,SNT
|
||||||
|
Ang Salita ng Diyos,SND
|
||||||
|
Ukrainian Bible,UKR
|
||||||
|
Uspanteco,USP
|
||||||
|
1934 Vietnamese Bible,VIET
|
||||||
|
Chinese Union Version (Simplified),CUVS
|
||||||
|
Chinese Union Version (Traditional),CUV
|
Can't render this file because it has a wrong number of fields in line 51.
|
@ -101,7 +101,7 @@ class SongUsageManager():
|
|||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
self.session.rollback()
|
self.session.rollback()
|
||||||
log.excertion(u'SongUsage Item failed to delete')
|
log.exception(u'SongUsage Item failed to delete')
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
@ -116,7 +116,7 @@ class SongUsageManager():
|
|||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
self.session.rollback()
|
self.session.rollback()
|
||||||
log.excertion(u'Failed to delete all Song Usage items')
|
log.exception(u'Failed to delete all Song Usage items')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def delete_to_date(self, date):
|
def delete_to_date(self, date):
|
||||||
@ -130,5 +130,5 @@ class SongUsageManager():
|
|||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
self.session.rollback()
|
self.session.rollback()
|
||||||
log.excertion(u'Failed to delete all Song Usage items to %s' % date)
|
log.exception(u'Failed to delete all Song Usage items to %s' % date)
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user