forked from openlp/openlp
Add add to existing service item
This commit is contained in:
parent
36b9688695
commit
de8d0f4d9c
@ -114,6 +114,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.Toolbar = None
|
||||
self.remoteTriggered = None
|
||||
self.ServiceItemIconName = None
|
||||
self.addToServiceItem = True
|
||||
self.PageLayout = QtGui.QVBoxLayout(self)
|
||||
self.PageLayout.setSpacing(0)
|
||||
self.PageLayout.setContentsMargins(4, 0, 4, 0)
|
||||
@ -285,6 +286,11 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
contextMenuAction(
|
||||
self.ListView, u':/system/system_add.png',
|
||||
self.trUtf8('&Add to Service'), self.onAddClick))
|
||||
if self.addToServiceItem:
|
||||
self.ListView.addAction(
|
||||
contextMenuAction(
|
||||
self.ListView, u':/system/system_add.png',
|
||||
self.trUtf8('&Add to Service Item'), self.onAddEditClick))
|
||||
QtCore.QObject.connect(
|
||||
self.ListView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||
self.onPreviewClick)
|
||||
@ -386,6 +392,22 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
service_item.fromPlugin = False
|
||||
self.parent.service_manager.addServiceItem(service_item)
|
||||
|
||||
def onAddEditClick(self):
|
||||
if not self.ListView.selectedIndexes() and not self.remoteTriggered:
|
||||
QtGui.QMessageBox.information(self,
|
||||
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.parent.service_manager.getServiceItem()
|
||||
if not service_item:
|
||||
QtGui.QMessageBox.information(self,
|
||||
self.trUtf8('No Servive item selected'),
|
||||
self.trUtf8('You must select a existing Service Item to add to.'))
|
||||
else:
|
||||
self.generateSlideData(service_item)
|
||||
self.parent.service_manager.addServiceItem(service_item)
|
||||
|
||||
def buildServiceItem(self):
|
||||
"""
|
||||
Common method for generating a service item
|
||||
|
@ -666,6 +666,16 @@ class ServiceManager(QtGui.QWidget):
|
||||
self.parent.PreviewController.addServiceManagerItem(
|
||||
self.serviceItems[item][u'service_item'], count)
|
||||
|
||||
def getServiceItem(self):
|
||||
"""
|
||||
Send the current item to the Preview slide controller
|
||||
"""
|
||||
item, count = self.findServiceItem()
|
||||
if item == -1:
|
||||
return False
|
||||
else:
|
||||
self.remoteEditTriggered = True
|
||||
return self.serviceItems[item][u'service_item']
|
||||
|
||||
def makeLive(self):
|
||||
"""
|
||||
|
@ -52,6 +52,7 @@ class ImageMediaItem(MediaManagerItem):
|
||||
# be instanced by the base MediaManagerItem
|
||||
self.ListViewWithDnD_class = ImageListView
|
||||
self.servicePath = None
|
||||
self.addToServiceItem = True
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.overrideActive = False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user