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