← Back to team overview

openlp-core team mailing list archive

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

 

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

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/49097

Fixes and more translation refactors
-- 
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/49097
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py	2011-02-07 15:55:02 +0000
+++ openlp/core/lib/plugin.py	2011-02-09 17:34:15 +0000
@@ -31,6 +31,7 @@
 from PyQt4 import QtCore
 
 from openlp.core.lib import Receiver
+from openlp.core.lib.ui import UiStrings
 
 log = logging.getLogger(__name__)
 
@@ -323,4 +324,33 @@
         """
         Called to define all translatable texts of the plugin
         """
-        pass
+        ## Load Action ##
+        self._setSingularTextString(StringContent.Load,
+            UiStrings.Load, UiStrings.LoadANew)
+        ## New Action ##
+        self._setSingularTextString(StringContent.New,
+            UiStrings.Add, UiStrings.AddANew)
+        ## Edit Action ##
+        self._setSingularTextString(StringContent.Edit,
+            UiStrings.Edit, UiStrings.EditSelect)
+        ## Delete Action ##
+        self._setSingularTextString(StringContent.Delete,
+            UiStrings.Delete, UiStrings.DeleteSelect)
+        ## Preview Action ##
+        self._setSingularTextString(StringContent.Preview,
+            UiStrings.Preview, UiStrings.PreviewSelect)
+        ## Send Live Action ##
+        self._setSingularTextString(StringContent.Live,
+            UiStrings.Live, UiStrings.SendSelectLive)
+        ## Add to Service Action ##
+        self._setSingularTextString(StringContent.Service,
+            UiStrings.Service, UiStrings.AddSelectService)
+
+    def _setSingularTextString(self, name, title, tooltip):
+        """
+        Utility method for creating a plugin's textStrings. This method makes
+        use of the singular name of the plugin object so must only be called
+        after this has been set.
+        """
+        self.textStrings[name] = { u'title': title, u'tooltip': tooltip %
+            self.getString(StringContent.Name)[u'singular']}

=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py	2011-02-09 05:04:12 +0000
+++ openlp/core/lib/ui.py	2011-02-09 17:34:15 +0000
@@ -41,17 +41,31 @@
     # These strings should need a good reason to be retranslated elsewhere.
     # Should some/more/less of these have an & attached?
     Add = translate('OpenLP.Ui', '&Add')
+    AddANew = unicode(translate('OpenLP.Ui', 'Add a new %s'))
+    AddSelectService = unicode(translate('OpenLP.Ui',
+        'Add the selected %s to the service'))
     AllFiles = translate('OpenLP.Ui', 'All Files')
     Authors = translate('OpenLP.Ui', 'Authors')
     Delete = translate('OpenLP.Ui', '&Delete')
+    DeleteSelect = unicode(translate('OpenLP.Ui', 'Delete the selected %s'))
+    DeleteType = unicode(translate('OpenLP.Ui', 'Delete %s'))
     Edit = translate('OpenLP.Ui', '&Edit')
+    EditSelect = unicode(translate('OpenLP.Ui', 'Edit the selected %s'))
+    EditType = unicode(translate('OpenLP.Ui', 'Edit %s'))
     Error = translate('OpenLP.Ui', 'Error')
+    ExportType = unicode(translate('OpenLP.Ui', 'Export %s'))
     Import = translate('OpenLP.Ui', 'Import')
+    ImportType = unicode(translate('OpenLP.Ui', 'Import %s'))
     Live = translate('OpenLP.Ui', 'Live')
     Load = translate('OpenLP.Ui', 'Load')
+    LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s'))
     New = translate('OpenLP.Ui', 'New')
+    NewType = unicode(translate('OpenLP.Ui', 'New %s'))
     OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0')
     Preview = translate('OpenLP.Ui', 'Preview')
+    PreviewSelect = unicode(translate('OpenLP.Ui', 'Preview the selected %s'))
+    SendSelectLive = unicode(translate('OpenLP.Ui',
+        'Send the selected %s live'))
     Service = translate('OpenLP.Ui', 'Service')
     Theme = translate('OpenLP.Ui', 'Theme')
     Themes = translate('OpenLP.Ui', 'Themes')
@@ -122,7 +136,7 @@
         Should this message box question the user.
     """
     if question:
-        return QtGui.QMessageBox.critical(parent, error, message,
+        return QtGui.QMessageBox.critical(parent, UiStrings.Error, message,
             QtGui.QMessageBox.StandardButtons(
             QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
     data = {u'message': message}

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2011-02-09 05:04:12 +0000
+++ openlp/core/ui/slidecontroller.py	2011-02-09 17:34:15 +0000
@@ -178,10 +178,12 @@
                     QtCore.SIGNAL(u'triggered(bool)'), self.onHideDisplay)
             self.toolbar.addToolbarSeparator(u'Loop Separator')
             self.toolbar.addToolbarButton(
+                # Does not need translating - control string.
                 u'Start Loop', u':/media/media_time.png',
                 translate('OpenLP.SlideController', 'Start continuous loop'),
                 self.onStartLoop)
             self.toolbar.addToolbarButton(
+                # Does not need translating - control string.
                 u'Stop Loop', u':/media/media_stop.png',
                 translate('OpenLP.SlideController', 'Stop continuous loop'),
                 self.onStopLoop)
@@ -196,11 +198,13 @@
         else:
             self.toolbar.addToolbarSeparator(u'Close Separator')
             self.toolbar.addToolbarButton(
+                # Does not need translating - control string.
                 u'Go Live', u':/general/general_live.png',
                 translate('OpenLP.SlideController', 'Move to live'),
                 self.onGoLive)
             self.toolbar.addToolbarSeparator(u'Close Separator')
             self.toolbar.addToolbarButton(
+                # Does not need translating - control string.
                 u'Edit Song', u':/general/general_edit.png',
                 translate('OpenLP.SlideController',
                 'Edit and reload song preview'),

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2011-02-05 23:02:59 +0000
+++ openlp/core/ui/thememanager.py	2011-02-09 17:34:15 +0000
@@ -35,7 +35,7 @@
 from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \
     build_icon, Receiver, SettingsManager, translate, check_item_selected, \
     BackgroundType, BackgroundGradientType, check_directory_exists
-from openlp.core.lib.ui import critical_error_message_box
+from openlp.core.lib.ui import UiStrings, critical_error_message_box
 from openlp.core.theme import Theme
 from openlp.core.ui import FileRenameForm, ThemeForm
 from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \
@@ -62,28 +62,28 @@
         self.layout.setObjectName(u'layout')
         self.toolbar = OpenLPToolbar(self)
         self.toolbar.addToolbarButton(
-            translate('OpenLP.ThemeManager', 'New Theme'),
+            UiStrings.NewType % UiStrings.Theme,
             u':/themes/theme_new.png',
             translate('OpenLP.ThemeManager', 'Create a new theme.'),
             self.onAddTheme)
         self.toolbar.addToolbarButton(
-            translate('OpenLP.ThemeManager', 'Edit Theme'),
+            UiStrings.EditType % UiStrings.Theme,
             u':/themes/theme_edit.png',
             translate('OpenLP.ThemeManager', 'Edit a theme.'),
             self.onEditTheme)
         self.deleteToolbarAction = self.toolbar.addToolbarButton(
-            translate('OpenLP.ThemeManager', 'Delete Theme'),
+            UiStrings.DeleteType % UiStrings.Theme,
             u':/general/general_delete.png',
             translate('OpenLP.ThemeManager', 'Delete a theme.'),
             self.onDeleteTheme)
         self.toolbar.addSeparator()
         self.toolbar.addToolbarButton(
-            translate('OpenLP.ThemeManager', 'Import Theme'),
+            UiStrings.ImportType % UiStrings.Theme,
             u':/general/general_import.png',
             translate('OpenLP.ThemeManager', 'Import a theme.'),
             self.onImportTheme)
         self.toolbar.addToolbarButton(
-            translate('OpenLP.ThemeManager', 'Export Theme'),
+            UiStrings.ExportType % UiStrings.Theme,
             u':/general/general_export.png',
             translate('OpenLP.ThemeManager', 'Export a theme.'),
             self.onExportTheme)

=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py	2011-02-09 05:04:12 +0000
+++ openlp/plugins/bibles/bibleplugin.py	2011-02-09 17:34:15 +0000
@@ -141,35 +141,4 @@
             u'title': UiStrings.Import,
             u'tooltip': translate('BiblesPlugin', 'Import a Bible')
         }
-        ## New Action ##
-        self.textStrings[StringContent.New] = {
-            u'title': UiStrings.Add,
-            u'tooltip': translate('BiblesPlugin', 'Add a new Bible')
-        }
-        ## Edit Action ##
-        self.textStrings[StringContent.Edit] = {
-            u'title': UiStrings.Edit,
-            u'tooltip': translate('BiblesPlugin', 'Edit the selected Bible')
-        }
-        ## Delete Action ##
-        self.textStrings[StringContent.Delete] = {
-            u'title': UiStrings.Delete,
-            u'tooltip': translate('BiblesPlugin', 'Delete the selected Bible')
-        }
-        ## Preview Action ##
-        self.textStrings[StringContent.Preview] = {
-            u'title': UiStrings.Preview,
-            u'tooltip': translate('BiblesPlugin', 'Preview the selected Bible')
-        }
-        ## Send Live Action ##
-        self.textStrings[StringContent.Live] = {
-            u'title': UiStrings.Live,
-            u'tooltip': translate('BiblesPlugin',
-                'Send the selected Bible live')
-        }
-        ## Add to Service Action ##
-        self.textStrings[StringContent.Service] = {
-            u'title': UiStrings.Service,
-            u'tooltip': translate('BiblesPlugin',
-                'Add the selected Bible to the service')
-        }
+        Plugin.setPluginTextStrings(self)

=== modified file 'openlp/plugins/custom/customplugin.py'
--- openlp/plugins/custom/customplugin.py	2011-02-09 05:04:12 +0000
+++ openlp/plugins/custom/customplugin.py	2011-02-09 17:34:15 +0000
@@ -119,48 +119,7 @@
             u'tooltip': translate('CustomsPlugin',
                 'Import a Custom')
         }
-        ## Load Action ##
-        self.textStrings[StringContent.Load] = {
-            u'title': UiStrings.Load,
-            u'tooltip': translate('CustomsPlugin',
-                'Load a new Custom')
-        }
-        ## New Action ##
-        self.textStrings[StringContent.New] = {
-            u'title': UiStrings.Add,
-            u'tooltip': translate('CustomsPlugin',
-                'Add a new Custom')
-        }
-        ## Edit Action ##
-        self.textStrings[StringContent.Edit] = {
-            u'title': UiStrings.Edit,
-            u'tooltip': translate('CustomsPlugin',
-                'Edit the selected Custom')
-        }
-        ## Delete Action ##
-        self.textStrings[StringContent.Delete] = {
-            u'title': UiStrings.Delete,
-            u'tooltip': translate('CustomsPlugin',
-                'Delete the selected Custom')
-        }
-        ## Preview Action ##
-        self.textStrings[StringContent.Preview] = {
-            u'title': UiStrings.Preview,
-            u'tooltip': translate('CustomsPlugin',
-                'Preview the selected Custom')
-        }
-        ## Send Live Action ##
-        self.textStrings[StringContent.Live] = {
-            u'title': UiStrings.Live,
-            u'tooltip': translate('CustomsPlugin',
-                'Send the selected Custom live')
-        }
-        ## Add to Service Action ##
-        self.textStrings[StringContent.Service] = {
-            u'title': UiStrings.Service,
-            u'tooltip': translate('CustomsPlugin',
-                'Add the selected Custom to the service')
-        }
+        Plugin.setPluginTextStrings(self)
 
     def finalise(self):
         """

=== modified file 'openlp/plugins/images/imageplugin.py'
--- openlp/plugins/images/imageplugin.py	2011-02-09 05:04:12 +0000
+++ openlp/plugins/images/imageplugin.py	2011-02-09 17:34:15 +0000
@@ -73,45 +73,4 @@
             u'title': translate('ImagePlugin', 'Images', 'container title')
         }
         # Middle Header Bar
-        ## Load Button ##
-        self.textStrings[StringContent.Load] = {
-            u'title': UiStrings.Load,
-            u'tooltip': translate('ImagePlugin',
-                'Load a new Image')
-        }
-        ## New Button ##
-        self.textStrings[StringContent.New] = {
-            u'title': UiStrings.Add,
-            u'tooltip': translate('ImagePlugin',
-                'Add a new Image')
-        }
-        ## Edit Button ##
-        self.textStrings[StringContent.Edit] = {
-            u'title': UiStrings.Edit,
-            u'tooltip': translate('ImagePlugin',
-                'Edit the selected Image')
-        }
-        ## Delete Button ##
-        self.textStrings[StringContent.Delete] = {
-            u'title': UiStrings.Delete,
-            u'tooltip': translate('ImagePlugin',
-                'Delete the selected Image')
-        }
-        ## Preview ##
-        self.textStrings[StringContent.Preview] = {
-            u'title': UiStrings.Preview,
-            u'tooltip': translate('ImagePlugin',
-                'Preview the selected Image')
-        }
-        ## Live  Button ##
-        self.textStrings[StringContent.Live] = {
-            u'title': UiStrings.Live,
-            u'tooltip': translate('ImagePlugin',
-                'Send the selected Image live')
-        }
-        ## Add to service Button ##
-        self.textStrings[StringContent.Service] = {
-            u'title': UiStrings.Service,
-            u'tooltip': translate('ImagePlugin',
-                'Add the selected Image to the service')
-        }
+        Plugin.setPluginTextStrings(self)

=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py	2011-02-09 05:04:12 +0000
+++ openlp/plugins/media/mediaplugin.py	2011-02-09 17:34:15 +0000
@@ -102,45 +102,4 @@
             u'title': translate('MediaPlugin', 'Media', 'container title')
         }
         # Middle Header Bar
-        ## Load Action ##
-        self.textStrings[StringContent.Load] = {
-            u'title': UiStrings.Load,
-            u'tooltip': translate('MediaPlugin',
-                'Load a new Media')
-        }
-        ## New Action ##
-        self.textStrings[StringContent.New] = {
-            u'title': UiStrings.Add,
-            u'tooltip': translate('MediaPlugin',
-                'Add a new Media')
-        }
-        ## Edit Action ##
-        self.textStrings[StringContent.Edit] = {
-            u'title': UiStrings.Edit,
-            u'tooltip': translate('MediaPlugin',
-                'Edit the selected Media')
-        }
-        ## Delete Action ##
-        self.textStrings[StringContent.Delete] = {
-            u'title': UiStrings.Delete,
-            u'tooltip': translate('MediaPlugin',
-                'Delete the selected Media')
-        }
-        ## Preview Action ##
-        self.textStrings[StringContent.Preview] = {
-            u'title': UiStrings.Preview,
-            u'tooltip': translate('MediaPlugin',
-                'Preview the selected Media')
-        }
-        ## Send Live Action ##
-        self.textStrings[StringContent.Live] = {
-            u'title': UiStrings.Live,
-            u'tooltip': translate('MediaPlugin',
-                'Send the selected Media live')
-        }
-        ## Add to Service Action ##
-        self.textStrings[StringContent.Service] = {
-            u'title': UiStrings.Service,
-            u'tooltip': translate('MediaPlugin',
-                'Add the selected Media to the service')
-        }
+        Plugin.setPluginTextStrings(self)

=== modified file 'openlp/plugins/presentations/lib/impresscontroller.py'
--- openlp/plugins/presentations/lib/impresscontroller.py	2011-02-07 19:37:07 +0000
+++ openlp/plugins/presentations/lib/impresscontroller.py	2011-02-09 17:34:15 +0000
@@ -429,7 +429,7 @@
         ``slide_no``
             The slide the text is required for, starting at 1
         """
-        return __get_text_from_slide(slide_no)
+        return self.__get_text_from_page(slide_no)
 
     def get_slide_notes(self, slide_no):
         """
@@ -438,7 +438,7 @@
         ``slide_no``
             The slide the notes are required for, starting at 1
         """
-        return __get_text_from_page(slide_no, True)
+        return self.__get_text_from_page(slide_no, True)
 
     def __get_text_from_page(self, slide_no, notes=False):
         """

=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py	2011-02-09 05:04:12 +0000
+++ openlp/plugins/presentations/presentationplugin.py	2011-02-09 17:34:15 +0000
@@ -168,33 +168,4 @@
                 'container title')
         }
         # Middle Header Bar
-        ## Load Action ##
-        self.textStrings[StringContent.Load] = {
-            u'title': UiStrings.Load,
-            u'tooltip': translate('PresentationPlugin',
-                'Load a new Presentation')
-        }
-        ## Delete Action ##
-        self.textStrings[StringContent.Delete] = {
-            u'title': UiStrings.Delete,
-            u'tooltip': translate('PresentationPlugin',
-                'Delete the selected Presentation')
-        }
-        ## Preview Action ##
-        self.textStrings[StringContent.Preview] = {
-            u'title': UiStrings.Preview,
-            u'tooltip': translate('PresentationPlugin',
-                'Preview the selected Presentation')
-        }
-        ## Send Live Action ##
-        self.textStrings[StringContent.Live] = {
-            u'title': UiStrings.Live,
-            u'tooltip': translate('PresentationPlugin',
-                'Send the selected Presentation live')
-        }
-        ## Add to Service Action ##
-        self.textStrings[StringContent.Service] = {
-            u'title': UiStrings.Service,
-            u'tooltip': translate('PresentationPlugin',
-                'Add the selected Presentation to the service')
-        }
+        Plugin.setPluginTextStrings(self)

=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py	2011-02-09 05:04:12 +0000
+++ openlp/plugins/songs/songsplugin.py	2011-02-09 17:34:15 +0000
@@ -226,42 +226,7 @@
             u'title': translate('SongsPlugin', 'Songs', 'container title')
         }
         # Middle Header Bar
-        ## New Action ##
-        self.textStrings[StringContent.New] = {
-            u'title': UiStrings.Add,
-            u'tooltip': translate('SongsPlugin',
-                'Add a new Song')
-        }
-        ## Edit Action ##
-        self.textStrings[StringContent.Edit] = {
-            u'title': UiStrings.Edit,
-            u'tooltip': translate('SongsPlugin',
-                'Edit the selected Song')
-        }
-        ## Delete Action ##
-        self.textStrings[StringContent.Delete] = {
-            u'title': UiStrings.Delete,
-            u'tooltip': translate('SongsPlugin',
-                'Delete the selected Song')
-        }
-        ## Preview Action ##
-        self.textStrings[StringContent.Preview] = {
-            u'title': UiStrings.Preview,
-            u'tooltip': translate('SongsPlugin',
-                'Preview the selected Song')
-        }
-        ## Send Live Action ##
-        self.textStrings[StringContent.Live] = {
-            u'title': UiStrings.Live,
-            u'tooltip': translate('SongsPlugin',
-                'Send the selected Song live')
-        }
-        ## Add to Service Action ##
-        self.textStrings[StringContent.Service] = {
-            u'title': UiStrings.Service,
-            u'tooltip': translate('SongsPlugin',
-                'Add the selected Song to the service')
-        }
+        Plugin.setPluginTextStrings(self)
 
     def finalise(self):
         """


Follow ups