Clean up Media mediaitem

This commit is contained in:
Tim Bentley 2010-04-05 08:22:21 +01:00
parent 5a3150a063
commit fa8c543556

View File

@ -54,8 +54,8 @@ class MediaMediaItem(MediaManagerItem):
self.ListViewWithDnD_class = MediaListView self.ListViewWithDnD_class = MediaListView
self.PreviewFunction = QtGui.QPixmap(u':/media/media_video.png').toImage() self.PreviewFunction = QtGui.QPixmap(u':/media/media_video.png').toImage()
MediaManagerItem.__init__(self, parent, icon, title) MediaManagerItem.__init__(self, parent, icon, title)
self.single_service_item = False
self.ServiceItemIconName = u':/media/media_video.png' self.ServiceItemIconName = u':/media/media_video.png'
self.MainDisplay = self.parent.maindisplay
def initPluginNameVisible(self): def initPluginNameVisible(self):
self.PluginNameVisible = self.trUtf8('Media') self.PluginNameVisible = self.trUtf8('Media')
@ -73,17 +73,16 @@ class MediaMediaItem(MediaManagerItem):
self.hasEditIcon = False self.hasEditIcon = False
def generateSlideData(self, service_item, item=None): def generateSlideData(self, service_item, item=None):
items = self.ListView.selectedIndexes() if item is None:
if len(items) > 1: item = self.ListView.currentItem()
return False if item is None:
return False
filename = unicode((item.data(QtCore.Qt.UserRole)).toString())
service_item.title = unicode(self.trUtf8('Media')) service_item.title = unicode(self.trUtf8('Media'))
service_item.add_capability(ItemCapabilities.RequiresMedia) service_item.add_capability(ItemCapabilities.RequiresMedia)
for item in items: frame = u':/media/image_clapperboard.png'
bitem = self.ListView.item(item.row()) (path, name) = os.path.split(filename)
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString()) service_item.add_from_command(path, name, frame)
frame = u':/media/image_clapperboard.png'
(path, name) = os.path.split(filename)
service_item.add_from_command(path, name, frame)
return True return True
def initialise(self): def initialise(self):