diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 3cea15b9b..7c5b856be 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -8,17 +8,13 @@ import os, os.path import sys import time -mypath=os.path.split(os.path.abspath(__file__))[0] -sys.path.insert(0,(os.path.join(mypath, '..', '..', '..', '..'))) +from openlp.core.resources import * from PyQt4 import QtCore, QtGui from PyQt4.QtGui import QDialog from PyQt4.QtCore import pyqtSignature from bibleimportdialog import Ui_BibleImportDialog -from bibleimportprogressform import BibleImportProgressForm - -from openlp.plugins.bibles.lib.biblemanager import BibleManager class BibleImportForm(QDialog, Ui_BibleImportDialog): """ @@ -70,23 +66,25 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog): def on_CopyrightEdit_lostFocus(self): self.validate() + def on_VersionNameEdit_lostFocus(self): self.validate() + def on_PermisionEdit_lostFocus(self): self.validate() + def on_BibleNameEdit_lostFocus(self): self.validate() + def on_BibleImportButtonBox_clicked(self,button): print button.text() if button.text() == "Save": - #bipf = BibleImportProgressForm() - #bipf.show() if self.biblemanager != None: self.MessageLabel.setText("Import Started") self.ProgressBar.setValue(1) self.progress = 0 self.biblemanager.process_dialog(self) - self.biblemanager.register_OSIS_file_bible(str(self.BibleNameEdit.displayText()), self.OSISLocationEdit.displayText()) + self.biblemanager.register_osis_file_bible(str(self.BibleNameEdit.displayText()), self.OSISLocationEdit.displayText()) self.biblemanager.save_meta_data(str(self.BibleNameEdit.displayText()), str(self.VersionNameEdit.displayText()), str(self.CopyrightEdit.displayText()), str(self.PermisionEdit.displayText())) self.MessageLabel.setText("Import Complete") elif button.text() == "Cancel": diff --git a/openlp/plugins/bibles/lib/bibleDBimpl.py b/openlp/plugins/bibles/lib/bibleDBimpl.py index e7d09b192..c07a468a6 100644 --- a/openlp/plugins/bibles/lib/bibleDBimpl.py +++ b/openlp/plugins/bibles/lib/bibleDBimpl.py @@ -137,7 +137,7 @@ class BibleDBImpl(BibleCommon): book_table.create() verse_table.create() self.save_meta("dbversion", "2") - self._loadTestaments() + self._load_testaments() def add_verse(self, bookid, chap, verse, text): log.debug( "add_verse %s,%s,%s,%s", bookid, chap, verse, text) diff --git a/openlp/plugins/bibles/lib/bibleHTTPimpl.py b/openlp/plugins/bibles/lib/bibleHTTPimpl.py index 38da45fbc..b6342ce00 100644 --- a/openlp/plugins/bibles/lib/bibleHTTPimpl.py +++ b/openlp/plugins/bibles/lib/bibleHTTPimpl.py @@ -20,9 +20,7 @@ import os, os.path import sys import urllib2 -#mypath=os.path.split(os.path.abspath(__file__))[0] -#sys.path.insert(0,(os.path.join(mypath, '..', '..', '..'))) -from openlp.plugins.bibles.lib.biblecommon import BibleCommon +from biblecommon import BibleCommon import logging diff --git a/openlp/plugins/bibles/lib/bibleOSISimpl.py b/openlp/plugins/bibles/lib/bibleOSISimpl.py index 7dcc1ff1c..8ff712a3b 100644 --- a/openlp/plugins/bibles/lib/bibleOSISimpl.py +++ b/openlp/plugins/bibles/lib/bibleOSISimpl.py @@ -87,9 +87,9 @@ class BibleOSISImpl(): if book_ptr != p[0]: book_ptr = p[0] self.bibledb.create_book(int(p[1]), self.booksOfBible[p[0]] , self.abbrevOfBible[p[0]]) - id = self.bibledb.getBibleBookId(self.booksOfBible[p[0]]) + id = self.bibledb.get_bible_book_id(self.booksOfBible[p[0]]) dialogobject.incrementBar() - self.bibledb.addVerse(id[0], p[1], p[2], t) + self.bibledb.add_verse(id[0], p[1], p[2], t) diff --git a/openlp/plugins/bibles/lib/biblemanager.py b/openlp/plugins/bibles/lib/biblemanager.py index bbd480dc4..7a542e4ca 100644 --- a/openlp/plugins/bibles/lib/biblemanager.py +++ b/openlp/plugins/bibles/lib/biblemanager.py @@ -46,7 +46,7 @@ class BibleManager(): self.bibleHTTPCache = {} # dict of bible http readers self.biblePath = self.config.get_data_path() self.proxyname = self.config.get_config("proxy name") #get proxy name for screen - self.bibleSuffix = self.config.get_config("suffix name", u'bible3') + self.bibleSuffix = self.config.get_config("suffix name", u'bible3,sqlite') self.dialogobject = None files = self.config.get_files() @@ -59,10 +59,10 @@ class BibleManager(): biblesource = self.bibleDBCache[bname].get_meta("WEB") # look to see if lazy load bible exists and get create getter. if biblesource: nhttp = BibleHTTPImpl() - nhttp.setBibleSource(biblesource) # tell The Server where to get the verses from. + nhttp.set_bible_source(biblesource) # tell The Server where to get the verses from. self.bibleHTTPCache[bname] = nhttp proxy = self.bibleDBCache[bname].get_meta("proxy") # look to see if lazy load bible exists and get create getter. - nhttp.setProxy(proxy) # tell The Server where to get the verses from. + nhttp.set_proxy(proxy) # tell The Server where to get the verses from. else: self.bibleHTTPCache[bname] = None # makes the Full / partial code easier. # @@ -72,7 +72,7 @@ class BibleManager(): def process_dialog(self, dialogobject): self.dialogobject = dialogobject - def register_HTTP_bible(self, biblename, biblesource, mode="lazy", proxyurl=None, proxyid=None, proxypass=None): + def register_http_bible(self, biblename, biblesource, mode="lazy", proxyurl=None, proxyid=None, proxypass=None): """ Return a list of bibles from a given URL. The selected Bible can then be registered and LazyLoaded into a database @@ -80,23 +80,23 @@ class BibleManager(): log.debug( "register_HTTP_bible %s,%s,%s,%s,%s", biblename, biblesource, proxyurl, proxyid, proxypass, mode) if self._is_new_bible(biblename): nbible = BibleDBImpl(self.biblePath, biblename, self.bibleSuffix) # Create new Bible - nbible.createTables() # Create Database + nbible.create_tables() # Create Database self.bibleDBCache[biblename] = nbible nhttp = BibleHTTPImpl() - nhttp.setBibleSource(biblesource) + nhttp.set_bible_source(biblesource) self.bibleHTTPCache[biblename] = nhttp nbible.save_meta("WEB", biblesource) # register a lazy loading interest if proxyurl != None: nbible.save_meta("proxy", proxyurl) # store the proxy URL - nhttp.setProxy(proxyurl) + nhttp.set_proxy(proxyurl) if proxyid != None: nbible.save_meta("proxyid", proxyid) # store the proxy userid if proxypass != None: nbible.save_meta("proxypass", proxypass) # store the proxy password - def register_CVS_file_bible(self, biblename, booksfile, versefile): + def register_cvs_file_bible(self, biblename, booksfile, versefile): """ Method to load a bible from a set of files into a database. If the database exists it is deleted and the database is reloaded @@ -104,12 +104,12 @@ class BibleManager(): """ if self._is_new_bible(biblename): nbible = BibleDBImpl(self.biblePath, biblename, self.bibleSuffix) # Create new Bible - nbible.createTables() # Create Database + nbible.create_tables() # Create Database self.bibleDBCache[biblename] = nbible # cache the database for use later bcsv = BibleCSVImpl(nbible) # create the loader and pass in the database bcsv.load_data(booksfile, versefile) - def register_OSIS_file_bible(self, biblename, osisfile): + def register_osis_file_bible(self, biblename, osisfile): """ Method to load a bible from a osis xml file extracted from Sword bible viewer. If the database exists it is deleted and the database is reloaded @@ -118,10 +118,10 @@ class BibleManager(): log.debug( "register_OSIS_file_bible %s , %s", biblename, osisfile) if self._is_new_bible(biblename): nbible = BibleDBImpl(self.biblePath, biblename, self.bibleSuffix) # Create new Bible - nbible.createTables() # Create Database + nbible.create_tables() # Create Database self.bibleDBCache[biblename] = nbible # cache the database for use later bcsv = BibleOSISImpl(self.biblePath, nbible) # create the loader and pass in the database - bcsv.loadData(osisfile, self.dialogobject) + bcsv.load_data(osisfile, self.dialogobject) # def loadBible(self,biblename): @@ -263,7 +263,7 @@ class BibleManager(): Check cache to see if new bible """ for b , o in self.bibleDBCache.iteritems(): - log.debug( b ) + log.debug( "Bible from cache in is_new_bible %s", b ) if b == name : return False return True