forked from openlp/openlp
Fix up plugins for multiple service item generation
This commit is contained in:
parent
b17b83bb27
commit
5a3150a063
@ -368,7 +368,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
raise NotImplementedError(u'MediaManagerItem.onDeleteClick needs to '
|
||||
u'be defined by the plugin')
|
||||
|
||||
def generateSlideData(self, item):
|
||||
def generateSlideData(self, item, item1):
|
||||
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs '
|
||||
u'to be defined by the plugin')
|
||||
|
||||
@ -402,6 +402,8 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.trUtf8('No Items Selected'),
|
||||
self.trUtf8('You must select one or more items.'))
|
||||
else:
|
||||
#Is it posssible to process multiple list items to generate multiple
|
||||
#service items?
|
||||
if self.single_service_item:
|
||||
log.debug(self.PluginNameShort + u' Add requested')
|
||||
service_item = self.buildServiceItem()
|
||||
@ -438,7 +440,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.trUtf8('Invalid Service Item'),
|
||||
self.trUtf8(unicode('You must select a %s service item.' % self.title)))
|
||||
|
||||
def buildServiceItem(self, item=0):
|
||||
def buildServiceItem(self, item=None):
|
||||
"""
|
||||
Common method for generating a service item
|
||||
"""
|
||||
|
@ -57,7 +57,6 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.ConfigSection = title
|
||||
self.IconPath = u'songs/song'
|
||||
self.ListViewWithDnD_class = BibleListView
|
||||
self.servicePath = None
|
||||
self.lastReference = []
|
||||
self.addToServiceItem = True
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
@ -440,7 +439,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
if self.search_results:
|
||||
self.displayResults(bible)
|
||||
|
||||
def generateSlideData(self, service_item, item_id=0):
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
log.debug(u'generating slide data')
|
||||
items = self.ListView.selectedIndexes()
|
||||
if len(items) == 0:
|
||||
|
@ -50,8 +50,8 @@ class CustomMediaItem(MediaManagerItem):
|
||||
# this next is a class, not an instance of a class - it will
|
||||
# be instanced by the base MediaManagerItem
|
||||
self.ListViewWithDnD_class = CustomListView
|
||||
self.servicePath = None
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.single_service_item = False
|
||||
# Holds information about whether the edit is remotly triggered and
|
||||
# which Custom is required.
|
||||
self.remoteCustom = -1
|
||||
@ -132,18 +132,21 @@ class CustomMediaItem(MediaManagerItem):
|
||||
row = self.ListView.row(item)
|
||||
self.ListView.takeItem(row)
|
||||
|
||||
def generateSlideData(self, service_item):
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
raw_slides =[]
|
||||
raw_footer = []
|
||||
slide = None
|
||||
theme = None
|
||||
if self.remoteTriggered is None:
|
||||
item = self.ListView.currentItem()
|
||||
if item is None:
|
||||
return False
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
if item is None:
|
||||
if self.remoteTriggered is None:
|
||||
item = self.ListView.currentItem()
|
||||
if item is None:
|
||||
return False
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
else:
|
||||
item_id = self.remoteCustom
|
||||
else:
|
||||
item_id = self.remoteCustom
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
service_item.add_capability(ItemCapabilities.AllowsEdit)
|
||||
service_item.add_capability(ItemCapabilities.AllowsPreview)
|
||||
customSlide = self.parent.custommanager.get_custom(item_id)
|
||||
|
@ -52,7 +52,6 @@ class ImageMediaItem(MediaManagerItem):
|
||||
# this next is a class, not an instance of a class - it will
|
||||
# be instanced by the base MediaManagerItem
|
||||
self.ListViewWithDnD_class = ImageListView
|
||||
self.servicePath = None
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
@ -136,7 +135,7 @@ class ImageMediaItem(MediaManagerItem):
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||
self.ListView.addItem(item_name)
|
||||
|
||||
def generateSlideData(self, service_item):
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
items = self.ListView.selectedIndexes()
|
||||
if items:
|
||||
service_item.title = self.trUtf8('Image(s)')
|
||||
|
@ -52,7 +52,7 @@ class MediaMediaItem(MediaManagerItem):
|
||||
# this next is a class, not an instance of a class - it will
|
||||
# be instanced by the base MediaManagerItem
|
||||
self.ListViewWithDnD_class = MediaListView
|
||||
self.PreviewFunction = self.video_get_preview
|
||||
self.PreviewFunction = QtGui.QPixmap(u':/media/media_video.png').toImage()
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.ServiceItemIconName = u':/media/media_video.png'
|
||||
self.MainDisplay = self.parent.maindisplay
|
||||
@ -72,13 +72,7 @@ class MediaMediaItem(MediaManagerItem):
|
||||
self.hasNewIcon = False
|
||||
self.hasEditIcon = False
|
||||
|
||||
def video_get_preview(self):
|
||||
# For now cross platform is an icon. Phonon does not support
|
||||
# individual frame access (yet?) and GStreamer is not available
|
||||
# on Windows
|
||||
return QtGui.QPixmap(u':/media/media_video.png').toImage()
|
||||
|
||||
def generateSlideData(self, service_item):
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
items = self.ListView.selectedIndexes()
|
||||
if len(items) > 1:
|
||||
return False
|
||||
@ -110,7 +104,7 @@ class MediaMediaItem(MediaManagerItem):
|
||||
for file in list:
|
||||
(path, filename) = os.path.split(unicode(file))
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
img = self.video_get_preview()
|
||||
img = QtGui.QPixmap(u':/media/media_video.png').toImage()
|
||||
item_name.setIcon(build_icon(img))
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||
self.ListView.addItem(item_name)
|
||||
|
@ -145,7 +145,7 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
doc.presentation_deleted()
|
||||
doc.close_presentation()
|
||||
|
||||
def generateSlideData(self, service_item):
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
items = self.ListView.selectedIndexes()
|
||||
if len(items) > 1:
|
||||
return False
|
||||
|
@ -49,7 +49,6 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.ConfigSection = title
|
||||
self.IconPath = u'songs/song'
|
||||
self.ListViewWithDnD_class = SongListView
|
||||
#self.servicePath = None
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.single_service_item = False
|
||||
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
|
||||
@ -290,13 +289,12 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.parent.songmanager.delete_song(item_id)
|
||||
self.onSearchTextButtonClick()
|
||||
|
||||
def generateSlideData(self, service_item, item=0):
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
raw_footer = []
|
||||
author_list = u''
|
||||
author_audit = []
|
||||
ccli = u''
|
||||
#Part of a loop so do not work out
|
||||
if item == 0:
|
||||
if item is None:
|
||||
if self.remoteTriggered is None:
|
||||
item = self.ListView.currentItem()
|
||||
if item is None:
|
||||
|
Loading…
Reference in New Issue
Block a user