forked from openlp/openlp
Allow Preview Controller to request servicemanger to make the preview item live and add next to preview.
Fixes: https://launchpad.net/bugs/730294
This commit is contained in:
parent
16a445e1e7
commit
9836131025
@ -101,6 +101,10 @@ class EventReceiver(QtCore.QObject):
|
||||
``servicemanager_previous_item``
|
||||
Display the previous item in the service
|
||||
|
||||
``servicemanager_preview_live``
|
||||
Requests a Preview item from the Service Manager to update live and
|
||||
add a new item to the preview panel
|
||||
|
||||
``servicemanager_next_item``
|
||||
Display the next item in the service
|
||||
|
||||
|
@ -111,6 +111,7 @@ class ServiceItem(object):
|
||||
self.start_time = 0
|
||||
self.end_time = 0
|
||||
self.media_length = 0
|
||||
self.from_service = False
|
||||
self._new_item()
|
||||
|
||||
def _new_item(self):
|
||||
|
@ -238,6 +238,8 @@ class ServiceManager(QtGui.QWidget):
|
||||
QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), self.expanded)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'servicemanager_preview_live'), self.previewLive)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'servicemanager_next_item'), self.nextItem)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
@ -558,6 +560,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
self.newFile()
|
||||
for item in items:
|
||||
serviceItem = ServiceItem()
|
||||
serviceItem.from_service = True
|
||||
serviceItem.render_manager = self.mainwindow.renderManager
|
||||
serviceItem.set_from_service(item, self.servicePath)
|
||||
self.validateItem(serviceItem)
|
||||
@ -662,6 +665,19 @@ class ServiceManager(QtGui.QWidget):
|
||||
self.addServiceItem(self.serviceItemEditForm.getServiceItem(),
|
||||
replace=True, expand=self.serviceItems[item][u'expanded'])
|
||||
|
||||
def previewLive(self, message):
|
||||
"""
|
||||
Called by the SlideController to request a preview item be made live
|
||||
and allows the next preview to be updated if relevent.
|
||||
"""
|
||||
id, row = message.split(u':')
|
||||
for sitem in self.serviceItems:
|
||||
if sitem[u'service_item']._uuid == id:
|
||||
item = self.serviceManagerList.topLevelItem(sitem[u'order'] - 1)
|
||||
self.serviceManagerList.setCurrentItem(item)
|
||||
self.makeLive(int(row))
|
||||
return
|
||||
|
||||
def nextItem(self):
|
||||
"""
|
||||
Called by the SlideController to select the next service item.
|
||||
@ -1017,6 +1033,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
if expand is None:
|
||||
expand = self.expandTabs
|
||||
item.render()
|
||||
item.from_service = True
|
||||
if replace:
|
||||
sitem, child = self.findServiceItem()
|
||||
item.merge(self.serviceItems[sitem][u'service_item'])
|
||||
@ -1071,11 +1088,16 @@ class ServiceManager(QtGui.QWidget):
|
||||
else:
|
||||
return self.serviceItems[item][u'service_item']
|
||||
|
||||
def makeLive(self):
|
||||
def makeLive(self, row=-1):
|
||||
"""
|
||||
Send the current item to the Live slide controller
|
||||
|
||||
``row``
|
||||
Row number to be displayed if from preview
|
||||
"""
|
||||
item, child = self.findServiceItem()
|
||||
if row != -1:
|
||||
child = row
|
||||
if self.serviceItems[item][u'service_item'].is_valid:
|
||||
self.mainwindow.liveController.addServiceManagerItem(
|
||||
self.serviceItems[item][u'service_item'], child)
|
||||
|
@ -655,6 +655,7 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
Utility method to update the selected slide in the list.
|
||||
"""
|
||||
print "c", slideno
|
||||
if slideno > self.previewListWidget.rowCount():
|
||||
self.previewListWidget.selectRow(
|
||||
self.previewListWidget.rowCount() - 1)
|
||||
@ -944,7 +945,6 @@ class SlideController(QtGui.QWidget):
|
||||
self.onSlideSelected()
|
||||
|
||||
def __checkUpdateSelectedSlide(self, row):
|
||||
print row, self.previewListWidget.rowCount()
|
||||
if row + 1 < self.previewListWidget.rowCount():
|
||||
self.previewListWidget.scrollToItem(
|
||||
self.previewListWidget.item(row + 1, 0))
|
||||
@ -1014,8 +1014,12 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
row = self.previewListWidget.currentRow()
|
||||
if row > -1 and row < self.previewListWidget.rowCount():
|
||||
self.parent.liveController.addServiceManagerItem(
|
||||
self.serviceItem, row)
|
||||
if self.serviceItem.from_service:
|
||||
Receiver.send_message('servicemanager_preview_live',
|
||||
u'%s:%s' % (self.serviceItem._uuid, row))
|
||||
else:
|
||||
self.parent.liveController.addServiceManagerItem(
|
||||
self.serviceItem, row)
|
||||
|
||||
def onMediaStart(self, item):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user