diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 81d9a5b03..2960b6e45 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -114,6 +114,7 @@ class MediaManagerItem(QtGui.QWidget): self.Toolbar = None self.remoteTriggered = None self.ServiceItemIconName = None + self.single_service_item = True self.addToServiceItem = False self.PageLayout = QtGui.QVBoxLayout(self) self.PageLayout.setSpacing(0) @@ -401,11 +402,19 @@ class MediaManagerItem(QtGui.QWidget): self.trUtf8('No Items Selected'), self.trUtf8('You must select one or more items.')) else: - log.debug(self.PluginNameShort + u' Add requested') - service_item = self.buildServiceItem() - if service_item: - service_item.from_plugin = False - self.parent.service_manager.addServiceItem(service_item) + if self.single_service_item: + log.debug(self.PluginNameShort + u' Add requested') + service_item = self.buildServiceItem() + if service_item: + service_item.from_plugin = False + self.parent.service_manager.addServiceItem(service_item) + else: + items = self.ListView.selectedIndexes() + for item in items: + service_item = self.buildServiceItem(item) + if service_item: + service_item.from_plugin = False + self.parent.service_manager.addServiceItem(service_item) def onAddEditClick(self): if not self.ListView.selectedIndexes() and not self.remoteTriggered: @@ -429,7 +438,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): + def buildServiceItem(self, item=0): """ Common method for generating a service item """ @@ -439,7 +448,7 @@ class MediaManagerItem(QtGui.QWidget): else: service_item.addIcon( u':/media/media_' + self.PluginNameShort.lower() + u'.png') - if self.generateSlideData(service_item): + if self.generateSlideData(service_item, item): return service_item else: return None diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 2b6de7d3b..d0ec4d2df 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -714,7 +714,7 @@ class ServiceManager(QtGui.QWidget): get_config(u'auto preview', u'False')): item += 1 if self.serviceItems and item < len(self.serviceItems) and \ - serviceItem[u'service_item'].is_capable(ItemCapabilities.AllowsPreview): + self.serviceItems[item][u'service_item'].is_capable(ItemCapabilities.AllowsPreview): self.parent.PreviewController.addServiceManagerItem( self.serviceItems[item][u'service_item'], 0) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 1a70a764a..ed886120d 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -440,7 +440,7 @@ class BibleMediaItem(MediaManagerItem): if self.search_results: self.displayResults(bible) - def generateSlideData(self, service_item): + def generateSlideData(self, service_item, item_id=0): log.debug(u'generating slide data') items = self.ListView.selectedIndexes() if len(items) == 0: diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index e2b1dbf80..7addeb9ed 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -49,8 +49,9 @@ class SongMediaItem(MediaManagerItem): self.ConfigSection = title self.IconPath = u'songs/song' self.ListViewWithDnD_class = SongListView - self.servicePath = None + #self.servicePath = None MediaManagerItem.__init__(self, parent, icon, title) + self.single_service_item = False self.edit_song_form = EditSongForm(self.parent.songmanager, self) self.song_maintenance_form = SongMaintenanceForm( self.parent.songmanager, self) @@ -276,31 +277,35 @@ class SongMediaItem(MediaManagerItem): if len(items) == 1: del_message = self.trUtf8('Delete song?') else: - del_message = unicode(self.trUtf8('Delete %d song?')) % len(items) + del_message = unicode(self.trUtf8('Delete %d songs?')) % len(items) ans = QtGui.QMessageBox.question(self, self.trUtf8('Delete Confirmation'), del_message, QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok| QtGui.QMessageBox.Cancel), QtGui.QMessageBox.Ok) if ans == QtGui.QMessageBox.Cancel: - return + return for item in items: item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] self.parent.songmanager.delete_song(item_id) self.onSearchTextButtonClick() - def generateSlideData(self, service_item): + def generateSlideData(self, service_item, item=0): raw_footer = [] author_list = u'' author_audit = [] ccli = u'' - if self.remoteTriggered is None: - item = self.ListView.currentItem() - if item is None: - return False - item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] + #Part of a loop so do not work out + if item == 0: + 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.remoteSong else: - item_id = self.remoteSong + item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] service_item.add_capability(ItemCapabilities.AllowsEdit) service_item.add_capability(ItemCapabilities.AllowsPreview) song = self.parent.songmanager.get_song(item_id)