WizardStrings

This commit is contained in:
Jon Tibble 2011-02-12 02:43:13 +00:00
parent 314697427d
commit 8d18a51f09
5 changed files with 53 additions and 47 deletions

View File

@ -55,6 +55,7 @@ class UiStrings(object):
EditType = unicode(translate('OpenLP.Ui', 'Edit %s'))
EmptyField = translate('OpenLP.Ui', 'Empty Field')
Error = translate('OpenLP.Ui', 'Error')
Export = translate('OpenLP.Ui', 'Export')
ExportType = unicode(translate('OpenLP.Ui', 'Export %s'))
Import = translate('OpenLP.Ui', 'Import')
ImportType = unicode(translate('OpenLP.Ui', 'Import %s'))

View File

@ -31,11 +31,30 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, Receiver, SettingsManager
from openlp.core.lib import build_icon, Receiver, SettingsManager, translate
from openlp.core.lib.ui import UiStrings, add_welcome_page
log = logging.getLogger(__name__)
class WizardStrings(object):
"""
Provide standard strings for wizards to use.
"""
# These strings should need a good reason to be retranslated elsewhere.
Description = unicode(translate('OpenLP.Ui', 'This wizard will help you '
'to %s %s from a variety of formats. Click the next button '
'below to start the process by selecting a format to %s from.',
'Variable 1 & 3 are import/export. Variable 2 is a type like Bibles'))
FinishedType = unicode(translate('OpenLP.Ui', 'Finished %s.'))
FormatLabel = translate('OpenLP.Ui', 'Format:')
ImportSelect = translate('OpenLP.Ui', 'Select Import Source')
ImportSelectLong = unicode(translate('OpenLP.Ui',
'Select the import format and the location to import from.'))
Welcome = u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
translate('OpenLP.Ui', 'Welcome to the %s %s Wizard',
'Variable 1 is the type e.g. Bible and variable 2 is import/export')
class OpenLPWizard(QtGui.QWizard):
"""
Generic OpenLP wizard to provide generic functionality and a unified look
@ -43,6 +62,7 @@ class OpenLPWizard(QtGui.QWizard):
"""
def __init__(self, parent, plugin, name, image):
QtGui.QWizard.__init__(self, parent)
self.plugin = plugin
self.setObjectName(name)
self.openIcon = build_icon(u':/general/general_open.png')
self.deleteIcon = build_icon(u':/general/general_delete.png')
@ -50,7 +70,6 @@ class OpenLPWizard(QtGui.QWizard):
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
self.setupUi(image)
self.registerFields()
self.plugin = plugin
self.customInit()
self.customSignals()
QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'),

View File

@ -33,10 +33,10 @@ import os.path
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, translate
from openlp.core.lib import Receiver, StringContent, translate
from openlp.core.lib.db import delete_database
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.core.utils import AppLocation, string_is_unicode
from openlp.plugins.bibles.lib.manager import BibleFormat
@ -363,22 +363,16 @@ class BibleImportForm(OpenLPWizard):
"""
self.setWindowTitle(
translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
self.titleLabel.setText(
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
translate('BiblesPlugin.ImportWizardForm',
'Welcome to the Bible Import Wizard'))
self.informationLabel.setText(
translate('BiblesPlugin.ImportWizardForm',
'This wizard will help you to import Bibles from a '
'variety of formats. Click the next button below to start the '
'process by selecting a format to import from.'))
self.selectPage.setTitle(translate('BiblesPlugin.ImportWizardForm',
'Select Import Source'))
self.selectPage.setSubTitle(
translate('BiblesPlugin.ImportWizardForm',
'Select the import format, and where to import from.'))
self.formatLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Format:'))
self.titleLabel.setText(WizardStrings.Welcome % (
self.plugin.getString(StringContent.Name)[u'singular'],
UiStrings.Import))
self.informationLabel.setText(WizardStrings.Description % (
UiStrings.Import.toLower(),
self.plugin.getString(StringContent.Name)[u'plural'],
UiStrings.Import.toLower()))
self.selectPage.setTitle(WizardStrings.ImportSelect)
self.selectPage.setSubTitle(WizardStrings.ImportSelectLong)
self.formatLabel.setText(WizardStrings.FormatLabel)
self.formatComboBox.setItemText(0,
translate('BiblesPlugin.ImportWizardForm', 'OSIS'))
self.formatComboBox.setItemText(1,
@ -796,8 +790,8 @@ class BibleImportForm(OpenLPWizard):
'bible. Please note, that verses will be downloaded on\n'
'demand and thus an internet connection is required.'))
else:
self.progressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm', 'Finished import.'))
self.progressLabel.setText(
WizardStrings.FinishedType % UiStrings.Import.toLower())
else:
self.progressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))

View File

@ -32,8 +32,8 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, Receiver, SettingsManager, translate
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.plugins.songs.lib.db import Song
from openlp.plugins.songs.lib.openlyricsexport import OpenLyricsExport
@ -213,9 +213,7 @@ class SongExportForm(OpenLPWizard):
self.availableListWidget) if item.checkState()
]
if not items:
critical_error_message_box(
translate('SongsPlugin.ExportWizardForm',
'No Song Selected'),
critical_error_message_box(UiStrings.NISp,
translate('SongsPlugin.ExportWizardForm',
'You need to add at least one Song to export.'))
return False
@ -289,7 +287,7 @@ class SongExportForm(OpenLPWizard):
self, songs, unicode(self.directoryLineEdit.text()))
if exporter.do_export():
self.progressLabel.setText(
translate('SongsPlugin.SongExportForm', 'Finished export.'))
WizardStrings.FinishedType % UiStrings.Export.toLower())
else:
self.progressLabel.setText(
translate('SongsPlugin.SongExportForm',

View File

@ -31,9 +31,9 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, SettingsManager, translate
from openlp.core.lib import Receiver, SettingsManager, StringContent, translate
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.plugins.songs.lib.importer import SongFormat
log = logging.getLogger(__name__)
@ -199,22 +199,16 @@ class SongImportForm(OpenLPWizard):
"""
self.setWindowTitle(
translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard'))
self.titleLabel.setText(
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
translate('SongsPlugin.ImportWizardForm',
'Welcome to the Song Import Wizard'))
self.informationLabel.setText(
translate('SongsPlugin.ImportWizardForm',
'This wizard will help you to import songs from a variety of '
'formats. Click the next button below to start the process by '
'selecting a format to import from.'))
self.sourcePage.setTitle(
translate('SongsPlugin.ImportWizardForm', 'Select Import Source'))
self.sourcePage.setSubTitle(
translate('SongsPlugin.ImportWizardForm',
'Select the import format, and where to import from.'))
self.formatLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'Format:'))
self.titleLabel.setText(WizardStrings.Welcome % (
self.plugin.getString(StringContent.Name)[u'singular'],
UiStrings.Import))
self.informationLabel.setText(WizardStrings.Description % (
UiStrings.Import.toLower(),
self.plugin.getString(StringContent.Name)[u'plural'],
UiStrings.Import.toLower()))
self.sourcePage.setTitle(WizardStrings.ImportSelect)
self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong)
self.formatLabel.setText(WizardStrings.FormatLabel)
self.formatComboBox.setItemText(0, UiStrings.OLPV2)
self.formatComboBox.setItemText(1,
translate('SongsPlugin.ImportWizardForm', 'openlp.org 1.x'))
@ -719,7 +713,7 @@ class SongImportForm(OpenLPWizard):
)
if importer.do_import():
self.progressLabel.setText(
translate('SongsPlugin.SongImportForm', 'Finished import.'))
WizardStrings.FinishedType % UiStrings.Import.toLower())
else:
self.progressLabel.setText(
translate('SongsPlugin.SongImportForm',