diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 843f4ef92..41e88b54b 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -34,6 +34,29 @@ from openlp.core.lib import build_icon, Receiver, translate log = logging.getLogger(__name__) +class UiStrings(object): + """ + Provide standard strings for objects to use. + """ + # 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') + AllFiles = translate('OpenLP.Ui', 'All Files') + Authors = translate('OpenLP.Ui', 'Authors') + Delete = translate('OpenLP.Ui', '&Delete') + Edit = translate('OpenLP.Ui', '&Edit') + Error = translate('OpenLP.Ui', 'Error') + Import = translate('OpenLP.Ui', 'Import') + Live = translate('OpenLP.Ui', 'Live') + Load = translate('OpenLP.Ui', 'Load') + New = translate('OpenLP.Ui', 'New') + OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0') + Preview = translate('OpenLP.Ui', 'Preview') + Service = translate('OpenLP.Ui', 'Service') + Theme = translate('OpenLP.Ui', 'Theme') + Themes = translate('OpenLP.Ui', 'Themes') + + def add_welcome_page(parent, image): """ Generate an opening welcome page for a wizard using a provided image. @@ -98,13 +121,12 @@ def critical_error_message_box(title=None, message=None, parent=None, ``question`` Should this message box question the user. """ - error = translate('OpenLP.Ui', 'Error') if question: return QtGui.QMessageBox.critical(parent, error, message, QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) data = {u'message': message} - data[u'title'] = title if title else error + data[u'title'] = title if title else UiStrings.Error return Receiver.send_message(u'openlp_error_message', data) def media_item_combo_box(parent, name): @@ -134,7 +156,7 @@ def create_delete_push_button(parent, icon=None): delete_button.setObjectName(u'deleteButton') delete_icon = icon if icon else u':/general/general_delete.png' delete_button.setIcon(build_icon(delete_icon)) - delete_button.setText(translate('OpenLP.Ui', '&Delete')) + delete_button.setText(UiStrings.Delete) delete_button.setToolTip( translate('OpenLP.Ui', 'Delete the selected item.')) QtCore.QObject.connect(delete_button, diff --git a/openlp/core/ui/displaytagtab.py b/openlp/core/ui/displaytagtab.py index 54d021913..abf0ca44f 100644 --- a/openlp/core/ui/displaytagtab.py +++ b/openlp/core/ui/displaytagtab.py @@ -34,7 +34,7 @@ import cPickle from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsTab, translate, DisplayTags -from openlp.core.lib.ui import critical_error_message_box +from openlp.core.lib.ui import UiStrings, critical_error_message_box class DisplayTagTab(SettingsTab): """ @@ -164,8 +164,7 @@ class DisplayTagTab(SettingsTab): self.startTagLabel.setText( translate('OpenLP.DisplayTagTab', 'Start tag')) self.endTagLabel.setText(translate('OpenLP.DisplayTagTab', 'End tag')) - self.deletePushButton.setText( - translate('OpenLP.DisplayTagTab', 'Delete')) + self.deletePushButton.setText(UiStrings.Delete) self.defaultPushButton.setText( translate('OpenLP.DisplayTagTab', 'Default')) self.newPushButton.setText(translate('OpenLP.DisplayTagTab', 'New')) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index e489d7b5d..c87a9544a 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -30,7 +30,8 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import RenderManager, build_icon, OpenLPDockWidget, \ SettingsManager, PluginManager, Receiver, translate -from openlp.core.lib.ui import base_action, checkable_action, icon_action +from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \ + icon_action from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ ThemeManager, SlideController, PluginForm, MediaDockManager, \ ShortcutListForm @@ -295,7 +296,7 @@ class Ui_MainWindow(object): """ Set up the translation system """ - mainWindow.mainTitle = translate('OpenLP.MainWindow', 'OpenLP 2.0') + mainWindow.mainTitle = UiStrings.OLPV2 mainWindow.setWindowTitle(mainWindow.mainTitle) self.FileMenu.setTitle(translate('OpenLP.MainWindow', '&File')) self.FileImportMenu.setTitle(translate('OpenLP.MainWindow', '&Import')) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index cf2c0983b..1caf43dfd 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -32,7 +32,7 @@ from PyQt4.phonon import Phonon from openlp.core.lib import OpenLPToolbar, Receiver, resize_image, \ ItemCapabilities, translate -from openlp.core.lib.ui import shortcut_action +from openlp.core.lib.ui import UiStrings, shortcut_action from openlp.core.ui import HideMode, MainDisplay log = logging.getLogger(__name__) @@ -87,12 +87,11 @@ class SlideController(QtGui.QWidget): # Type label for the top of the slide controller self.typeLabel = QtGui.QLabel(self.panel) if self.isLive: - self.typeLabel.setText(translate('OpenLP.SlideController', 'Live')) + self.typeLabel.setText(UiStrings.Live) self.split = 1 self.typePrefix = u'live' else: - self.typeLabel.setText(translate('OpenLP.SlideController', - 'Preview')) + self.typeLabel.setText(UiStrings.Preview) self.split = 0 self.typePrefix = u'preview' self.typeLabel.setStyleSheet(u'font-weight: bold; font-size: 12pt;') diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 018df7597..f86fa0143 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate, BackgroundType, BackgroundGradientType, \ Receiver -from openlp.core.lib.ui import critical_error_message_box +from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.utils import get_images_filter from themewizard import Ui_ThemeWizard @@ -483,8 +483,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): Background Image button pushed. """ images_filter = get_images_filter() - images_filter = '%s;;%s (*.*) (*)' % (images_filter, - translate('OpenLP.ThemeForm', 'All Files')) + images_filter = '%s;;%s (*.*) (*)' % (images_filter, UiStrings.AllFiles) filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.ThemeForm', 'Select Image'), u'', images_filter) diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 441b95155..ba4ce5acb 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -27,6 +27,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsTab, Receiver, ThemeLevel, translate +from openlp.core.lib.ui import UiStrings class ThemesTab(SettingsTab): """ @@ -98,7 +99,7 @@ class ThemesTab(SettingsTab): QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList) def retranslateUi(self): - self.tabTitleVisible = translate('OpenLP.ThemesTab', 'Themes') + self.tabTitleVisible = UiStrings.Themes self.GlobalGroupBox.setTitle( translate('OpenLP.ThemesTab', 'Global Theme')) self.LevelGroupBox.setTitle( diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index a350c13cc..4090503db 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -27,7 +27,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsTab, translate -from openlp.core.lib.ui import create_valign_combo +from openlp.core.lib.ui import UiStrings, create_valign_combo class AlertsTab(SettingsTab): """ @@ -117,10 +117,8 @@ class AlertsTab(SettingsTab): translate('AlertsPlugin.AlertsTab', 'Alert timeout:')) self.TimeoutSpinBox.setSuffix( translate('AlertsPlugin.AlertsTab', 's')) - self.PreviewGroupBox.setTitle( - translate('AlertsPlugin.AlertsTab', 'Preview')) - self.FontPreview.setText( - translate('AlertsPlugin.AlertsTab', 'OpenLP 2.0')) + self.PreviewGroupBox.setTitle(UiStrings.Preview) + self.FontPreview.setText(UiStrings.OLPV2) def onBackgroundColorButtonClicked(self): new_color = QtGui.QColorDialog.getColor( diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index e3b2ad4aa..e1dadd4bf 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -29,6 +29,7 @@ import logging from PyQt4 import QtCore, QtGui from openlp.core.lib import Plugin, StringContent, build_icon, translate +from openlp.core.lib.ui import UiStrings from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem log = logging.getLogger(__name__) @@ -137,38 +138,38 @@ class BiblePlugin(Plugin): # Middle Header Bar ## Import Action ## self.textStrings[StringContent.Import] = { - u'title': translate('BiblesPlugin', '&Import'), + u'title': UiStrings.Import, u'tooltip': translate('BiblesPlugin', 'Import a Bible') } ## New Action ## self.textStrings[StringContent.New] = { - u'title': translate('BiblesPlugin', '&Add'), + u'title': UiStrings.Add, u'tooltip': translate('BiblesPlugin', 'Add a new Bible') } ## Edit Action ## self.textStrings[StringContent.Edit] = { - u'title': translate('BiblesPlugin', '&Edit'), + u'title': UiStrings.Edit, u'tooltip': translate('BiblesPlugin', 'Edit the selected Bible') } ## Delete Action ## self.textStrings[StringContent.Delete] = { - u'title': translate('BiblesPlugin', '&Delete'), + u'title': UiStrings.Delete, u'tooltip': translate('BiblesPlugin', 'Delete the selected Bible') } ## Preview Action ## self.textStrings[StringContent.Preview] = { - u'title': translate('BiblesPlugin', 'Preview'), + u'title': UiStrings.Preview, u'tooltip': translate('BiblesPlugin', 'Preview the selected Bible') } ## Send Live Action ## self.textStrings[StringContent.Live] = { - u'title': translate('BiblesPlugin', 'Live'), + u'title': UiStrings.Live, u'tooltip': translate('BiblesPlugin', 'Send the selected Bible live') } ## Add to Service Action ## self.textStrings[StringContent.Service] = { - u'title': translate('BiblesPlugin', 'Service'), + u'title': UiStrings.Service, u'tooltip': translate('BiblesPlugin', 'Add the selected Bible to the service') } diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index f21dd0e07..f528a4b1b 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -35,7 +35,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, SettingsManager, translate from openlp.core.lib.db import delete_database -from openlp.core.lib.ui import critical_error_message_box +from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.ui.wizard import OpenLPWizard from openlp.core.utils import AppLocation, string_is_unicode from openlp.plugins.bibles.lib.manager import BibleFormat @@ -745,8 +745,7 @@ class BibleImportForm(OpenLPWizard): """ if filters: filters += u';;' - filters += u'%s (*)' % translate('BiblesPlugin.ImportWizardForm', - 'All Files') + filters += u'%s (*)' % UiStrings.AllFiles filename = QtGui.QFileDialog.getOpenFileName(self, title, os.path.dirname(SettingsManager.get_last_dir( self.plugin.settingsSection, 1)), filters) diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index 54cb38501..210556ad8 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -30,6 +30,7 @@ from forms import EditCustomForm from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib.db import Manager +from openlp.core.lib.ui import UiStrings from openlp.plugins.custom.lib import CustomMediaItem, CustomTab from openlp.plugins.custom.lib.db import CustomSlide, init_schema @@ -114,49 +115,49 @@ class CustomPlugin(Plugin): # Middle Header Bar ## Import Action ## self.textStrings[StringContent.Import] = { - u'title': translate('CustomsPlugin', 'Import'), + u'title': UiStrings.Import, u'tooltip': translate('CustomsPlugin', 'Import a Custom') } ## Load Action ## self.textStrings[StringContent.Load] = { - u'title': translate('CustomsPlugin', 'Load'), + u'title': UiStrings.Load, u'tooltip': translate('CustomsPlugin', 'Load a new Custom') } ## New Action ## self.textStrings[StringContent.New] = { - u'title': translate('CustomsPlugin', 'Add'), + u'title': UiStrings.Add, u'tooltip': translate('CustomsPlugin', 'Add a new Custom') } ## Edit Action ## self.textStrings[StringContent.Edit] = { - u'title': translate('CustomsPlugin', 'Edit'), + u'title': UiStrings.Edit, u'tooltip': translate('CustomsPlugin', 'Edit the selected Custom') } ## Delete Action ## self.textStrings[StringContent.Delete] = { - u'title': translate('CustomsPlugin', 'Delete'), + u'title': UiStrings.Delete, u'tooltip': translate('CustomsPlugin', 'Delete the selected Custom') } ## Preview Action ## self.textStrings[StringContent.Preview] = { - u'title': translate('CustomsPlugin', 'Preview'), + u'title': UiStrings.Preview, u'tooltip': translate('CustomsPlugin', 'Preview the selected Custom') } ## Send Live Action ## self.textStrings[StringContent.Live] = { - u'title': translate('CustomsPlugin', 'Live'), + u'title': UiStrings.Live, u'tooltip': translate('CustomsPlugin', 'Send the selected Custom live') } ## Add to Service Action ## self.textStrings[StringContent.Service] = { - u'title': translate('CustomsPlugin', 'Service'), + u'title': UiStrings.Service, u'tooltip': translate('CustomsPlugin', 'Add the selected Custom to the service') } diff --git a/openlp/plugins/custom/forms/editcustomdialog.py b/openlp/plugins/custom/forms/editcustomdialog.py index b7887aa90..1ca29732b 100644 --- a/openlp/plugins/custom/forms/editcustomdialog.py +++ b/openlp/plugins/custom/forms/editcustomdialog.py @@ -27,7 +27,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate -from openlp.core.lib.ui import create_save_cancel_button_box, \ +from openlp.core.lib.ui import UiStrings, create_save_cancel_button_box, \ create_delete_push_button, create_up_down_push_button_set class Ui_CustomEditDialog(object): @@ -107,13 +107,11 @@ class Ui_CustomEditDialog(object): translate('CustomPlugin.EditCustomForm', 'Edit Custom Slides')) self.titleLabel.setText( translate('CustomPlugin.EditCustomForm', '&Title:')) - self.addButton.setText( - translate('CustomPlugin.EditCustomForm', '&Add')) + self.addButton.setText(UiStrings.Add) self.addButton.setToolTip( translate('CustomPlugin.EditCustomForm', 'Add a new slide at ' 'bottom.')) - self.editButton.setText( - translate('CustomPlugin.EditCustomForm', '&Edit')) + self.editButton.setText(UiStrings.Edit) self.editButton.setToolTip( translate('CustomPlugin.EditCustomForm', 'Edit the selected ' 'slide.')) diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index ea118d3ec..0af48bacd 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -27,6 +27,7 @@ import logging from openlp.core.lib import Plugin, StringContent, build_icon, translate +from openlp.core.lib.ui import UiStrings from openlp.plugins.images.lib import ImageMediaItem log = logging.getLogger(__name__) @@ -74,43 +75,43 @@ class ImagePlugin(Plugin): # Middle Header Bar ## Load Button ## self.textStrings[StringContent.Load] = { - u'title': translate('ImagePlugin', 'Load'), + u'title': UiStrings.Load, u'tooltip': translate('ImagePlugin', 'Load a new Image') } ## New Button ## self.textStrings[StringContent.New] = { - u'title': translate('ImagePlugin', 'Add'), + u'title': UiStrings.Add, u'tooltip': translate('ImagePlugin', 'Add a new Image') } ## Edit Button ## self.textStrings[StringContent.Edit] = { - u'title': translate('ImagePlugin', 'Edit'), + u'title': UiStrings.Edit, u'tooltip': translate('ImagePlugin', 'Edit the selected Image') } ## Delete Button ## self.textStrings[StringContent.Delete] = { - u'title': translate('ImagePlugin', 'Delete'), + u'title': UiStrings.Delete, u'tooltip': translate('ImagePlugin', 'Delete the selected Image') } ## Preview ## self.textStrings[StringContent.Preview] = { - u'title': translate('ImagePlugin', 'Preview'), + u'title': UiStrings.Preview, u'tooltip': translate('ImagePlugin', 'Preview the selected Image') } ## Live Button ## self.textStrings[StringContent.Live] = { - u'title': translate('ImagePlugin', 'Live'), + u'title': UiStrings.Live, u'tooltip': translate('ImagePlugin', 'Send the selected Image live') } ## Add to service Button ## self.textStrings[StringContent.Service] = { - u'title': translate('ImagePlugin', 'Service'), + u'title': UiStrings.Service, u'tooltip': translate('ImagePlugin', 'Add the selected Image to the service') } diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 6e720fa0b..6ec4cf264 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -32,7 +32,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ ItemCapabilities, SettingsManager, translate, check_item_selected, \ check_directory_exists, Receiver -from openlp.core.lib.ui import critical_error_message_box +from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.utils import AppLocation, delete_file, get_images_filter log = logging.getLogger(__name__) @@ -64,7 +64,7 @@ class ImageMediaItem(MediaManagerItem): 'Select Image(s)') file_formats = get_images_filter() self.OnNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats, - unicode(translate('ImagePlugin.MediaItem', 'All Files'))) + unicode(UiStrings.AllFiles)) self.replaceAction.setText( translate('ImagePlugin.MediaItem', 'Replace Background')) self.replaceAction.setToolTip( diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index ad6087daf..42dcc321c 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -30,6 +30,7 @@ import mimetypes from PyQt4.phonon import Phonon from openlp.core.lib import Plugin, StringContent, build_icon, translate +from openlp.core.lib.ui import UiStrings from openlp.plugins.media.lib import MediaMediaItem, MediaTab log = logging.getLogger(__name__) @@ -103,43 +104,43 @@ class MediaPlugin(Plugin): # Middle Header Bar ## Load Action ## self.textStrings[StringContent.Load] = { - u'title': translate('MediaPlugin', 'Load'), + u'title': UiStrings.Load, u'tooltip': translate('MediaPlugin', 'Load a new Media') } ## New Action ## self.textStrings[StringContent.New] = { - u'title': translate('MediaPlugin', 'Add'), + u'title': UiStrings.Add, u'tooltip': translate('MediaPlugin', 'Add a new Media') } ## Edit Action ## self.textStrings[StringContent.Edit] = { - u'title': translate('MediaPlugin', 'Edit'), + u'title': UiStrings.Edit, u'tooltip': translate('MediaPlugin', 'Edit the selected Media') } ## Delete Action ## self.textStrings[StringContent.Delete] = { - u'title': translate('MediaPlugin', 'Delete'), + u'title': UiStrings.Delete, u'tooltip': translate('MediaPlugin', 'Delete the selected Media') } ## Preview Action ## self.textStrings[StringContent.Preview] = { - u'title': translate('MediaPlugin', 'Preview'), + u'title': UiStrings.Preview, u'tooltip': translate('MediaPlugin', 'Preview the selected Media') } ## Send Live Action ## self.textStrings[StringContent.Live] = { - u'title': translate('MediaPlugin', 'Live'), + u'title': UiStrings.Live, u'tooltip': translate('MediaPlugin', 'Send the selected Media live') } ## Add to Service Action ## self.textStrings[StringContent.Service] = { - u'title': translate('MediaPlugin', 'Service'), + u'title': UiStrings.Service, u'tooltip': translate('MediaPlugin', 'Add the selected Media to the service') } diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index 17417df58..213ff2927 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -31,6 +31,7 @@ import os import logging from openlp.core.lib import Plugin, StringContent, build_icon, translate +from openlp.core.lib.ui import UiStrings from openlp.core.utils import AppLocation from openlp.plugins.presentations.lib import PresentationController, \ PresentationMediaItem, PresentationTab @@ -169,31 +170,31 @@ class PresentationPlugin(Plugin): # Middle Header Bar ## Load Action ## self.textStrings[StringContent.Load] = { - u'title': translate('PresentationPlugin', 'Load'), + u'title': UiStrings.Load, u'tooltip': translate('PresentationPlugin', 'Load a new Presentation') } ## Delete Action ## self.textStrings[StringContent.Delete] = { - u'title': translate('PresentationPlugin', 'Delete'), + u'title': UiStrings.Delete, u'tooltip': translate('PresentationPlugin', 'Delete the selected Presentation') } ## Preview Action ## self.textStrings[StringContent.Preview] = { - u'title': translate('PresentationPlugin', 'Preview'), + u'title': UiStrings.Preview, u'tooltip': translate('PresentationPlugin', 'Preview the selected Presentation') } ## Send Live Action ## self.textStrings[StringContent.Live] = { - u'title': translate('PresentationPlugin', 'Live'), + u'title': UiStrings.Live, u'tooltip': translate('PresentationPlugin', 'Send the selected Presentation live') } ## Add to Service Action ## self.textStrings[StringContent.Service] = { - u'title': translate('PresentationPlugin', 'Service'), + u'title': UiStrings.Service, u'tooltip': translate('PresentationPlugin', 'Add the selected Presentation to the service') } diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index e9be62830..6854a17ae 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.py @@ -27,7 +27,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate -from openlp.core.lib.ui import create_save_cancel_button_box +from openlp.core.lib.ui import UiStrings, create_save_cancel_button_box class Ui_EditSongDialog(object): def setupUi(self, editSongDialog): @@ -257,19 +257,15 @@ class Ui_EditSongDialog(object): translate('SongsPlugin.EditSongForm', '&Lyrics:')) self.verseOrderLabel.setText( translate('SongsPlugin.EditSongForm', '&Verse order:')) - self.verseAddButton.setText( - translate('SongsPlugin.EditSongForm', '&Add')) - self.verseEditButton.setText( - translate('SongsPlugin.EditSongForm', '&Edit')) + self.verseAddButton.setText(UiStrings.Add) + self.verseEditButton.setText(UiStrings.Edit) self.verseEditAllButton.setText( translate('SongsPlugin.EditSongForm', 'Ed&it All')) - self.verseDeleteButton.setText( - translate('SongsPlugin.EditSongForm', '&Delete')) + self.verseDeleteButton.setText(UiStrings.Delete) self.songTabWidget.setTabText( self.songTabWidget.indexOf(self.lyricsTab), translate('SongsPlugin.EditSongForm', 'Title && Lyrics')) - self.authorsGroupBox.setTitle( - translate('SongsPlugin.EditSongForm', 'Authors')) + self.authorsGroupBox.setTitle(UiStrings.Authors) self.authorAddButton.setText( translate('SongsPlugin.EditSongForm', '&Add to Song')) self.authorRemoveButton.setText( @@ -292,8 +288,7 @@ class Ui_EditSongDialog(object): self.songTabWidget.indexOf(self.authorsTab), translate('SongsPlugin.EditSongForm', 'Authors, Topics && Song Book')) - self.themeGroupBox.setTitle( - translate('SongsPlugin.EditSongForm', 'Theme')) + self.themeGroupBox.setTitle(UiStrings.Theme) self.themeAddButton.setText( translate('SongsPlugin.EditSongForm', 'New &Theme')) self.rightsGroupBox.setTitle( diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index a9af7f6b2..8cd8c70fa 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -32,7 +32,7 @@ import os from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, SettingsManager, translate -from openlp.core.lib.ui import critical_error_message_box +from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.ui.wizard import OpenLPWizard from openlp.plugins.songs.lib.importer import SongFormat @@ -215,8 +215,7 @@ class SongImportForm(OpenLPWizard): 'Select the import format, and where to import from.')) self.formatLabel.setText( translate('SongsPlugin.ImportWizardForm', 'Format:')) - self.formatComboBox.setItemText(0, - translate('SongsPlugin.ImportWizardForm', 'OpenLP 2.0')) + self.formatComboBox.setItemText(0, UiStrings.OLPV2) self.formatComboBox.setItemText(1, translate('SongsPlugin.ImportWizardForm', 'openlp.org 1.x')) self.formatComboBox.setItemText(2, @@ -489,8 +488,7 @@ class SongImportForm(OpenLPWizard): """ if filters: filters += u';;' - filters += u'%s (*)' % translate('SongsPlugin.ImportWizardForm', - 'All Files') + filters += u'%s (*)' % UiStrings.AllFiles filenames = QtGui.QFileDialog.getOpenFileNames(self, title, SettingsManager.get_last_dir(self.plugin.settingsSection, 1), filters) diff --git a/openlp/plugins/songs/forms/songmaintenancedialog.py b/openlp/plugins/songs/forms/songmaintenancedialog.py index 51fafcc7a..0fa3335dc 100644 --- a/openlp/plugins/songs/forms/songmaintenancedialog.py +++ b/openlp/plugins/songs/forms/songmaintenancedialog.py @@ -27,6 +27,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate +from openlp.core.lib.ui import UiStrings class Ui_SongMaintenanceDialog(object): def setupUi(self, songMaintenanceDialog): @@ -145,30 +146,21 @@ class Ui_SongMaintenanceDialog(object): def retranslateUi(self, songMaintenanceDialog): songMaintenanceDialog.setWindowTitle( translate('SongsPlugin.SongMaintenanceForm', 'Song Maintenance')) - authorsString = translate('SongsPlugin.SongMaintenanceForm', 'Authors') + authorsString = UiStrings.Authors topicsString = translate('SongsPlugin.SongMaintenanceForm', 'Topics') booksString = translate('SongsPlugin.SongMaintenanceForm', 'Song Books') self.listItemAuthors.setText(authorsString) self.listItemTopics.setText(topicsString) self.listItemBooks.setText(booksString) - self.authorsAddButton.setText( - translate('SongsPlugin.SongMaintenanceForm', '&Add')) - self.authorsEditButton.setText( - translate('SongsPlugin.SongMaintenanceForm', '&Edit')) - self.authorsDeleteButton.setText( - translate('SongsPlugin.SongMaintenanceForm', '&Delete')) - self.topicsAddButton.setText( - translate('SongsPlugin.SongMaintenanceForm', '&Add')) - self.topicsEditButton.setText( - translate('SongsPlugin.SongMaintenanceForm', '&Edit')) - self.topicsDeleteButton.setText( - translate('SongsPlugin.SongMaintenanceForm', '&Delete')) - self.booksAddButton.setText( - translate('SongsPlugin.SongMaintenanceForm', '&Add')) - self.booksEditButton.setText( - translate('SongsPlugin.SongMaintenanceForm', '&Edit')) - self.booksDeleteButton.setText( - translate('SongsPlugin.SongMaintenanceForm', '&Delete')) + self.authorsAddButton.setText(UiStrings.Add) + self.authorsEditButton.setText(UiStrings.Edit) + self.authorsDeleteButton.setText(UiStrings.Delete) + self.topicsAddButton.setText(UiStrings.Add) + self.topicsEditButton.setText(UiStrings.Edit) + self.topicsDeleteButton.setText(UiStrings.Delete) + self.booksAddButton.setText(UiStrings.Add) + self.booksEditButton.setText(UiStrings.Edit) + self.booksDeleteButton.setText(UiStrings.Delete) typeListWidth = max(self.fontMetrics().width(authorsString), self.fontMetrics().width(topicsString), self.fontMetrics().width(booksString)) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 66cff169f..312d0d6e7 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -33,6 +33,7 @@ from sqlalchemy.sql import or_ from openlp.core.lib import MediaManagerItem, BaseListWithDnD, Receiver, \ ItemCapabilities, translate, check_item_selected, PluginStatus +from openlp.core.lib.ui import UiStrings from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \ SongImportForm from openlp.plugins.songs.lib import OpenLyrics, SongXML @@ -147,10 +148,8 @@ class SongMediaItem(MediaManagerItem): translate('SongsPlugin.MediaItem', 'Titles')), (3, u':/songs/song_search_lyrics.png', translate('SongsPlugin.MediaItem', 'Lyrics')), - (4, u':/songs/song_search_author.png', - translate('SongsPlugin.MediaItem', 'Authors')), - (5, u':/slides/slide_theme.png', - translate('SongsPlugin.MediaItem', 'Themes')) + (4, u':/songs/song_search_author.png', UiStrings.Authors), + (5, u':/slides/slide_theme.png', UiStrings.Themes) ]) self.configUpdated() diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 7efe73db2..6b9564af1 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -31,6 +31,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib.db import Manager +from openlp.core.lib.ui import UiStrings from openlp.plugins.songs.lib import SongMediaItem, SongsTab, SongXML from openlp.plugins.songs.lib.db import init_schema, Song from openlp.plugins.songs.lib.importer import SongFormat @@ -227,37 +228,37 @@ class SongsPlugin(Plugin): # Middle Header Bar ## New Action ## self.textStrings[StringContent.New] = { - u'title': translate('SongsPlugin', 'Add'), + u'title': UiStrings.Add, u'tooltip': translate('SongsPlugin', 'Add a new Song') } ## Edit Action ## self.textStrings[StringContent.Edit] = { - u'title': translate('SongsPlugin', 'Edit'), + u'title': UiStrings.Edit, u'tooltip': translate('SongsPlugin', 'Edit the selected Song') } ## Delete Action ## self.textStrings[StringContent.Delete] = { - u'title': translate('SongsPlugin', 'Delete'), + u'title': UiStrings.Delete, u'tooltip': translate('SongsPlugin', 'Delete the selected Song') } ## Preview Action ## self.textStrings[StringContent.Preview] = { - u'title': translate('SongsPlugin', 'Preview'), + u'title': UiStrings.Preview, u'tooltip': translate('SongsPlugin', 'Preview the selected Song') } ## Send Live Action ## self.textStrings[StringContent.Live] = { - u'title': translate('SongsPlugin', 'Live'), + u'title': UiStrings.Live, u'tooltip': translate('SongsPlugin', 'Send the selected Song live') } ## Add to Service Action ## self.textStrings[StringContent.Service] = { - u'title': translate('SongsPlugin', 'Service'), + u'title': UiStrings.Service, u'tooltip': translate('SongsPlugin', 'Add the selected Song to the service') }