forked from openlp/openlp
Fix i18n for mediaitems
bzr-revno: 635
This commit is contained in:
commit
fa2bd8df96
@ -62,14 +62,19 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
This sets the translation context of all the text in the
|
||||
Media Manager item.
|
||||
|
||||
``self.PluginTextShort``
|
||||
The shortened name for the plugin, e.g. *'Image'* for the
|
||||
image plugin.
|
||||
``self.PluginNameShort``
|
||||
The shortened (usually singular) name for the plugin e.g. *'Song'*
|
||||
for the Songs plugin.
|
||||
|
||||
``self.PluginNameVisible``
|
||||
The user visible name for a plugin which should use a suitable
|
||||
translation function. This should normally be
|
||||
``self.trUtf8(self.PluginNameShort)``.
|
||||
|
||||
``self.ConfigSection``
|
||||
The section in the configuration where the items in the media
|
||||
manager are stored. This could potentially be
|
||||
``self.PluginTextShort.lower()``.
|
||||
``self.PluginNameShort.lower()``.
|
||||
|
||||
``self.OnNewPrompt``
|
||||
Defaults to *'Select Image(s)'*.
|
||||
@ -116,9 +121,13 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.PageLayout.setSpacing(0)
|
||||
self.PageLayout.setContentsMargins(4, 0, 4, 0)
|
||||
self.requiredIcons()
|
||||
self.initPluginNameVisible()
|
||||
self.setupUi()
|
||||
self.retranslateUi()
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
pass
|
||||
|
||||
def requiredIcons(self):
|
||||
"""
|
||||
This method is called to define the icons for the plugin.
|
||||
@ -204,51 +213,51 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
## File Button ##
|
||||
if self.hasFileIcon:
|
||||
self.addToolbarButton(
|
||||
u'%s %s' % (self.trUtf8(u'Load'), self.PluginTextShort),
|
||||
u'%s %s' % (self.trUtf8(u'Load a new'), self.PluginTextShort),
|
||||
u'Load %s' % self.PluginNameShort,
|
||||
u'%s %s' % (self.trUtf8(u'Load a new'), self.PluginNameVisible),
|
||||
u':%s_load.png' % self.IconPath, self.onFileClick,
|
||||
u'%sFileItem' % self.PluginTextShort)
|
||||
u'%sFileItem' % self.PluginNameShort)
|
||||
## New Button ##
|
||||
if self.hasNewIcon:
|
||||
self.addToolbarButton(
|
||||
u'%s %s' % (self.trUtf8(u'New'), self.PluginTextShort),
|
||||
u'%s %s' % (self.trUtf8(u'Add a new'), self.PluginTextShort),
|
||||
u'New %s' % self.PluginNameShort,
|
||||
u'%s %s' % (self.trUtf8(u'Add a new'), self.PluginNameVisible),
|
||||
u':%s_new.png' % self.IconPath, self.onNewClick,
|
||||
u'%sNewItem' % self.PluginTextShort)
|
||||
u'%sNewItem' % self.PluginNameShort)
|
||||
## Edit Button ##
|
||||
if self.hasEditIcon:
|
||||
self.addToolbarButton(
|
||||
u'%s %s' % (self.trUtf8(u'Edit'), self.PluginTextShort),
|
||||
u'%s %s' % (self.trUtf8(u'Edit the selected'), self.PluginTextShort),
|
||||
u'Edit %s' % self.PluginNameShort,
|
||||
u'%s %s' % (self.trUtf8(u'Edit the selected'), self.PluginNameVisible),
|
||||
u':%s_edit.png' % self.IconPath, self.onEditClick,
|
||||
u'%sEditItem' % self.PluginTextShort)
|
||||
u'%sEditItem' % self.PluginNameShort)
|
||||
## Delete Button ##
|
||||
if self.hasDeleteIcon:
|
||||
self.addToolbarButton(
|
||||
u'%s %s' % (self.trUtf8(u'Delete'), self.PluginTextShort),
|
||||
u'Delete %s' % self.PluginNameShort,
|
||||
self.trUtf8(u'Delete the selected item'),
|
||||
u':%s_delete.png' % self.IconPath, self.onDeleteClick,
|
||||
u'%sDeleteItem' % self.PluginTextShort)
|
||||
u'%sDeleteItem' % self.PluginNameShort)
|
||||
## Separator Line ##
|
||||
self.addToolbarSeparator()
|
||||
## Preview ##
|
||||
self.addToolbarButton(
|
||||
u'%s %s' % (self.trUtf8(u'Preview'), self.PluginTextShort),
|
||||
u'Preview %s' % self.PluginNameShort,
|
||||
self.trUtf8(u'Preview the selected item'),
|
||||
u':/system/system_preview.png', self.onPreviewClick,
|
||||
u'PreviewItem')
|
||||
## Live Button ##
|
||||
self.addToolbarButton(
|
||||
self.trUtf8(u'Go Live'),
|
||||
u'Go Live',
|
||||
self.trUtf8(u'Send the selected item live'),
|
||||
u':/system/system_live.png', self.onLiveClick,
|
||||
u'LiveItem')
|
||||
## Add to service Button ##
|
||||
self.addToolbarButton(
|
||||
u'%s %s %s' % (self.trUtf8(u'Add'), self.trUtf8(u'to Service'), self.PluginTextShort),
|
||||
u'%s %s %s' % (u'Add', self.PluginNameShort, u'to Service'),
|
||||
self.trUtf8(u'Add the selected item(s) to the service'),
|
||||
u':/system/system_add.png', self.onAddClick,
|
||||
u'%sAddServiceItem' % self.PluginTextShort)
|
||||
u'%sAddServiceItem' % self.PluginNameShort)
|
||||
|
||||
def addListViewToToolBar(self):
|
||||
#Add the List widget
|
||||
@ -260,7 +269,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.ListView.setAlternatingRowColors(True)
|
||||
self.ListView.setDragEnabled(True)
|
||||
self.ListView.setObjectName(u'%sListView' % self.PluginTextShort)
|
||||
self.ListView.setObjectName(u'%sListView' % self.PluginNameShort)
|
||||
#Add tp PageLayout
|
||||
self.PageLayout.addWidget(self.ListView)
|
||||
#define and add the context menu
|
||||
@ -269,13 +278,13 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.ListView.addAction(
|
||||
contextMenuAction(
|
||||
self.ListView, u':%s_new.png' % self.IconPath,
|
||||
u'%s %s' % (self.trUtf8(u'&Edit'), self.PluginTextShort),
|
||||
u'%s %s' % (self.trUtf8(u'&Edit'), self.PluginNameVisible),
|
||||
self.onEditClick))
|
||||
self.ListView.addAction(contextMenuSeparator(self.ListView))
|
||||
self.ListView.addAction(
|
||||
contextMenuAction(
|
||||
self.ListView, u':/system/system_preview.png',
|
||||
u'%s %s' % (self.trUtf8(u'&Preview'), self.PluginTextShort),
|
||||
u'%s %s' % (self.trUtf8(u'&Preview'), self.PluginNameVisible),
|
||||
self.onPreviewClick))
|
||||
self.ListView.addAction(
|
||||
contextMenuAction(
|
||||
@ -351,19 +360,19 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
u'to be defined by the plugin')
|
||||
|
||||
def onPreviewClick(self):
|
||||
log.debug(self.PluginTextShort + u' Preview Requested')
|
||||
log.debug(self.PluginNameShort + u' Preview Requested')
|
||||
service_item = self.buildServiceItem()
|
||||
if service_item is not None:
|
||||
self.parent.preview_controller.addServiceItem(service_item)
|
||||
|
||||
def onLiveClick(self):
|
||||
log.debug(self.PluginTextShort + u' Live Requested')
|
||||
log.debug(self.PluginNameShort + u' Live Requested')
|
||||
service_item = self.buildServiceItem()
|
||||
if service_item is not None:
|
||||
self.parent.live_controller.addServiceItem(service_item)
|
||||
|
||||
def onAddClick(self):
|
||||
log.debug(self.PluginTextShort + u' Add Requested')
|
||||
log.debug(self.PluginNameShort + u' Add Requested')
|
||||
service_item = self.buildServiceItem()
|
||||
if service_item is not None:
|
||||
self.parent.service_manager.addServiceItem(service_item)
|
||||
@ -374,7 +383,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
"""
|
||||
service_item = ServiceItem(self.parent)
|
||||
service_item.addIcon(
|
||||
u':/media/media_' + self.PluginTextShort.lower() + u'.png')
|
||||
u':/media/media_' + self.PluginNameShort.lower() + u'.png')
|
||||
if self.generateSlideData(service_item):
|
||||
self.ListView.clearSelection()
|
||||
return service_item
|
||||
|
@ -47,7 +47,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
|
||||
def __init__(self, parent, icon, title):
|
||||
self.TranslationContext = u'BiblePlugin'
|
||||
self.PluginTextShort = u'Bible'
|
||||
self.PluginNameShort = u'Bible'
|
||||
self.ConfigSection = u'bibles'
|
||||
self.IconPath = u'songs/song'
|
||||
self.ListViewWithDnD_class = BibleListView
|
||||
@ -59,6 +59,9 @@ class BibleMediaItem(MediaManagerItem):
|
||||
QtCore.QObject.connect(Receiver().get_receiver(),
|
||||
QtCore.SIGNAL(u'openlpreloadbibles'), self.reloadBibles)
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
|
||||
|
||||
def requiredIcons(self):
|
||||
MediaManagerItem.requiredIcons(self)
|
||||
self.hasEditIcon = False
|
||||
|
@ -43,7 +43,7 @@ class CustomMediaItem(MediaManagerItem):
|
||||
|
||||
def __init__(self, parent, icon, title):
|
||||
self.TranslationContext = u'CustomPlugin'
|
||||
self.PluginTextShort = u'Custom'
|
||||
self.PluginNameShort = u'Custom'
|
||||
self.ConfigSection = u'custom'
|
||||
self.IconPath = u'custom/custom'
|
||||
# this next is a class, not an instance of a class - it will
|
||||
@ -63,6 +63,9 @@ class CustomMediaItem(MediaManagerItem):
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'load_custom_list'), self.initialise)
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
|
||||
|
||||
def requiredIcons(self):
|
||||
MediaManagerItem.requiredIcons(self)
|
||||
self.hasFileIcon = False
|
||||
|
@ -45,7 +45,7 @@ class ImageMediaItem(MediaManagerItem):
|
||||
|
||||
def __init__(self, parent, icon, title):
|
||||
self.TranslationContext = u'ImagePlugin'
|
||||
self.PluginTextShort = u'Image'
|
||||
self.PluginNameShort = u'Image'
|
||||
self.ConfigSection = u'images'
|
||||
self.IconPath = u'images/image'
|
||||
# this next is a class, not an instance of a class - it will
|
||||
@ -56,6 +56,9 @@ class ImageMediaItem(MediaManagerItem):
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.overrideActive = False
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.OnNewPrompt = self.trUtf8(u'Select Image(s)')
|
||||
self.OnNewFileMasks = \
|
||||
|
@ -44,8 +44,8 @@ class MediaMediaItem(MediaManagerItem):
|
||||
|
||||
def __init__(self, parent, icon, title):
|
||||
self.TranslationContext = u'MediaPlugin'
|
||||
self.PluginNameShort = u'Media'
|
||||
self.IconPath = u'images/image'
|
||||
self.PluginTextShort = u'Media'
|
||||
self.ConfigSection = u'media'
|
||||
self.OnNewPrompt = u'Select Media(s)'
|
||||
self.OnNewFileMasks = \
|
||||
@ -57,6 +57,9 @@ class MediaMediaItem(MediaManagerItem):
|
||||
self.PreviewFunction = self.video_get_preview
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
|
||||
|
||||
def requiredIcons(self):
|
||||
MediaManagerItem.requiredIcons(self)
|
||||
self.hasFileIcon = True
|
||||
|
@ -49,7 +49,7 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
def __init__(self, parent, icon, title, controllers):
|
||||
self.controllers = controllers
|
||||
self.TranslationContext = u'PresentationPlugin'
|
||||
self.PluginTextShort = u'Presentation'
|
||||
self.PluginNameShort = u'Presentation'
|
||||
self.ConfigSection = u'presentations'
|
||||
self.IconPath = u'presentations/presentation'
|
||||
self.OnNewPrompt = u'Select Presentation(s)'
|
||||
@ -60,6 +60,9 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.message_listener = MessageListener(controllers)
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
|
||||
|
||||
def requiredIcons(self):
|
||||
MediaManagerItem.requiredIcons(self)
|
||||
self.hasFileIcon = True
|
||||
|
@ -45,7 +45,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
|
||||
def __init__(self, parent, icon, title):
|
||||
self.TranslationContext = u'SongPlugin'
|
||||
self.PluginTextShort = u'Song'
|
||||
self.PluginNameShort = u'Song'
|
||||
self.ConfigSection = u'songs'
|
||||
self.IconPath = u'songs/song'
|
||||
self.ListViewWithDnD_class = SongListView
|
||||
@ -58,6 +58,9 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.fromPreview = -1
|
||||
self.fromServiceManager = -1
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
|
||||
|
||||
def requiredIcons(self):
|
||||
MediaManagerItem.requiredIcons(self)
|
||||
self.hasFileIcon = False
|
||||
|
Loading…
Reference in New Issue
Block a user