merge upstream

This commit is contained in:
Mattias Põldaru 2011-02-10 07:12:50 +02:00
commit bdf9de4421
11 changed files with 64 additions and 234 deletions

View File

@ -31,6 +31,7 @@ import logging
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 @@ class Plugin(QtCore.QObject):
"""
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']}

View File

@ -41,17 +41,31 @@ class UiStrings(object):
# 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 @@ def critical_error_message_box(title=None, message=None, parent=None,
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}

View File

@ -178,10 +178,12 @@ class SlideController(QtGui.QWidget):
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 @@ class SlideController(QtGui.QWidget):
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'),

View File

@ -35,7 +35,7 @@ from PyQt4 import QtCore, QtGui
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 @@ class ThemeManager(QtGui.QWidget):
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)

View File

@ -141,35 +141,4 @@ class BiblePlugin(Plugin):
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)

View File

@ -119,48 +119,7 @@ class CustomPlugin(Plugin):
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):
"""

View File

@ -73,45 +73,4 @@ class ImagePlugin(Plugin):
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)

View File

@ -102,45 +102,4 @@ class MediaPlugin(Plugin):
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)

View File

@ -429,7 +429,7 @@ class ImpressDocument(PresentationDocument):
``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 @@ class ImpressDocument(PresentationDocument):
``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):
"""

View File

@ -168,33 +168,4 @@ class PresentationPlugin(Plugin):
'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)

View File

@ -226,42 +226,7 @@ class SongsPlugin(Plugin):
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):
"""