Fixed translate() function in MediaPlugin

This commit is contained in:
Frode Woldsund 2010-06-06 15:30:57 +02:00
parent febb743acd
commit 4571e808ba
2 changed files with 18 additions and 12 deletions

View File

@ -58,13 +58,14 @@ class MediaMediaItem(MediaManagerItem):
self.ServiceItemIconName = u':/media/media_video.png' self.ServiceItemIconName = u':/media/media_video.png'
def initPluginNameVisible(self): def initPluginNameVisible(self):
self.PluginNameVisible = translate('MediaItem','Media') self.PluginNameVisible = translate(u'MediaPlugin.MediaItem', u'Media')
def retranslateUi(self): def retranslateUi(self):
self.OnNewPrompt = translate('MediaItem','Select Media') self.OnNewPrompt = translate(u'MediaPlugin.MediaItem', u'Select Media')
self.OnNewFileMasks = translate('MediaItem','Videos (%s);;' self.OnNewFileMasks = translate(u'MediaPlugin.MediaItem',
'Audio (%s);;' u'Videos (%s);;'
'All files (*)' % (self.parent.video_list, self.parent.audio_list)) u'Audio (%s);;'
u'All files (*)' % (self.parent.video_list, self.parent.audio_list))
def requiredIcons(self): def requiredIcons(self):
MediaManagerItem.requiredIcons(self) MediaManagerItem.requiredIcons(self)
@ -78,7 +79,7 @@ class MediaMediaItem(MediaManagerItem):
self.ListView.addAction( self.ListView.addAction(
contextMenuAction( contextMenuAction(
self.ListView, u':/slides/slide_blank.png', self.ListView, u':/slides/slide_blank.png',
translate('MediaItem','Replace Live Background'), translate(u'MediaPlugin.MediaItem', u'Replace Live Background'),
self.onReplaceClick)) self.onReplaceClick))
def addEndHeaderBar(self): def addEndHeaderBar(self):
@ -93,7 +94,8 @@ class MediaMediaItem(MediaManagerItem):
self.ImageWidget.setObjectName(u'ImageWidget') self.ImageWidget.setObjectName(u'ImageWidget')
self.blankButton = self.Toolbar.addToolbarButton( self.blankButton = self.Toolbar.addToolbarButton(
u'Replace Background', u':/slides/slide_blank.png', u'Replace Background', u':/slides/slide_blank.png',
translate('MediaItem','Replace Live Background'), self.onReplaceClick, False) translate(u'MediaPlugin.MediaItem', u'Replace Live Background'),
self.onReplaceClick, False)
# Add the song widget to the page layout # Add the song widget to the page layout
self.PageLayout.addWidget(self.ImageWidget) self.PageLayout.addWidget(self.ImageWidget)
@ -105,8 +107,10 @@ class MediaMediaItem(MediaManagerItem):
self.background = True self.background = True
if not self.ListView.selectedIndexes(): if not self.ListView.selectedIndexes():
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('MediaItem','No item selected'), translate(u'MediaPlugin.MediaItem',
translate('MediaItem','You must select one item')) u'No item selected'),
translate(u'MediaPlugin.MediaItem',
u'You must select one item'))
items = self.ListView.selectedIndexes() items = self.ListView.selectedIndexes()
for item in items: for item in items:
bitem = self.ListView.item(item.row()) bitem = self.ListView.item(item.row())
@ -119,7 +123,8 @@ class MediaMediaItem(MediaManagerItem):
if item is None: if item is None:
return False return False
filename = unicode((item.data(QtCore.Qt.UserRole)).toString()) filename = unicode((item.data(QtCore.Qt.UserRole)).toString())
service_item.title = unicode(translate('MediaItem','Media')) service_item.title = unicode(
translate(u'MediaPlugin.MediaItem', u'Media'))
service_item.add_capability(ItemCapabilities.RequiresMedia) service_item.add_capability(ItemCapabilities.RequiresMedia)
frame = u':/media/image_clapperboard.png' frame = u':/media/image_clapperboard.png'
(path, name) = os.path.split(filename) (path, name) = os.path.split(filename)

View File

@ -76,6 +76,7 @@ class MediaPlugin(Plugin):
return MediaMediaItem(self, self.icon, self.name) return MediaMediaItem(self, self.icon, self.name)
def about(self): def about(self):
about_text = translate('MediaPlugin','<b>Media Plugin</b><br>This plugin ' about_text = translate(u'MediaPlugin.MediaPlugin',
'allows the playing of audio and video media') u'<b>Media Plugin</b><br>This plugin '
u'allows the playing of audio and video media')
return about_text return about_text