Clean up fixes

This commit is contained in:
Tim Bentley 2010-05-06 17:49:12 +01:00
parent 0e7fb1c80c
commit 6c9c9848db
4 changed files with 17 additions and 19 deletions

View File

@ -101,8 +101,7 @@ class ServiceManager(QtGui.QWidget):
self.parent = parent
self.serviceItems = []
self.serviceName = u''
self.suffixes = u''
self.viewers = u''
self.suffixes = []
self.droppos = 0
#is a new service and has not been saved
self.isNew = True
@ -231,10 +230,7 @@ class ServiceManager(QtGui.QWidget):
self.menu.addMenu(self.themeMenu)
def supportedSuffixes(self, suffix):
self.suffixes = u'%s %s' % (self.suffixes, suffix)
def supportedViewers(self, viewer):
self.viewers = u'%s %s' % (self.viewers, viewer)
self.suffixes.append(suffix)
def contextMenu(self, point):
item = self.ServiceManagerList.itemAt(point)
@ -690,8 +686,6 @@ class ServiceManager(QtGui.QWidget):
type = serviceItem._raw_frames[0][u'title'].split(u'.')[1]
if type not in self.suffixes:
serviceItem.isValid = False
if serviceItem.title not in self.viewers:
serviceItem.isValid = False
def cleanUp(self):
"""
@ -775,8 +769,17 @@ class ServiceManager(QtGui.QWidget):
Send the current item to the Preview slide controller
"""
item, count = self.findServiceItem()
self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count)
if self.serviceItems[item][u'service_item'].isValid:
self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count)
else:
QtGui.QMessageBox.critical(self,
self.trUtf8('Missing Display Handler?'),
self.trUtf8('Your item cannot be displayed as '
'there is no handler to display it'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
def getServiceItem(self):
"""
@ -808,8 +811,8 @@ class ServiceManager(QtGui.QWidget):
else:
QtGui.QMessageBox.critical(self,
self.trUtf8('Missing Display Handler?'),
self.trUtf8('Your item cannot be display as '
'there is no handler to display it?'),
self.trUtf8('Your item cannot be displayed as '
'there is no handler to display it'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)

View File

@ -846,7 +846,6 @@ class SlideController(QtGui.QWidget):
self.killTimer(self.timer_id)
self.timer_id = 0
def timerEvent(self, event):
"""
If the timer event is for this window select next slide

View File

@ -53,14 +53,12 @@ class MediaPlugin(Plugin):
self.video_list, mimetype = self._add_to_list(self.video_list, type, mimetype)
type = mimetype.split(u'video/')
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.video_list)
self.service_manager.supportedViewers(self.name)
def _add_to_list(self, list, value, type):
if len(value) == 2:
if list.find(value[1]) == -1:
list += u'*.%s ' % value[1]
self.service_manager.supportedSuffixes(value[1])
type = u''
return list, type

View File

@ -71,13 +71,11 @@ class PresentationMediaItem(MediaManagerItem):
if self.controllers[controller].enabled:
types = self.controllers[controller].supports + \
self.controllers[controller].alsosupports
self.parent.service_manager.supportedViewers(controller)
for type in types:
if fileType.find(type) == -1:
fileType += u'*%s ' % type
self.parent.service_manager.supportedSuffixes(type)
self.OnNewFileMasks = self.trUtf8('Presentations (%s)' % fileType)
self.parent.service_manager.supportedSuffixes(fileType)
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)