forked from openlp/openlp
Fix up Bible bugs following addition of Tabs and Move code split
bzr-revno: 382
This commit is contained in:
parent
980ed505e2
commit
4ad8b74167
@ -3,7 +3,7 @@
|
|||||||
"""
|
"""
|
||||||
OpenLP - Open Source Lyrics Projection
|
OpenLP - Open Source Lyrics Projection
|
||||||
Copyright (c) 2008 Raoul Snyman
|
Copyright (c) 2008 Raoul Snyman
|
||||||
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
|
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
the terms of the GNU General Public License as published by the Free Software
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
@ -26,6 +26,7 @@ from openlp.core.lib import MediaManagerItem, Receiver
|
|||||||
from openlp.core.resources import *
|
from openlp.core.resources import *
|
||||||
|
|
||||||
from openlp.plugins.bibles.forms import BibleImportForm
|
from openlp.plugins.bibles.forms import BibleImportForm
|
||||||
|
from openlp.plugins.bibles.lib import BiblesTab
|
||||||
|
|
||||||
class BibleMediaItem(MediaManagerItem):
|
class BibleMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
@ -242,6 +243,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.ClearAdvancedSearchComboBox.clear()
|
self.ClearAdvancedSearchComboBox.clear()
|
||||||
|
|
||||||
def loadBibles(self):
|
def loadBibles(self):
|
||||||
|
log.debug("Loading Bibles")
|
||||||
bibles = self.parent.biblemanager.get_bibles('full')
|
bibles = self.parent.biblemanager.get_bibles('full')
|
||||||
for bible in bibles: # load bibles into the combo boxes
|
for bible in bibles: # load bibles into the combo boxes
|
||||||
self.QuickVersionComboBox.addItem(bible)
|
self.QuickVersionComboBox.addItem(bible)
|
||||||
@ -285,6 +287,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.adjustComboBox(1, vse, self.AdvancedToVerse)
|
self.adjustComboBox(1, vse, self.AdvancedToVerse)
|
||||||
|
|
||||||
def onAdvancedSearchButton(self):
|
def onAdvancedSearchButton(self):
|
||||||
|
log.debug("Advanced Search Button pressed")
|
||||||
bible = str(self.AdvancedVersionComboBox.currentText())
|
bible = str(self.AdvancedVersionComboBox.currentText())
|
||||||
book = str(self.AdvancedBookComboBox.currentText())
|
book = str(self.AdvancedBookComboBox.currentText())
|
||||||
chapter_from = int(self.AdvancedFromChapter.currentText())
|
chapter_from = int(self.AdvancedFromChapter.currentText())
|
||||||
@ -308,13 +311,13 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self._adjust_combobox(1, vse, self.AdvancedToVerse)
|
self._adjust_combobox(1, vse, self.AdvancedToVerse)
|
||||||
|
|
||||||
def onQuickSearchButton(self):
|
def onQuickSearchButton(self):
|
||||||
self.log.debug("onQuickSearchButton")
|
log.debug("Quick Search Button pressed")
|
||||||
bible = str(self.QuickVersionComboBox.currentText())
|
bible = str(self.QuickVersionComboBox.currentText())
|
||||||
text = str(self.QuickSearchEdit.displayText())
|
text = str(self.QuickSearchEdit.displayText())
|
||||||
if self.ClearQuickSearchComboBox.currentIndex() == 0:
|
if self.ClearQuickSearchComboBox.currentIndex() == 0:
|
||||||
self.BibleListView.clear() # clear the results
|
self.BibleListView.clear() # clear the results
|
||||||
self.BibleListView.setRowCount(0)
|
self.BibleListView.setRowCount(0)
|
||||||
elif self.QuickSearchComboBox.currentIndex() == 1:
|
if self.QuickSearchComboBox.currentIndex() == 1:
|
||||||
self.search_results = self.parent.biblemanager.get_verse_from_text(bible, text)
|
self.search_results = self.parent.biblemanager.get_verse_from_text(bible, text)
|
||||||
else:
|
else:
|
||||||
self.searchByReference(bible, text)
|
self.searchByReference(bible, text)
|
||||||
@ -322,7 +325,9 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.displayResults(bible)
|
self.displayResults(bible)
|
||||||
|
|
||||||
def onBiblePreviewClick(self):
|
def onBiblePreviewClick(self):
|
||||||
|
log.debug("Bible Preview Button pressed")
|
||||||
items = self.BibleListView.selectedItems()
|
items = self.BibleListView.selectedItems()
|
||||||
|
old_chapter = ''
|
||||||
for item in items:
|
for item in items:
|
||||||
text = str(item.text())
|
text = str(item.text())
|
||||||
verse = text[:text.find("(")]
|
verse = text[:text.find("(")]
|
||||||
@ -332,31 +337,32 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
chapter = str(self.search_results[0][1])
|
chapter = str(self.search_results[0][1])
|
||||||
verse = str(self.search_results[0][2])
|
verse = str(self.search_results[0][2])
|
||||||
text = self.search_results[0][3]
|
text = self.search_results[0][3]
|
||||||
o = self.SettingsOutputStyleComboBox.currentIndex()
|
if self.parent.bibles_tab.paragraph_style: #Paragraph
|
||||||
v = self.SettingsVerseStyleComboBox.currentIndex()
|
text = text + u'\n'
|
||||||
if o == 1: #Paragraph
|
if self.parent.bibles_tab.display_style == 1:
|
||||||
text = text + u"\n"
|
loc = self.formatVerse(old_chapter, chapter, verse, u'(', u')')
|
||||||
if v == 1: #Paragraph
|
elif self.parent.bibles_tab.display_style == 2:
|
||||||
loc = self._format_verse(chapter, verse, u"(", u")")
|
loc = self.formatVerse(old_chapter, chapter, verse, u'{', u'}')
|
||||||
elif v == 2: #Paragraph
|
elif self.parent.bibles_tab.display_style == 3:
|
||||||
loc = self._format_verse(chapter, verse, u"{", u"}")
|
loc = self.formatVerse(old_chapter, chapter, verse, u'[', u']')
|
||||||
elif v == 3: #Paragraph
|
|
||||||
loc = self._format_verse(chapter, verse, u"[", u"]")
|
|
||||||
else:
|
else:
|
||||||
loc = self._format_verse(chapter, verse, u"", u"")
|
loc = self.formatVerse(old_chapter, chapter, verse, u'', u'')
|
||||||
|
old_chapter = chapter
|
||||||
print book
|
print book
|
||||||
print loc
|
print loc
|
||||||
print text
|
print text
|
||||||
|
|
||||||
def formatVerse(self, chapter, verse, opening, closing):
|
def formatVerse(self, old_chapter, chapter, verse, opening, closing):
|
||||||
loc = opening
|
loc = opening
|
||||||
if self.SettingsNewChapterCheck.checkState() == 2:
|
if self.parent.bibles_tab.new_chapter_check:
|
||||||
loc += chapter + u':'
|
if old_chapter != chapter:
|
||||||
|
loc += chapter + u':'
|
||||||
loc += verse
|
loc += verse
|
||||||
loc += closing
|
loc += closing
|
||||||
return loc
|
return loc
|
||||||
|
|
||||||
def reloadBibles(self):
|
def reloadBibles(self):
|
||||||
|
log.debug("Reloading Bibles")
|
||||||
self.parent.biblemanager.reload_bibles()
|
self.parent.biblemanager.reload_bibles()
|
||||||
self.initialiseForm()
|
self.initialiseForm()
|
||||||
|
|
||||||
@ -405,6 +411,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.BibleListView.setRowHeight(row_count, 20)
|
self.BibleListView.setRowHeight(row_count, 20)
|
||||||
|
|
||||||
def searchByReference(self, bible, search):
|
def searchByReference(self, bible, search):
|
||||||
|
log.debug("searchByReference %s ,%s", bible, search)
|
||||||
book = ''
|
book = ''
|
||||||
start_chapter = ''
|
start_chapter = ''
|
||||||
end_chapter = ''
|
end_chapter = ''
|
||||||
@ -482,6 +489,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
int(start_chapter), int(end_chapter), int(start_verse),
|
int(start_chapter), int(end_chapter), int(start_verse),
|
||||||
int(end_verse))
|
int(end_verse))
|
||||||
else:
|
else:
|
||||||
reply = QtGui.QMessageBox.information(self.MediaManagerItem,
|
reply = QtGui.QMessageBox.information(self,
|
||||||
translate(u'BibleMediaItem', u'Information'),
|
translate(u'BibleMediaItem', u'Information'),
|
||||||
translate(u'BibleMediaItem', message))
|
translate(u'BibleMediaItem', message))
|
||||||
|
@ -118,7 +118,9 @@ class BiblesTab(SettingsTab):
|
|||||||
QtCore.QObject.connect(self.VerseRadioButton,
|
QtCore.QObject.connect(self.VerseRadioButton,
|
||||||
QtCore.SIGNAL("pressed()"), self.onVerseRadioButtonPressed)
|
QtCore.SIGNAL("pressed()"), self.onVerseRadioButtonPressed)
|
||||||
QtCore.QObject.connect(self.ParagraphRadioButton,
|
QtCore.QObject.connect(self.ParagraphRadioButton,
|
||||||
QtCore.SIGNAL("pressed()"), self.onParagraphRadioButtonPressed)
|
QtCore.SIGNAL("pressed()"), self.onParagraphRadioButtonPressed)
|
||||||
|
QtCore.QObject.connect(self.DisplayStyleComboBox,
|
||||||
|
QtCore.SIGNAL("activated(int)"), self.onDisplayStyleComboBoxChanged)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.VerseDisplayGroupBox.setTitle(translate('SettingsForm', 'Verse Display'))
|
self.VerseDisplayGroupBox.setTitle(translate('SettingsForm', 'Verse Display'))
|
||||||
@ -134,6 +136,9 @@ class BiblesTab(SettingsTab):
|
|||||||
self.BibleSearchGroupBox.setTitle(translate('SettingsForm', 'Search'))
|
self.BibleSearchGroupBox.setTitle(translate('SettingsForm', 'Search'))
|
||||||
self.BibleSearchCheckBox.setText(translate('SettingsForm', 'Search-as-you-type'))
|
self.BibleSearchCheckBox.setText(translate('SettingsForm', 'Search-as-you-type'))
|
||||||
|
|
||||||
|
def onDisplayStyleComboBoxChanged(self):
|
||||||
|
self.display_style = self.DisplayStyleComboBox.currentIndex()
|
||||||
|
|
||||||
def onVerseRadioButtonPressed(self):
|
def onVerseRadioButtonPressed(self):
|
||||||
self.paragraph_style = False
|
self.paragraph_style = False
|
||||||
|
|
||||||
@ -170,6 +175,6 @@ class BiblesTab(SettingsTab):
|
|||||||
def save(self):
|
def save(self):
|
||||||
self.config.set_config("paragraph style", str(self.paragraph_style))
|
self.config.set_config("paragraph style", str(self.paragraph_style))
|
||||||
self.config.set_config("display new chapter", str(self.new_chapter_check))
|
self.config.set_config("display new chapter", str(self.new_chapter_check))
|
||||||
self.config.set_config("display brackets", str(self.DisplayStyleComboBox.currentIndex()))
|
self.config.set_config("display brackets", str(self.display_style))
|
||||||
self.config.set_config("search as type", str(self.bible_search_check))
|
self.config.set_config("search as type", str(self.bible_search_check))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user