forked from openlp/openlp
commit
db02cd55ee
@ -48,6 +48,7 @@ class ServiceItem():
|
||||
self.raw_footer = None
|
||||
self.theme = None
|
||||
log.debug(u'Service item created for %s ', self.shortname)
|
||||
self.service_frames = []
|
||||
|
||||
def addIcon(self, icon):
|
||||
self.iconic_representation = buildIcon(icon)
|
||||
@ -62,23 +63,35 @@ class ServiceItem():
|
||||
else:
|
||||
self.plugin.render_manager.set_override_theme(self.theme)
|
||||
log.debug(u'Formatting slides')
|
||||
if len(self.frames) == 0 and len(self.raw_slides) > 0 :
|
||||
for slide in self.raw_slides:
|
||||
formated = self.plugin.render_manager.format_slide(slide)
|
||||
if self.service_item_type == u'text':
|
||||
for slide in self.service_frames:
|
||||
formated = self.plugin.render_manager.format_slide(slide[u'raw_slide'])
|
||||
for format in formated:
|
||||
frame = self.plugin.render_manager.generate_slide(format, self.raw_footer)
|
||||
self.frames.append({u'title': format, u'image': frame})
|
||||
self.frames.append({u'title': slide[u'title'], u'image': frame})
|
||||
elif self.service_item_type == u'command':
|
||||
self.frames = self.service_frames
|
||||
self.service_frames = []
|
||||
elif self.service_item_type == u'image':
|
||||
self.frames = self.service_frames
|
||||
self.service_frames = []
|
||||
else:
|
||||
if len(self.command_files) > 0:
|
||||
pass
|
||||
assert(0 , u'Invalid value rendere :%s' % self.service_item_type)
|
||||
|
||||
def add_from_image(self, frame_title, image):
|
||||
self.service_item_type = u'image'
|
||||
self.service_frames.append({u'title': frame_title, u'image': image})
|
||||
|
||||
def add_from_text(self, frame_title, raw_slide):
|
||||
self.service_item_type = u'text'
|
||||
frame_title = frame_title.split(u'\n')[0]
|
||||
self.service_frames.append({u'title': frame_title, u'raw_slide': raw_slide})
|
||||
|
||||
def add_from_command(self, frame_title, command):
|
||||
self.service_item_type = u'command'
|
||||
self.service_frames.append({u'title': frame_title, u'command': command})
|
||||
|
||||
|
||||
def get_parent_node(self):
|
||||
"""
|
||||
This method returns a parent node to be inserted into the Service
|
||||
Manager. At the moment this has to be a QAbstractListModel based class
|
||||
"""
|
||||
pass
|
||||
|
||||
def get_oos_repr(self):
|
||||
"""
|
||||
|
@ -140,8 +140,8 @@ class ServiceManager(QtGui.QWidget):
|
||||
count = 0
|
||||
for frame in item.frames:
|
||||
treewidgetitem1 = QtGui.QTreeWidgetItem(treewidgetitem)
|
||||
text = frame[u'title'][0]
|
||||
treewidgetitem1.setText(0,text[:30])
|
||||
text = frame[u'title']
|
||||
treewidgetitem1.setText(0,text[:40])
|
||||
treewidgetitem1.setData(0, QtCore.Qt.UserRole,QtCore.QVariant(count))
|
||||
count = count + 1
|
||||
|
||||
|
@ -309,7 +309,13 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
Loads a ServiceManagerItem.
|
||||
"""
|
||||
self.addServiceItem(serviceitem)
|
||||
log.debug(u'add Service Manager Item')
|
||||
self.PreviewListData.clear()
|
||||
self.serviceitem = serviceitem
|
||||
framenumber = 0
|
||||
for frame in self.serviceitem.frames:
|
||||
self.PreviewListData.addRow(frame[u'image'], framenumber)
|
||||
framenumber += 1
|
||||
row = self.PreviewListData.createIndex(slideno, 0)
|
||||
if row.isValid():
|
||||
self.PreviewListView.selectionModel().setCurrentIndex(row,
|
||||
|
@ -397,7 +397,8 @@ class BibleMediaItem(MediaManagerItem):
|
||||
else:
|
||||
service_item.theme = self.parent.bibles_tab.bible_theme
|
||||
raw_slides.append(bible_text)
|
||||
service_item.raw_slides = raw_slides
|
||||
for slide in raw_slides:
|
||||
service_item.add_from_text(slide[:30], slide)
|
||||
service_item.raw_footer = raw_footer
|
||||
|
||||
def formatVerse(self, old_chapter, chapter, verse, opening, closing):
|
||||
|
@ -248,5 +248,6 @@ class CustomMediaItem(MediaManagerItem):
|
||||
raw_footer.append(title + u' '+ credit)
|
||||
if theme is not None:
|
||||
service_item.title = title
|
||||
service_item.raw_slides = raw_slides
|
||||
for slide in raw_slides:
|
||||
service_item.add_from_text(slide[:30], slide)
|
||||
service_item.raw_footer = raw_footer
|
||||
|
@ -150,10 +150,12 @@ class ImageMediaItem(MediaManagerItem):
|
||||
|
||||
def generateSlideData(self, service_item):
|
||||
indexes = self.ImageListView.selectedIndexes()
|
||||
service_item.title = u'Images'
|
||||
for index in indexes:
|
||||
filename = self.ImageListData.getFilename(index)
|
||||
frame = QtGui.QPixmap(str(filename))
|
||||
service_item.frames.append({u'title': filename , u'image': frame})
|
||||
(path, name) =os.path.split(filename)
|
||||
service_item.add_from_image(name, frame)
|
||||
|
||||
def onImagePreviewClick(self):
|
||||
log.debug(u'Image Preview Requested')
|
||||
|
@ -168,7 +168,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.onSongLiveClick))
|
||||
self.SongListView.addAction(self.contextMenuAction(self.SongListView,
|
||||
':/system/system_add.png', translate('SongMediaItem', u'&Add to Service'),
|
||||
self.onSongEditClick))
|
||||
self.onSongAddClick))
|
||||
|
||||
def retranslateUi(self):
|
||||
self.SearchTypeLabel.setText(translate('SongMediaItem', u'Search Type:'))
|
||||
@ -258,9 +258,8 @@ class SongMediaItem(MediaManagerItem):
|
||||
else:
|
||||
service_item.theme = song.theme_name
|
||||
verses = song.lyrics.split(u'\n\n')
|
||||
for verse in verses:
|
||||
raw_slides.append(verse)
|
||||
service_item.raw_slides = raw_slides
|
||||
for slide in verses:
|
||||
service_item.add_from_text(slide[:30], slide)
|
||||
service_item.title = song.title
|
||||
raw_footer.append(str(u'%s \n%s \n' % (song.title, song.copyright )))
|
||||
raw_footer.append(song.copyright)
|
||||
|
Loading…
Reference in New Issue
Block a user