Update files to provide list of values for bibles

Update code to read from files in code base and not .openlp

bzr-revno: 318
This commit is contained in:
Tim Bentley 2009-02-15 19:11:27 +00:00
parent 649208afe5
commit 19395e6880
8 changed files with 193 additions and 35 deletions

View File

@ -17,7 +17,6 @@ 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
@ -325,20 +324,22 @@ class BiblePlugin(Plugin, PluginUtils):
log.debug("_initialise_form")
self.QuickSearchComboBox.clear()
self.QuickVersionComboBox.clear()
self.AdvancedVersionComboBox.clear()
bibles = self.biblemanager.get_bibles("full")
self.AdvancedVersionComboBox.clear()
self.QuickSearchComboBox.addItem("Verse Search")
self.QuickSearchComboBox.addItem("Text Search")
self.ClearQuickSearchComboBox.addItem("Clear")
self.ClearQuickSearchComboBox.addItem("Keep")
self.ClearAdvancedSearchComboBox.addItem("Clear")
self.ClearAdvancedSearchComboBox.addItem("Keep")
self.SettingsOutputStyleComboBox.addItem("Verse")
self.SettingsOutputStyleComboBox.addItem("Continuous")
self.SettingsOutputStyleComboBox.addItem("Paragraph")
self.SettingsVerseStyleComboBox.addItem("No Brackets")
self.SettingsVerseStyleComboBox.addItem("( and )")
self.SettingsVerseStyleComboBox.addItem("{ and }")
self.SettingsVerseStyleComboBox.addItem("[ and ]")
bibles = self.biblemanager.get_bibles("full")
for b in bibles: # load bibles into the combo boxes
self.QuickVersionComboBox.addItem(b)

View File

@ -40,29 +40,43 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils):
self.AddressEdit.setText(self.config.get_config("addressedit", ""))
self.UsernameEdit.setText(self.config.get_config("usernameedit", ""))
self.PasswordEdit.setText(self.config.get_config("passwordedit",""))
filepath = os.path.split(os.path.abspath(__file__))[0]
filepath = os.path.abspath(os.path.join(filepath, '..', 'resources','crosswalkbooks.csv'))
fbibles=open(filepath, 'r')
self.bible_versions = {}
self.BibleComboBox.clear()
for line in fbibles:
p = line.split(",")
self.bible_versions[p[0]] = p[1].replace('\n', '')
self.BibleComboBox.addItem(str(p[0]))
QtCore.QObject.connect(self.LocationComboBox, QtCore.SIGNAL("activated(int)"), self.onLocationComboBox)
QtCore.QObject.connect(self.BibleComboBox, QtCore.SIGNAL("activated(int)"), self.onBibleComboBox)
@pyqtSignature("")
def on_VersesFileButton_clicked(self):
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file',self._get_last_dir())
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file',self._get_last_dir(1))
self.VerseLocationEdit.setText(filename)
self._save_last_directory(filename)
if filename != "":
self._save_last_directory(filename, 1)
self.setCSV()
@pyqtSignature("")
def on_BooksFileButton_clicked(self):
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file',self._get_last_dir(1))
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file',self._get_last_dir(2))
self.BooksLocationEdit.setText(filename)
self._save_last_directory(filename, 1)
if filename != "":
self._save_last_directory(filename, 2)
self.setCSV()
@pyqtSignature("")
def on_OsisFileButton_clicked(self):
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file',self._get_last_dir(2))
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file',self._get_last_dir(3))
self.OSISLocationEdit.setText(filename)
self._save_last_directory(filename, 2)
if filename != "":
self._save_last_directory(filename, 3)
self.setOSIS()
def on_OSISLocationEdit_lostFocus(self):
@ -90,7 +104,6 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils):
@pyqtSignature("")
def on_AddressEdit_lostFocus(self):
self.config.set_config("addressedit", str(self.AddressEdit.displayText()))
@pyqtSignature("")
def on_UsernameEdit_lostFocus(self):
@ -166,6 +179,8 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils):
self.biblemanager.register_csv_file_bible(str(self.BibleNameEdit.displayText()), self.BooksLocationEdit.displayText(), self.VerseLocationEdit.displayText())
else:
self.setMax(1) # set a value as it will not be needed
bible = self.bible_versions[str(self.BibleComboBox.currentText())]
print bible
self.biblemanager.register_http_bible(str(self.BibleComboBox.currentText()), \
str(self.LocationComboBox.currentText()), \
str(self.AddressEdit.displayText()), \

View File

@ -15,6 +15,8 @@ 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 os
import os.path
import logging
from openlp.plugins.bibles.lib.bibleDBimpl import BibleDBImpl
from openlp.core.lib import Receiver
@ -27,8 +29,11 @@ class BibleOSISImpl():
def __init__(self, biblepath, bibledb):
self.bibledb = bibledb
self.booksOfBible = {} # books of the bible linked to bibleid {osis , name}
self.abbrevOfBible = {} # books of the bible linked to bibleid {osis ,Abbrev }
fbibles=open(biblepath+"/osisbooks_en.txt", 'r')
self.abbrevOfBible = {} # books of the bible linked to bibleid {osis ,Abbrev }
filepath = os.path.split(os.path.abspath(__file__))[0]
filepath = os.path.abspath(os.path.join(filepath, '..', 'resources','osisbooks.csv'))
fbibles=open(filepath, 'r')
for line in fbibles:
p = line.split(",")
self.booksOfBible[p[0]] = p[1].replace('\n', '')

View File

@ -1,11 +0,0 @@
1,50,ge,31:25:3:4
2,40,ex,5:6:7:8
3,27,le,9:10:11:13
4,36,nu,1:35:6
5,34,de,1:3:4
23,150,ps,1:4:5
47,28,mt,25:23:30
48,15,mr,21:23:23
49,24,lu,23:43:34
50,21,joh,23:65:76
73,22,re,20:23:24

View File

@ -1,11 +0,0 @@
Genesis,1
Exodus,2
Leviticus,3
Numbers,4
Deuteronomy,5
Psalms,23
Matthew,47
Mark,48
Luke,49
John,50
Revelation,73

View File

@ -0,0 +1,27 @@
New American Standard,nas
American Standard Version,asv
English Standard Version,esv
New King James Version,nkj
King James Version,kjv
Holman Christian Standard Bible,csb
Third Millennium Bible,tmb
New International Version,niv
New Living Translation,nlt
New Revised Standard,nrs
Revised Standard Version,rsv
Good News Translation,gnt
Douay-Rheims Bible,rhe
The Message,msg
The Complete Jewish Bible,cjb
New Century Version,ncv
GOD'S WORD Translation,gwd
Hebrew Names Version,hnv
World English Bible,web
The Bible in Basic English,bbe
Young's Literal Translation,ylt
Today's New International Version,tnv
New International Reader's Version,nrv
The Darby Translation,dby
The Webster Bible,wbt
The Latin Vulgate,vul
Weymouth New Testament,wnt
1 New American Standard nas
2 American Standard Version asv
3 English Standard Version esv
4 New King James Version nkj
5 King James Version kjv
6 Holman Christian Standard Bible csb
7 Third Millennium Bible tmb
8 New International Version niv
9 New Living Translation nlt
10 New Revised Standard nrs
11 Revised Standard Version rsv
12 Good News Translation gnt
13 Douay-Rheims Bible rhe
14 The Message msg
15 The Complete Jewish Bible cjb
16 New Century Version ncv
17 GOD'S WORD Translation gwd
18 Hebrew Names Version hnv
19 World English Bible web
20 The Bible in Basic English bbe
21 Young's Literal Translation ylt
22 Today's New International Version tnv
23 New International Reader's Version nrv
24 The Darby Translation dby
25 The Webster Bible wbt
26 The Latin Vulgate vul
27 Weymouth New Testament wnt

View File

@ -0,0 +1,66 @@
Genesis,ge,1
Exodus,ex,1
Leviticus,le,1
Numbers,nu,1
Deuteronomy,de,1
Joshua,jos,1
Judges,jud,1
Ruth,ru,1
1 Samual,1sa,1
2 Samual,2sa,1
1 Kings,1ki,1
2 Kings,2ki,1
1 Chronicles,1ch,1
2 Chronicles,2ch,1
Ezra,ezr,1
Nehemiah,ne,1
Esther,es,1
Job,job,1
Psalms,ps,1
Proverbs,pr,1
Ecclesiastes,ec,1
Song of Songs,so,1
Isaiah,isa,1
Jeremiah,jer,1
Lamentations,la,1
Ezekiel,exe,1
Daniel,da,1
Hosea,ho,1
Joel,joe,1
Amos,am,1
Obad,ob,1
Jonah,Jonah,1
Micah,mic,1
Naham,na,1
Habakkuk,hab,1
Zephaniah,zep,1
Haggai,hag,1
Zechariah,zec,1
Malachi,mal,1
Matthew,mt,2
Mark,mk,2
Luke,lu,2
John,joh,2
Acts,ac,2
Romans,ro,2
1 Corinthans,1co,2
2 Corinthans,2co,2
Galatians,ga,2
Ephesians,eph,2
Philippians,php,2
Colossians,col,2
1 Thessalonians,1th,2
2 Thessalonians,2th,2
1 Timothy,1ti,2
2 Timothy,2ti,2
Titus,tit,2
Philemon,phm,2
Hebrews,heb,2
James,jas,2
1 Peter,1pe,2
2 Peter,2pe,2
1 John,1jo,2
2 John,2jo,2
3 John,3jo,2
Jude,jude,2
Revelation,re,2
1 Genesis ge 1
2 Exodus ex 1
3 Leviticus le 1
4 Numbers nu 1
5 Deuteronomy de 1
6 Joshua jos 1
7 Judges jud 1
8 Ruth ru 1
9 1 Samual 1sa 1
10 2 Samual 2sa 1
11 1 Kings 1ki 1
12 2 Kings 2ki 1
13 1 Chronicles 1ch 1
14 2 Chronicles 2ch 1
15 Ezra ezr 1
16 Nehemiah ne 1
17 Esther es 1
18 Job job 1
19 Psalms ps 1
20 Proverbs pr 1
21 Ecclesiastes ec 1
22 Song of Songs so 1
23 Isaiah isa 1
24 Jeremiah jer 1
25 Lamentations la 1
26 Ezekiel exe 1
27 Daniel da 1
28 Hosea ho 1
29 Joel joe 1
30 Amos am 1
31 Obad ob 1
32 Jonah Jonah 1
33 Micah mic 1
34 Naham na 1
35 Habakkuk hab 1
36 Zephaniah zep 1
37 Haggai hag 1
38 Zechariah zec 1
39 Malachi mal 1
40 Matthew mt 2
41 Mark mk 2
42 Luke lu 2
43 John joh 2
44 Acts ac 2
45 Romans ro 2
46 1 Corinthans 1co 2
47 2 Corinthans 2co 2
48 Galatians ga 2
49 Ephesians eph 2
50 Philippians php 2
51 Colossians col 2
52 1 Thessalonians 1th 2
53 2 Thessalonians 2th 2
54 1 Timothy 1ti 2
55 2 Timothy 2ti 2
56 Titus tit 2
57 Philemon phm 2
58 Hebrews heb 2
59 James jas 2
60 1 Peter 1pe 2
61 2 Peter 2pe 2
62 1 John 1jo 2
63 2 John 2jo 2
64 3 John 3jo 2
65 Jude jude 2
66 Revelation re 2

View File

@ -0,0 +1,66 @@
Gen,Genesis,Gen
Exod,Exodus,Exod
Lev,Leviticus,Lev
Num,Numbers,Num
Deut,Deuteronomy,Deut
Josh,Joshua,Josh
Judg,Judges,Judg
Ruth,Ruth,Ruth
1Sam,1 Samual,1Sam
2Sam,2 Samual,2Sam
1Kgs,1 Kings,1Kgs
2Kgs,2 Kings,2Kgs
1Chr,1 Chronicles,1Chr
2Chr,2 Chronicles,2Chr
Ezra,Ezra,Ezra
Neh,Nehemiah,Neh
Esth,Esther,Esth
Job,Job,Job
Ps,Psalms,Ps
Prov,Proverbs,Prov
Eccl,Ecclesiastes,Eccl
Song,Song of Songs,Song
Isa,Isaiah,Isa
Jer,Jeremiah,Jer
Lam,Lamentations,Lam
Ezek,Ezekiel,Ezek
Dan,Daniel,Dan
Hos,Hosea,Hos
Joel,Joel,Joel
Amos,Amos,Amos
Obad,Obad,Obad
Jonah,Jonah,Jonah
Mic,Micah,Mic
Nah,Naham,Nah
Hab,Habakkuk,Hab
Zeph,Zephaniah,Zeph
Hag,Haggai,Hag
Zech,Zechariah,Zech
Mal,Malachi,Mal
Matt,Matthew,Matt
Mark,Mark,Mark
Luke,Luke,Luke
John,John,John
Acts,Acts,Acts
Rom,Romans,Rom
1Cor,1 Corinthans,1Cor
2Cor,2 Corinthans,2Cor
Gal,Galatians,Gal
Eph,Ephesians,Eph
Phil,Philippians,Phil
Col,Colossians,Col
1Thess,1 Thessalonians,1Thess
2Thess,2 Thessalonians,2Thess
1Tim,1 Timothy,1Tim
2Tim,2 Timothy,2Tim
Titus,Titus,Titus
Phlm,Philemon,Phlm
Heb,Hebrews,Heb
Jas,James,Jas
1Pet,1 Peter,1Pet
2Pet,2 Peter,2Pet
1John,1 John,1John
2John,2 John,2John
3John,3 John,3John
Jude,Jude,Jude
Rev,Revelation,Rev
1 Gen Genesis Gen
2 Exod Exodus Exod
3 Lev Leviticus Lev
4 Num Numbers Num
5 Deut Deuteronomy Deut
6 Josh Joshua Josh
7 Judg Judges Judg
8 Ruth Ruth Ruth
9 1Sam 1 Samual 1Sam
10 2Sam 2 Samual 2Sam
11 1Kgs 1 Kings 1Kgs
12 2Kgs 2 Kings 2Kgs
13 1Chr 1 Chronicles 1Chr
14 2Chr 2 Chronicles 2Chr
15 Ezra Ezra Ezra
16 Neh Nehemiah Neh
17 Esth Esther Esth
18 Job Job Job
19 Ps Psalms Ps
20 Prov Proverbs Prov
21 Eccl Ecclesiastes Eccl
22 Song Song of Songs Song
23 Isa Isaiah Isa
24 Jer Jeremiah Jer
25 Lam Lamentations Lam
26 Ezek Ezekiel Ezek
27 Dan Daniel Dan
28 Hos Hosea Hos
29 Joel Joel Joel
30 Amos Amos Amos
31 Obad Obad Obad
32 Jonah Jonah Jonah
33 Mic Micah Mic
34 Nah Naham Nah
35 Hab Habakkuk Hab
36 Zeph Zephaniah Zeph
37 Hag Haggai Hag
38 Zech Zechariah Zech
39 Mal Malachi Mal
40 Matt Matthew Matt
41 Mark Mark Mark
42 Luke Luke Luke
43 John John John
44 Acts Acts Acts
45 Rom Romans Rom
46 1Cor 1 Corinthans 1Cor
47 2Cor 2 Corinthans 2Cor
48 Gal Galatians Gal
49 Eph Ephesians Eph
50 Phil Philippians Phil
51 Col Colossians Col
52 1Thess 1 Thessalonians 1Thess
53 2Thess 2 Thessalonians 2Thess
54 1Tim 1 Timothy 1Tim
55 2Tim 2 Timothy 2Tim
56 Titus Titus Titus
57 Phlm Philemon Phlm
58 Heb Hebrews Heb
59 Jas James Jas
60 1Pet 1 Peter 1Pet
61 2Pet 2 Peter 2Pet
62 1John 1 John 1John
63 2John 2 John 2John
64 3John 3 John 3John
65 Jude Jude Jude
66 Rev Revelation Rev