← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~meths/openlp/testing into lp:openlp

 

Jon Tibble has proposed merging lp:~meths/openlp/testing into lp:openlp.

    Requested reviews:
    OpenLP Core (openlp-core)


Fix i18n for mediaitems
-- 
https://code.launchpad.net/~meths/openlp/testing/+merge/14173
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2009-10-24 16:40:36 +0000
+++ openlp/core/lib/mediamanageritem.py	2009-10-29 15:25:17 +0000
@@ -62,14 +62,19 @@
         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 @@
         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 @@
         ## 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 @@
             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 @@
             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 @@
             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 @@
         """
         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

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2009-10-27 20:52:30 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2009-10-29 15:25:17 +0000
@@ -47,7 +47,7 @@
 
     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 @@
         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

=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py	2009-10-29 13:44:33 +0000
+++ openlp/plugins/custom/lib/mediaitem.py	2009-10-29 15:25:17 +0000
@@ -43,7 +43,7 @@
 
     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 @@
         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

=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2009-10-24 16:40:36 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2009-10-29 15:25:17 +0000
@@ -45,7 +45,7 @@
 
     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 @@
         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 = \

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2009-10-09 22:46:35 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2009-10-29 15:25:17 +0000
@@ -44,8 +44,8 @@
 
     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 @@
         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

=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2009-10-24 16:40:36 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2009-10-29 15:25:17 +0000
@@ -49,7 +49,7 @@
     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 @@
         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

=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2009-10-29 13:44:33 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2009-10-29 15:25:17 +0000
@@ -45,7 +45,7 @@
 
     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 @@
         self.fromPreview = -1
         self.fromServiceManager = -1
 
+    def initPluginNameVisible(self):
+        self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
+
     def requiredIcons(self):
         MediaManagerItem.requiredIcons(self)
         self.hasFileIcon = False


Follow ups