UiStrings and SongStrings

This commit is contained in:
Jon Tibble 2011-02-11 21:17:56 +00:00
parent 2bcc01f35d
commit 9366155924
17 changed files with 114 additions and 103 deletions

View File

@ -449,8 +449,7 @@ class MediaManagerItem(QtGui.QWidget):
Add a selected item to the current service Add a selected item to the current service
""" """
if not self.listView.selectedIndexes() and not self.remoteTriggered: if not self.listView.selectedIndexes() and not self.remoteTriggered:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self, UiStrings.NISp,
translate('OpenLP.MediaManagerItem', 'No Items Selected'),
translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'You must select one or more items.')) 'You must select one or more items.'))
else: else:
@ -476,17 +475,14 @@ class MediaManagerItem(QtGui.QWidget):
Add a selected item to an existing item in the current service. Add a selected item to an existing item in the current service.
""" """
if not self.listView.selectedIndexes() and not self.remoteTriggered: if not self.listView.selectedIndexes() and not self.remoteTriggered:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self, UiStrings.NISp,
translate('OpenLP.MediaManagerItem', 'No Items Selected'),
translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'You must select one or more items')) 'You must select one or more items'))
else: else:
log.debug(u'%s Add requested', self.plugin.name) log.debug(u'%s Add requested', self.plugin.name)
serviceItem = self.parent.serviceManager.getServiceItem() serviceItem = self.parent.serviceManager.getServiceItem()
if not serviceItem: if not serviceItem:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self, UiStrings.NISs,
translate('OpenLP.MediaManagerItem',
'No Service Item Selected'),
translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'You must select an existing service item to add to.')) 'You must select an existing service item to add to.'))
elif self.plugin.name.lower() == serviceItem.name.lower(): elif self.plugin.name.lower() == serviceItem.name.lower():

View File

@ -178,9 +178,9 @@ class HorizontalType(object):
""" """
Return a string representation of a horizontal type. Return a string representation of a horizontal type.
""" """
if horizontal_type == Horizontal.Right: if horizontal_type == HorizontalType.Right:
return u'right' return u'right'
elif horizontal_type == Horizontal.Center: elif horizontal_type == HorizontalType.Center:
return u'center' return u'center'
else: else:
return u'left' return u'left'

View File

@ -46,7 +46,6 @@ class UiStrings(object):
'Add the selected %s to the service.')) 'Add the selected %s to the service.'))
Advanced = translate('OpenLP.Ui', 'Advanced') Advanced = translate('OpenLP.Ui', 'Advanced')
AllFiles = translate('OpenLP.Ui', 'All Files') AllFiles = translate('OpenLP.Ui', 'All Files')
Authors = translate('OpenLP.Ui', 'Authors')
CreateANew = unicode(translate('OpenLP.Ui', 'Create a new %s.')) CreateANew = unicode(translate('OpenLP.Ui', 'Create a new %s.'))
Delete = translate('OpenLP.Ui', '&Delete') Delete = translate('OpenLP.Ui', '&Delete')
DeleteSelect = unicode(translate('OpenLP.Ui', 'Delete the selected %s.')) DeleteSelect = unicode(translate('OpenLP.Ui', 'Delete the selected %s.'))
@ -54,6 +53,7 @@ class UiStrings(object):
Edit = translate('OpenLP.Ui', '&Edit') Edit = translate('OpenLP.Ui', '&Edit')
EditSelect = unicode(translate('OpenLP.Ui', 'Edit the selected %s.')) EditSelect = unicode(translate('OpenLP.Ui', 'Edit the selected %s.'))
EditType = unicode(translate('OpenLP.Ui', 'Edit %s')) EditType = unicode(translate('OpenLP.Ui', 'Edit %s'))
EmptyField = translate('OpenLP.Ui', 'Empty Field')
Error = translate('OpenLP.Ui', 'Error') Error = translate('OpenLP.Ui', 'Error')
ExportType = unicode(translate('OpenLP.Ui', 'Export %s')) ExportType = unicode(translate('OpenLP.Ui', 'Export %s'))
Import = translate('OpenLP.Ui', 'Import') Import = translate('OpenLP.Ui', 'Import')
@ -63,6 +63,10 @@ class UiStrings(object):
LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s.')) LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s.'))
New = translate('OpenLP.Ui', 'New') New = translate('OpenLP.Ui', 'New')
NewType = unicode(translate('OpenLP.Ui', 'New %s')) NewType = unicode(translate('OpenLP.Ui', 'New %s'))
NFSs = translate('OpenLP.Ui', 'No File Selected', 'Singular')
NFSp = translate('OpenLP.Ui', 'No Files Selected', 'Plural')
NISs = translate('OpenLP.Ui', 'No Item Selected', 'Singular')
NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural')
OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0') OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0')
OpenType = unicode(translate('OpenLP.Ui', 'Open %s')) OpenType = unicode(translate('OpenLP.Ui', 'Open %s'))
Preview = translate('OpenLP.Ui', 'Preview') Preview = translate('OpenLP.Ui', 'Preview')
@ -75,8 +79,8 @@ class UiStrings(object):
SendSelectLive = unicode(translate('OpenLP.Ui', SendSelectLive = unicode(translate('OpenLP.Ui',
'Send the selected %s live.')) 'Send the selected %s live.'))
Service = translate('OpenLP.Ui', 'Service') Service = translate('OpenLP.Ui', 'Service')
Theme = translate('OpenLP.Ui', 'Theme') Theme = translate('OpenLP.Ui', 'Theme', 'Singular')
Themes = translate('OpenLP.Ui', 'Themes') Themes = translate('OpenLP.Ui', 'Themes', 'Plural')
def add_welcome_page(parent, image): def add_welcome_page(parent, image):
@ -168,7 +172,7 @@ def media_item_combo_box(parent, name):
combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
return combo return combo
def create_delete_push_button(parent, icon=None): def create_delete_push_button(parent, item_name, icon=None):
""" """
Creates a standard push button with a delete label and optional icon. The Creates a standard push button with a delete label and optional icon. The
button is connected to the parent's ``onDeleteButtonClicked()`` method to button is connected to the parent's ``onDeleteButtonClicked()`` method to
@ -186,8 +190,7 @@ def create_delete_push_button(parent, icon=None):
delete_icon = icon if icon else u':/general/general_delete.png' delete_icon = icon if icon else u':/general/general_delete.png'
delete_button.setIcon(build_icon(delete_icon)) delete_button.setIcon(build_icon(delete_icon))
delete_button.setText(UiStrings.Delete) delete_button.setText(UiStrings.Delete)
delete_button.setToolTip( delete_button.setToolTip(UiStrings.DeleteSelect % item_name)
translate('OpenLP.Ui', 'Delete the selected item.'))
QtCore.QObject.connect(delete_button, QtCore.QObject.connect(delete_button,
QtCore.SIGNAL(u'clicked()'), parent.onDeleteButtonClicked) QtCore.SIGNAL(u'clicked()'), parent.onDeleteButtonClicked)
return delete_button return delete_button

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box, \ from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box, \
create_delete_push_button, create_up_down_push_button_set create_delete_push_button, create_up_down_push_button_set
class Ui_ServiceItemEditDialog(object): class Ui_ServiceItemEditDialog(object):
@ -41,7 +41,8 @@ class Ui_ServiceItemEditDialog(object):
self.dialogLayout.addWidget(self.listWidget, 0, 0) self.dialogLayout.addWidget(self.listWidget, 0, 0)
self.buttonLayout = QtGui.QVBoxLayout() self.buttonLayout = QtGui.QVBoxLayout()
self.buttonLayout.setObjectName(u'buttonLayout') self.buttonLayout.setObjectName(u'buttonLayout')
self.deleteButton = create_delete_push_button(serviceItemEditDialog) self.deleteButton = create_delete_push_button(
serviceItemEditDialog, UiStrings.Service.toLower())
self.buttonLayout.addWidget(self.deleteButton) self.buttonLayout.addWidget(self.deleteButton)
self.buttonLayout.addStretch() self.buttonLayout.addStretch()
self.upButton, self.downButton = create_up_down_push_button_set( self.upButton, self.downButton = create_up_down_push_button_set(

View File

@ -26,7 +26,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import StringContent, build_icon, translate
from openlp.core.lib.ui import create_delete_push_button from openlp.core.lib.ui import create_delete_push_button
class Ui_AlertDialog(object): class Ui_AlertDialog(object):
@ -66,7 +66,8 @@ class Ui_AlertDialog(object):
self.saveButton.setIcon(build_icon(u':/general/general_save.png')) self.saveButton.setIcon(build_icon(u':/general/general_save.png'))
self.saveButton.setObjectName(u'saveButton') self.saveButton.setObjectName(u'saveButton')
self.manageButtonLayout.addWidget(self.saveButton) self.manageButtonLayout.addWidget(self.saveButton)
self.deleteButton = create_delete_push_button(alertDialog) self.deleteButton = create_delete_push_button(alertDialog,
self.parent.getString(StringContent.Name)[u'singular'].toLower())
self.deleteButton.setEnabled(False) self.deleteButton.setEnabled(False)
self.manageButtonLayout.addWidget(self.deleteButton) self.manageButtonLayout.addWidget(self.deleteButton)
self.manageButtonLayout.addStretch() self.manageButtonLayout.addStretch()

View File

@ -35,7 +35,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, translate from openlp.core.lib import Receiver, translate
from openlp.core.lib.db import delete_database 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.ui.wizard import OpenLPWizard
from openlp.core.utils import AppLocation, string_is_unicode from openlp.core.utils import AppLocation, string_is_unicode
from openlp.plugins.bibles.lib.manager import BibleFormat from openlp.plugins.bibles.lib.manager import BibleFormat
@ -468,9 +468,7 @@ class BibleImportForm(OpenLPWizard):
elif self.currentPage() == self.selectPage: elif self.currentPage() == self.selectPage:
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS: if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
if not self.field(u'osis_location').toString(): if not self.field(u'osis_location').toString():
critical_error_message_box( critical_error_message_box(UiStrings.NFSs,
translate('BiblesPlugin.ImportWizardForm',
'Invalid Bible Location'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file to import your ' 'You need to specify a file to import your '
'Bible from.')) 'Bible from.'))
@ -478,8 +476,7 @@ class BibleImportForm(OpenLPWizard):
return False return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV: elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
if not self.field(u'csv_testamentsfile').toString(): if not self.field(u'csv_testamentsfile').toString():
answer = critical_error_message_box(translate( answer = critical_error_message_box(UiStrings.NFSs,
'BiblesPlugin.ImportWizardForm', 'No Testaments File'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You have not specified a testaments file. Do you ' 'You have not specified a testaments file. Do you '
'want to proceed with the import?'), question=True) 'want to proceed with the import?'), question=True)
@ -487,18 +484,14 @@ class BibleImportForm(OpenLPWizard):
self.csvTestamentsEdit.setFocus() self.csvTestamentsEdit.setFocus()
return False return False
elif not self.field(u'csv_booksfile').toString(): elif not self.field(u'csv_booksfile').toString():
critical_error_message_box( critical_error_message_box(UiStrings.NFSs,
translate('BiblesPlugin.ImportWizardForm',
'Invalid Books File'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file with books of ' 'You need to specify a file with books of '
'the Bible to use in the import.')) 'the Bible to use in the import.'))
self.csvBooksEdit.setFocus() self.csvBooksEdit.setFocus()
return False return False
elif not self.field(u'csv_versefile').toString(): elif not self.field(u'csv_versefile').toString():
critical_error_message_box( critical_error_message_box(UiStrings.NFSs,
translate('BiblesPlugin.ImportWizardForm',
'Invalid Verse File'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file of Bible ' 'You need to specify a file of Bible '
'verses to import.')) 'verses to import.'))
@ -507,9 +500,7 @@ class BibleImportForm(OpenLPWizard):
elif self.field(u'source_format').toInt()[0] == \ elif self.field(u'source_format').toInt()[0] == \
BibleFormat.OpenSong: BibleFormat.OpenSong:
if not self.field(u'opensong_file').toString(): if not self.field(u'opensong_file').toString():
critical_error_message_box( critical_error_message_box(UiStrings.NFSs,
translate('BiblesPlugin.ImportWizardForm',
'Invalid OpenSong Bible'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify an OpenSong Bible ' 'You need to specify an OpenSong Bible '
'file to import.')) 'file to import.'))
@ -517,9 +508,7 @@ class BibleImportForm(OpenLPWizard):
return False return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1: elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1:
if not self.field(u'openlp1_location').toString(): if not self.field(u'openlp1_location').toString():
critical_error_message_box( critical_error_message_box(UiStrings.NFSs,
translate('BiblesPlugin.ImportWizardForm',
'Invalid Bible Location'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file to import your ' 'You need to specify a file to import your '
'Bible from.')) 'Bible from.'))
@ -531,17 +520,13 @@ class BibleImportForm(OpenLPWizard):
license_copyright = \ license_copyright = \
unicode(self.field(u'license_copyright').toString()) unicode(self.field(u'license_copyright').toString())
if not license_version: if not license_version:
critical_error_message_box( critical_error_message_box(UiStrings.EmptyField,
translate('BiblesPlugin.ImportWizardForm',
'Empty Version Name'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a version name for your Bible.')) 'You need to specify a version name for your Bible.'))
self.versionNameEdit.setFocus() self.versionNameEdit.setFocus()
return False return False
elif not license_copyright: elif not license_copyright:
critical_error_message_box( critical_error_message_box(UiStrings.EmptyField,
translate('BiblesPlugin.ImportWizardForm',
'Empty Copyright'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to set a copyright for your Bible. ' 'You need to set a copyright for your Bible. '
'Bibles in the Public Domain need to be marked as such.')) 'Bibles in the Public Domain need to be marked as such.'))

View File

@ -52,7 +52,7 @@ class CustomPlugin(Plugin):
CustomMediaItem, CustomTab) CustomMediaItem, CustomTab)
self.weight = -5 self.weight = -5
self.manager = Manager(u'custom', init_schema) self.manager = Manager(u'custom', init_schema)
self.edit_custom_form = EditCustomForm(self.manager) self.edit_custom_form = EditCustomForm(self)
self.icon_path = u':/plugins/plugin_custom.png' self.icon_path = u':/plugins/plugin_custom.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)

View File

@ -26,7 +26,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import StringContent, build_icon, translate
from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box, \ from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box, \
create_delete_push_button, create_up_down_push_button_set create_delete_push_button, create_up_down_push_button_set
@ -66,7 +66,9 @@ class Ui_CustomEditDialog(object):
self.editAllButton = QtGui.QPushButton(customEditDialog) self.editAllButton = QtGui.QPushButton(customEditDialog)
self.editAllButton.setObjectName(u'editAllButton') self.editAllButton.setObjectName(u'editAllButton')
self.buttonLayout.addWidget(self.editAllButton) self.buttonLayout.addWidget(self.editAllButton)
self.deleteButton = create_delete_push_button(customEditDialog) self.deleteButton = create_delete_push_button(customEditDialog,
customEditDialog.parent.getString(
StringContent.Name)[u'singular'].toLower())
self.deleteButton.setEnabled(False) self.deleteButton.setEnabled(False)
self.buttonLayout.addWidget(self.deleteButton) self.buttonLayout.addWidget(self.deleteButton)
self.buttonLayout.addStretch() self.buttonLayout.addStretch()

View File

@ -42,14 +42,15 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
Class documentation goes here. Class documentation goes here.
""" """
log.info(u'Custom Editor loaded') log.info(u'Custom Editor loaded')
def __init__(self, manager, parent=None): def __init__(self, parent):
""" """
Constructor Constructor
""" """
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self)
self.parent = parent
self.manager = self.parent.manager
self.setupUi(self) self.setupUi(self)
# Create other objects and forms. # Create other objects and forms.
self.manager = manager
self.editSlideForm = EditCustomSlideForm(self) self.editSlideForm = EditCustomSlideForm(self)
# Connecting signals and slots # Connecting signals and slots
QtCore.QObject.connect(self.previewButton, QtCore.QObject.connect(self.previewButton,

View File

@ -28,6 +28,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_accept_reject_button_box
from openlp.plugins.songs.lib.ui import SongStrings
class Ui_AuthorsDialog(object): class Ui_AuthorsDialog(object):
def setupUi(self, authorsDialog): def setupUi(self, authorsDialog):
@ -64,7 +65,7 @@ class Ui_AuthorsDialog(object):
def retranslateUi(self, authorsDialog): def retranslateUi(self, authorsDialog):
authorsDialog.setWindowTitle( authorsDialog.setWindowTitle(
translate('SongsPlugin.AuthorsForm', 'Author Maintenance')) SongStrings.TypeMaintenance % SongStrings.Author)
self.displayLabel.setText( self.displayLabel.setText(
translate('SongsPlugin.AuthorsForm', 'Display name:')) translate('SongsPlugin.AuthorsForm', 'Display name:'))
self.firstNameLabel.setText( self.firstNameLabel.setText(

View File

@ -28,6 +28,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box
from openlp.plugins.songs.lib.ui import SongStrings
class Ui_EditSongDialog(object): class Ui_EditSongDialog(object):
def setupUi(self, editSongDialog): def setupUi(self, editSongDialog):
@ -265,21 +266,19 @@ class Ui_EditSongDialog(object):
self.songTabWidget.setTabText( self.songTabWidget.setTabText(
self.songTabWidget.indexOf(self.lyricsTab), self.songTabWidget.indexOf(self.lyricsTab),
translate('SongsPlugin.EditSongForm', 'Title && Lyrics')) translate('SongsPlugin.EditSongForm', 'Title && Lyrics'))
self.authorsGroupBox.setTitle(UiStrings.Authors) self.authorsGroupBox.setTitle(SongStrings.Authors)
self.authorAddButton.setText( self.authorAddButton.setText(
translate('SongsPlugin.EditSongForm', '&Add to Song')) translate('SongsPlugin.EditSongForm', '&Add to Song'))
self.authorRemoveButton.setText( self.authorRemoveButton.setText(
translate('SongsPlugin.EditSongForm', '&Remove')) translate('SongsPlugin.EditSongForm', '&Remove'))
self.maintenanceButton.setText(translate('SongsPlugin.EditSongForm', self.maintenanceButton.setText(translate('SongsPlugin.EditSongForm',
'&Manage Authors, Topics, Song Books')) '&Manage Authors, Topics, Song Books'))
self.topicsGroupBox.setTitle( self.topicsGroupBox.setTitle(SongStrings.Topic)
translate('SongsPlugin.EditSongForm', 'Topic'))
self.topicAddButton.setText( self.topicAddButton.setText(
translate('SongsPlugin.EditSongForm', 'A&dd to Song')) translate('SongsPlugin.EditSongForm', 'A&dd to Song'))
self.topicRemoveButton.setText( self.topicRemoveButton.setText(
translate('SongsPlugin.EditSongForm', 'R&emove')) translate('SongsPlugin.EditSongForm', 'R&emove'))
self.songBookGroupBox.setTitle( self.songBookGroupBox.setTitle(SongStrings.SongBook)
translate('SongsPlugin.EditSongForm', 'Song Book'))
self.songBookNameLabel.setText(translate('SongsPlugin.EditSongForm', self.songBookNameLabel.setText(translate('SongsPlugin.EditSongForm',
'Book:')) 'Book:'))
self.songBookNumberLabel.setText(translate('SongsPlugin.EditSongForm', self.songBookNumberLabel.setText(translate('SongsPlugin.EditSongForm',

View File

@ -28,6 +28,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_accept_reject_button_box
from openlp.plugins.songs.lib.ui import SongStrings
class Ui_SongBookDialog(object): class Ui_SongBookDialog(object):
def setupUi(self, songBookDialog): def setupUi(self, songBookDialog):
@ -58,7 +59,7 @@ class Ui_SongBookDialog(object):
def retranslateUi(self, songBookDialog): def retranslateUi(self, songBookDialog):
songBookDialog.setWindowTitle( songBookDialog.setWindowTitle(
translate('SongsPlugin.SongBookForm', 'Song Book Maintenance')) SongStrings.TypeMaintenance % SongStrings.SongBook)
self.nameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:')) self.nameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:'))
self.publisherLabel.setText( self.publisherLabel.setText(
translate('SongsPlugin.SongBookForm', '&Publisher:')) translate('SongsPlugin.SongBookForm', '&Publisher:'))

View File

@ -330,9 +330,7 @@ class SongImportForm(OpenLPWizard):
source_format = self.formatComboBox.currentIndex() source_format = self.formatComboBox.currentIndex()
if source_format == SongFormat.OpenLP2: if source_format == SongFormat.OpenLP2:
if self.openLP2FilenameEdit.text().isEmpty(): if self.openLP2FilenameEdit.text().isEmpty():
critical_error_message_box( critical_error_message_box(UiStrings.NFSs,
translate('SongsPlugin.ImportWizardForm',
'No OpenLP 2.0 Song Database Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to select an OpenLP 2.0 song database ' 'You need to select an OpenLP 2.0 song database '
'file to import from.')) 'file to import from.'))
@ -340,9 +338,7 @@ class SongImportForm(OpenLPWizard):
return False return False
elif source_format == SongFormat.OpenLP1: elif source_format == SongFormat.OpenLP1:
if self.openLP1FilenameEdit.text().isEmpty(): if self.openLP1FilenameEdit.text().isEmpty():
critical_error_message_box( critical_error_message_box(UiStrings.NFSs,
translate('SongsPlugin.ImportWizardForm',
'No openlp.org 1.x Song Database Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to select an openlp.org 1.x song ' 'You need to select an openlp.org 1.x song '
'database file to import from.')) 'database file to import from.'))
@ -350,9 +346,7 @@ class SongImportForm(OpenLPWizard):
return False return False
elif source_format == SongFormat.OpenLyrics: elif source_format == SongFormat.OpenLyrics:
if self.openLyricsFileListWidget.count() == 0: if self.openLyricsFileListWidget.count() == 0:
critical_error_message_box( critical_error_message_box(UiStrings.NFSp,
translate('SongsPlugin.ImportWizardForm',
'No OpenLyrics Files Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one OpenLyrics ' 'You need to add at least one OpenLyrics '
'song file to import from.')) 'song file to import from.'))
@ -360,9 +354,7 @@ class SongImportForm(OpenLPWizard):
return False return False
elif source_format == SongFormat.OpenSong: elif source_format == SongFormat.OpenSong:
if self.openSongFileListWidget.count() == 0: if self.openSongFileListWidget.count() == 0:
critical_error_message_box( critical_error_message_box(UiStrings.NFSp,
translate('SongsPlugin.ImportWizardForm',
'No OpenSong Files Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one OpenSong ' 'You need to add at least one OpenSong '
'song file to import from.')) 'song file to import from.'))
@ -370,9 +362,7 @@ class SongImportForm(OpenLPWizard):
return False return False
elif source_format == SongFormat.WordsOfWorship: elif source_format == SongFormat.WordsOfWorship:
if self.wordsOfWorshipFileListWidget.count() == 0: if self.wordsOfWorshipFileListWidget.count() == 0:
critical_error_message_box( critical_error_message_box(UiStrings.NFSp,
translate('SongsPlugin.ImportWizardForm',
'No Words of Worship Files Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one Words of Worship ' 'You need to add at least one Words of Worship '
'file to import from.')) 'file to import from.'))
@ -380,9 +370,7 @@ class SongImportForm(OpenLPWizard):
return False return False
elif source_format == SongFormat.CCLI: elif source_format == SongFormat.CCLI:
if self.ccliFileListWidget.count() == 0: if self.ccliFileListWidget.count() == 0:
critical_error_message_box( critical_error_message_box(UiStrings.NFSp,
translate('SongsPlugin.ImportWizardForm',
'No CCLI Files Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one CCLI file ' 'You need to add at least one CCLI file '
'to import from.')) 'to import from.'))
@ -390,9 +378,7 @@ class SongImportForm(OpenLPWizard):
return False return False
elif source_format == SongFormat.SongsOfFellowship: elif source_format == SongFormat.SongsOfFellowship:
if self.songsOfFellowshipFileListWidget.count() == 0: if self.songsOfFellowshipFileListWidget.count() == 0:
critical_error_message_box( critical_error_message_box(UiStrings.NFSp,
translate('SongsPlugin.ImportWizardForm',
'No Songs of Fellowship File Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one Songs of Fellowship ' 'You need to add at least one Songs of Fellowship '
'file to import from.')) 'file to import from.'))
@ -400,9 +386,7 @@ class SongImportForm(OpenLPWizard):
return False return False
elif source_format == SongFormat.Generic: elif source_format == SongFormat.Generic:
if self.genericFileListWidget.count() == 0: if self.genericFileListWidget.count() == 0:
critical_error_message_box( critical_error_message_box(UiStrings.NFSp,
translate('SongsPlugin.ImportWizardForm',
'No Document/Presentation Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one document or ' 'You need to add at least one document or '
'presentation file to import from.')) 'presentation file to import from.'))
@ -410,9 +394,7 @@ class SongImportForm(OpenLPWizard):
return False return False
elif source_format == SongFormat.EasiSlides: elif source_format == SongFormat.EasiSlides:
if self.easiSlidesFilenameEdit.text().isEmpty(): if self.easiSlidesFilenameEdit.text().isEmpty():
critical_error_message_box( critical_error_message_box(UiStrings.NFSp,
translate('SongsPlugin.ImportWizardForm',
'No Easislides Songs file selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to select an xml song file exported from ' 'You need to select an xml song file exported from '
'EasiSlides, to import from.')) 'EasiSlides, to import from.'))
@ -420,9 +402,7 @@ class SongImportForm(OpenLPWizard):
return False return False
elif source_format == SongFormat.EasyWorship: elif source_format == SongFormat.EasyWorship:
if self.ewFilenameEdit.text().isEmpty(): if self.ewFilenameEdit.text().isEmpty():
critical_error_message_box( critical_error_message_box(UiStrings.NFSs,
translate('SongsPlugin.ImportWizardForm',
'No EasyWorship Song Database Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to select an EasyWorship song database ' 'You need to select an EasyWorship song database '
'file to import from.')) 'file to import from.'))
@ -430,9 +410,7 @@ class SongImportForm(OpenLPWizard):
return False return False
elif source_format == SongFormat.SongBeamer: elif source_format == SongFormat.SongBeamer:
if self.songBeamerFileListWidget.count() == 0: if self.songBeamerFileListWidget.count() == 0:
critical_error_message_box( critical_error_message_box(UiStrings.NFSp,
translate('SongsPlugin.ImportWizardForm',
'No SongBeamer File Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one SongBeamer ' 'You need to add at least one SongBeamer '
'file to import from.')) 'file to import from.'))
@ -585,7 +563,7 @@ class SongImportForm(OpenLPWizard):
'Select Songs of Fellowship Files'), 'Select Songs of Fellowship Files'),
self.songsOfFellowshipFileListWidget, u'%s (*.rtf)' self.songsOfFellowshipFileListWidget, u'%s (*.rtf)'
% translate('SongsPlugin.ImportWizardForm', % translate('SongsPlugin.ImportWizardForm',
'Songs Of Felloship Song Files') 'Songs Of Fellowship Song Files')
) )
def onSongsOfFellowshipRemoveButtonClicked(self): def onSongsOfFellowshipRemoveButtonClicked(self):

View File

@ -28,6 +28,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import UiStrings from openlp.core.lib.ui import UiStrings
from openlp.plugins.songs.lib.ui import SongStrings
class Ui_SongMaintenanceDialog(object): class Ui_SongMaintenanceDialog(object):
def setupUi(self, songMaintenanceDialog): def setupUi(self, songMaintenanceDialog):
@ -145,13 +146,10 @@ class Ui_SongMaintenanceDialog(object):
def retranslateUi(self, songMaintenanceDialog): def retranslateUi(self, songMaintenanceDialog):
songMaintenanceDialog.setWindowTitle( songMaintenanceDialog.setWindowTitle(
translate('SongsPlugin.SongMaintenanceForm', 'Song Maintenance')) SongStrings.TypeMaintenance % SongStrings.Song)
authorsString = UiStrings.Authors self.listItemAuthors.setText(SongStrings.Authors)
topicsString = translate('SongsPlugin.SongMaintenanceForm', 'Topics') self.listItemTopics.setText(SongStrings.Topics)
booksString = translate('SongsPlugin.SongMaintenanceForm', 'Song Books') self.listItemBooks.setText(SongStrings.SongBooks)
self.listItemAuthors.setText(authorsString)
self.listItemTopics.setText(topicsString)
self.listItemBooks.setText(booksString)
self.authorsAddButton.setText(UiStrings.Add) self.authorsAddButton.setText(UiStrings.Add)
self.authorsEditButton.setText(UiStrings.Edit) self.authorsEditButton.setText(UiStrings.Edit)
self.authorsDeleteButton.setText(UiStrings.Delete) self.authorsDeleteButton.setText(UiStrings.Delete)
@ -161,8 +159,8 @@ class Ui_SongMaintenanceDialog(object):
self.booksAddButton.setText(UiStrings.Add) self.booksAddButton.setText(UiStrings.Add)
self.booksEditButton.setText(UiStrings.Edit) self.booksEditButton.setText(UiStrings.Edit)
self.booksDeleteButton.setText(UiStrings.Delete) self.booksDeleteButton.setText(UiStrings.Delete)
typeListWidth = max(self.fontMetrics().width(authorsString), typeListWidth = max(self.fontMetrics().width(SongStrings.Authors),
self.fontMetrics().width(topicsString), self.fontMetrics().width(SongStrings.Topics),
self.fontMetrics().width(booksString)) self.fontMetrics().width(SongStrings.SongBooks))
self.typeListWidget.setFixedWidth(typeListWidth + self.typeListWidget.setFixedWidth(typeListWidth +
self.typeListWidget.iconSize().width() + 32) self.typeListWidget.iconSize().width() + 32)

View File

@ -28,6 +28,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_accept_reject_button_box
from openlp.plugins.songs.lib.ui import SongStrings
class Ui_TopicsDialog(object): class Ui_TopicsDialog(object):
def setupUi(self, topicsDialog): def setupUi(self, topicsDialog):
@ -52,6 +53,6 @@ class Ui_TopicsDialog(object):
def retranslateUi(self, topicsDialog): def retranslateUi(self, topicsDialog):
topicsDialog.setWindowTitle( topicsDialog.setWindowTitle(
translate('SongsPlugin.TopicsForm', 'Topic Maintenance')) SongStrings.TypeMaintenance % SongStrings.Topic)
self.nameLabel.setText( self.nameLabel.setText(
translate('SongsPlugin.TopicsForm', 'Topic name:')) translate('SongsPlugin.TopicsForm', 'Topic name:'))

View File

@ -38,6 +38,7 @@ from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
SongImportForm, SongExportForm SongImportForm, SongExportForm
from openlp.plugins.songs.lib import OpenLyrics, SongXML from openlp.plugins.songs.lib import OpenLyrics, SongXML
from openlp.plugins.songs.lib.db import Author, Song from openlp.plugins.songs.lib.db import Author, Song
from openlp.plugins.songs.lib.ui import SongStrings
from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.searchedit import SearchEdit
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -129,7 +130,7 @@ class SongMediaItem(MediaManagerItem):
self.searchTextButton.setText( self.searchTextButton.setText(
translate('SongsPlugin.MediaItem', 'Search')) translate('SongsPlugin.MediaItem', 'Search'))
self.maintenanceAction.setText( self.maintenanceAction.setText(
translate('SongsPlugin.MediaItem', 'Song Maintenance')) SongStrings.TypeMaintenance % SongString.Song)
self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem', self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem',
'Maintain the lists of authors, topics and books')) 'Maintain the lists of authors, topics and books'))
@ -141,7 +142,7 @@ class SongMediaItem(MediaManagerItem):
translate('SongsPlugin.MediaItem', 'Titles')), translate('SongsPlugin.MediaItem', 'Titles')),
(3, u':/songs/song_search_lyrics.png', (3, u':/songs/song_search_lyrics.png',
translate('SongsPlugin.MediaItem', 'Lyrics')), translate('SongsPlugin.MediaItem', 'Lyrics')),
(4, u':/songs/song_search_author.png', UiStrings.Authors), (4, u':/songs/song_search_author.png', SongStrings.Authors),
(5, u':/slides/slide_theme.png', UiStrings.Themes) (5, u':/slides/slide_theme.png', UiStrings.Themes)
]) ])
self.configUpdated() self.configUpdated()

View File

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`openlp.plugins.songs.lib.ui` module provides standard UI components
for the songs plugin.
"""
from openlp.core.lib import translate
class SongStrings(object):
"""
Provide standard strings for use throughout the songs plugin.
"""
# These strings should need a good reason to be retranslated elsewhere.
Author = translate('OpenLP.Ui', 'Author', 'Singular')
Authors = translate('OpenLP.Ui', 'Authors', 'Plural')
SongBook = translate('OpenLP.Ui', 'Song Book', 'Singular')
SongBooks = translate('OpenLP.Ui', 'Song Books', 'Plural')
Topic = translate('OpenLP.Ui', 'Topic', 'Singular')
Topics = translate('OpenLP.Ui', 'Topics', 'Plural')
TypeMaintenance = unicode(translate('OpenLP.Ui', '%s Maintenance'))