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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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:
@ -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]

View File

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