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)
|
log.debug(u'format_slide %s', words)
|
||||||
verses = []
|
verses = []
|
||||||
verses_text = words.splitlines()
|
verses_text = words.split(u'\n\n')
|
||||||
for verse in verses_text:
|
for verse in verses_text:
|
||||||
lines = verse.split(u'\n')
|
lines = verse.split(u'\n')
|
||||||
verses.append(self.split_set_of_lines(lines, footer)[0])
|
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.calculate_default(self.screen_list[self.current_display]['size'])
|
||||||
self.build_text_rectangle(self.themedata)
|
self.build_text_rectangle(self.themedata)
|
||||||
self.renderer.set_frame_dest(self.width, self.height)
|
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):
|
def generate_slide(self,main_text, footer_text):
|
||||||
log.debug(u'generate slide')
|
log.debug(u'generate slide')
|
||||||
|
@ -47,7 +47,7 @@ class ServiceItem():
|
|||||||
self.frames = []
|
self.frames = []
|
||||||
self.raw_footer = None
|
self.raw_footer = None
|
||||||
self.theme = 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):
|
def addIcon(self, icon):
|
||||||
self.iconic_representation = buildIcon(icon)
|
self.iconic_representation = buildIcon(icon)
|
||||||
|
@ -198,6 +198,7 @@ class BiblesTab(SettingsTab):
|
|||||||
self.BibleThemeComboBox.setCurrentIndex(self.bible_theme)
|
self.BibleThemeComboBox.setCurrentIndex(self.bible_theme)
|
||||||
else:
|
else:
|
||||||
pass # TODO need to code
|
pass # TODO need to code
|
||||||
|
self.bible_theme = None
|
||||||
|
|
||||||
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))
|
||||||
|
@ -369,13 +369,14 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
def generateSlideData(self, service_item):
|
def generateSlideData(self, service_item):
|
||||||
log.debug(u'Bible Preview Button pressed')
|
log.debug(u'Bible Preview Button pressed')
|
||||||
items = self.BibleListView.selectedIndexes()
|
items = self.BibleListView.selectedIndexes()
|
||||||
old_chapter = ''
|
old_chapter = u''
|
||||||
raw_slides=[]
|
raw_slides=[]
|
||||||
raw_footer = []
|
raw_footer = []
|
||||||
|
bible_text = u''
|
||||||
for item in items:
|
for item in items:
|
||||||
text = self.BibleListData.getValue(item)
|
text = self.BibleListData.getValue(item)
|
||||||
verse = text[:text.find("(")]
|
verse = text[:text.find(u'(')]
|
||||||
bible = text[text.find("(") + 1:text.find(")")]
|
bible = text[text.find(u'(') + 1:text.find(u')')]
|
||||||
self.searchByReference(bible, verse)
|
self.searchByReference(bible, verse)
|
||||||
book = self.search_results[0][0]
|
book = self.search_results[0][0]
|
||||||
chapter = str(self.search_results[0][1])
|
chapter = str(self.search_results[0][1])
|
||||||
@ -392,15 +393,15 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
else:
|
else:
|
||||||
loc = self.formatVerse(old_chapter, chapter, verse, u'', u'')
|
loc = self.formatVerse(old_chapter, chapter, verse, u'', u'')
|
||||||
old_chapter = chapter
|
old_chapter = chapter
|
||||||
raw_slides.append(loc + u' '+text)
|
bible_text = bible_text + u' '+ loc + u' '+ text
|
||||||
service_item.title = book + u' ' + loc
|
service_item.title = book + u' ' + loc
|
||||||
if len(raw_footer) <= 1:
|
if len(raw_footer) <= 1:
|
||||||
raw_footer.append(book)
|
raw_footer.append(book)
|
||||||
|
|
||||||
if len(raw_slides) > 0:
|
service_item.theme = self.parent.bibles_tab.bible_theme
|
||||||
service_item.theme = None
|
raw_slides.append(bible_text)
|
||||||
service_item.raw_slides = raw_slides
|
service_item.raw_slides = raw_slides
|
||||||
service_item.raw_footer = raw_footer
|
service_item.raw_footer = raw_footer
|
||||||
|
|
||||||
def formatVerse(self, old_chapter, chapter, verse, opening, closing):
|
def formatVerse(self, old_chapter, chapter, verse, opening, closing):
|
||||||
loc = opening
|
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
|
import logging
|
||||||
|
|
||||||
from PyQt4.QtCore import *
|
from PyQt4.QtCore import *
|
||||||
@ -6,7 +25,7 @@ from PyQt4.QtGui import *
|
|||||||
|
|
||||||
class TextListData(QAbstractListModel):
|
class TextListData(QAbstractListModel):
|
||||||
"""
|
"""
|
||||||
An abstract list of strings
|
An abstract list of strings
|
||||||
"""
|
"""
|
||||||
global log
|
global log
|
||||||
log=logging.getLogger(u'TextListData')
|
log=logging.getLogger(u'TextListData')
|
||||||
@ -14,18 +33,18 @@ class TextListData(QAbstractListModel):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
QAbstractListModel.__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):
|
def resetStore(self):
|
||||||
#reset list so can be reloaded
|
#reset list so can be reloaded
|
||||||
self.items=[]
|
self.items = []
|
||||||
|
|
||||||
def rowCount(self, parent):
|
def rowCount(self, parent):
|
||||||
return len(self.items)
|
return len(self.items)
|
||||||
|
|
||||||
def insertRow(self, row, id, title):
|
def insertRow(self, row, id, title):
|
||||||
self.beginInsertRows(QModelIndex(),row,row)
|
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.items.insert(row, (id, title))
|
||||||
self.endInsertRows()
|
self.endInsertRows()
|
||||||
|
|
||||||
@ -36,18 +55,15 @@ class TextListData(QAbstractListModel):
|
|||||||
|
|
||||||
def addRow(self, id, title):
|
def addRow(self, id, title):
|
||||||
self.insertRow(len(self.items), id, title)
|
self.insertRow(len(self.items), id, title)
|
||||||
|
|
||||||
def data(self, index, role):
|
def data(self, index, role):
|
||||||
row=index.row()
|
row=index.row()
|
||||||
if row > len(self.items): # if the last row is selected and deleted, we then get called with an empty row!
|
if row > len(self.items): # if the last row is selected and deleted, we then get called with an empty row!
|
||||||
return QVariant()
|
return QVariant()
|
||||||
if role==Qt.DisplayRole:
|
if role == Qt.DisplayRole:
|
||||||
retval= self.items[row][1]
|
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]
|
|
||||||
else:
|
else:
|
||||||
retval= QVariant()
|
retval = QVariant()
|
||||||
# log.info("Returning"+ str(retval))
|
|
||||||
if type(retval) is not type(QVariant):
|
if type(retval) is not type(QVariant):
|
||||||
return QVariant(retval)
|
return QVariant(retval)
|
||||||
else:
|
else:
|
||||||
@ -60,10 +76,7 @@ class TextListData(QAbstractListModel):
|
|||||||
def getValue(self, index):
|
def getValue(self, index):
|
||||||
row = index.row()
|
row = index.row()
|
||||||
return self.items[row][1]
|
return self.items[row][1]
|
||||||
|
|
||||||
def deleteRow(self, index):
|
def deleteRow(self, index):
|
||||||
row = index.row()
|
row = index.row()
|
||||||
self.removeRow(row)
|
self.removeRow(row)
|
||||||
|
|
||||||
if __name__=="__main__":
|
|
||||||
sxml=TextListData()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user