forked from openlp/openlp
Add Preview , Live and Service to ServiceManager
Remove unwanted Drag and drop stuff Clean up remanants
This commit is contained in:
parent
bc1c714693
commit
8c7c71e0c0
@ -100,8 +100,6 @@ class MainWindow(object):
|
||||
self.ServiceManagerContents.liveController = self.LiveController
|
||||
self.ThemeManagerContents.serviceManager = self.ServiceManagerContents
|
||||
self.ThemeManagerContents.loadThemes()
|
||||
self.PreviewController.postInit()
|
||||
self.LiveController.postInit()
|
||||
|
||||
# Initialise SlideControllers
|
||||
log.info(u'Set Up SlideControllers')
|
||||
|
@ -78,11 +78,13 @@ class ServiceManager(QtGui.QWidget):
|
||||
self.ServiceManagerList.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
|
||||
self.ServiceManagerList.setAlternatingRowColors(True)
|
||||
self.ServiceManagerList.setObjectName("ServiceManagerList")
|
||||
#endable drop
|
||||
self.ServiceManagerList .__class__.dragEnterEvent=self.dragEnterEvent
|
||||
self.ServiceManagerList .__class__.dragMoveEvent=self.dragEnterEvent
|
||||
self.ServiceManagerList .__class__.dropEvent =self.dropEvent
|
||||
self.ServiceManagerList.setDragEnabled(True)
|
||||
self.ServiceManagerList .__class__.mouseMoveEvent =self.onMouseMoveEvent
|
||||
#endable drag
|
||||
#self.ServiceManagerList.setDragEnabled(True)
|
||||
#self.ServiceManagerList .__class__.mouseMoveEvent =self.onMouseMoveEvent
|
||||
|
||||
self.Layout.addWidget(self.ServiceManagerList)
|
||||
|
||||
@ -179,30 +181,30 @@ class ServiceManager(QtGui.QWidget):
|
||||
print plugin
|
||||
self.eventManager.post_event(Event(EventType.LoadServiceItem, plugin))
|
||||
|
||||
def onMouseMoveEvent(self, event):
|
||||
"""
|
||||
Drag and drop eventDo not care what data is selected
|
||||
as the recepient will use events to request the data move
|
||||
just tell it what plugin to call
|
||||
"""
|
||||
print "ServiceManager"
|
||||
if event.buttons() != QtCore.Qt.LeftButton:
|
||||
return
|
||||
|
||||
items = self.ServiceManagerList.selectedIndexes()
|
||||
if items == []:
|
||||
return
|
||||
|
||||
drag = QtGui.QDrag(self)
|
||||
mimeData = QtCore.QMimeData()
|
||||
drag.setMimeData(mimeData)
|
||||
for item in items:
|
||||
mimeData.setText(u'ServiceManager')
|
||||
|
||||
dropAction = drag.start(QtCore.Qt.CopyAction)
|
||||
|
||||
if dropAction == QtCore.Qt.CopyAction:
|
||||
self.close()
|
||||
# def onMouseMoveEvent(self, event):
|
||||
# """
|
||||
# Drag and drop eventDo not care what data is selected
|
||||
# as the recepient will use events to request the data move
|
||||
# just tell it what plugin to call
|
||||
# """
|
||||
# print "ServiceManager"
|
||||
# if event.buttons() != QtCore.Qt.LeftButton:
|
||||
# return
|
||||
#
|
||||
# items = self.ServiceManagerList.selectedIndexes()
|
||||
# if items == []:
|
||||
# return
|
||||
#
|
||||
# drag = QtGui.QDrag(self)
|
||||
# mimeData = QtCore.QMimeData()
|
||||
# drag.setMimeData(mimeData)
|
||||
# for item in items:
|
||||
# mimeData.setText(u'ServiceManager')
|
||||
#
|
||||
# dropAction = drag.start(QtCore.Qt.CopyAction)
|
||||
#
|
||||
# if dropAction == QtCore.Qt.CopyAction:
|
||||
# self.close()
|
||||
|
||||
|
||||
def oos_as_text(self):
|
||||
|
@ -26,62 +26,64 @@ from openlp.core.lib import OpenLPToolbar
|
||||
from openlp.core import translate
|
||||
from openlp.core.lib import Event, EventType, EventManager
|
||||
|
||||
class PreviewList(QtGui.QListView):
|
||||
|
||||
def __init__(self,parent=None):
|
||||
QtGui.QListView.__init__(self,parent)
|
||||
self.setAcceptDrops(True)
|
||||
|
||||
def dragEnterEvent(self, event):
|
||||
"""
|
||||
Accept Drag events
|
||||
"""
|
||||
event.accept()
|
||||
self.dropEvent(event)
|
||||
|
||||
def dropEvent(self, event):
|
||||
"""
|
||||
Handle the release of the event and trigger the plugin
|
||||
to add the data
|
||||
"""
|
||||
print "preview drop event"
|
||||
link=event.mimeData()
|
||||
if link.hasText():
|
||||
plugin = event.mimeData().text()
|
||||
if plugin == u'ServiceManager':
|
||||
#Service Manager to Preview is not a sane
|
||||
self.serviceManager.makeLive()
|
||||
else:
|
||||
print "preview fired ", plugin
|
||||
self.eventManager.post_event(Event(EventType.PreviewShow, plugin))
|
||||
|
||||
class LiveList(QtGui.QListView):
|
||||
def __init__(self,parent=None):
|
||||
QtGui.QListView.__init__(self,parent)
|
||||
self.setAcceptDrops(True)
|
||||
|
||||
def dragEnterEvent(self, event):
|
||||
"""
|
||||
Accept Drag events
|
||||
"""
|
||||
event.accept()
|
||||
self.dropEvent(event)
|
||||
|
||||
def dropEvent(self, event):
|
||||
"""
|
||||
Handle the release of the event and trigger the plugin
|
||||
to add the data
|
||||
"""
|
||||
print "Live drop event"
|
||||
link=event.mimeData()
|
||||
if link.hasText():
|
||||
plugin = event.mimeData().text()
|
||||
if plugin == u'ServiceManager':
|
||||
#Service Manager to Preview is not a sane
|
||||
self.serviceManager.makeLive()
|
||||
else:
|
||||
print "live fired plugin ", plugin
|
||||
self.eventManager.post_event(Event(EventType.LiveShow, plugin))
|
||||
#class PreviewList(QtGui.QListView):
|
||||
#
|
||||
# def __init__(self,parent=None):
|
||||
# QtGui.QListView.__init__(self,parent)
|
||||
# self.setAcceptDrops(True)
|
||||
# self.setDropIndicatorShown(True)
|
||||
# self.setDragEnabled(False)
|
||||
# self.setDragDropMode(QtGui.QAbstractItemView.DropOnly)
|
||||
#
|
||||
# def dragEnterEvent(self, event):
|
||||
# """
|
||||
# Accept Drag events
|
||||
# """
|
||||
# event.accept()
|
||||
#
|
||||
# def dropEvent(self, event):
|
||||
# """
|
||||
# Handle the release of the event and trigger the plugin
|
||||
# to add the data
|
||||
# """
|
||||
# print "preview drop event"
|
||||
# link=event.mimeData()
|
||||
# if link.hasText():
|
||||
# plugin = event.mimeData().text()
|
||||
# if plugin == u'ServiceManager':
|
||||
# #Service Manager to Preview is not a sane
|
||||
# self.serviceManager.makeLive()
|
||||
# else:
|
||||
# print "preview fired ", plugin
|
||||
# self.eventManager.post_event(Event(EventType.PreviewShow, plugin))
|
||||
#
|
||||
#class LiveList(QtGui.QListView):
|
||||
# def __init__(self,parent=None):
|
||||
# QtGui.QListView.__init__(self,parent)
|
||||
# self.setAcceptDrops(True)
|
||||
# self.setDropIndicatorShown(True)
|
||||
# self.setDragEnabled(False)
|
||||
# self.setDragDropMode(QtGui.QAbstractItemView.DropOnly)
|
||||
#
|
||||
# def dragEnterEvent(self, event):
|
||||
# """
|
||||
# Accept Drag events
|
||||
# """
|
||||
# event.accept()
|
||||
#
|
||||
# def dropEvent(self, event):
|
||||
# """
|
||||
# Handle the release of the event and trigger the plugin
|
||||
# to add the data
|
||||
# """
|
||||
# print "Live drop event"
|
||||
# link=event.mimeData()
|
||||
# if link.hasText():
|
||||
# plugin = event.mimeData().text()
|
||||
# if plugin == u'ServiceManager':
|
||||
# self.serviceManager.makeLive()
|
||||
# else:
|
||||
# self.eventManager.post_event(Event(EventType.LiveShow, plugin))
|
||||
|
||||
|
||||
class SlideData(QtCore.QAbstractListModel):
|
||||
@ -184,14 +186,8 @@ class SlideController(QtGui.QWidget):
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
|
||||
#load the correct class for drag and drop
|
||||
if self.isLive:
|
||||
self.PreviewListView = LiveList(self.scrollAreaWidgetContents)
|
||||
else:
|
||||
self.PreviewListView = PreviewList(self.scrollAreaWidgetContents)
|
||||
|
||||
self.PreviewListView.setDragEnabled(False)
|
||||
self.PreviewListView.setDragDropMode(QtGui.QAbstractItemView.DropOnly)
|
||||
|
||||
self.PreviewListView = QtGui.QListView(self.scrollAreaWidgetContents)
|
||||
self.PreviewListData = SlideData()
|
||||
self.PreviewListView.isLive = self.isLive
|
||||
self.PreviewListView.setModel(self.PreviewListData)
|
||||
@ -251,11 +247,6 @@ class SlideController(QtGui.QWidget):
|
||||
QtCore.QObject.connect(self.PreviewListView,
|
||||
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
|
||||
|
||||
def postInit(self):
|
||||
self.PreviewListView.eventManager = self.eventManager
|
||||
self.PreviewListView.serviceManager = self.serviceManager
|
||||
|
||||
|
||||
def onSlideSelectedFirst(self):
|
||||
row = self.PreviewListData.createIndex(0, 0)
|
||||
if row.isValid():
|
||||
|
@ -24,7 +24,7 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core import translate
|
||||
from openlp.core.lib import MediaManagerItem
|
||||
from openlp.core.resources import *
|
||||
from openlp.core.lib import ServiceItem
|
||||
|
||||
from openlp.plugins.images.lib import ListWithPreviews
|
||||
|
||||
@ -150,20 +150,33 @@ class ImageMediaItem(MediaManagerItem):
|
||||
self.ImageListData.removeRow(current_row)
|
||||
self.parent.config.set_list(u'images', self.ImageListData.getFileList())
|
||||
|
||||
def onImageClick(self, where):
|
||||
def generateSlideData(self, service_item):
|
||||
indexes = self.ImageListView.selectedIndexes()
|
||||
for index in indexes:
|
||||
filename = self.ImageListData.getFilename(index)
|
||||
log.info(u"Click %s:%s"%(str(where), filename))
|
||||
where.add(filename)
|
||||
where.render()
|
||||
frame = QtGui.QPixmap(str(filename))
|
||||
service_item.frames.append({u'formatted': u'Image', u'image': frame})
|
||||
|
||||
def onImagePreviewClick(self):
|
||||
self.onImageClick(self.parent.preview_service_item)
|
||||
log.debug(u'Image Preview Requested')
|
||||
service_item = ServiceItem(self.parent)
|
||||
service_item.addIcon( ":/media/media_image.png")
|
||||
service_item.render_manager = self.parent.render_manager
|
||||
self.generateSlideData(service_item)
|
||||
self.parent.preview_controller.addServiceItem(service_item)
|
||||
|
||||
def onImageLiveClick(self):
|
||||
self.onImageClick(self.parent.live_service_item)
|
||||
log.debug(u'Image Live Requested')
|
||||
service_item = ServiceItem(self.parent)
|
||||
service_item.addIcon( ":/media/media_image.png")
|
||||
service_item.render_manager = self.parent.render_manager
|
||||
self.generateSlideData(service_item)
|
||||
self.parent.live_controller.addServiceItem(service_item)
|
||||
|
||||
def onImageAddClick(self):
|
||||
"""Add this item to the OOS"""
|
||||
pass
|
||||
log.debug(u'Image Live Requested')
|
||||
service_item = ServiceItem(self.parent)
|
||||
service_item.addIcon( ":/media/media_image.png")
|
||||
service_item.render_manager = self.parent.render_manager
|
||||
self.generateSlideData(service_item)
|
||||
self.parent.service_manager.addServiceItem(service_item)
|
||||
|
Loading…
Reference in New Issue
Block a user