forked from openlp/openlp
Corrections to Renderer to handle slides not lines
Fixes to Bibleplugin to renderer multiple verses per slide Pass Bible Theme to RenderManager
This commit is contained in:
parent
df0fd5b618
commit
a5615fd4fe
@ -118,7 +118,7 @@ class Renderer:
|
||||
"""
|
||||
log.debug(u'format_slide %s', words)
|
||||
verses = []
|
||||
verses_text = words.splitlines()
|
||||
verses_text = words.split(u'\n\n')
|
||||
for verse in verses_text:
|
||||
lines = verse.split(u'\n')
|
||||
verses.append(self.split_set_of_lines(lines, footer)[0])
|
||||
|
@ -123,7 +123,7 @@ class RenderManager:
|
||||
self.calculate_default(self.screen_list[self.current_display]['size'])
|
||||
self.build_text_rectangle(self.themedata)
|
||||
self.renderer.set_frame_dest(self.width, self.height)
|
||||
return self.renderer.format_slide(words, footer)
|
||||
return self.renderer.format_slide(words, False)
|
||||
|
||||
def generate_slide(self,main_text, footer_text):
|
||||
log.debug(u'generate slide')
|
||||
|
@ -47,7 +47,7 @@ class ServiceItem():
|
||||
self.frames = []
|
||||
self.raw_footer = None
|
||||
self.theme = None
|
||||
log.debug(u'Service item created for %s', self.shortname)
|
||||
log.debug(u'Service item created for %s ', self.shortname)
|
||||
|
||||
def addIcon(self, icon):
|
||||
self.iconic_representation = buildIcon(icon)
|
||||
|
@ -198,6 +198,7 @@ class BiblesTab(SettingsTab):
|
||||
self.BibleThemeComboBox.setCurrentIndex(self.bible_theme)
|
||||
else:
|
||||
pass # TODO need to code
|
||||
self.bible_theme = None
|
||||
|
||||
def save(self):
|
||||
self.config.set_config("paragraph style", str(self.paragraph_style))
|
||||
|
@ -369,13 +369,14 @@ class BibleMediaItem(MediaManagerItem):
|
||||
def generateSlideData(self, service_item):
|
||||
log.debug(u'Bible Preview Button pressed')
|
||||
items = self.BibleListView.selectedIndexes()
|
||||
old_chapter = ''
|
||||
old_chapter = u''
|
||||
raw_slides=[]
|
||||
raw_footer = []
|
||||
bible_text = u''
|
||||
for item in items:
|
||||
text = self.BibleListData.getValue(item)
|
||||
verse = text[:text.find("(")]
|
||||
bible = text[text.find("(") + 1:text.find(")")]
|
||||
verse = text[:text.find(u'(')]
|
||||
bible = text[text.find(u'(') + 1:text.find(u')')]
|
||||
self.searchByReference(bible, verse)
|
||||
book = self.search_results[0][0]
|
||||
chapter = str(self.search_results[0][1])
|
||||
@ -392,15 +393,15 @@ class BibleMediaItem(MediaManagerItem):
|
||||
else:
|
||||
loc = self.formatVerse(old_chapter, chapter, verse, u'', u'')
|
||||
old_chapter = chapter
|
||||
raw_slides.append(loc + u' '+text)
|
||||
bible_text = bible_text + u' '+ loc + u' '+ text
|
||||
service_item.title = book + u' ' + loc
|
||||
if len(raw_footer) <= 1:
|
||||
raw_footer.append(book)
|
||||
|
||||
if len(raw_slides) > 0:
|
||||
service_item.theme = None
|
||||
service_item.raw_slides = raw_slides
|
||||
service_item.raw_footer = raw_footer
|
||||
service_item.theme = self.parent.bibles_tab.bible_theme
|
||||
raw_slides.append(bible_text)
|
||||
service_item.raw_slides = raw_slides
|
||||
service_item.raw_footer = raw_footer
|
||||
|
||||
def formatVerse(self, old_chapter, chapter, verse, opening, closing):
|
||||
loc = opening
|
||||
|
@ -1,3 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
"""
|
||||
OpenLP - Open Source Lyrics Projection
|
||||
Copyright (c) 2008 Raoul Snyman
|
||||
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
|
||||
|
||||
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
|
||||
Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
import logging
|
||||
|
||||
from PyQt4.QtCore import *
|
||||
@ -6,7 +25,7 @@ from PyQt4.QtGui import *
|
||||
|
||||
class TextListData(QAbstractListModel):
|
||||
"""
|
||||
An abstract list of strings
|
||||
An abstract list of strings
|
||||
"""
|
||||
global log
|
||||
log=logging.getLogger(u'TextListData')
|
||||
@ -14,18 +33,18 @@ class TextListData(QAbstractListModel):
|
||||
|
||||
def __init__(self):
|
||||
QAbstractListModel.__init__(self)
|
||||
self.items=[] # will be a list of (database id , title) tuples
|
||||
self.items = [] # will be a list of (database id , title) tuples
|
||||
|
||||
def resetStore(self):
|
||||
#reset list so can be reloaded
|
||||
self.items=[]
|
||||
|
||||
self.items = []
|
||||
|
||||
def rowCount(self, parent):
|
||||
return len(self.items)
|
||||
|
||||
def insertRow(self, row, id, title):
|
||||
self.beginInsertRows(QModelIndex(),row,row)
|
||||
log.debug("insert row %d:%s for id %d"%(row,title, id))
|
||||
log.debug(u'insert row %d:%s for id %d'%(row,title, id))
|
||||
self.items.insert(row, (id, title))
|
||||
self.endInsertRows()
|
||||
|
||||
@ -36,18 +55,15 @@ class TextListData(QAbstractListModel):
|
||||
|
||||
def addRow(self, id, title):
|
||||
self.insertRow(len(self.items), id, title)
|
||||
|
||||
|
||||
def data(self, index, role):
|
||||
row=index.row()
|
||||
if row > len(self.items): # if the last row is selected and deleted, we then get called with an empty row!
|
||||
return QVariant()
|
||||
if role==Qt.DisplayRole:
|
||||
retval= self.items[row][1]
|
||||
# elif role == Qt.ToolTipRole: #not sure if need as it shows the database row number
|
||||
# retval= self.items[row][0]
|
||||
if role == Qt.DisplayRole:
|
||||
retval = self.items[row][1]
|
||||
else:
|
||||
retval= QVariant()
|
||||
# log.info("Returning"+ str(retval))
|
||||
retval = QVariant()
|
||||
if type(retval) is not type(QVariant):
|
||||
return QVariant(retval)
|
||||
else:
|
||||
@ -60,10 +76,7 @@ class TextListData(QAbstractListModel):
|
||||
def getValue(self, index):
|
||||
row = index.row()
|
||||
return self.items[row][1]
|
||||
|
||||
|
||||
def deleteRow(self, index):
|
||||
row = index.row()
|
||||
self.removeRow(row)
|
||||
|
||||
if __name__=="__main__":
|
||||
sxml=TextListData()
|
||||
|
Loading…
Reference in New Issue
Block a user