This commit is contained in:
Andreas Preikschat 2011-02-09 16:00:04 +01:00
commit 50e9f9ab5e
22 changed files with 177 additions and 176 deletions

View File

@ -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,
@ -219,3 +241,28 @@ def add_widget_completer(cache, widget):
completer = QtGui.QCompleter(cache)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
widget.setCompleter(completer)
def create_valign_combo(form, parent, layout):
"""
Creates a standard label and combo box for asking users to select a
vertical alignment.
``form``
The UI screen that the label and combo will appear on.
``parent``
The parent object. This should be a ``QWidget`` descendant.
``layout``
A layout object to add the label and combo widgets to.
"""
verticalLabel = QtGui.QLabel(parent)
verticalLabel.setObjectName(u'VerticalLabel')
verticalLabel.setText(translate('OpenLP.Ui', '&Vertical Align:'))
form.verticalComboBox = QtGui.QComboBox(parent)
form.verticalComboBox.setObjectName(u'VerticalComboBox')
form.verticalComboBox.addItem(translate('OpenLP.Ui', 'Top'))
form.verticalComboBox.addItem(translate('OpenLP.Ui', 'Middle'))
form.verticalComboBox.addItem(translate('OpenLP.Ui', 'Bottom'))
verticalLabel.setBuddy(form.verticalComboBox)
layout.addRow(verticalLabel, form.verticalComboBox)

View File

@ -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'))

View File

@ -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'))

View File

@ -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;')
@ -874,7 +873,8 @@ class SlideController(QtGui.QWidget):
using *Blank to Theme*.
"""
log.debug(u'updatePreview %s ' % self.screens.current[u'primary'])
if not self.screens.current[u'primary']:
if not self.screens.current[u'primary'] and \
self.serviceItem.is_capable(ItemCapabilities.ProvidesOwnDisplay):
# Grab now, but try again in a couple of seconds if slide change
# is slow
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)

View File

@ -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)

View File

@ -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(

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, build_icon
from openlp.core.lib.ui import add_welcome_page
from openlp.core.lib.ui import add_welcome_page, create_valign_combo
class Ui_ThemeWizard(object):
def setupUi(self, themeWizard):
@ -242,12 +242,8 @@ class Ui_ThemeWizard(object):
self.horizontalComboBox.setObjectName(u'HorizontalComboBox')
self.alignmentLayout.addRow(self.horizontalLabel,
self.horizontalComboBox)
self.verticalLabel = QtGui.QLabel(self.alignmentPage)
self.verticalLabel.setObjectName(u'VerticalLabel')
self.verticalComboBox = QtGui.QComboBox(self.alignmentPage)
self.verticalComboBox.addItems([u'', u'', u''])
self.verticalComboBox.setObjectName(u'VerticalComboBox')
self.alignmentLayout.addRow(self.verticalLabel, self.verticalComboBox)
create_valign_combo(themeWizard, self.alignmentPage,
self.alignmentLayout)
self.transitionsLabel = QtGui.QLabel(self.alignmentPage)
self.transitionsLabel.setObjectName(u'TransitionsLabel')
self.transitionsCheckBox = QtGui.QCheckBox(self.alignmentPage)
@ -450,8 +446,7 @@ class Ui_ThemeWizard(object):
self.mainAreaPage.setSubTitle(
translate('OpenLP.ThemeWizard', 'Define the font and display '
'characteristics for the Display text'))
self.mainFontLabel.setText(
translate('OpenLP.ThemeWizard', 'Font:'))
self.mainFontLabel.setText(translate('OpenLP.ThemeWizard', 'Font:'))
self.mainColorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
self.mainSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
self.mainSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
@ -465,8 +460,7 @@ class Ui_ThemeWizard(object):
self.shadowCheckBox.setText(translate('OpenLP.ThemeWizard', '&Shadow:'))
self.shadowSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
self.shadowSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
self.mainBoldCheckBox.setText(
translate('OpenLP.ThemeWizard', 'Bold'))
self.mainBoldCheckBox.setText(translate('OpenLP.ThemeWizard', 'Bold'))
self.mainItalicsCheckBox.setText(
translate('OpenLP.ThemeWizard', 'Italic'))
self.footerAreaPage.setTitle(
@ -491,14 +485,6 @@ class Ui_ThemeWizard(object):
translate('OpenLP.ThemeWizard', 'Right'))
self.horizontalComboBox.setItemText(2,
translate('OpenLP.ThemeWizard', 'Center'))
self.verticalLabel.setText(
translate('OpenLP.ThemeWizard', 'Vertical Align:'))
self.verticalComboBox.setItemText(0,
translate('OpenLP.ThemeWizard', 'Top'))
self.verticalComboBox.setItemText(1,
translate('OpenLP.ThemeWizard', 'Middle'))
self.verticalComboBox.setItemText(2,
translate('OpenLP.ThemeWizard', 'Bottom'))
self.transitionsLabel.setText(
translate('OpenLP.ThemeWizard', 'Transitions:'))
self.areaPositionPage.setTitle(

View File

@ -27,6 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate
from openlp.core.lib.ui import UiStrings, create_valign_combo
class AlertsTab(SettingsTab):
"""
@ -40,48 +41,43 @@ class AlertsTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'AlertsTab')
SettingsTab.setupUi(self)
self.FontGroupBox = QtGui.QGroupBox(self.leftColumn)
self.FontGroupBox.setObjectName(u'FontGroupBox')
self.FontLayout = QtGui.QFormLayout(self.FontGroupBox)
self.FontLayout.setObjectName(u'FontLayout')
self.FontLabel = QtGui.QLabel(self.FontGroupBox)
self.fontGroupBox = QtGui.QGroupBox(self.leftColumn)
self.fontGroupBox.setObjectName(u'fontGroupBox')
self.fontLayout = QtGui.QFormLayout(self.fontGroupBox)
self.fontLayout.setObjectName(u'fontLayout')
self.FontLabel = QtGui.QLabel(self.fontGroupBox)
self.FontLabel.setObjectName(u'FontLabel')
self.FontComboBox = QtGui.QFontComboBox(self.FontGroupBox)
self.FontComboBox = QtGui.QFontComboBox(self.fontGroupBox)
self.FontComboBox.setObjectName(u'FontComboBox')
self.FontLayout.addRow(self.FontLabel, self.FontComboBox)
self.FontColorLabel = QtGui.QLabel(self.FontGroupBox)
self.fontLayout.addRow(self.FontLabel, self.FontComboBox)
self.FontColorLabel = QtGui.QLabel(self.fontGroupBox)
self.FontColorLabel.setObjectName(u'FontColorLabel')
self.ColorLayout = QtGui.QHBoxLayout()
self.ColorLayout.setObjectName(u'ColorLayout')
self.FontColorButton = QtGui.QPushButton(self.FontGroupBox)
self.FontColorButton = QtGui.QPushButton(self.fontGroupBox)
self.FontColorButton.setObjectName(u'FontColorButton')
self.ColorLayout.addWidget(self.FontColorButton)
self.ColorLayout.addSpacing(20)
self.BackgroundColorLabel = QtGui.QLabel(self.FontGroupBox)
self.BackgroundColorLabel = QtGui.QLabel(self.fontGroupBox)
self.BackgroundColorLabel.setObjectName(u'BackgroundColorLabel')
self.ColorLayout.addWidget(self.BackgroundColorLabel)
self.BackgroundColorButton = QtGui.QPushButton(self.FontGroupBox)
self.BackgroundColorButton = QtGui.QPushButton(self.fontGroupBox)
self.BackgroundColorButton.setObjectName(u'BackgroundColorButton')
self.ColorLayout.addWidget(self.BackgroundColorButton)
self.FontLayout.addRow(self.FontColorLabel, self.ColorLayout)
self.FontSizeLabel = QtGui.QLabel(self.FontGroupBox)
self.fontLayout.addRow(self.FontColorLabel, self.ColorLayout)
self.FontSizeLabel = QtGui.QLabel(self.fontGroupBox)
self.FontSizeLabel.setObjectName(u'FontSizeLabel')
self.FontSizeSpinBox = QtGui.QSpinBox(self.FontGroupBox)
self.FontSizeSpinBox = QtGui.QSpinBox(self.fontGroupBox)
self.FontSizeSpinBox.setObjectName(u'FontSizeSpinBox')
self.FontLayout.addRow(self.FontSizeLabel, self.FontSizeSpinBox)
self.TimeoutLabel = QtGui.QLabel(self.FontGroupBox)
self.fontLayout.addRow(self.FontSizeLabel, self.FontSizeSpinBox)
self.TimeoutLabel = QtGui.QLabel(self.fontGroupBox)
self.TimeoutLabel.setObjectName(u'TimeoutLabel')
self.TimeoutSpinBox = QtGui.QSpinBox(self.FontGroupBox)
self.TimeoutSpinBox = QtGui.QSpinBox(self.fontGroupBox)
self.TimeoutSpinBox.setMaximum(180)
self.TimeoutSpinBox.setObjectName(u'TimeoutSpinBox')
self.FontLayout.addRow(self.TimeoutLabel, self.TimeoutSpinBox)
self.LocationLabel = QtGui.QLabel(self.FontGroupBox)
self.LocationLabel.setObjectName(u'LocationLabel')
self.LocationComboBox = QtGui.QComboBox(self.FontGroupBox)
self.LocationComboBox.addItems([u'', u'', u''])
self.LocationComboBox.setObjectName(u'LocationComboBox')
self.FontLayout.addRow(self.LocationLabel, self.LocationComboBox)
self.leftLayout.addWidget(self.FontGroupBox)
self.fontLayout.addRow(self.TimeoutLabel, self.TimeoutSpinBox)
create_valign_combo(self, self.fontGroupBox, self.fontLayout)
self.leftLayout.addWidget(self.fontGroupBox)
self.leftLayout.addStretch()
self.PreviewGroupBox = QtGui.QGroupBox(self.rightColumn)
self.PreviewGroupBox.setObjectName(u'PreviewGroupBox')
@ -99,15 +95,13 @@ class AlertsTab(SettingsTab):
QtCore.SIGNAL(u'pressed()'), self.onFontColorButtonClicked)
QtCore.QObject.connect(self.FontComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked)
QtCore.QObject.connect(self.LocationComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onLocationComboBoxClicked)
QtCore.QObject.connect(self.TimeoutSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged)
QtCore.QObject.connect(self.FontSizeSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), self.onFontSizeSpinBoxChanged)
def retranslateUi(self):
self.FontGroupBox.setTitle(
self.fontGroupBox.setTitle(
translate('AlertsPlugin.AlertsTab', 'Font'))
self.FontLabel.setText(
translate('AlertsPlugin.AlertsTab', 'Font name:'))
@ -123,18 +117,8 @@ class AlertsTab(SettingsTab):
translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
self.TimeoutSpinBox.setSuffix(
translate('AlertsPlugin.AlertsTab', 's'))
self.LocationLabel.setText(
translate('AlertsPlugin.AlertsTab', 'Location:'))
self.PreviewGroupBox.setTitle(
translate('AlertsPlugin.AlertsTab', 'Preview'))
self.FontPreview.setText(
translate('AlertsPlugin.AlertsTab', 'OpenLP 2.0'))
self.LocationComboBox.setItemText(0,
translate('AlertsPlugin.AlertsTab', 'Top'))
self.LocationComboBox.setItemText(1,
translate('AlertsPlugin.AlertsTab', 'Middle'))
self.LocationComboBox.setItemText(2,
translate('AlertsPlugin.AlertsTab', 'Bottom'))
self.PreviewGroupBox.setTitle(UiStrings.Preview)
self.FontPreview.setText(UiStrings.OLPV2)
def onBackgroundColorButtonClicked(self):
new_color = QtGui.QColorDialog.getColor(
@ -148,9 +132,6 @@ class AlertsTab(SettingsTab):
def onFontComboBoxClicked(self):
self.updateDisplay()
def onLocationComboBoxClicked(self, location):
self.location = location
def onFontColorButtonClicked(self):
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.font_color), self)
@ -188,7 +169,7 @@ class AlertsTab(SettingsTab):
u'background-color: %s' % self.font_color)
self.BackgroundColorButton.setStyleSheet(
u'background-color: %s' % self.bg_color)
self.LocationComboBox.setCurrentIndex(self.location)
self.verticalComboBox.setCurrentIndex(self.location)
font = QtGui.QFont()
font.setFamily(self.font_face)
self.FontComboBox.setCurrentFont(font)
@ -197,14 +178,14 @@ class AlertsTab(SettingsTab):
def save(self):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
self.font_face = self.FontComboBox.currentFont().family()
settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
settings.setValue(u'font color', QtCore.QVariant(self.font_color))
settings.setValue(u'font size', QtCore.QVariant(self.font_size))
self.font_face = self.FontComboBox.currentFont().family()
settings.setValue(u'font face', QtCore.QVariant(self.font_face))
settings.setValue(u'timeout', QtCore.QVariant(self.timeout))
settings.setValue(u'location',
QtCore.QVariant(self.LocationComboBox.currentIndex()))
self.location = self.verticalComboBox.currentIndex()
settings.setValue(u'location', QtCore.QVariant(self.location))
settings.endGroup()
def updateDisplay(self):

View File

@ -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')
}

View File

@ -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)

View File

@ -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')
}

View File

@ -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.'))

View File

@ -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')
}

View File

@ -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(

View File

@ -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')
}

View File

@ -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')
}

View File

@ -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(

View File

@ -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)

View File

@ -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))

View File

@ -81,14 +81,14 @@ class EasiSlidesImport(SongImport):
def _parse_song(self, song):
self._success = True
self._add_title(self.title, song.Title1, True)
self._add_alttitle(self.alternate_title, song.Title2)
self._add_number(self.song_number, song.SongNumber)
self._add_unicode_attribute(self.title, song.Title1, True)
self._add_unicode_attribute(self.alternate_title, song.Title2)
self._add_unicode_attribute(self.song_number, song.SongNumber)
if self.song_number == u'0':
self.song_number = u''
self._add_authors(song)
self._add_copyright(song)
self._add_book(self.song_book_name, song.BookReference)
self._add_unicode_attribute(self.song_book_name, song.BookReference)
self._parse_and_add_lyrics(song)
return self._success

View File

@ -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, SongExportForm
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()

View File

@ -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
@ -240,37 +241,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')
}