openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00093
[Merge] lp:~trb143/openlp/servicing into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/servicing into lp:openlp.
Requested reviews:
openlp.org Core (openlp-core)
Fix up serviceitem interface
--
https://code.launchpad.net/~trb143/openlp/servicing/+merge/7119
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2009-06-04 16:14:10 +0000
+++ openlp/core/lib/serviceitem.py 2009-06-05 19:00:57 +0000
@@ -48,6 +48,7 @@
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 @@
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
-
-
- 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
+ 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_oos_repr(self):
"""
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2009-06-04 16:14:10 +0000
+++ openlp/core/ui/servicemanager.py 2009-06-05 19:00:57 +0000
@@ -140,8 +140,8 @@
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
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2009-06-04 19:00:41 +0000
+++ openlp/core/ui/slidecontroller.py 2009-06-05 19:00:57 +0000
@@ -291,7 +291,7 @@
"""
Loads a ServiceItem.
"""
- log.debug(u'addServiceItem')
+ log.debug(u'add Service Item')
self.serviceitem = serviceitem
self.serviceitem.render()
self.PreviewListData.clear()
@@ -309,7 +309,13 @@
"""
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,
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2009-06-05 05:00:26 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2009-06-05 19:00:57 +0000
@@ -397,7 +397,8 @@
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):
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2009-06-03 15:38:14 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2009-06-05 19:00:57 +0000
@@ -248,5 +248,6 @@
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
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2009-06-01 17:50:37 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2009-06-05 19:00:57 +0000
@@ -150,10 +150,12 @@
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')
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2009-06-03 16:14:56 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2009-06-05 19:00:57 +0000
@@ -168,7 +168,7 @@
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 @@
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)
Follow ups