WizardStrings

This commit is contained in:
Jon Tibble 2011-02-14 00:35:53 +00:00
parent 043665d154
commit 1d91192e3b
8 changed files with 26 additions and 24 deletions

View File

@ -45,6 +45,7 @@ class UiStrings(object):
AddANew = unicode(translate('OpenLP.Ui', 'Add a new %s.')) AddANew = unicode(translate('OpenLP.Ui', 'Add a new %s.'))
AddSelectService = unicode(translate('OpenLP.Ui', AddSelectService = unicode(translate('OpenLP.Ui',
'Add the selected %s to the service.')) 'Add the selected %s to the service.'))
AddType = unicode(translate('OpenLP.Ui', 'Add %s'))
Advanced = translate('OpenLP.Ui', 'Advanced') Advanced = translate('OpenLP.Ui', 'Advanced')
AllFiles = translate('OpenLP.Ui', 'All Files') AllFiles = translate('OpenLP.Ui', 'All Files')
Browse = translate('OpenLP.Ui', 'Browse...') Browse = translate('OpenLP.Ui', 'Browse...')

View File

@ -30,10 +30,12 @@ import re
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, translate 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.forms import EditVerseForm
from openlp.plugins.songs.lib import SongXML, VerseType from openlp.plugins.songs.lib import SongXML, VerseType
from openlp.plugins.songs.lib.db import Book, Song, Author, Topic from openlp.plugins.songs.lib.db import Book, Song, Author, Topic
from openlp.plugins.songs.lib.ui import SongStrings
from editsongdialog import Ui_EditSongDialog from editsongdialog import Ui_EditSongDialog
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -307,7 +309,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
text = unicode(self.authorsComboBox.currentText()) text = unicode(self.authorsComboBox.currentText())
if item == 0 and text: if item == 0 and text:
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Author'), UiStrings.AddType % SongStrings.Author,
translate('SongsPlugin.EditSongForm', 'This author does not ' translate('SongsPlugin.EditSongForm', 'This author does not '
'exist, do you want to add them?'), 'exist, do you want to add them?'),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
@ -336,8 +338,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.__addAuthorToList(author) self.__addAuthorToList(author)
self.authorsComboBox.setCurrentIndex(0) self.authorsComboBox.setCurrentIndex(0)
else: else:
QtGui.QMessageBox.warning(self, QtGui.QMessageBox.warning(self, UiStrings.NISs,
translate('SongsPlugin.EditSongForm', 'No Author Selected'),
translate('SongsPlugin.EditSongForm', 'You have not selected ' translate('SongsPlugin.EditSongForm', 'You have not selected '
'a valid author. Either select an author from the list, ' 'a valid author. Either select an author from the list, '
'or type in a new author and click the "Add Author to ' '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()) text = unicode(self.topicsComboBox.currentText())
if item == 0 and text: if item == 0 and text:
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Topic'), UiStrings.AddType % SongStrings.Topic,
translate('SongsPlugin.EditSongForm', 'This topic does not ' translate('SongsPlugin.EditSongForm', 'This topic does not '
'exist, do you want to add it?'), 'exist, do you want to add it?'),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
@ -396,8 +397,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.topicsListView.addItem(topic_item) self.topicsListView.addItem(topic_item)
self.topicsComboBox.setCurrentIndex(0) self.topicsComboBox.setCurrentIndex(0)
else: else:
QtGui.QMessageBox.warning(self, QtGui.QMessageBox.warning(self, UiStrings.NISs,
translate('SongsPlugin.EditSongForm', 'No Topic Selected'),
translate('SongsPlugin.EditSongForm', 'You have not selected ' translate('SongsPlugin.EditSongForm', 'You have not selected '
'a valid topic. Either select a topic from the list, or ' 'a valid topic. Either select a topic from the list, or '
'type in a new topic and click the "Add Topic to Song" ' '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()) text = unicode(self.songBookComboBox.currentText())
if self.songBookComboBox.findText(text, QtCore.Qt.MatchExactly) < 0: if self.songBookComboBox.findText(text, QtCore.Qt.MatchExactly) < 0:
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Book'), UiStrings.AddType % SongStrings.SongBook,
translate('SongsPlugin.EditSongForm', 'This song book does ' translate('SongsPlugin.EditSongForm', 'This song book does '
'not exist, do you want to add it?'), 'not exist, do you want to add it?'),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,

View File

@ -30,6 +30,7 @@ from lxml import etree, objectify
import re import re
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib.songimport import SongImport from openlp.plugins.songs.lib.songimport import SongImport
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -64,8 +65,7 @@ class EasiSlidesImport(SongImport):
xml = unicode(etree.tostring(file)) xml = unicode(etree.tostring(file))
song_xml = objectify.fromstring(xml) song_xml = objectify.fromstring(xml)
self.import_wizard.incrementProgressBar( self.import_wizard.incrementProgressBar(
unicode(translate('SongsPlugin.ImportWizardForm', WizardStrings.ImportingType % os.path.split(self.filename)[-1])
u'Importing %s...')) % os.path.split(self.filename)[-1])
self.import_wizard.progressBar.setMaximum(len(song_xml.Item)) self.import_wizard.progressBar.setMaximum(len(song_xml.Item))
for song in song_xml.Item: for song in song_xml.Item:
self.import_wizard.incrementProgressBar( self.import_wizard.incrementProgressBar(

View File

@ -32,6 +32,7 @@ import os
import struct import struct
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib import retrieve_windows_encoding from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport from songimport import SongImport
@ -231,8 +232,7 @@ class EasyWorshipSongImport(SongImport):
title = self.get_field(fi_title) title = self.get_field(fi_title)
if title: if title:
self.import_wizard.incrementProgressBar( self.import_wizard.incrementProgressBar(
unicode(translate('SongsPlugin.ImportWizardForm', WizardStrings.ImportingType % title, 0)
'Importing "%s"...')) % title, 0)
self.title = title self.title = title
# Get remaining fields # Get remaining fields
copy = self.get_field(fi_copy) copy = self.get_field(fi_copy)

View File

@ -33,6 +33,7 @@ from chardet.universaldetector import UniversalDetector
import sqlite import sqlite
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib import retrieve_windows_encoding from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport from songimport import SongImport
@ -103,8 +104,7 @@ class OpenLP1SongImport(SongImport):
lyrics = song[2].replace(u'\r\n', u'\n') lyrics = song[2].replace(u'\r\n', u'\n')
copyright = song[3] copyright = song[3]
self.import_wizard.incrementProgressBar( self.import_wizard.incrementProgressBar(
unicode(translate('SongsPlugin.ImportWizardForm', WizardStrings.ImportingType % title)
'Importing "%s"...')) % title)
self.title = title self.title = title
verses = lyrics.split(u'\n\n') verses = lyrics.split(u'\n\n')
for verse in verses: for verse in verses:

View File

@ -96,7 +96,7 @@ class SongBeamerImport(SongImport):
read_verses = False read_verses = False
file_name = os.path.split(file)[1] file_name = os.path.split(file)[1]
self.import_wizard.incrementProgressBar( self.import_wizard.incrementProgressBar(
u'Importing %s' % (file_name), 0) WizardStrings.ImportingType % file_name, 0)
if os.path.isfile(file): if os.path.isfile(file):
detect_file = open(file, u'r') detect_file = open(file, u'r')
details = chardet.detect(detect_file.read(2048)) details = chardet.detect(detect_file.read(2048))

View File

@ -31,6 +31,7 @@ import os
import logging import logging
import struct import struct
from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib.songimport import SongImport from openlp.plugins.songs.lib.songimport import SongImport
TITLE = 1 TITLE = 1
@ -113,7 +114,7 @@ class SongShowPlusImport(SongImport):
otherList = {} otherList = {}
file_name = os.path.split(file)[1] file_name = os.path.split(file)[1]
self.import_wizard.incrementProgressBar( self.import_wizard.incrementProgressBar(
u'Importing %s' % (file_name), 0) WizardStrings.ImportingType % file_name, 0)
songData = open(file, 'rb') songData = open(file, 'rb')
while (1): while (1):
blockKey, = struct.unpack("I", songData.read(4)) blockKey, = struct.unpack("I", songData.read(4))
@ -138,7 +139,6 @@ class SongShowPlusImport(SongImport):
else: else:
lengthDescriptor, = struct.unpack("B", songData.read(1)) lengthDescriptor, = struct.unpack("B", songData.read(1))
data = songData.read(lengthDescriptor) data = songData.read(lengthDescriptor)
if blockKey == TITLE: if blockKey == TITLE:
self.title = unicode(data, u'cp1252') self.title = unicode(data, u'cp1252')
elif blockKey == AUTHOR: elif blockKey == AUTHOR:
@ -153,10 +153,10 @@ class SongShowPlusImport(SongImport):
elif blockKey == CCLI_NO: elif blockKey == CCLI_NO:
self.ccli_number = int(data) self.ccli_number = int(data)
elif blockKey == VERSE: elif blockKey == VERSE:
self.add_verse(unicode(data, u'cp1252'), self.add_verse(unicode(data, u'cp1252'),
"V%s" % verseNo) "V%s" % verseNo)
elif blockKey == CHORUS: elif blockKey == CHORUS:
self.add_verse(unicode(data, u'cp1252'), self.add_verse(unicode(data, u'cp1252'),
"C%s" % verseNo) "C%s" % verseNo)
elif blockKey == TOPIC: elif blockKey == TOPIC:
self.topics.append(unicode(data, u'cp1252')) self.topics.append(unicode(data, u'cp1252'))
@ -180,11 +180,11 @@ class SongShowPlusImport(SongImport):
songData.close() songData.close()
self.finish() self.finish()
self.import_wizard.incrementProgressBar( self.import_wizard.incrementProgressBar(
u'Importing %s' % (file_name)) WizardStrings.ImportingType % file_name)
return True return True
def toOpenLPVerseTag(self, verseName): def toOpenLPVerseTag(self, verseName):
if verseName.find(" ")!=-1: if verseName.find(" ") != -1:
verseParts = verseName.split(" ") verseParts = verseName.split(" ")
verseType = verseParts[0] verseType = verseParts[0]
verseNumber = verseParts[1] verseNumber = verseParts[1]

View File

@ -30,6 +30,7 @@ Worship songs into the OpenLP database.
import os import os
import logging import logging
from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib.songimport import SongImport from openlp.plugins.songs.lib.songimport import SongImport
BLOCK_TYPES = (u'V', u'C', u'B') BLOCK_TYPES = (u'V', u'C', u'B')
@ -116,7 +117,7 @@ class WowImport(SongImport):
copyright = u'' copyright = u''
file_name = os.path.split(file)[1] file_name = os.path.split(file)[1]
self.import_wizard.incrementProgressBar( self.import_wizard.incrementProgressBar(
u'Importing %s' % (file_name), 0) WizardStrings.ImportingType % file_name, 0)
# Get the song title # Get the song title
self.title = file_name.rpartition(u'.')[0] self.title = file_name.rpartition(u'.')[0]
songData = open(file, 'rb') songData = open(file, 'rb')
@ -162,5 +163,5 @@ class WowImport(SongImport):
songData.close() songData.close()
self.finish() self.finish()
self.import_wizard.incrementProgressBar( self.import_wizard.incrementProgressBar(
u'Importing %s' % (file_name)) WizardStrings.ImportingType % file_name)
return True return True