Validate Service item viewer loading

This commit is contained in:
Tim Bentley 2010-05-05 20:14:48 +01:00
parent a8bbd540d4
commit 27a963a9c2
5 changed files with 21 additions and 8 deletions

View File

@ -550,6 +550,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
log.info(u'Load data from Settings') log.info(u'Load data from Settings')
self.settingsForm.postSetUp() self.settingsForm.postSetUp()
def versionCheck(self, version): def versionCheck(self, version):
""" """
Checks the version of the Application called from openlp.pyw Checks the version of the Application called from openlp.pyw

View File

@ -102,6 +102,7 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems = [] self.serviceItems = []
self.serviceName = u'' self.serviceName = u''
self.suffixes = u'' self.suffixes = u''
self.viewers = u''
self.droppos = 0 self.droppos = 0
#is a new service and has not been saved #is a new service and has not been saved
self.isNew = True self.isNew = True
@ -232,6 +233,9 @@ class ServiceManager(QtGui.QWidget):
def supportedSuffixes(self, suffix): def supportedSuffixes(self, suffix):
self.suffixes = u'%s %s' % (self.suffixes, suffix) self.suffixes = u'%s %s' % (self.suffixes, suffix)
def supportedViewers(self, viewer):
self.viewers = u'%s %s' % (self.viewers, viewer)
def contextMenu(self, point): def contextMenu(self, point):
item = self.ServiceManagerList.itemAt(point) item = self.ServiceManagerList.itemAt(point)
if item is None: if item is None:
@ -686,6 +690,8 @@ class ServiceManager(QtGui.QWidget):
type = serviceItem._raw_frames[0][u'title'].split(u'.')[1] type = serviceItem._raw_frames[0][u'title'].split(u'.')[1]
if type not in self.suffixes: if type not in self.suffixes:
serviceItem.isValid = False serviceItem.isValid = False
if serviceItem.title not in self.viewers:
serviceItem.isValid = False
def cleanUp(self): def cleanUp(self):
""" """

View File

@ -339,16 +339,16 @@ class SlideController(QtGui.QWidget):
QtCore.SIGNAL(u'slidecontroller_%s_change' % self.type_prefix), QtCore.SIGNAL(u'slidecontroller_%s_change' % self.type_prefix),
self.onSlideChange) self.onSlideChange)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_set' % self.type_prefix), QtCore.SIGNAL(u'slidecontroller_%s_set' % self.type_prefix),
self.onSlideSelectedIndex) self.onSlideSelectedIndex)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.type_prefix), QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.type_prefix),
self.onSlideBlank) self.onSlideBlank)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.type_prefix), QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.type_prefix),
self.onSlideUnblank) self.onSlideUnblank)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.type_prefix), QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.type_prefix),
self.onTextRequest) self.onTextRequest)
QtCore.QObject.connect(self.Splitter, QtCore.QObject.connect(self.Splitter,
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter) QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
@ -486,6 +486,7 @@ class SlideController(QtGui.QWidget):
Display the slide number passed Display the slide number passed
""" """
log.debug(u'processManagerItem') log.debug(u'processManagerItem')
self.onStopLoop()
#If old item was a command tell it to stop #If old item was a command tell it to stop
if self.serviceItem and self.serviceItem.is_command(): if self.serviceItem and self.serviceItem.is_command():
self.onMediaStop() self.onMediaStop()
@ -589,8 +590,8 @@ class SlideController(QtGui.QWidget):
data_item[u'selected'] = \ data_item[u'selected'] = \
(self.PreviewListWidget.currentRow() == framenumber) (self.PreviewListWidget.currentRow() == framenumber)
data.append(data_item) data.append(data_item)
Receiver.send_message(u'slidecontroller_%s_text_response' Receiver.send_message(u'slidecontroller_%s_text_response'
% self.type_prefix, data) % self.type_prefix, data)
#Screen event methods #Screen event methods
def onSlideSelectedFirst(self): def onSlideSelectedFirst(self):
@ -614,7 +615,7 @@ class SlideController(QtGui.QWidget):
index = int(message[0]) index = int(message[0])
if not self.serviceItem: if not self.serviceItem:
return return
Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(), Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(),
[self.serviceItem, self.isLive, index]) [self.serviceItem, self.isLive, index])
if self.serviceItem.is_command(): if self.serviceItem.is_command():
self.updatePreview() self.updatePreview()
@ -827,7 +828,10 @@ class SlideController(QtGui.QWidget):
""" """
Stop the timer loop running Stop the timer loop running
""" """
self.killTimer(self.timer_id) if self.timer_id != 0:
self.killTimer(self.timer_id)
self.timer_id = 0
def timerEvent(self, event): def timerEvent(self, event):
""" """

View File

@ -55,6 +55,7 @@ class MediaPlugin(Plugin):
self.video_list, mimetype = self._add_to_list(self.video_list, type, mimetype) self.video_list, mimetype = self._add_to_list(self.video_list, type, mimetype)
self.service_manager.supportedSuffixes(self.audio_list) self.service_manager.supportedSuffixes(self.audio_list)
self.service_manager.supportedSuffixes(self.video_list) self.service_manager.supportedSuffixes(self.video_list)
self.service_manager.supportedViewers(self.name)
def _add_to_list(self, list, value, type): def _add_to_list(self, list, value, type):
if len(value) == 2: if len(value) == 2:

View File

@ -71,6 +71,7 @@ class PresentationMediaItem(MediaManagerItem):
if self.controllers[controller].enabled: if self.controllers[controller].enabled:
types = self.controllers[controller].supports + \ types = self.controllers[controller].supports + \
self.controllers[controller].alsosupports self.controllers[controller].alsosupports
self.parent.service_manager.supportedViewers(controller)
for type in types: for type in types:
if fileType.find(type) == -1: if fileType.find(type) == -1:
fileType += u'*%s ' % type fileType += u'*%s ' % type