Update to PEP 8 standard

bzr-revno: 224
This commit is contained in:
Tim Bentley 2008-12-15 18:10:47 +00:00
parent 95e6f05018
commit 45d311f2ce
6 changed files with 43 additions and 43 deletions

View File

@ -221,7 +221,7 @@ class BiblePlugin(Plugin):
pass
def _initialise_form(self):
bibles = self.biblemanager.getBibles()
bibles = self.biblemanager.get_bibles()
self.QuickSearchComboBox.addItem("Text Search")
self.QuickSearchComboBox.addItem("Verse Search")
first = True
@ -240,10 +240,10 @@ class BiblePlugin(Plugin):
def _initialise_bible_advanced(self, bible):
log.debug("_initialise_bible_advanced %s ", bible)
currentBook = str(self.AdvancedBookComboBox.currentText())
cf = self.biblemanager.getBookChapterCount(bible, currentBook)[0]
cf = self.biblemanager.get_book_chapter_count(bible, currentBook)[0]
log.debug("Book change bible %s book %s ChapterCount %s", bible, currentBook, cf)
if cf == None: # Only change the search details if the book is missing from the new bible
books = self.biblemanager.getBibleBooks(str(self.AdvancedVersionComboBox.currentText()))
books = self.biblemanager.get_bible_books_full(str(self.AdvancedVersionComboBox.currentText()))
self.AdvancedBookComboBox.clear()
first = True
for b in books:
@ -255,8 +255,8 @@ class BiblePlugin(Plugin):
def _initialise_chapter_verse(self, bible, book):
log.debug("_initialise_chapter_verse %s , %s", bible, book)
self.chaptersfrom = self.biblemanager.getBookChapterCount(bible, book)[0]
self.verses = self.biblemanager.getBookVerseCount(bible, book, 1)[0]
self.chaptersfrom = self.biblemanager.get_book_chapter_count(bible, book)[0]
self.verses = self.biblemanager.get_book_verse_count(bible, book, 1)[0]
self._adjust_combobox(1, self.chaptersfrom, self.AdvancedFromChapter)
self._adjust_combobox(1, self.chaptersfrom, self.AdvancedToChapter)
self._adjust_combobox(1, self.verses, self.AdvancedFromVerse)
@ -267,7 +267,7 @@ class BiblePlugin(Plugin):
book = str(self.AdvancedBookComboBox.currentText())
cf = self.AdvancedFromChapter.currentText()
self._adjust_combobox(cf, self.chaptersfrom, self.AdvancedToChapter)
vse = self.biblemanager.getBookVerseCount(bible, book, int(cf))[0] # get the verse count for new chapter
vse = self.biblemanager.get_book_verse_count(bible, book, int(cf))[0] # get the verse count for new chapter
self._adjust_combobox(1, vse, self.AdvancedFromVerse)
self._adjust_combobox(1, vse, self.AdvancedToVerse)
@ -287,7 +287,7 @@ class BiblePlugin(Plugin):
if t1 != t2:
bible = str(self.AdvancedVersionComboBox.currentText())
book = str(self.AdvancedBookComboBox.currentText())
vse = self.biblemanager.getBookVerseCount(bible, book, int(t2))[0] # get the verse count for new chapter
vse = self.biblemanager.get_book_verse_count(bible, book, int(t2))[0] # get the verse count for new chapter
self._adjust_combobox(1, vse, self.AdvancedToVerse)
def onAdvancedSearchButton(self):
@ -297,24 +297,24 @@ class BiblePlugin(Plugin):
chapto = int(self.AdvancedToChapter.currentText())
versefrom = int(self.AdvancedFromVerse.currentText())
verseto = int(self.AdvancedToVerse.currentText())
self.searchresults = self.biblemanager.getVerseText(bible, book, chapfrom, versefrom, verseto)
self._displayResults()
self.searchresults = self.biblemanager.get_verse_text(bible, book, chapfrom, versefrom, verseto)
self._display_results()
def onQuickSearchButton(self):
bible = str(self.QuickVersionComboBox.currentText())
text = str(self.QuickSearchEdit.displayText())
if self.QuickSearchComboBox.currentText() == "Text Search":
self._searchText(bible, text)
self._search_text(bible, text)
else:
self._verseSearch()
self._verse_search()
def _search_text(self, bible, text):
self.searchresults = self.biblemanager.getVersesFromText(bible,text)
self._displayResults()
self.searchresults = self.biblemanager.get_verse_from_text(bible,text)
self._display_results()
def _verse_search(self):
self._displayResults()
self._display_results()
def _display_results(self):
self.listView.clear() # clear the results

View File

@ -85,9 +85,9 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog):
self.MessageLabel.setText("Import Started")
self.ProgressBar.setValue(1)
self.progress = 0
self.biblemanager.processDialog(self)
self.biblemanager.registerOSISFileBible(str(self.BibleNameEdit.displayText()), self.OSISLocationEdit.displayText())
self.biblemanager.saveMetaData(str(self.BibleNameEdit.displayText()), str(self.VersionNameEdit.displayText()), str(self.CopyrightEdit.displayText()), str(self.PermisionEdit.displayText()))
self.biblemanager.process_dialog(self)
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":
self.close()

View File

@ -68,7 +68,7 @@ class BibleManager():
log.debug( "Bible Initialised")
def processDialog(self, dialogobject):
def process_dialog(self, dialogobject):
self.dialogobject = dialogobject
def registerHTTPBible(self, biblename, biblesource, mode="lazy", proxyurl=None, proxyid=None, proxypass=None):
@ -108,7 +108,7 @@ class BibleManager():
bcsv = BibleCSVImpl(nbible) # create the loader and pass in the database
bcsv.loadData(booksfile, versefile)
def registerOSISFileBible(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
@ -142,7 +142,7 @@ class BibleManager():
self._loadBook(biblename,bookid, bookname, bookabbrev)
self._loadChapter(biblename,bookid, bookname, chptr)
def getBibles(self, mode="full"):
def get_bibles(self, mode="full"):
"""
Returns a list of Books of the bible
"""
@ -151,21 +151,21 @@ class BibleManager():
r.append(b)
return r
def getBibleBooks(self,bible):
def get_bible_books_full(self,bible):
"""
Returns a list of the books of the bible from the database
"""
log.debug("getbibleBooks %s", bible)
return self.bibleDBCache[bible].getBibleBooks()
def getBookChapterCount(self, bible, book):
def get_book_chapter_count(self, bible, book):
"""
Returns the number of Chapters for a given book
"""
log.debug( "getBookChapterCount %s,%s", bible, book)
return self.bibleDBCache[bible].getMaxBibleBookChapters(book)
def getBookVerseCount(self, bible, book, chapter):
def get_book_verse_count(self, bible, book, chapter):
"""
Returns all the number of verses for a given
book and chapterMaxBibleBookVerses
@ -173,7 +173,7 @@ class BibleManager():
log.debug( "getBookVerseCount %s,%s,%s", bible, book, chapter)
return self.bibleDBCache[bible].getMaxBibleBookVerses(book, chapter)
def getVersesFromText(self, bible, versetext):
def get_verse_from_text(self, bible, versetext):
"""
Returns all the number of verses for a given
book and chapterMaxBibleBookVerses
@ -181,7 +181,7 @@ class BibleManager():
log.debug( "getVersesFromText %s,%s", bible, versetext)
return self.bibleDBCache[bible].getVersesFromText(versetext)
def saveMetaData(self, bible, version, copyright, permissions):
def save_meta_data(self, bible, version, copyright, permissions):
"""
Saves the bibles meta data
"""
@ -197,7 +197,7 @@ class BibleManager():
log.debug( "getMetaData %s,%s", bible, key)
self.bibleDBCache[bible].getMeta(key)
def getVerseText(self, bible, bookname, chapter, sverse, everse = 0 ):
def get_verse_text(self, bible, bookname, chapter, sverse, everse = 0 ):
"""
Returns a list of verses for a given Book, Chapter and ranges of verses.
If the end verse(everse) is less then the start verse(sverse)

View File

@ -55,7 +55,7 @@ class TestBibleManager:
log.debug("\n.......testRegisterBibleFiles")
self.bm.registerFileBible("TheMessage",'biblebooks_msg_short.csv','bibleverses_msg_short.csv')
self.bm.registerFileBible("NIV",'biblebooks_niv_short.csv','bibleverses_niv_short.csv')
b = self.bm.getBibles()
b = self.bm.get_bibles()
for b1 in b:
log.debug( b1)
assert(b1 in b)
@ -66,7 +66,7 @@ class TestBibleManager:
self.bm.registerHTTPBible("asv","Crosswalk", "", "", "")
self.bm.registerHTTPBible("nasb","Biblegateway", "", "", "")
self.bm.registerHTTPBible("nkj","Biblegateway", "http://tigger2:3128/", "", "")
b = self.bm.getBibles()
b = self.bm.get_bibles()
for b1 in b:
log.debug( b1)
assert(b1 in b)
@ -75,40 +75,40 @@ class TestBibleManager:
def testGetBibles(self):
log.debug( "\n.......testGetBibles")
# make sure the shuffled sequence does not lose any elements
b = self.bm.getBibles()
b = self.bm.get_bibles()
for b1 in b:
log.debug( b1)
assert(b1 in b)
def testGetBibleBooks(self):
log.debug( "\n.......testGetBibleBooks")
c = self.bm.getBibleBooks("NIV")
c = self.bm.get_bible_books_full("NIV")
for c1 in c:
log.debug( c1)
assert(c1 in c)
def testGetBookChapterCount(self):
log.debug( "\n.......testGetBookChapterCount")
assert(self.bm.getBookChapterCount("Matthew") == '28')
assert(self.bm.get_book_chapter_count("Matthew") == '28')
def testGetBookVerseCount(self):
log.debug( "\n.......testGetBookVerseCount")
assert(self.bm.getBookVerseCount("Genesis", 1) == '31')
assert(self.bm.getBookVerseCount("Genesis", 2) == '25')
assert(self.bm.getBookVerseCount("Matthew", 1) == '25')
assert(self.bm.getBookVerseCount("Revelation", 1) == '20')
assert(self.bm.get_book_verse_count("Genesis", 1) == '31')
assert(self.bm.get_book_verse_count("Genesis", 2) == '25')
assert(self.bm.get_book_verse_count("Matthew", 1) == '25')
assert(self.bm.get_book_verse_count("Revelation", 1) == '20')
def testGetVerseText(self):
log.debug( "\n.......testGetVerseText")
#c = self.bm.getVerseText("TheMessage",'Genesis',1,2,1)
#c = self.bm.get_verse_text("TheMessage",'Genesis',1,2,1)
#log.debug( c )
#c = self.bm.getVerseText('NIV','Genesis',1,1,2)
#c = self.bm.get_verse_text('NIV','Genesis',1,1,2)
#log.debug( c )
c = self.bm.getVerseText('asv','Genesis',10,1,20)
c = self.bm.get_verse_text('asv','Genesis',10,1,20)
log.debug( c )
c = self.bm.getVerseText('nasb','Genesis',10,1,20)
c = self.bm.get_verse_text('nasb','Genesis',10,1,20)
log.debug( c )
c = self.bm.getVerseText('nkj','Revelation',10,1,20)
c = self.bm.get_verse_text('nkj','Revelation',10,1,20)
log.debug( c )
def testLoadBible(self):

View File

@ -55,7 +55,7 @@ class TestBibleManager:
log.debug("\n.......testRegisterBibleFiles")
self.bm.registerCSVFileBible("TheMessage",'biblebooks_msg_short.csv','bibleverses_msg_short.csv')
self.bm.registerCSVFileBible("NIV",'biblebooks_niv_short.csv','bibleverses_niv_short.csv')
b = self.bm.getBibles()
b = self.bm.get_bibles()
for b1 in b:
log.debug( b1)
assert(b1 in b)

View File

@ -53,8 +53,8 @@ class TestBibleManager:
def testRegisterOSISBibleFiles(self):
# Register a bible from files
log.debug("\n.......testRegisterOSISBibleFiles")
self.bm.registerOSISFileBible("asv",'asv.osis')
b = self.bm.getBibles()
self.bm.register_OSIS_file_bible("asv",'asv.osis')
b = self.bm.get_bibles()
for b1 in b:
log.debug( b1)
assert(b1 in b)