Fix OSIS imports and screen refresh issues.

Move Langauge file to Resources.

bzr-revno: 217
This commit is contained in:
Tim Bentley 2008-12-13 19:42:25 +00:00
parent 1b28a4d4c7
commit a0800e842f
5 changed files with 101 additions and 28 deletions

View File

@ -131,4 +131,7 @@ class Plugin(object):
return self.Name
def initalise_ui(self):
return self.Name
"""
Called by the plugin Manager to setup any UI features on creation after the UI has been created,
"""
pass

View File

@ -55,10 +55,19 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog):
else:
self.BooksLocationEdit.setReadOnly(False)
self.VerseLocationEdit.setReadOnly(False)
self.validate()
def on_BooksLocationEdit_lostFocus(self):
self.validate()
if len(self.BooksLocationEdit.displayText()) > 1 or len(self.VerseLocationEdit.displayText()) > 1:
self.OSISLocationEdit.setReadOnly(True)
else:
self.OSISLocationEdit.setReadOnly(False)
def on_VerseLocationEdit_lostFocus(self):
if len(self.BooksLocationEdit.displayText()) > 1 or len(self.VerseLocationEdit.displayText()) > 1:
self.OSISLocationEdit.setReadOnly(True)
else:
self.OSISLocationEdit.setReadOnly(False)
def on_CopyrightEdit_lostFocus(self):
self.validate()
def on_VersionNameEdit_lostFocus(self):
@ -73,12 +82,22 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog):
#bipf = BibleImportProgressForm()
#bipf.show()
if self.biblemanager != None:
self.biblemanager.processDialog(bipf)
self.MessageLabel.setText("Import Started")
self.ProgressBar.setValue(0)
self.progress = 0
self.biblemanager.processDialog(self)
self.biblemanager.registerOSISFileBible(str(self.BibleNameEdit.displayText()), self.OSISLocationEdit.displayText())
self.MessageLabel.setText("Import Complete")
elif button.text() == "Cancel":
self.close()
def setMax(self, max):
self.ProgressBar.setMaximum(max)
def incrementBar(self):
self.progress +=1
self.ProgressBar.setValue(self.progress)
self.update()
def validate(self):
print "validate"
@ -98,17 +117,3 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog):
# self.BibleImportButtonBox.removeButton(self.savebutton) # hide the save button tile screen is valid
class runner(QtGui.QApplication):
def run(self):
values = ["Genesis","Matthew","Revelation"]
self.bm = BibleManager("/home/timali/.openlp")
self.bim = BibleImportForm()
self.bim.show()
self.processEvents()
sys.exit(app.exec_())
if __name__ == '__main__':
app = runner(sys.argv)
app.run()

View File

@ -34,13 +34,11 @@ class BibleOSISImpl():
global log
log=logging.getLogger("BibleOSISImpl")
log.info("BibleOSISImpl loaded")
def __init__(self, bibledb):
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 }
resourcepath=os.path.split(os.path.abspath(__file__))[0]
resourcepath = os.path.join(resourcepath, 'resources')
fbibles=open(resourcepath+"/osisbooks_en.txt", 'r')
fbibles=open(biblepath+"/osisbooks_en.txt", 'r')
for line in fbibles:
p = line.split(",")
self.booksOfBible[p[0]] = p[1].replace('\n', '')
@ -53,7 +51,7 @@ class BibleOSISImpl():
self.bibledb.saveMeta("Permission", "You Have Some")
#TODO: need to see if new / old or both testaments
dialogobject.setMax(66)
dialogobject.setMax(65)
osis=open(osisfile, 'r')

View File

@ -77,7 +77,7 @@ class BibleManager():
"""
log.debug( "registerHTTPBible %s,%s,%s,%s,%s", biblename, biblesource, proxyurl, proxyid, proxypass, mode)
if self._isNewBible(biblename):
nbible = BibleDBImpl(biblename) # Create new Bible
nbible = BibleDBImpl(self.biblePath, biblename, self.bibleSuffix) # Create new Bible
nbible.createTables() # Create Database
self.bibleDBCache[biblename] = nbible
@ -101,7 +101,7 @@ class BibleManager():
from scratch.
"""
if self._isNewBible(biblename):
nbible = BibleDBImpl(biblename) # Create new Bible
nbible = BibleDBImpl(self.biblePath, biblename, self.bibleSuffix) # Create new Bible
nbible.createTables() # Create Database
self.bibleDBCache[biblename] = nbible # cache the database for use later
bcsv = BibleCSVImpl(nbible) # create the loader and pass in the database
@ -113,11 +113,12 @@ class BibleManager():
If the database exists it is deleted and the database is reloaded
from scratch.
"""
log.debug( "registerOSISFileBible %s , %s", biblename, osisfile)
if self._isNewBible(biblename):
nbible = BibleDBImpl(biblename) # Create new Bible
nbible = BibleDBImpl(self.biblePath, biblename, self.bibleSuffix) # Create new Bible
nbible.createTables() # Create Database
self.bibleDBCache[biblename] = nbible # cache the database for use later
bcsv = BibleOSISImpl(nbible) # create the loader and pass in the database
bcsv = BibleOSISImpl(self.biblePath, nbible) # create the loader and pass in the database
bcsv.loadData(osisfile, self.dialogobject)

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