diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index f4aa8162e..196a8567f 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -45,6 +45,7 @@ class UiStrings(object): AddANew = unicode(translate('OpenLP.Ui', 'Add a new %s.')) AddSelectService = unicode(translate('OpenLP.Ui', 'Add the selected %s to the service.')) + AddType = unicode(translate('OpenLP.Ui', 'Add %s')) Advanced = translate('OpenLP.Ui', 'Advanced') AllFiles = translate('OpenLP.Ui', 'All Files') Browse = translate('OpenLP.Ui', 'Browse...') diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 8536d38b8..d792afa2f 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -30,10 +30,12 @@ import re from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, translate -from openlp.core.lib.ui import add_widget_completer, critical_error_message_box +from openlp.core.lib.ui import UiStrings, add_widget_completer, \ + critical_error_message_box from openlp.plugins.songs.forms import EditVerseForm from openlp.plugins.songs.lib import SongXML, VerseType from openlp.plugins.songs.lib.db import Book, Song, Author, Topic +from openlp.plugins.songs.lib.ui import SongStrings from editsongdialog import Ui_EditSongDialog log = logging.getLogger(__name__) @@ -307,7 +309,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): text = unicode(self.authorsComboBox.currentText()) if item == 0 and text: if QtGui.QMessageBox.question(self, - translate('SongsPlugin.EditSongForm', 'Add Author'), + UiStrings.AddType % SongStrings.Author, translate('SongsPlugin.EditSongForm', 'This author does not ' 'exist, do you want to add them?'), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, @@ -336,8 +338,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.__addAuthorToList(author) self.authorsComboBox.setCurrentIndex(0) else: - QtGui.QMessageBox.warning(self, - translate('SongsPlugin.EditSongForm', 'No Author Selected'), + QtGui.QMessageBox.warning(self, UiStrings.NISs, translate('SongsPlugin.EditSongForm', 'You have not selected ' 'a valid author. Either select an author from the list, ' 'or type in a new author and click the "Add Author to ' @@ -366,7 +367,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): text = unicode(self.topicsComboBox.currentText()) if item == 0 and text: if QtGui.QMessageBox.question(self, - translate('SongsPlugin.EditSongForm', 'Add Topic'), + UiStrings.AddType % SongStrings.Topic, translate('SongsPlugin.EditSongForm', 'This topic does not ' 'exist, do you want to add it?'), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, @@ -396,8 +397,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.topicsListView.addItem(topic_item) self.topicsComboBox.setCurrentIndex(0) else: - QtGui.QMessageBox.warning(self, - translate('SongsPlugin.EditSongForm', 'No Topic Selected'), + QtGui.QMessageBox.warning(self, UiStrings.NISs, translate('SongsPlugin.EditSongForm', 'You have not selected ' 'a valid topic. Either select a topic from the list, or ' 'type in a new topic and click the "Add Topic to Song" ' @@ -584,7 +584,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): text = unicode(self.songBookComboBox.currentText()) if self.songBookComboBox.findText(text, QtCore.Qt.MatchExactly) < 0: if QtGui.QMessageBox.question(self, - translate('SongsPlugin.EditSongForm', 'Add Book'), + UiStrings.AddType % SongStrings.SongBook, translate('SongsPlugin.EditSongForm', 'This song book does ' 'not exist, do you want to add it?'), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, diff --git a/openlp/plugins/songs/lib/easislidesimport.py b/openlp/plugins/songs/lib/easislidesimport.py index 5d56af8ce..232202c4f 100644 --- a/openlp/plugins/songs/lib/easislidesimport.py +++ b/openlp/plugins/songs/lib/easislidesimport.py @@ -30,6 +30,7 @@ from lxml import etree, objectify import re from openlp.core.lib import translate +from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib.songimport import SongImport log = logging.getLogger(__name__) @@ -64,8 +65,7 @@ class EasiSlidesImport(SongImport): xml = unicode(etree.tostring(file)) song_xml = objectify.fromstring(xml) self.import_wizard.incrementProgressBar( - unicode(translate('SongsPlugin.ImportWizardForm', - u'Importing %s...')) % os.path.split(self.filename)[-1]) + WizardStrings.ImportingType % os.path.split(self.filename)[-1]) self.import_wizard.progressBar.setMaximum(len(song_xml.Item)) for song in song_xml.Item: self.import_wizard.incrementProgressBar( diff --git a/openlp/plugins/songs/lib/ewimport.py b/openlp/plugins/songs/lib/ewimport.py index 312e3b759..df88f025b 100644 --- a/openlp/plugins/songs/lib/ewimport.py +++ b/openlp/plugins/songs/lib/ewimport.py @@ -32,6 +32,7 @@ import os import struct from openlp.core.lib import translate +from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib import retrieve_windows_encoding from songimport import SongImport @@ -231,8 +232,7 @@ class EasyWorshipSongImport(SongImport): title = self.get_field(fi_title) if title: self.import_wizard.incrementProgressBar( - unicode(translate('SongsPlugin.ImportWizardForm', - 'Importing "%s"...')) % title, 0) + WizardStrings.ImportingType % title, 0) self.title = title # Get remaining fields copy = self.get_field(fi_copy) diff --git a/openlp/plugins/songs/lib/olp1import.py b/openlp/plugins/songs/lib/olp1import.py index c3e1ca6b4..daf3629a4 100644 --- a/openlp/plugins/songs/lib/olp1import.py +++ b/openlp/plugins/songs/lib/olp1import.py @@ -33,6 +33,7 @@ from chardet.universaldetector import UniversalDetector import sqlite from openlp.core.lib import translate +from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib import retrieve_windows_encoding from songimport import SongImport @@ -103,8 +104,7 @@ class OpenLP1SongImport(SongImport): lyrics = song[2].replace(u'\r\n', u'\n') copyright = song[3] self.import_wizard.incrementProgressBar( - unicode(translate('SongsPlugin.ImportWizardForm', - 'Importing "%s"...')) % title) + WizardStrings.ImportingType % title) self.title = title verses = lyrics.split(u'\n\n') for verse in verses: diff --git a/openlp/plugins/songs/lib/songbeamerimport.py b/openlp/plugins/songs/lib/songbeamerimport.py index eeabc0e5d..9b47b2c52 100644 --- a/openlp/plugins/songs/lib/songbeamerimport.py +++ b/openlp/plugins/songs/lib/songbeamerimport.py @@ -96,7 +96,7 @@ class SongBeamerImport(SongImport): read_verses = False file_name = os.path.split(file)[1] self.import_wizard.incrementProgressBar( - u'Importing %s' % (file_name), 0) + WizardStrings.ImportingType % file_name, 0) if os.path.isfile(file): detect_file = open(file, u'r') details = chardet.detect(detect_file.read(2048)) diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py index 924f7eeaf..289fd2860 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -31,6 +31,7 @@ import os import logging import struct +from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib.songimport import SongImport TITLE = 1 @@ -113,7 +114,7 @@ class SongShowPlusImport(SongImport): otherList = {} file_name = os.path.split(file)[1] self.import_wizard.incrementProgressBar( - u'Importing %s' % (file_name), 0) + WizardStrings.ImportingType % file_name, 0) songData = open(file, 'rb') while (1): blockKey, = struct.unpack("I", songData.read(4)) @@ -138,7 +139,6 @@ class SongShowPlusImport(SongImport): else: lengthDescriptor, = struct.unpack("B", songData.read(1)) data = songData.read(lengthDescriptor) - if blockKey == TITLE: self.title = unicode(data, u'cp1252') elif blockKey == AUTHOR: @@ -153,10 +153,10 @@ class SongShowPlusImport(SongImport): elif blockKey == CCLI_NO: self.ccli_number = int(data) elif blockKey == VERSE: - self.add_verse(unicode(data, u'cp1252'), + self.add_verse(unicode(data, u'cp1252'), "V%s" % verseNo) elif blockKey == CHORUS: - self.add_verse(unicode(data, u'cp1252'), + self.add_verse(unicode(data, u'cp1252'), "C%s" % verseNo) elif blockKey == TOPIC: self.topics.append(unicode(data, u'cp1252')) @@ -180,11 +180,11 @@ class SongShowPlusImport(SongImport): songData.close() self.finish() self.import_wizard.incrementProgressBar( - u'Importing %s' % (file_name)) + WizardStrings.ImportingType % file_name) return True - + def toOpenLPVerseTag(self, verseName): - if verseName.find(" ")!=-1: + if verseName.find(" ") != -1: verseParts = verseName.split(" ") verseType = verseParts[0] verseNumber = verseParts[1] diff --git a/openlp/plugins/songs/lib/wowimport.py b/openlp/plugins/songs/lib/wowimport.py index b90a47de6..c7bd5d743 100644 --- a/openlp/plugins/songs/lib/wowimport.py +++ b/openlp/plugins/songs/lib/wowimport.py @@ -30,6 +30,7 @@ Worship songs into the OpenLP database. import os import logging +from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib.songimport import SongImport BLOCK_TYPES = (u'V', u'C', u'B') @@ -116,7 +117,7 @@ class WowImport(SongImport): copyright = u'' file_name = os.path.split(file)[1] self.import_wizard.incrementProgressBar( - u'Importing %s' % (file_name), 0) + WizardStrings.ImportingType % file_name, 0) # Get the song title self.title = file_name.rpartition(u'.')[0] songData = open(file, 'rb') @@ -162,5 +163,5 @@ class WowImport(SongImport): songData.close() self.finish() self.import_wizard.incrementProgressBar( - u'Importing %s' % (file_name)) + WizardStrings.ImportingType % file_name) return True