forked from openlp/openlp
tweaks and cleanups
This commit is contained in:
parent
444a219a20
commit
e6f0fde98d
@ -463,6 +463,9 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.displayResults(bible, bible2)
|
||||
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
'''
|
||||
Generates and formats the slides for the service item.
|
||||
'''
|
||||
log.debug(u'generating slide data')
|
||||
items = self.listView.selectedIndexes()
|
||||
if len(items) == 0:
|
||||
@ -480,14 +483,14 @@ class BibleMediaItem(MediaManagerItem):
|
||||
reference = bitem.data(QtCore.Qt.UserRole)
|
||||
if isinstance(reference, QtCore.QVariant):
|
||||
reference = reference.toPyObject()
|
||||
#bible = self._decodeQtObject(reference, 'bible')
|
||||
book = self._decodeQtObject(reference, 'book')
|
||||
chapter = self._decodeQtObject(reference, 'chapter')
|
||||
verse = self._decodeQtObject(reference, 'verse')
|
||||
text = self._decodeQtObject(reference, 'text')
|
||||
#bible = self._decodeQtObject(reference, 'bible')
|
||||
version = self._decodeQtObject(reference, 'version')
|
||||
copyright = self._decodeQtObject(reference, 'copyright')
|
||||
#permission = self._decodeQtObject(reference, 'permission')
|
||||
text = self._decodeQtObject(reference, 'text')
|
||||
bible2 = self._decodeQtObject(reference, 'bible2')
|
||||
if bible2:
|
||||
bible2_version = self._decodeQtObject(reference,
|
||||
@ -496,7 +499,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
'bible2_copyright')
|
||||
#bible2_permission = self._decodeQtObject(reference,
|
||||
# 'bible2_permission')
|
||||
text2 = self._decodeQtObject(reference, 'text2')
|
||||
bible2_text = self._decodeQtObject(reference, 'bible2_text')
|
||||
if self.parent.settings_tab.display_style == 1:
|
||||
verse_text = self.formatVerse(old_chapter, chapter, verse,
|
||||
u'(', u')')
|
||||
@ -521,7 +524,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
if footer not in raw_footer:
|
||||
raw_footer.append(footer)
|
||||
bible_text = u'%s %s \n\n %s %s' % (verse_text, text,
|
||||
verse_text, text2)
|
||||
verse_text, bible2_text)
|
||||
raw_slides.append(bible_text)
|
||||
bible_text = u''
|
||||
else:
|
||||
@ -533,14 +536,16 @@ class BibleMediaItem(MediaManagerItem):
|
||||
if self.parent.settings_tab.layout_style == 0:
|
||||
raw_slides.append(bible_text)
|
||||
bible_text = u''
|
||||
# if we are verse per slide we have already been added
|
||||
if self.parent.settings_tab.layout_style != 0 and not bible2:
|
||||
raw_slides.append(bible_text)
|
||||
# service item title
|
||||
if not service_item.title:
|
||||
if bible2:
|
||||
service_item.title = u'%s (%s, %s) %s' % (book, version,
|
||||
bible2_version, verse_text)
|
||||
else:
|
||||
service_item.title = u'%s (%s) %s' % (book, version,
|
||||
verse_text)
|
||||
service_item.title = u'%s (%s) %s' % (book, version, verse_text)
|
||||
elif service_item.title.find(translate('BiblesPlugin.MediaItem',
|
||||
'etc')) == -1:
|
||||
service_item.title = u'%s, %s' % (service_item.title,
|
||||
@ -550,14 +555,11 @@ class BibleMediaItem(MediaManagerItem):
|
||||
service_item.theme = None
|
||||
else:
|
||||
service_item.theme = self.parent.settings_tab.bible_theme
|
||||
# if we are verse per slide we have already been added
|
||||
if self.parent.settings_tab.layout_style != 0 and not bible2:
|
||||
raw_slides.append(bible_text)
|
||||
for slide in raw_slides:
|
||||
service_item.add_from_text(slide[:30], slide)
|
||||
if service_item.raw_footer:
|
||||
for foot in raw_footer:
|
||||
service_item.raw_footer.append(foot)
|
||||
for footer in raw_footer:
|
||||
service_item.raw_footer.append(footer)
|
||||
else:
|
||||
service_item.raw_footer = raw_footer
|
||||
return True
|
||||
@ -589,8 +591,8 @@ class BibleMediaItem(MediaManagerItem):
|
||||
row, QtCore.QVariant(book[u'chapters']))
|
||||
if first:
|
||||
first = False
|
||||
self.initialiseChapterVerse(
|
||||
bible, book[u'name'], book[u'chapters'])
|
||||
self.initialiseChapterVerse(bible, book[u'name'],
|
||||
book[u'chapters'])
|
||||
|
||||
def initialiseChapterVerse(self, bible, book, chapters):
|
||||
log.debug(u'initialiseChapterVerse %s, %s', bible, book)
|
||||
@ -598,8 +600,8 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.verses = self.parent.manager.get_verse_count(bible, book, 1)
|
||||
if self.verses == 0:
|
||||
self.AdvancedSearchButton.setEnabled(False)
|
||||
self.AdvancedMessage.setText(
|
||||
translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.'))
|
||||
self.AdvancedMessage.setText(translate('BiblesPlugin.MediaItem',
|
||||
'Bible not fully loaded.'))
|
||||
else:
|
||||
self.AdvancedSearchButton.setEnabled(True)
|
||||
self.AdvancedMessage.setText(u'')
|
||||
@ -615,6 +617,10 @@ class BibleMediaItem(MediaManagerItem):
|
||||
combo.addItem(unicode(i))
|
||||
|
||||
def displayResults(self, bible, bible2=None):
|
||||
'''
|
||||
Displays the search results in the media manager. All data needed for further
|
||||
action is saved for/in each row.
|
||||
'''
|
||||
version = self.parent.manager.get_meta_data(bible, u'Version')
|
||||
copyright = self.parent.manager.get_meta_data(bible, u'Copyright')
|
||||
permission = self.parent.manager.get_meta_data(bible, u'Permissions')
|
||||
@ -634,36 +640,38 @@ class BibleMediaItem(MediaManagerItem):
|
||||
for count, verse in enumerate(self.search_results):
|
||||
if bible2:
|
||||
vdict = {
|
||||
'bible': QtCore.QVariant(bible),
|
||||
'version': QtCore.QVariant(version.value),
|
||||
'copyright': QtCore.QVariant(copyright.value),
|
||||
#'permission': QtCore.QVariant(permission.value),
|
||||
'bible2': QtCore.QVariant(bible2),
|
||||
'bible2_version': QtCore.QVariant(bible2_version.value),
|
||||
'bible2_copyright': QtCore.QVariant(bible2_copyright.value),
|
||||
#'bible2_permission': QtCore.QVariant(bible2_permission),
|
||||
'book': QtCore.QVariant(verse.book.name),
|
||||
'chapter': QtCore.QVariant(verse.chapter),
|
||||
'verse': QtCore.QVariant(verse.verse),
|
||||
'text': QtCore.QVariant(verse.text),
|
||||
'text2': QtCore.QVariant(self.search_results2[count].text)
|
||||
'book':QtCore.QVariant(verse.book.name),
|
||||
'chapter':QtCore.QVariant(verse.chapter),
|
||||
'verse':QtCore.QVariant(verse.verse),
|
||||
#'bible':QtCore.QVariant(bible),
|
||||
'version':QtCore.QVariant(version.value),
|
||||
'copyright':QtCore.QVariant(copyright.value),
|
||||
#'permission':QtCore.QVariant(permission.value),
|
||||
'text':QtCore.QVariant(verse.text),
|
||||
'bible2':QtCore.QVariant(bible2),
|
||||
'bible2_version':QtCore.QVariant(bible2_version.value),
|
||||
'bible2_copyright':QtCore.QVariant(bible2_copyright.value),
|
||||
#'bible2_permission':QtCore.QVariant(bible2_permission),
|
||||
'bible2_text':QtCore.QVariant(
|
||||
self.search_results2[count].text)
|
||||
}
|
||||
bible_text = u' %s %d:%d (%s, %s)' % (verse.book.name,
|
||||
verse.chapter, verse.verse, version.value, bible2_version.value)
|
||||
else:
|
||||
vdict = {
|
||||
'bible': QtCore.QVariant(bible),
|
||||
'version': QtCore.QVariant(version.value),
|
||||
'copyright': QtCore.QVariant(copyright.value),
|
||||
#'permission': QtCore.QVariant(permission.value),
|
||||
'bible2': QtCore.QVariant(bible2),
|
||||
'book': QtCore.QVariant(verse.book.name),
|
||||
'chapter': QtCore.QVariant(verse.chapter),
|
||||
'verse': QtCore.QVariant(verse.verse),
|
||||
'text': QtCore.QVariant(verse.text)
|
||||
#'bible': QtCore.QVariant(bible),
|
||||
'version': QtCore.QVariant(version.value),
|
||||
'copyright': QtCore.QVariant(copyright.value),
|
||||
#'permission': QtCore.QVariant(permission.value),
|
||||
'text': QtCore.QVariant(verse.text),
|
||||
'bible2': QtCore.QVariant(bible2)
|
||||
}
|
||||
bible_text = u' %s %d:%d (%s)' % (verse.book.name,
|
||||
verse.chapter, verse.verse, version.value)
|
||||
# set the row title
|
||||
bible_verse = QtGui.QListWidgetItem(bible_text)
|
||||
#bible_verse.setData(QtCore.Qt.UserRole,
|
||||
# QtCore.QVariant(bible_text))
|
||||
@ -672,3 +680,5 @@ class BibleMediaItem(MediaManagerItem):
|
||||
row = self.listView.setCurrentRow(count + start_count)
|
||||
if row:
|
||||
row.setSelected(True)
|
||||
self.search_results = {}
|
||||
self.search_results2 = {}
|
||||
|
Loading…
Reference in New Issue
Block a user