forked from openlp/openlp
ServiceItem cleanup - sort out name format errors
This commit is contained in:
parent
0aca1665be
commit
b1766d7ee4
@ -67,7 +67,7 @@ class ServiceItem(object):
|
|||||||
self.theme = None
|
self.theme = None
|
||||||
self.service_item_path = None
|
self.service_item_path = None
|
||||||
self.service_item_type = None
|
self.service_item_type = None
|
||||||
self.editEnabled = False
|
self.edit_enabled = False
|
||||||
self._raw_frames = []
|
self._raw_frames = []
|
||||||
self._display_frames = []
|
self._display_frames = []
|
||||||
self._uuid = unicode(uuid.uuid1())
|
self._uuid = unicode(uuid.uuid1())
|
||||||
@ -262,22 +262,22 @@ class ServiceItem(object):
|
|||||||
"""
|
"""
|
||||||
return self._uuid != other._uuid
|
return self._uuid != other._uuid
|
||||||
|
|
||||||
def isSong(self):
|
def is_song(self):
|
||||||
return self.name == u'Songs'
|
return self.name == u'Songs'
|
||||||
|
|
||||||
def isMedia(self):
|
def is_media(self):
|
||||||
return self.name.lower() == u'media'
|
return self.name.lower() == u'media'
|
||||||
|
|
||||||
def isCommand(self):
|
def is_command(self):
|
||||||
return self.service_item_type == ServiceItemType.Command
|
return self.service_item_type == ServiceItemType.Command
|
||||||
|
|
||||||
def isImage(self):
|
def is_image(self):
|
||||||
return self.service_item_type == ServiceItemType.Image
|
return self.service_item_type == ServiceItemType.Image
|
||||||
|
|
||||||
def isText(self):
|
def is_text(self):
|
||||||
return self.service_item_type == ServiceItemType.Text
|
return self.service_item_type == ServiceItemType.Text
|
||||||
|
|
||||||
def getFrames(self):
|
def get_frames(self):
|
||||||
if self.service_item_type == ServiceItemType.Text:
|
if self.service_item_type == ServiceItemType.Text:
|
||||||
return self._display_frames
|
return self._display_frames
|
||||||
else:
|
else:
|
||||||
|
@ -48,7 +48,7 @@ class ServiceManagerList(QtGui.QTreeWidget):
|
|||||||
# else:
|
# else:
|
||||||
# pos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
# pos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||||
# serviceItem = self.parent.serviceItems[pos - 1]
|
# serviceItem = self.parent.serviceItems[pos - 1]
|
||||||
# if serviceItem[u'data'].editEnabled:
|
# if serviceItem[u'data'].edit_enabled:
|
||||||
# self.parent.editAction.setVisible(True)
|
# self.parent.editAction.setVisible(True)
|
||||||
# else:
|
# else:
|
||||||
# self.parent.editAction.setVisible(False)
|
# self.parent.editAction.setVisible(False)
|
||||||
@ -395,7 +395,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
treewidgetitem.setData(0, QtCore.Qt.UserRole,
|
treewidgetitem.setData(0, QtCore.Qt.UserRole,
|
||||||
QtCore.QVariant(item[u'order']))
|
QtCore.QVariant(item[u'order']))
|
||||||
treewidgetitem.setExpanded(item[u'expanded'])
|
treewidgetitem.setExpanded(item[u'expanded'])
|
||||||
for count, frame in enumerate(serviceitem.getFrames()):
|
for count, frame in enumerate(serviceitem.get_frames()):
|
||||||
treewidgetitem1 = QtGui.QTreeWidgetItem(treewidgetitem)
|
treewidgetitem1 = QtGui.QTreeWidgetItem(treewidgetitem)
|
||||||
text = frame[u'title']
|
text = frame[u'title']
|
||||||
treewidgetitem1.setText(0,text[:40])
|
treewidgetitem1.setText(0,text[:40])
|
||||||
@ -597,7 +597,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
Posts a remote edit message to a plugin to allow item to be edited.
|
Posts a remote edit message to a plugin to allow item to be edited.
|
||||||
"""
|
"""
|
||||||
item, count = self.findServiceItem()
|
item, count = self.findServiceItem()
|
||||||
if self.serviceItems[item][u'service_item'].editEnabled:
|
if self.serviceItems[item][u'service_item'].edit_enabled:
|
||||||
self.remoteEditTriggered = True
|
self.remoteEditTriggered = True
|
||||||
Receiver().send_message(u'%s_edit' % self.serviceItems[item][u'service_item'].name, u'L:%s' %
|
Receiver().send_message(u'%s_edit' % self.serviceItems[item][u'service_item'].name, u'L:%s' %
|
||||||
self.serviceItems[item][u'service_item'].editId )
|
self.serviceItems[item][u'service_item'].editId )
|
||||||
|
@ -345,9 +345,9 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.Songbar.setVisible(False)
|
self.Songbar.setVisible(False)
|
||||||
self.Mediabar.setVisible(False)
|
self.Mediabar.setVisible(False)
|
||||||
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||||
if item.isText():
|
if item.is_text():
|
||||||
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||||
if item.isSong() and \
|
if item.is_song() and \
|
||||||
str_to_bool(self.songsconfig.get_config(u'display songbar', True)):
|
str_to_bool(self.songsconfig.get_config(u'display songbar', True)):
|
||||||
for action in self.Songbar.actions:
|
for action in self.Songbar.actions:
|
||||||
self.Songbar.actions[action].setVisible(False)
|
self.Songbar.actions[action].setVisible(False)
|
||||||
@ -362,11 +362,11 @@ class SlideController(QtGui.QWidget):
|
|||||||
#More than 20 verses hard luck
|
#More than 20 verses hard luck
|
||||||
pass
|
pass
|
||||||
self.Songbar.setVisible(True)
|
self.Songbar.setVisible(True)
|
||||||
elif item.isImage():
|
elif item.is_image():
|
||||||
#Not sensible to allow loops with 1 frame
|
#Not sensible to allow loops with 1 frame
|
||||||
if len(item.getFrames()) > 1:
|
if len(item.get_frames()) > 1:
|
||||||
self.Toolbar.makeWidgetsVisible(self.image_list)
|
self.Toolbar.makeWidgetsVisible(self.image_list)
|
||||||
elif item.isMedia():
|
elif item.is_media():
|
||||||
self.Toolbar.setVisible(False)
|
self.Toolbar.setVisible(False)
|
||||||
self.Mediabar.setVisible(True)
|
self.Mediabar.setVisible(True)
|
||||||
self.volumeSlider.setAudioOutput(self.parent.mainDisplay.audio)
|
self.volumeSlider.setAudioOutput(self.parent.mainDisplay.audio)
|
||||||
@ -378,9 +378,9 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.Toolbar.setVisible(True)
|
self.Toolbar.setVisible(True)
|
||||||
self.Mediabar.setVisible(False)
|
self.Mediabar.setVisible(False)
|
||||||
self.Toolbar.makeWidgetsInvisible(self.song_edit_list)
|
self.Toolbar.makeWidgetsInvisible(self.song_edit_list)
|
||||||
if item.editEnabled and item.fromPlugin:
|
if item.edit_enabled and item.fromPlugin:
|
||||||
self.Toolbar.makeWidgetsVisible(self.song_edit_list)
|
self.Toolbar.makeWidgetsVisible(self.song_edit_list)
|
||||||
elif item.isMedia():
|
elif item.is_media():
|
||||||
self.Toolbar.setVisible(False)
|
self.Toolbar.setVisible(False)
|
||||||
self.Mediabar.setVisible(True)
|
self.Mediabar.setVisible(True)
|
||||||
self.volumeSlider.setAudioOutput(self.audio)
|
self.volumeSlider.setAudioOutput(self.audio)
|
||||||
@ -400,14 +400,14 @@ class SlideController(QtGui.QWidget):
|
|||||||
item.render()
|
item.render()
|
||||||
log.log(15, u'Rendering took %4s' % (time.time() - before))
|
log.log(15, u'Rendering took %4s' % (time.time() - before))
|
||||||
self.enableToolBar(item)
|
self.enableToolBar(item)
|
||||||
if item.isCommand():
|
if item.is_command():
|
||||||
self.wasCommandItem = True
|
self.wasCommandItem = True
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
Receiver().send_message(u'%s_start' % item.name.lower(), \
|
Receiver().send_message(u'%s_start' % item.name.lower(), \
|
||||||
[item.shortname, item.service_item_path,
|
[item.shortname, item.service_item_path,
|
||||||
item.service_frames[0][u'title'], self.isLive])
|
item.service_frames[0][u'title'], self.isLive])
|
||||||
else:
|
else:
|
||||||
if item.isMedia():
|
if item.is_media():
|
||||||
self.onMediaStart(item)
|
self.onMediaStart(item)
|
||||||
slideno = 0
|
slideno = 0
|
||||||
if self.songEdit:
|
if self.songEdit:
|
||||||
@ -434,14 +434,14 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.onMediaStop()
|
self.onMediaStop()
|
||||||
self.wasCommandItem = False
|
self.wasCommandItem = False
|
||||||
self.enableToolBar(item)
|
self.enableToolBar(item)
|
||||||
if item.isCommand():
|
if item.is_command():
|
||||||
self.wasCommandItem = False
|
self.wasCommandItem = False
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
Receiver().send_message(u'%s_start' % item.name.lower(), \
|
Receiver().send_message(u'%s_start' % item.name.lower(), \
|
||||||
[item.shortname, item.service_item_path,
|
[item.shortname, item.service_item_path,
|
||||||
item.service_frames[0][u'title'], slideno, self.isLive])
|
item.service_frames[0][u'title'], slideno, self.isLive])
|
||||||
else:
|
else:
|
||||||
if item.isMedia():
|
if item.is_media():
|
||||||
self.onMediaStart(item)
|
self.onMediaStart(item)
|
||||||
self.displayServiceManagerItems(item, slideno)
|
self.displayServiceManagerItems(item, slideno)
|
||||||
|
|
||||||
@ -459,13 +459,13 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.PreviewListWidget.clear()
|
self.PreviewListWidget.clear()
|
||||||
self.PreviewListWidget.setRowCount(0)
|
self.PreviewListWidget.setRowCount(0)
|
||||||
self.PreviewListWidget.setColumnWidth(0, width)
|
self.PreviewListWidget.setColumnWidth(0, width)
|
||||||
for framenumber, frame in enumerate(self.serviceItem.getFrames()):
|
for framenumber, frame in enumerate(self.serviceItem.get_frames()):
|
||||||
self.PreviewListWidget.setRowCount(
|
self.PreviewListWidget.setRowCount(
|
||||||
self.PreviewListWidget.rowCount() + 1)
|
self.PreviewListWidget.rowCount() + 1)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtGui.QTableWidgetItem()
|
||||||
slide_height = 0
|
slide_height = 0
|
||||||
#It is a Image
|
#It is a Image
|
||||||
if not self.serviceItem.isText():
|
if not self.serviceItem.is_text():
|
||||||
label = QtGui.QLabel()
|
label = QtGui.QLabel()
|
||||||
label.setMargin(4)
|
label.setMargin(4)
|
||||||
pixmap = self.parent.RenderManager.resize_image(frame[u'image'])
|
pixmap = self.parent.RenderManager.resize_image(frame[u'image'])
|
||||||
@ -478,7 +478,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.PreviewListWidget.setItem(framenumber, 0, item)
|
self.PreviewListWidget.setItem(framenumber, 0, item)
|
||||||
if slide_height != 0:
|
if slide_height != 0:
|
||||||
self.PreviewListWidget.setRowHeight(framenumber, slide_height)
|
self.PreviewListWidget.setRowHeight(framenumber, slide_height)
|
||||||
if self.serviceItem.isText():
|
if self.serviceItem.is_text():
|
||||||
self.PreviewListWidget.resizeRowsToContents()
|
self.PreviewListWidget.resizeRowsToContents()
|
||||||
self.PreviewListWidget.setColumnWidth(
|
self.PreviewListWidget.setColumnWidth(
|
||||||
0, self.PreviewListWidget.viewport().size().width())
|
0, self.PreviewListWidget.viewport().size().width())
|
||||||
@ -498,7 +498,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Go to the first slide.
|
Go to the first slide.
|
||||||
"""
|
"""
|
||||||
if self.serviceItem.isCommand():
|
if self.serviceItem.is_command():
|
||||||
Receiver().send_message(u'%s_first'% self.serviceItem.name.lower())
|
Receiver().send_message(u'%s_first'% self.serviceItem.name.lower())
|
||||||
self.updatePreview()
|
self.updatePreview()
|
||||||
else:
|
else:
|
||||||
@ -509,7 +509,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Blank the screen.
|
Blank the screen.
|
||||||
"""
|
"""
|
||||||
if self.serviceItem.isCommand():
|
if self.serviceItem.is_command():
|
||||||
if blanked:
|
if blanked:
|
||||||
Receiver().send_message(u'%s_blank'% self.serviceItem.name.lower())
|
Receiver().send_message(u'%s_blank'% self.serviceItem.name.lower())
|
||||||
else:
|
else:
|
||||||
@ -525,7 +525,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
row = self.PreviewListWidget.currentRow()
|
row = self.PreviewListWidget.currentRow()
|
||||||
self.row = 0
|
self.row = 0
|
||||||
if row > -1 and row < self.PreviewListWidget.rowCount():
|
if row > -1 and row < self.PreviewListWidget.rowCount():
|
||||||
if self.serviceItem.isCommand():
|
if self.serviceItem.is_command():
|
||||||
Receiver().send_message(u'%s_slide'% self.serviceItem.name.lower(), [row])
|
Receiver().send_message(u'%s_slide'% self.serviceItem.name.lower(), [row])
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
self.updatePreview()
|
self.updatePreview()
|
||||||
@ -568,7 +568,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Go to the next slide.
|
Go to the next slide.
|
||||||
"""
|
"""
|
||||||
if self.serviceItem.isCommand():
|
if self.serviceItem.is_command():
|
||||||
Receiver().send_message(u'%s_next'% self.serviceItem.name.lower())
|
Receiver().send_message(u'%s_next'% self.serviceItem.name.lower())
|
||||||
self.updatePreview()
|
self.updatePreview()
|
||||||
else:
|
else:
|
||||||
@ -582,7 +582,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Go to the previous slide.
|
Go to the previous slide.
|
||||||
"""
|
"""
|
||||||
if self.serviceItem.isCommand():
|
if self.serviceItem.is_command():
|
||||||
Receiver().send_message(
|
Receiver().send_message(
|
||||||
u'%s_previous'% self.serviceItem.name.lower())
|
u'%s_previous'% self.serviceItem.name.lower())
|
||||||
self.updatePreview()
|
self.updatePreview()
|
||||||
@ -597,7 +597,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Go to the last slide.
|
Go to the last slide.
|
||||||
"""
|
"""
|
||||||
if self.serviceItem.isCommand():
|
if self.serviceItem.is_command():
|
||||||
Receiver().send_message(u'%s_last'% self.serviceItem.name.lower())
|
Receiver().send_message(u'%s_last'% self.serviceItem.name.lower())
|
||||||
self.updatePreview()
|
self.updatePreview()
|
||||||
else:
|
else:
|
||||||
|
@ -145,7 +145,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
customSlide = self.parent.custommanager.get_custom(item_id)
|
customSlide = self.parent.custommanager.get_custom(item_id)
|
||||||
title = customSlide.title
|
title = customSlide.title
|
||||||
credit = customSlide.credits
|
credit = customSlide.credits
|
||||||
service_item.editEnabled = True
|
service_item.edit_enabled = True
|
||||||
service_item.editId = item_id
|
service_item.editId = item_id
|
||||||
theme = customSlide.theme_name
|
theme = customSlide.theme_name
|
||||||
if len(theme) is not 0 :
|
if len(theme) is not 0 :
|
||||||
|
@ -287,7 +287,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
item_id = self.remoteSong
|
item_id = self.remoteSong
|
||||||
song = self.parent.songmanager.get_song(item_id)
|
song = self.parent.songmanager.get_song(item_id)
|
||||||
service_item.theme = song.theme_name
|
service_item.theme = song.theme_name
|
||||||
service_item.editEnabled = True
|
service_item.edit_enabled = True
|
||||||
service_item.editId = item_id
|
service_item.editId = item_id
|
||||||
service_item.verse_order = song.verse_order
|
service_item.verse_order = song.verse_order
|
||||||
if song.lyrics.startswith(u'<?xml version='):
|
if song.lyrics.startswith(u'<?xml version='):
|
||||||
@ -320,4 +320,3 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
song.title, author_audit, song.copyright, song.ccli_number
|
song.title, author_audit, song.copyright, song.ccli_number
|
||||||
]
|
]
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user