removed not neede unicode calls

This commit is contained in:
Andreas Preikschat 2012-05-17 20:57:01 +02:00
parent a379d9ec54
commit ed3b7660fa
63 changed files with 445 additions and 493 deletions

View File

@ -194,7 +194,7 @@ class OpenLP(QtGui.QApplication):
if event.type() == QtCore.QEvent.FileOpen: if event.type() == QtCore.QEvent.FileOpen:
file_name = event.file() file_name = event.file()
log.debug(u'Got open file event for %s!', file_name) log.debug(u'Got open file event for %s!', file_name)
self.args.insert(0, unicode(file_name)) self.args.insert(0, file_name)
return True return True
else: else:
return QtGui.QApplication.event(self, event) return QtGui.QApplication.event(self, event)

View File

@ -371,22 +371,22 @@ def create_separated_list(stringlist):
List of unicode strings List of unicode strings
""" """
if Qt.PYQT_VERSION_STR >= u'4.9' and Qt.qVersion() >= u'4.8': if Qt.PYQT_VERSION_STR >= u'4.9' and Qt.qVersion() >= u'4.8':
return unicode(QtCore.QLocale().createSeparatedList(stringlist)) return QtCore.QLocale().createSeparatedList(stringlist)
if not stringlist: if not stringlist:
return u'' return u''
elif len(stringlist) == 1: elif len(stringlist) == 1:
return stringlist[0] return stringlist[0]
elif len(stringlist) == 2: elif len(stringlist) == 2:
return unicode(translate('OpenLP.core.lib', '%1 and %2', return translate('OpenLP.core.lib', '%1 and %2',
'Locale list separator: 2 items').arg(stringlist[0], stringlist[1])) 'Locale list separator: 2 items').arg(stringlist[0], stringlist[1])
else: else:
merged = unicode(translate('OpenLP.core.lib', '%1, and %2', merged = translate('OpenLP.core.lib', '%1, and %2',
u'Locale list separator: end').arg(stringlist[-2], stringlist[-1])) u'Locale list separator: end').arg(stringlist[-2], stringlist[-1])
for index in reversed(range(1, len(stringlist) - 2)): for index in reversed(range(1, len(stringlist) - 2)):
merged = unicode(translate('OpenLP.core.lib', '%1, %2', merged = translate('OpenLP.core.lib', '%1, %2',
u'Locale list separator: middle').arg(stringlist[index], merged)) u'Locale list separator: middle').arg(stringlist[index], merged)
return unicode(translate('OpenLP.core.lib', '%1, %2', return translate('OpenLP.core.lib', '%1, %2',
u'Locale list separator: start').arg(stringlist[0], merged)) u'Locale list separator: start').arg(stringlist[0], merged)
from eventreceiver import Receiver from eventreceiver import Receiver

View File

@ -208,11 +208,11 @@ class Manager(object):
if db_ver > up_ver: if db_ver > up_ver:
critical_error_message_box( critical_error_message_box(
translate('OpenLP.Manager', 'Database Error'), translate('OpenLP.Manager', 'Database Error'),
unicode(translate('OpenLP.Manager', 'The database being ' translate('OpenLP.Manager', 'The database being '
'loaded was created in a more recent version of ' 'loaded was created in a more recent version of '
'OpenLP. The database is version %d, while OpenLP ' 'OpenLP. The database is version %d, while OpenLP '
'expects version %d. The database will not be loaded.' 'expects version %d. The database will not be loaded.'
'\n\nDatabase: %s')) % \ '\n\nDatabase: %s') % \
(db_ver, up_ver, self.db_url) (db_ver, up_ver, self.db_url)
) )
return return
@ -222,8 +222,8 @@ class Manager(object):
log.exception(u'Error loading database: %s', self.db_url) log.exception(u'Error loading database: %s', self.db_url)
critical_error_message_box( critical_error_message_box(
translate('OpenLP.Manager', 'Database Error'), translate('OpenLP.Manager', 'Database Error'),
unicode(translate('OpenLP.Manager', 'OpenLP cannot load your ' translate('OpenLP.Manager', 'OpenLP cannot load your '
'database.\n\nDatabase: %s')) % self.db_url 'database.\n\nDatabase: %s') % self.db_url
) )
def save_object(self, object_instance, commit=True): def save_object(self, object_instance, commit=True):

View File

@ -98,7 +98,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
event.accept() event.accept()
files = [] files = []
for url in event.mimeData().urls(): for url in event.mimeData().urls():
localFile = unicode(url.toLocalFile()) localFile = url.toLocalFile()
if os.path.isfile(localFile): if os.path.isfile(localFile):
files.append(localFile) files.append(localFile)
elif os.path.isdir(localFile): elif os.path.isdir(localFile):

View File

@ -336,7 +336,7 @@ class MediaManagerItem(QtGui.QWidget):
self, self.onNewPrompt, self, self.onNewPrompt,
SettingsManager.get_last_dir(self.settingsSection), SettingsManager.get_last_dir(self.settingsSection),
self.onNewFileMasks) self.onNewFileMasks)
log.info(u'New files(s) %s', unicode(files)) log.info(u'New files(s) %s', files)
if files: if files:
Receiver.send_message(u'cursor_busy') Receiver.send_message(u'cursor_busy')
self.validateAndLoad(files) self.validateAndLoad(files)
@ -359,9 +359,8 @@ class MediaManagerItem(QtGui.QWidget):
critical_error_message_box( critical_error_message_box(
translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'Invalid File Type'), 'Invalid File Type'),
unicode(translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'Invalid File %s.\nSuffix not supported')) 'Invalid File %s.\nSuffix not supported') % file)
% file)
errorShown = True errorShown = True
else: else:
newFiles.append(file) newFiles.append(file)
@ -379,9 +378,9 @@ class MediaManagerItem(QtGui.QWidget):
names = [] names = []
fullList = [] fullList = []
for count in range(self.listView.count()): for count in range(self.listView.count()):
names.append(unicode(self.listView.item(count).text())) names.append(self.listView.item(count).text())
fullList.append(unicode(self.listView.item(count). fullList.append(self.listView.item(count).
data(QtCore.Qt.UserRole).toString())) data(QtCore.Qt.UserRole).toString())
duplicatesFound = False duplicatesFound = False
filesAdded = False filesAdded = False
for file in files: for file in files:
@ -401,8 +400,8 @@ class MediaManagerItem(QtGui.QWidget):
if duplicatesFound: if duplicatesFound:
critical_error_message_box( critical_error_message_box(
UiStrings().Duplicate, UiStrings().Duplicate,
unicode(translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'Duplicate files were found on import and were ignored.'))) 'Duplicate files were found on import and were ignored.'))
def contextMenu(self, point): def contextMenu(self, point):
item = self.listView.itemAt(point) item = self.listView.itemAt(point)
@ -421,7 +420,7 @@ class MediaManagerItem(QtGui.QWidget):
filelist = [] filelist = []
while count < self.listView.count(): while count < self.listView.count():
bitem = self.listView.item(count) bitem = self.listView.item(count)
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) filename = bitem.data(QtCore.Qt.UserRole).toString()
filelist.append(filename) filelist.append(filename)
count += 1 count += 1
return filelist return filelist
@ -573,8 +572,8 @@ class MediaManagerItem(QtGui.QWidget):
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'Invalid Service Item'), 'Invalid Service Item'),
unicode(translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'You must select a %s service item.')) % self.title) 'You must select a %s service item.') % self.title)
def buildServiceItem(self, item=None, xmlVersion=False, remote=False): def buildServiceItem(self, item=None, xmlVersion=False, remote=False):
""" """

View File

@ -464,12 +464,12 @@ class ServiceItem(object):
start = None start = None
end = None end = None
if self.start_time != 0: if self.start_time != 0:
start = unicode(translate('OpenLP.ServiceItem', start = translate('OpenLP.ServiceItem',
'<strong>Start</strong>: %s')) % \ '<strong>Start</strong>: %s') % \
unicode(datetime.timedelta(seconds=self.start_time)) unicode(datetime.timedelta(seconds=self.start_time))
if self.media_length != 0: if self.media_length != 0:
end = unicode(translate('OpenLP.ServiceItem', end = translate('OpenLP.ServiceItem',
'<strong>Length</strong>: %s')) % \ '<strong>Length</strong>: %s') % \
unicode(datetime.timedelta(seconds=self.media_length)) unicode(datetime.timedelta(seconds=self.media_length))
if not start and not end: if not start and not end:
return u'' return u''

View File

@ -100,7 +100,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
# Check if the selected word is misspelled and offer spelling # Check if the selected word is misspelled and offer spelling
# suggestions if it is. # suggestions if it is.
if ENCHANT_AVAILABLE and self.textCursor().hasSelection(): if ENCHANT_AVAILABLE and self.textCursor().hasSelection():
text = unicode(self.textCursor().selectedText()) text = self.textCursor().selectedText()
if not self.dictionary.check(text): if not self.dictionary.check(text):
spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',
'Spelling Suggestions')) 'Spelling Suggestions'))

View File

@ -66,7 +66,7 @@ class OpenLPToolbar(QtGui.QToolBar):
Add a widget and store it's handle under the widgets object name. Add a widget and store it's handle under the widgets object name.
""" """
action = self.addWidget(widget) action = self.addWidget(widget)
self.actions[unicode(widget.objectName())] = action self.actions[widget.objectName()] = action
def setWidgetVisible(self, widgets, visible=True): def setWidgetVisible(self, widgets, visible=True):
""" """

View File

@ -66,7 +66,7 @@ class UiStrings(object):
self.CreateService = translate('OpenLP.Ui', 'Create a new service.') self.CreateService = translate('OpenLP.Ui', 'Create a new service.')
self.ConfirmDelete = translate('OpenLP.Ui', 'Confirm Delete') self.ConfirmDelete = translate('OpenLP.Ui', 'Confirm Delete')
self.Continuous = translate('OpenLP.Ui', 'Continuous') self.Continuous = translate('OpenLP.Ui', 'Continuous')
self.Default = unicode(translate('OpenLP.Ui', 'Default')) self.Default = translate('OpenLP.Ui', 'Default')
self.Delete = translate('OpenLP.Ui', '&Delete') self.Delete = translate('OpenLP.Ui', '&Delete')
self.DisplayStyle = translate('OpenLP.Ui', 'Display style:') self.DisplayStyle = translate('OpenLP.Ui', 'Display style:')
self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error') self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error')
@ -127,7 +127,7 @@ class UiStrings(object):
self.Split = translate('OpenLP.Ui', 'Optional &Split') self.Split = translate('OpenLP.Ui', 'Optional &Split')
self.SplitToolTip = translate('OpenLP.Ui', 'Split a slide into two ' self.SplitToolTip = translate('OpenLP.Ui', 'Split a slide into two '
'only if it does not fit on the screen as one slide.') 'only if it does not fit on the screen as one slide.')
self.StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s')) self.StartTimeCode = translate('OpenLP.Ui', 'Start %s')
self.StopPlaySlidesInLoop = translate('OpenLP.Ui', self.StopPlaySlidesInLoop = translate('OpenLP.Ui',
'Stop Play Slides in Loop') 'Stop Play Slides in Loop')
self.StopPlaySlidesToEnd = translate('OpenLP.Ui', self.StopPlaySlidesToEnd = translate('OpenLP.Ui',

View File

@ -139,7 +139,7 @@ class Ui_AboutDialog(object):
} }
documentors = [u'Wesley "wrst" Stout', documentors = [u'Wesley "wrst" Stout',
u'John "jseagull1" Cegalis (lead)'] u'John "jseagull1" Cegalis (lead)']
self.creditsTextEdit.setPlainText(unicode(translate('OpenLP.AboutForm', self.creditsTextEdit.setPlainText(translate('OpenLP.AboutForm',
'Project Lead\n' 'Project Lead\n'
' %s\n' ' %s\n'
'\n' '\n'
@ -200,7 +200,7 @@ class Ui_AboutDialog(object):
' God our Father, for sending His Son to die\n' ' God our Father, for sending His Son to die\n'
' on the cross, setting us free from sin. We\n' ' on the cross, setting us free from sin. We\n'
' bring this software to you for free because\n' ' bring this software to you for free because\n'
' He has set us free.')) % (lead, u'\n '.join(developers), ' He has set us free.') % (lead, u'\n '.join(developers),
u'\n '.join(contributors), u'\n '.join(testers), u'\n '.join(contributors), u'\n '.join(testers),
u'\n '.join(packagers), u'\n '.join(translators[u'af']), u'\n '.join(packagers), u'\n '.join(translators[u'af']),
u'\n '.join(translators[u'de']), u'\n '.join(translators[u'de']),
@ -218,9 +218,9 @@ class Ui_AboutDialog(object):
self.aboutNotebook.setTabText( self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.creditsTab), self.aboutNotebook.indexOf(self.creditsTab),
translate('OpenLP.AboutForm', 'Credits')) translate('OpenLP.AboutForm', 'Credits'))
copyright = unicode(translate('OpenLP.AboutForm', copyright = translate('OpenLP.AboutForm',
'Copyright \xa9 2004-2012 %s\n' 'Copyright \xa9 2004-2012 %s\n'
'Portions copyright \xa9 2004-2012 %s')) % (u'Raoul Snyman', 'Portions copyright \xa9 2004-2012 %s') % (u'Raoul Snyman',
u'Tim Bentley, Jonathan Corwin, Michael Gorven, Gerald Britton, ' u'Tim Bentley, Jonathan Corwin, Michael Gorven, Gerald Britton, '
u'Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin K\xf6hler, ' u'Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin K\xf6hler, '
u'Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias ' u'Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias '

View File

@ -47,7 +47,7 @@ class AboutForm(QtGui.QDialog, Ui_AboutDialog):
about_text = about_text.replace(u'<version>', about_text = about_text.replace(u'<version>',
applicationVersion[u'version']) applicationVersion[u'version'])
if applicationVersion[u'build']: if applicationVersion[u'build']:
build_text = unicode(translate('OpenLP.AboutForm', ' build %s')) % \ build_text = translate('OpenLP.AboutForm', ' build %s') % \
applicationVersion[u'build'] applicationVersion[u'build']
else: else:
build_text = u'' build_text = u''

View File

@ -52,12 +52,12 @@ class AdvancedTab(SettingsTab):
# 11 o'clock is the most popular time for morning service. # 11 o'clock is the most popular time for morning service.
self.defaultServiceHour = 11 self.defaultServiceHour = 11
self.defaultServiceMinute = 0 self.defaultServiceMinute = 0
self.defaultServiceName = unicode(translate('OpenLP.AdvancedTab', self.defaultServiceName = translate('OpenLP.AdvancedTab',
'Service %Y-%m-%d %H-%M', 'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: ' 'This may not contain any of the following characters: '
'/\\?*|<>\[\]":+\n' '/\\?*|<>\[\]":+\n'
'See http://docs.python.org/library/datetime.html' 'See http://docs.python.org/library/datetime.html'
'#strftime-strptime-behavior for more information.')) '#strftime-strptime-behavior for more information.')
self.defaultImage = u':/graphics/openlp-splash-screen.png' self.defaultImage = u':/graphics/openlp-splash-screen.png'
self.defaultColor = u'#ffffff' self.defaultColor = u'#ffffff'
self.iconPath = u':/system/system_settings.png' self.iconPath = u':/system/system_settings.png'
@ -299,9 +299,9 @@ class AdvancedTab(SettingsTab):
translate('OpenLP.AdvancedTab', 'Name:')) translate('OpenLP.AdvancedTab', 'Name:'))
self.serviceNameEdit.setToolTip(translate('OpenLP.AdvancedTab', self.serviceNameEdit.setToolTip(translate('OpenLP.AdvancedTab',
'Consult the OpenLP manual for usage.')) 'Consult the OpenLP manual for usage.'))
self.serviceNameRevertButton.setToolTip(unicode( self.serviceNameRevertButton.setToolTip(
translate('OpenLP.AdvancedTab', translate('OpenLP.AdvancedTab',
'Revert to the default service name "%s".')) % 'Revert to the default service name "%s".') %
self.defaultServiceName) self.defaultServiceName)
self.serviceNameExampleLabel.setText(translate('OpenLP.AdvancedTab', self.serviceNameExampleLabel.setText(translate('OpenLP.AdvancedTab',
'Example:')) 'Example:'))
@ -397,7 +397,7 @@ class AdvancedTab(SettingsTab):
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
settings.setValue(u'default service enabled', settings.setValue(u'default service enabled',
self.serviceNameCheckBox.isChecked()) self.serviceNameCheckBox.isChecked())
service_name = unicode(self.serviceNameEdit.text()) service_name = self.serviceNameEdit.text()
preset_is_valid = self.generateServiceNameExample()[0] preset_is_valid = self.generateServiceNameExample()[0]
if service_name == self.defaultServiceName or not preset_is_valid: if service_name == self.defaultServiceName or not preset_is_valid:
settings.remove(u'default service name') settings.remove(u'default service name')

View File

@ -110,10 +110,10 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
def _createReport(self): def _createReport(self):
openlp_version = get_application_version() openlp_version = get_application_version()
description = unicode(self.descriptionTextEdit.toPlainText()) description = self.descriptionTextEdit.toPlainText()
traceback = unicode(self.exceptionTextEdit.toPlainText()) traceback = self.exceptionTextEdit.toPlainText()
system = unicode(translate('OpenLP.ExceptionForm', system = translate('OpenLP.ExceptionForm',
'Platform: %s\n')) % platform.platform() 'Platform: %s\n') % platform.platform()
libraries = u'Python: %s\n' % platform.python_version() + \ libraries = u'Python: %s\n' % platform.python_version() + \
u'Qt4: %s\n' % Qt.qVersion() + \ u'Qt4: %s\n' % Qt.qVersion() + \
u'Phonon: %s\n' % PHONON_VERSION + \ u'Phonon: %s\n' % PHONON_VERSION + \
@ -139,13 +139,13 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
""" """
Saving exception log and system informations to a file. Saving exception log and system informations to a file.
""" """
report_text = unicode(translate('OpenLP.ExceptionForm', report_text = translate('OpenLP.ExceptionForm',
'**OpenLP Bug Report**\n' '**OpenLP Bug Report**\n'
'Version: %s\n\n' 'Version: %s\n\n'
'--- Details of the Exception. ---\n\n%s\n\n ' '--- Details of the Exception. ---\n\n%s\n\n '
'--- Exception Traceback ---\n%s\n' '--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n' '--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n')) '--- Library Versions ---\n%s\n')
filename = QtGui.QFileDialog.getSaveFileName(self, filename = QtGui.QFileDialog.getSaveFileName(self,
translate('OpenLP.ExceptionForm', 'Save Crash Report'), translate('OpenLP.ExceptionForm', 'Save Crash Report'),
SettingsManager.get_last_dir(self.settingsSection), SettingsManager.get_last_dir(self.settingsSection),
@ -176,7 +176,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
Opening systems default email client and inserting exception log and Opening systems default email client and inserting exception log and
system informations. system informations.
""" """
body = unicode(translate('OpenLP.ExceptionForm', body = translate('OpenLP.ExceptionForm',
'*OpenLP Bug Report*\n' '*OpenLP Bug Report*\n'
'Version: %s\n\n' 'Version: %s\n\n'
'--- Details of the Exception. ---\n\n%s\n\n ' '--- Details of the Exception. ---\n\n%s\n\n '
@ -184,7 +184,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
'--- System information ---\n%s\n' '--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n', '--- Library Versions ---\n%s\n',
'Please add the information that bug reports are favoured written ' 'Please add the information that bug reports are favoured written '
'in English.')) 'in English.')
content = self._createReport() content = self._createReport()
source = u'' source = u''
exception = u'' exception = u''
@ -209,8 +209,8 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
else: else:
self.__buttonState(False) self.__buttonState(False)
self.descriptionWordCount.setText( self.descriptionWordCount.setText(
unicode(translate('OpenLP.ExceptionDialog', translate('OpenLP.ExceptionDialog',
'Description characters to enter : %s')) % count) 'Description characters to enter : %s') % count)
def onAttachFileButtonClicked(self): def onAttachFileButtonClicked(self):
files = QtGui.QFileDialog.getOpenFileName( files = QtGui.QFileDialog.getOpenFileName(

View File

@ -87,8 +87,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self.config.readfp(io.BytesIO(files)) self.config.readfp(io.BytesIO(files))
self.updateScreenListCombo() self.updateScreenListCombo()
self.downloadCanceled = False self.downloadCanceled = False
self.downloading = unicode(translate('OpenLP.FirstTimeWizard', self.downloading = translate('OpenLP.FirstTimeWizard',
'Downloading %s...')) 'Downloading %s...')
QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
self.onCancelButtonClicked) self.onCancelButtonClicked)
QtCore.QObject.connect(self.noInternetFinishButton, QtCore.QObject.connect(self.noInternetFinishButton,
@ -435,7 +435,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
while bibles_iterator.value(): while bibles_iterator.value():
item = bibles_iterator.value() item = bibles_iterator.value()
if item.parent() and item.checkState(0) == QtCore.Qt.Checked: if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
bible = unicode(item.data(0, QtCore.Qt.UserRole).toString()) bible = item.data(0, QtCore.Qt.UserRole).toString()
self._incrementProgressBar(self.downloading % bible, 0) self._incrementProgressBar(self.downloading % bible, 0)
self.previous_size = 0 self.previous_size = 0
self.urlGetFile(u'%s%s' % (self.web, bible), self.urlGetFile(u'%s%s' % (self.web, bible),
@ -445,7 +445,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
for i in xrange(self.themesListWidget.count()): for i in xrange(self.themesListWidget.count()):
item = self.themesListWidget.item(i) item = self.themesListWidget.item(i)
if item.checkState() == QtCore.Qt.Checked: if item.checkState() == QtCore.Qt.Checked:
theme = unicode(item.data(QtCore.Qt.UserRole).toString()) theme = item.data(QtCore.Qt.UserRole).toString()
self._incrementProgressBar(self.downloading % theme, 0) self._incrementProgressBar(self.downloading % theme, 0)
self.previous_size = 0 self.previous_size = 0
self.urlGetFile(u'%s%s' % (self.web, theme), self.urlGetFile(u'%s%s' % (self.web, theme),

View File

@ -155,18 +155,18 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
html_expands = FormattingTags.get_html_tags() html_expands = FormattingTags.get_html_tags()
if self.selected != -1: if self.selected != -1:
html = html_expands[self.selected] html = html_expands[self.selected]
tag = unicode(self.tagLineEdit.text()) tag = self.tagLineEdit.text()
for linenumber, html1 in enumerate(html_expands): for linenumber, html1 in enumerate(html_expands):
if self._strip(html1[u'start tag']) == tag and \ if self._strip(html1[u'start tag']) == tag and \
linenumber != self.selected: linenumber != self.selected:
critical_error_message_box( critical_error_message_box(
translate('OpenLP.FormattingTagForm', 'Update Error'), translate('OpenLP.FormattingTagForm', 'Update Error'),
unicode(translate('OpenLP.FormattingTagForm', translate('OpenLP.FormattingTagForm',
'Tag %s already defined.')) % tag) 'Tag %s already defined.') % tag)
return return
html[u'desc'] = unicode(self.descriptionLineEdit.text()) html[u'desc'] = self.descriptionLineEdit.text()
html[u'start html'] = unicode(self.startTagLineEdit.text()) html[u'start html'] = self.startTagLineEdit.text()
html[u'end html'] = unicode(self.endTagLineEdit.text()) html[u'end html'] = self.endTagLineEdit.text()
html[u'start tag'] = u'{%s}' % tag html[u'start tag'] = u'{%s}' % tag
html[u'end tag'] = u'{/%s}' % tag html[u'end tag'] = u'{/%s}' % tag
# Keep temporary tags when the user changes one. # Keep temporary tags when the user changes one.

View File

@ -257,7 +257,7 @@ class MainDisplay(Display):
height = self.frame.evaluateJavaScript(js) height = self.frame.evaluateJavaScript(js)
if shrink: if shrink:
if text: if text:
alert_height = int(height) alert_height = int(height.toString())
self.resize(self.width(), alert_height) self.resize(self.width(), alert_height)
self.setVisible(True) self.setVisible(True)
if location == AlertLocation.Middle: if location == AlertLocation.Middle:

View File

@ -173,7 +173,7 @@ class Ui_MainWindow(object):
self.themeManagerDock) self.themeManagerDock)
# Create the menu items # Create the menu items
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_category(unicode(UiStrings().File), action_list.add_category(UiStrings().File,
CategoryOrder.standardMenu) CategoryOrder.standardMenu)
self.fileNewItem = create_action(mainWindow, u'fileNewItem', self.fileNewItem = create_action(mainWindow, u'fileNewItem',
icon=u':/general/general_new.png', icon=u':/general/general_new.png',
@ -202,19 +202,19 @@ class Ui_MainWindow(object):
icon=u':/system/system_exit.png', icon=u':/system/system_exit.png',
shortcuts=[QtGui.QKeySequence(u'Alt+F4')], shortcuts=[QtGui.QKeySequence(u'Alt+F4')],
category=UiStrings().File, triggers=mainWindow.close) category=UiStrings().File, triggers=mainWindow.close)
action_list.add_category(unicode(UiStrings().Import), action_list.add_category(UiStrings().Import,
CategoryOrder.standardMenu) CategoryOrder.standardMenu)
self.importThemeItem = create_action(mainWindow, self.importThemeItem = create_action(mainWindow,
u'importThemeItem', category=UiStrings().Import) u'importThemeItem', category=UiStrings().Import)
self.importLanguageItem = create_action(mainWindow, self.importLanguageItem = create_action(mainWindow,
u'importLanguageItem')#, category=UiStrings().Import) u'importLanguageItem')#, category=UiStrings().Import)
action_list.add_category(unicode(UiStrings().Export), action_list.add_category(UiStrings().Export,
CategoryOrder.standardMenu) CategoryOrder.standardMenu)
self.exportThemeItem = create_action(mainWindow, self.exportThemeItem = create_action(mainWindow,
u'exportThemeItem', category=UiStrings().Export) u'exportThemeItem', category=UiStrings().Export)
self.exportLanguageItem = create_action(mainWindow, self.exportLanguageItem = create_action(mainWindow,
u'exportLanguageItem')#, category=UiStrings().Export) u'exportLanguageItem')#, category=UiStrings().Export)
action_list.add_category(unicode(UiStrings().View), action_list.add_category(UiStrings().View,
CategoryOrder.standardMenu) CategoryOrder.standardMenu)
self.viewMediaManagerItem = create_action(mainWindow, self.viewMediaManagerItem = create_action(mainWindow,
u'viewMediaManagerItem', shortcuts=[QtGui.QKeySequence(u'F8')], u'viewMediaManagerItem', shortcuts=[QtGui.QKeySequence(u'F8')],
@ -239,7 +239,7 @@ class Ui_MainWindow(object):
category=UiStrings().View, triggers=self.setLivePanelVisibility) category=UiStrings().View, triggers=self.setLivePanelVisibility)
self.lockPanel = create_action(mainWindow, u'lockPanel', self.lockPanel = create_action(mainWindow, u'lockPanel',
checked=panelLocked, triggers=self.setLockPanel) checked=panelLocked, triggers=self.setLockPanel)
action_list.add_category(unicode(UiStrings().ViewMode), action_list.add_category(UiStrings().ViewMode,
CategoryOrder.standardMenu) CategoryOrder.standardMenu)
self.modeDefaultItem = create_action(mainWindow, u'modeDefaultItem', self.modeDefaultItem = create_action(mainWindow, u'modeDefaultItem',
checked=False, category=UiStrings().ViewMode) checked=False, category=UiStrings().ViewMode)
@ -252,8 +252,7 @@ class Ui_MainWindow(object):
self.modeGroup.addAction(self.modeSetupItem) self.modeGroup.addAction(self.modeSetupItem)
self.modeGroup.addAction(self.modeLiveItem) self.modeGroup.addAction(self.modeLiveItem)
self.modeDefaultItem.setChecked(True) self.modeDefaultItem.setChecked(True)
action_list.add_category(unicode(UiStrings().Tools), action_list.add_category(UiStrings().Tools, CategoryOrder.standardMenu)
CategoryOrder.standardMenu)
self.toolsAddToolItem = create_action(mainWindow, self.toolsAddToolItem = create_action(mainWindow,
u'toolsAddToolItem', icon=u':/tools/tools_add.png', u'toolsAddToolItem', icon=u':/tools/tools_add.png',
category=UiStrings().Tools) category=UiStrings().Tools)
@ -265,7 +264,7 @@ class Ui_MainWindow(object):
category=UiStrings().Tools) category=UiStrings().Tools)
self.updateThemeImages = create_action(mainWindow, self.updateThemeImages = create_action(mainWindow,
u'updateThemeImages', category=UiStrings().Tools) u'updateThemeImages', category=UiStrings().Tools)
action_list.add_category(unicode(UiStrings().Settings), action_list.add_category(UiStrings().Settings,
CategoryOrder.standardMenu) CategoryOrder.standardMenu)
self.settingsPluginListItem = create_action(mainWindow, self.settingsPluginListItem = create_action(mainWindow,
u'settingsPluginListItem', u'settingsPluginListItem',
@ -300,8 +299,7 @@ class Ui_MainWindow(object):
u'settingsImportItem', category=UiStrings().Settings) u'settingsImportItem', category=UiStrings().Settings)
self.settingsExportItem = create_action(mainWindow, self.settingsExportItem = create_action(mainWindow,
u'settingsExportItem', category=UiStrings().Settings) u'settingsExportItem', category=UiStrings().Settings)
action_list.add_category(unicode(UiStrings().Help), action_list.add_category(UiStrings().Help, CategoryOrder.standardMenu)
CategoryOrder.standardMenu)
self.aboutItem = create_action(mainWindow, u'aboutItem', self.aboutItem = create_action(mainWindow, u'aboutItem',
icon=u':/system/system_about.png', icon=u':/system/system_about.png',
shortcuts=[QtGui.QKeySequence(u'Ctrl+F1')], shortcuts=[QtGui.QKeySequence(u'Ctrl+F1')],
@ -497,8 +495,8 @@ class Ui_MainWindow(object):
translate('OpenLP.MainWindow', '&Web Site')) translate('OpenLP.MainWindow', '&Web Site'))
for item in self.languageGroup.actions(): for item in self.languageGroup.actions():
item.setText(item.objectName()) item.setText(item.objectName())
item.setStatusTip(unicode(translate('OpenLP.MainWindow', item.setStatusTip(translate('OpenLP.MainWindow',
'Set the interface language to %s')) % item.objectName()) 'Set the interface language to %s') % item.objectName())
self.autoLanguageItem.setText( self.autoLanguageItem.setText(
translate('OpenLP.MainWindow', '&Autodetect')) translate('OpenLP.MainWindow', '&Autodetect'))
self.autoLanguageItem.setStatusTip(translate('OpenLP.MainWindow', self.autoLanguageItem.setStatusTip(translate('OpenLP.MainWindow',
@ -709,10 +707,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Notifies the user that a newer version of OpenLP is available. Notifies the user that a newer version of OpenLP is available.
Triggered by delay thread. Triggered by delay thread.
""" """
version_text = unicode(translate('OpenLP.MainWindow', version_text = translate('OpenLP.MainWindow',
'Version %s of OpenLP is now available for download (you are ' 'Version %s of OpenLP is now available for download (you are '
'currently running version %s). \n\nYou can download the latest ' 'currently running version %s). \n\nYou can download the latest '
'version from http://openlp.org/.')) 'version from http://openlp.org/.')
QtGui.QMessageBox.question(self, QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'OpenLP Version Updated'), translate('OpenLP.MainWindow', 'OpenLP Version Updated'),
version_text % (version, get_application_version()[u'full'])) version_text % (version, get_application_version()[u'full']))
@ -928,11 +926,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtGui.QMessageBox.No) QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No: if answer == QtGui.QMessageBox.No:
return return
import_file_name = unicode(QtGui.QFileDialog.getOpenFileName(self, import_file_name = QtGui.QFileDialog.getOpenFileName(self,
translate('OpenLP.MainWindow', 'Open File'), translate('OpenLP.MainWindow', 'Open File'), '',
'',
translate('OpenLP.MainWindow', translate('OpenLP.MainWindow',
'OpenLP Export Settings Files (*.conf)'))) 'OpenLP Export Settings Files (*.conf)'))
if not import_file_name: if not import_file_name:
return return
setting_sections = [] setting_sections = []
@ -1003,10 +1000,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
Export settings to a .conf file in INI format Export settings to a .conf file in INI format
""" """
export_file_name = unicode(QtGui.QFileDialog.getSaveFileName(self, export_file_name = QtGui.QFileDialog.getSaveFileName(self,
translate('OpenLP.MainWindow', 'Export Settings File'), '', translate('OpenLP.MainWindow', 'Export Settings File'), '',
translate('OpenLP.MainWindow', translate('OpenLP.MainWindow',
'OpenLP Export Settings File (*.conf)'))) 'OpenLP Export Settings File (*.conf)'))
if not export_file_name: if not export_file_name:
return return
# Make sure it's a .conf file. # Make sure it's a .conf file.
@ -1218,8 +1215,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def defaultThemeChanged(self, theme): def defaultThemeChanged(self, theme):
self.defaultThemeLabel.setText( self.defaultThemeLabel.setText(
unicode(translate('OpenLP.MainWindow', 'Default Theme: %s')) % translate('OpenLP.MainWindow', 'Default Theme: %s') % theme)
theme)
def toggleMediaManager(self): def toggleMediaManager(self):
self.mediaManagerDock.setVisible(not self.mediaManagerDock.isVisible()) self.mediaManagerDock.setVisible(not self.mediaManagerDock.isVisible())

View File

@ -324,8 +324,7 @@ class MediaController(object):
# Media could not be loaded correctly # Media could not be loaded correctly
critical_error_message_box( critical_error_message_box(
translate('MediaPlugin.MediaItem', 'Unsupported File'), translate('MediaPlugin.MediaItem', 'Unsupported File'),
unicode(translate('MediaPlugin.MediaItem', translate('MediaPlugin.MediaItem', 'Unsupported File'))
'Unsupported File')))
return False return False
# dont care about actual theme, set a black background # dont care about actual theme, set a black background
if controller.isLive and not controller.media_info.is_background: if controller.isLive and not controller.media_info.is_background:
@ -339,8 +338,7 @@ class MediaController(object):
if not self.video_play([controller]): if not self.video_play([controller]):
critical_error_message_box( critical_error_message_box(
translate('MediaPlugin.MediaItem', 'Unsupported File'), translate('MediaPlugin.MediaItem', 'Unsupported File'),
unicode(translate('MediaPlugin.MediaItem', translate('MediaPlugin.MediaItem', 'Unsupported File'))
'Unsupported File')))
return False return False
self.set_controls_visible(controller, True) self.set_controls_visible(controller, True)
log.debug(u'use %s controller' % self.curDisplayMediaPlayer[display]) log.debug(u'use %s controller' % self.curDisplayMediaPlayer[display])

View File

@ -71,22 +71,19 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
plugin.status = int(plugin.status) plugin.status = int(plugin.status)
# Set the little status text in brackets next to the plugin name. # Set the little status text in brackets next to the plugin name.
if plugin.status == PluginStatus.Disabled: if plugin.status == PluginStatus.Disabled:
status_text = unicode( status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
translate('OpenLP.PluginForm', '%s (Disabled)'))
elif plugin.status == PluginStatus.Active: elif plugin.status == PluginStatus.Active:
status_text = unicode( status_text = translate('OpenLP.PluginForm', '%s (Active)')
translate('OpenLP.PluginForm', '%s (Active)'))
else: else:
# PluginStatus.Inactive # PluginStatus.Inactive
status_text = unicode( status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
translate('OpenLP.PluginForm', '%s (Inactive)'))
item.setText(status_text % plugin.nameStrings[u'singular']) item.setText(status_text % plugin.nameStrings[u'singular'])
# If the plugin has an icon, set it! # If the plugin has an icon, set it!
if plugin.icon: if plugin.icon:
item.setIcon(plugin.icon) item.setIcon(plugin.icon)
self.pluginListWidget.addItem(item) self.pluginListWidget.addItem(item)
pluginListWidth = max(pluginListWidth, self.fontMetrics().width( pluginListWidth = max(pluginListWidth, self.fontMetrics().width(
unicode(translate('OpenLP.PluginForm', '%s (Inactive)')) % translate('OpenLP.PluginForm', '%s (Inactive)') %
plugin.nameStrings[u'singular'])) plugin.nameStrings[u'singular']))
self.pluginListWidget.setFixedWidth(pluginListWidth + self.pluginListWidget.setFixedWidth(pluginListWidth +
self.pluginListWidget.iconSize().width() + 48) self.pluginListWidget.iconSize().width() + 48)
@ -136,16 +133,12 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
self.activePlugin.appStartup() self.activePlugin.appStartup()
else: else:
self.activePlugin.toggleStatus(PluginStatus.Inactive) self.activePlugin.toggleStatus(PluginStatus.Inactive)
status_text = unicode( status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
translate('OpenLP.PluginForm', '%s (Inactive)'))
if self.activePlugin.status == PluginStatus.Active: if self.activePlugin.status == PluginStatus.Active:
status_text = unicode( status_text = translate('OpenLP.PluginForm', '%s (Active)')
translate('OpenLP.PluginForm', '%s (Active)'))
elif self.activePlugin.status == PluginStatus.Inactive: elif self.activePlugin.status == PluginStatus.Inactive:
status_text = unicode( status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
translate('OpenLP.PluginForm', '%s (Inactive)'))
elif self.activePlugin.status == PluginStatus.Disabled: elif self.activePlugin.status == PluginStatus.Disabled:
status_text = unicode( status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
translate('OpenLP.PluginForm', '%s (Disabled)'))
self.pluginListWidget.currentItem().setText( self.pluginListWidget.currentItem().setText(
status_text % self.activePlugin.nameStrings[u'singular']) status_text % self.activePlugin.nameStrings[u'singular'])

View File

@ -172,8 +172,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
""" """
html_data = self._addElement(u'html') html_data = self._addElement(u'html')
self._addElement(u'head', parent=html_data) self._addElement(u'head', parent=html_data)
self._addElement(u'title', unicode(self.titleLineEdit.text()), self._addElement(u'title', self.titleLineEdit.text(), html_data.head)
html_data.head)
css_path = os.path.join( css_path = os.path.join(
AppLocation.get_data_path(), u'service_print.css') AppLocation.get_data_path(), u'service_print.css')
custom_css = get_text_file_string(css_path) custom_css = get_text_file_string(css_path)
@ -182,7 +181,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
self._addElement(u'style', custom_css, html_data.head, self._addElement(u'style', custom_css, html_data.head,
attribute=(u'type', u'text/css')) attribute=(u'type', u'text/css'))
self._addElement(u'body', parent=html_data) self._addElement(u'body', parent=html_data)
self._addElement(u'h1', cgi.escape(unicode(self.titleLineEdit.text())), self._addElement(u'h1', cgi.escape(self.titleLineEdit.text()),
html_data.body, classId=u'serviceTitle') html_data.body, classId=u'serviceTitle')
for index, item in enumerate(self.serviceManager.serviceItems): for index, item in enumerate(self.serviceManager.serviceItems):
self._addPreviewItem(html_data.body, item[u'service_item'], index) self._addPreviewItem(html_data.body, item[u'service_item'], index)
@ -241,7 +240,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
translate('OpenLP.ServiceManager', 'Notes: '), p, translate('OpenLP.ServiceManager', 'Notes: '), p,
classId=u'itemNotesTitle') classId=u'itemNotesTitle')
self._addElement(u'span', self._addElement(u'span',
cgi.escape(unicode(item.notes)).replace(u'\n', u'<br>'), p, cgi.escape(item.notes).replace(u'\n', u'<br>'), p,
classId=u'itemNotesText') classId=u'itemNotesText')
# Add play length of media files. # Add play length of media files.
if item.is_media() and self.metaDataCheckBox.isChecked(): if item.is_media() and self.metaDataCheckBox.isChecked():

View File

@ -174,7 +174,7 @@ class ServiceManager(QtGui.QWidget):
self.orderToolbar = OpenLPToolbar(self) self.orderToolbar = OpenLPToolbar(self)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_category( action_list.add_category(
unicode(UiStrings().Service), CategoryOrder.standardToolbar) UiStrings().Service, CategoryOrder.standardToolbar)
self.serviceManagerList.moveTop = self.orderToolbar.addToolbarAction( self.serviceManagerList.moveTop = self.orderToolbar.addToolbarAction(
u'moveTop', text=translate('OpenLP.ServiceManager', 'Move to &top'), u'moveTop', text=translate('OpenLP.ServiceManager', 'Move to &top'),
icon=u':/services/service_top.png', tooltip=translate( icon=u':/services/service_top.png', tooltip=translate(
@ -405,13 +405,13 @@ class ServiceManager(QtGui.QWidget):
elif result == QtGui.QMessageBox.Save: elif result == QtGui.QMessageBox.Save:
self.saveFile() self.saveFile()
if not loadFile: if not loadFile:
fileName = unicode(QtGui.QFileDialog.getOpenFileName( fileName = QtGui.QFileDialog.getOpenFileName(
self.mainwindow, self.mainwindow,
translate('OpenLP.ServiceManager', 'Open File'), translate('OpenLP.ServiceManager', 'Open File'),
SettingsManager.get_last_dir( SettingsManager.get_last_dir(
self.mainwindow.serviceManagerSettingsSection), self.mainwindow.serviceManagerSettingsSection),
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz)'))) 'OpenLP Service Files (*.osz)'))
if not fileName: if not fileName:
return False return False
else: else:
@ -503,11 +503,11 @@ class ServiceManager(QtGui.QWidget):
if not os.path.exists(path_from): if not os.path.exists(path_from):
if not skipMissing: if not skipMissing:
Receiver.send_message(u'cursor_normal') Receiver.send_message(u'cursor_normal')
title = unicode(translate('OpenLP.ServiceManager', title = translate('OpenLP.ServiceManager',
'Service File Missing')) 'Service File Missing')
message = unicode(translate('OpenLP.ServiceManager', message = translate('OpenLP.ServiceManager',
'File missing from service\n\n %s \n\n' 'File missing from service\n\n %s \n\n'
'Continue saving?' % path_from )) 'Continue saving?' % path_from )
answer = QtGui.QMessageBox.critical(self, title, answer = QtGui.QMessageBox.critical(self, title,
message, message,
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.StandardButtons(
@ -621,9 +621,9 @@ class ServiceManager(QtGui.QWidget):
directory = SettingsManager.get_last_dir( directory = SettingsManager.get_last_dir(
self.mainwindow.serviceManagerSettingsSection) self.mainwindow.serviceManagerSettingsSection)
path = os.path.join(directory, default_filename) path = os.path.join(directory, default_filename)
fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, fileName = QtGui.QFileDialog.getSaveFileName(self.mainwindow,
UiStrings().SaveService, path, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)'))) translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)'))
if not fileName: if not fileName:
return False return False
if os.path.splitext(fileName)[1] == u'': if os.path.splitext(fileName)[1] == u'':
@ -1043,16 +1043,16 @@ class ServiceManager(QtGui.QWidget):
tips = [] tips = []
if serviceitem.temporary_edit: if serviceitem.temporary_edit:
tips.append(u'<strong>%s:</strong> <em>%s</em>' % tips.append(u'<strong>%s:</strong> <em>%s</em>' %
(unicode(translate('OpenLP.ServiceManager', 'Edit')), (translate('OpenLP.ServiceManager', 'Edit'),
(unicode(translate('OpenLP.ServiceManager', (translate('OpenLP.ServiceManager',
'Service copy only'))))) 'Service copy only'))))
if serviceitem.theme and serviceitem.theme != -1: if serviceitem.theme and serviceitem.theme != -1:
tips.append(u'<strong>%s:</strong> <em>%s</em>' % tips.append(u'<strong>%s:</strong> <em>%s</em>' %
(unicode(translate('OpenLP.ServiceManager', 'Slide theme')), (translate('OpenLP.ServiceManager', 'Slide theme')),
serviceitem.theme)) serviceitem.theme)
if serviceitem.notes: if serviceitem.notes:
tips.append(u'<strong>%s: </strong> %s' % tips.append(u'<strong>%s: </strong> %s' %
(unicode(translate('OpenLP.ServiceManager', 'Notes')), (translate('OpenLP.ServiceManager', 'Notes'),
cgi.escape(unicode(serviceitem.notes)))) cgi.escape(unicode(serviceitem.notes))))
if item[u'service_item'] \ if item[u'service_item'] \
.is_capable(ItemCapabilities.HasVariableStartTime): .is_capable(ItemCapabilities.HasVariableStartTime):
@ -1099,7 +1099,7 @@ class ServiceManager(QtGui.QWidget):
Set the theme for the current service. Set the theme for the current service.
""" """
log.debug(u'onThemeComboBoxSelected') log.debug(u'onThemeComboBoxSelected')
self.service_theme = unicode(self.themeComboBox.currentText()) self.service_theme = self.themeComboBox.currentText()
self.mainwindow.renderer.set_service_theme(self.service_theme) self.mainwindow.renderer.set_service_theme(self.service_theme)
Settings().setValue( Settings().setValue(
self.mainwindow.serviceManagerSettingsSection + self.mainwindow.serviceManagerSettingsSection +
@ -1358,11 +1358,11 @@ class ServiceManager(QtGui.QWidget):
event.setDropAction(QtCore.Qt.CopyAction) event.setDropAction(QtCore.Qt.CopyAction)
event.accept() event.accept()
for url in link.urls(): for url in link.urls():
filename = unicode(url.toLocalFile()) filename = url.toLocalFile()
if filename.endswith(u'.osz'): if filename.endswith(u'.osz'):
self.onLoadServiceClicked(filename) self.onLoadServiceClicked(filename)
elif link.hasText(): elif link.hasText():
plugin = unicode(link.text()) plugin = link.text()
item = self.serviceManagerList.itemAt(event.pos()) item = self.serviceManagerList.itemAt(event.pos())
# ServiceManager started the drag and drop # ServiceManager started the drag and drop
if plugin == u'ServiceManager': if plugin == u'ServiceManager':
@ -1434,7 +1434,7 @@ class ServiceManager(QtGui.QWidget):
self.regenerateServiceItems() self.regenerateServiceItems()
def onThemeChangeAction(self): def onThemeChangeAction(self):
theme = unicode(self.sender().objectName()) theme = self.sender().objectName()
# No object name means that the "Default" theme is supposed to be used. # No object name means that the "Default" theme is supposed to be used.
if not theme: if not theme:
theme = None theme = None

View File

@ -128,7 +128,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
continue continue
item = QtGui.QTreeWidgetItem([category.name]) item = QtGui.QTreeWidgetItem([category.name])
for action in category.actions: for action in category.actions:
actionText = REMOVE_AMPERSAND.sub('', unicode(action.text())) actionText = REMOVE_AMPERSAND.sub('', action.text())
actionItem = QtGui.QTreeWidgetItem([actionText]) actionItem = QtGui.QTreeWidgetItem([actionText])
actionItem.setIcon(0, action.icon()) actionItem.setIcon(0, action.icon())
actionItem.setData(0, QtCore.Qt.UserRole, action) actionItem.setData(0, QtCore.Qt.UserRole, action)
@ -441,9 +441,9 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
Receiver.send_message(u'openlp_warning_message', { Receiver.send_message(u'openlp_warning_message', {
u'title': translate('OpenLP.ShortcutListDialog', u'title': translate('OpenLP.ShortcutListDialog',
'Duplicate Shortcut'), 'Duplicate Shortcut'),
u'message': unicode(translate('OpenLP.ShortcutListDialog', u'message': translate('OpenLP.ShortcutListDialog',
'The shortcut "%s" is already assigned to another action, ' 'The shortcut "%s" is already assigned to another action, '
'please use a different shortcut.')) % key_sequence.toString() 'please use a different shortcut.') % key_sequence.toString()
}) })
return is_valid return is_valid

View File

@ -446,7 +446,7 @@ class SlideController(Controller):
SONGS_PLUGIN_AVAILABLE = True SONGS_PLUGIN_AVAILABLE = True
except ImportError: except ImportError:
SONGS_PLUGIN_AVAILABLE = False SONGS_PLUGIN_AVAILABLE = False
sender_name = unicode(self.sender().objectName()) sender_name = self.sender().objectName()
verse_type = sender_name[15:] \ verse_type = sender_name[15:] \
if sender_name[:15] == u'shortcutAction_' else u'' if sender_name[:15] == u'shortcutAction_' else u''
if SONGS_PLUGIN_AVAILABLE: if SONGS_PLUGIN_AVAILABLE:
@ -647,7 +647,7 @@ class SlideController(Controller):
framenumber, width / self.ratio) framenumber, width / self.ratio)
def onSongBarHandler(self): def onSongBarHandler(self):
request = unicode(self.sender().text()) request = self.sender().text()
slide_no = self.slideList[request] slide_no = self.slideList[request]
self.__updatePreviewSelection(slide_no) self.__updatePreviewSelection(slide_no)
self.slideSelected() self.slideSelected()

View File

@ -208,8 +208,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
""" """
Updates the lines on a page on the wizard Updates the lines on a page on the wizard
""" """
self.mainLineCountLabel.setText(unicode(translate('OpenLP.ThemeForm', self.mainLineCountLabel.setText(translate('OpenLP.ThemeForm',
'(approximately %d lines per slide)')) % int(lines)) '(approximately %d lines per slide)') % int(lines))
def resizeEvent(self, event=None): def resizeEvent(self, event=None):
""" """
@ -319,8 +319,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.themeNameEdit.setVisible(not edit) self.themeNameEdit.setVisible(not edit)
self.edit_mode = edit self.edit_mode = edit
if edit: if edit:
self.setWindowTitle(unicode(translate('OpenLP.ThemeWizard', self.setWindowTitle(translate('OpenLP.ThemeWizard',
'Edit Theme - %s')) % self.theme.theme_name) 'Edit Theme - %s') % self.theme.theme_name)
self.next() self.next()
else: else:
self.setWindowTitle(UiStrings().NewTheme) self.setWindowTitle(UiStrings().NewTheme)
@ -550,23 +550,20 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
return return
log.debug(u'updateTheme') log.debug(u'updateTheme')
# main page # main page
self.theme.font_main_name = \ self.theme.font_main_name = self.mainFontComboBox.currentFont().family()
unicode(self.mainFontComboBox.currentFont().family()) self.theme.font_main_size = self.field(u'mainSizeSpinBox').toInt()[0]
self.theme.font_main_size = \
self.field(u'mainSizeSpinBox').toInt()[0]
self.theme.font_main_line_adjustment = \ self.theme.font_main_line_adjustment = \
self.field(u'lineSpacingSpinBox').toInt()[0] self.field(u'lineSpacingSpinBox').toInt()[0]
self.theme.font_main_outline_size = \ self.theme.font_main_outline_size = \
self.field(u'outlineSizeSpinBox').toInt()[0] self.field(u'outlineSizeSpinBox').toInt()[0]
self.theme.font_main_shadow_size = \ self.theme.font_main_shadow_size = \
self.field(u'shadowSizeSpinBox').toInt()[0] self.field(u'shadowSizeSpinBox').toInt()[0]
self.theme.font_main_bold = \ self.theme.font_main_bold = self.field(u'mainBoldCheckBox').toBool()
self.field(u'mainBoldCheckBox').toBool()
self.theme.font_main_italics = \ self.theme.font_main_italics = \
self.field(u'mainItalicsCheckBox').toBool() self.field(u'mainItalicsCheckBox').toBool()
# footer page # footer page
self.theme.font_footer_name = \ self.theme.font_footer_name = \
unicode(self.footerFontComboBox.currentFont().family()) self.footerFontComboBox.currentFont().family()
self.theme.font_footer_size = \ self.theme.font_footer_size = \
self.field(u'footerSizeSpinBox').toInt()[0] self.field(u'footerSizeSpinBox').toInt()[0]
# position page # position page
@ -594,7 +591,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
Lets save the theme as Finish has been triggered Lets save the theme as Finish has been triggered
""" """
# Save the theme name # Save the theme name
self.theme.theme_name = unicode(self.field(u'name').toString()) self.theme.theme_name = self.field(u'name').toString()
if not self.theme.theme_name: if not self.theme.theme_name:
critical_error_message_box( critical_error_message_box(
translate('OpenLP.ThemeForm', 'Theme Name Missing'), translate('OpenLP.ThemeForm', 'Theme Name Missing'),

View File

@ -173,8 +173,8 @@ class ThemeManager(QtGui.QWidget):
""" """
if item is None: if item is None:
return return
real_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString()) real_theme_name = item.data(QtCore.Qt.UserRole).toString()
theme_name = unicode(item.text()) theme_name = item.text()
# If default theme restrict actions # If default theme restrict actions
if real_theme_name == theme_name: if real_theme_name == theme_name:
self.deleteToolbarAction.setVisible(True) self.deleteToolbarAction.setVisible(True)
@ -189,8 +189,8 @@ class ThemeManager(QtGui.QWidget):
item = self.themeListWidget.itemAt(point) item = self.themeListWidget.itemAt(point)
if item is None: if item is None:
return return
real_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString()) real_theme_name = item.data(QtCore.Qt.UserRole).toString()
theme_name = unicode(item.text()) theme_name = item.text()
self.deleteAction.setVisible(False) self.deleteAction.setVisible(False)
self.renameAction.setVisible(False) self.renameAction.setVisible(False)
self.globalAction.setVisible(False) self.globalAction.setVisible(False)
@ -211,13 +211,13 @@ class ThemeManager(QtGui.QWidget):
# reset the old name # reset the old name
item = self.themeListWidget.item(count) item = self.themeListWidget.item(count)
old_name = item.text() old_name = item.text()
new_name = unicode(item.data(QtCore.Qt.UserRole).toString()) new_name = item.data(QtCore.Qt.UserRole).toString()
if old_name != new_name: if old_name != new_name:
self.themeListWidget.item(count).setText(new_name) self.themeListWidget.item(count).setText(new_name)
# Set the new name # Set the new name
if theme_name == new_name: if theme_name == new_name:
name = unicode(translate('OpenLP.ThemeManager', name = translate('OpenLP.ThemeManager',
'%s (default)')) % new_name '%s (default)') % new_name
self.themeListWidget.item(count).setText(name) self.themeListWidget.item(count).setText(name)
self.deleteToolbarAction.setVisible( self.deleteToolbarAction.setVisible(
item not in self.themeListWidget.selectedItems()) item not in self.themeListWidget.selectedItems())
@ -233,15 +233,14 @@ class ThemeManager(QtGui.QWidget):
item = self.themeListWidget.item(count) item = self.themeListWidget.item(count)
old_name = item.text() old_name = item.text()
# reset the old name # reset the old name
if old_name != unicode(item.data(QtCore.Qt.UserRole).toString()): if old_name != item.data(QtCore.Qt.UserRole).toString():
self.themeListWidget.item(count).setText( self.themeListWidget.item(count).setText(
unicode(item.data(QtCore.Qt.UserRole).toString())) item.data(QtCore.Qt.UserRole).toString())
# Set the new name # Set the new name
if count == selected_row: if count == selected_row:
self.global_theme = unicode( self.global_theme = self.themeListWidget.item(count).text()
self.themeListWidget.item(count).text()) name = translate('OpenLP.ThemeManager',
name = unicode(translate('OpenLP.ThemeManager', '%s (default)') % self.global_theme
'%s (default)')) % self.global_theme
self.themeListWidget.item(count).setText(name) self.themeListWidget.item(count).setText(name)
Settings().setValue( Settings().setValue(
self.settingsSection + u'/global theme', self.global_theme) self.settingsSection + u'/global theme', self.global_theme)
@ -262,16 +261,16 @@ class ThemeManager(QtGui.QWidget):
""" """
Renames an existing theme to a new name Renames an existing theme to a new name
""" """
if self._validate_theme_action(unicode(translate('OpenLP.ThemeManager', if self._validate_theme_action(translate('OpenLP.ThemeManager',
'You must select a theme to rename.')), 'You must select a theme to rename.'),
unicode(translate('OpenLP.ThemeManager', 'Rename Confirmation')), translate('OpenLP.ThemeManager', 'Rename Confirmation'),
unicode(translate('OpenLP.ThemeManager', 'Rename %s theme?')), translate('OpenLP.ThemeManager', 'Rename %s theme?'),
False, False): False, False):
item = self.themeListWidget.currentItem() item = self.themeListWidget.currentItem()
old_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString()) old_theme_name = item.data(QtCore.Qt.UserRole).toString()
self.fileRenameForm.fileNameEdit.setText(old_theme_name) self.fileRenameForm.fileNameEdit.setText(old_theme_name)
if self.fileRenameForm.exec_(): if self.fileRenameForm.exec_():
new_theme_name = unicode(self.fileRenameForm.fileNameEdit.text()) new_theme_name = self.fileRenameForm.fileNameEdit.text()
if old_theme_name == new_theme_name: if old_theme_name == new_theme_name:
return return
if self.checkIfThemeExists(new_theme_name): if self.checkIfThemeExists(new_theme_name):
@ -288,12 +287,12 @@ class ThemeManager(QtGui.QWidget):
Copies an existing theme to a new name Copies an existing theme to a new name
""" """
item = self.themeListWidget.currentItem() item = self.themeListWidget.currentItem()
old_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString()) old_theme_name = item.data(QtCore.Qt.UserRole).toString()
self.fileRenameForm.fileNameEdit.setText( self.fileRenameForm.fileNameEdit.setText(
unicode(translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager',
'Copy of %s', 'Copy of <theme name>')) % old_theme_name) 'Copy of %s', 'Copy of <theme name>') % old_theme_name)
if self.fileRenameForm.exec_(True): if self.fileRenameForm.exec_(True):
new_theme_name = unicode(self.fileRenameForm.fileNameEdit.text()) new_theme_name = self.fileRenameForm.fileNameEdit.text()
if self.checkIfThemeExists(new_theme_name): if self.checkIfThemeExists(new_theme_name):
theme_data = self.getThemeData(old_theme_name) theme_data = self.getThemeData(old_theme_name)
self.cloneThemeData(theme_data, new_theme_name) self.cloneThemeData(theme_data, new_theme_name)
@ -322,8 +321,7 @@ class ThemeManager(QtGui.QWidget):
translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager',
'You must select a theme to edit.')): 'You must select a theme to edit.')):
item = self.themeListWidget.currentItem() item = self.themeListWidget.currentItem()
theme = self.getThemeData( theme = self.getThemeData(item.data(QtCore.Qt.UserRole).toString())
unicode(item.data(QtCore.Qt.UserRole).toString()))
if theme.background_type == u'image': if theme.background_type == u'image':
self.old_background_image = theme.background_filename self.old_background_image = theme.background_filename
self.themeForm.theme = theme self.themeForm.theme = theme
@ -334,12 +332,12 @@ class ThemeManager(QtGui.QWidget):
""" """
Delete a theme Delete a theme
""" """
if self._validate_theme_action(unicode(translate('OpenLP.ThemeManager', if self._validate_theme_action(translate('OpenLP.ThemeManager',
'You must select a theme to delete.')), 'You must select a theme to delete.'),
unicode(translate('OpenLP.ThemeManager', 'Delete Confirmation')), translate('OpenLP.ThemeManager', 'Delete Confirmation'),
unicode(translate('OpenLP.ThemeManager', 'Delete %s theme?'))): translate('OpenLP.ThemeManager', 'Delete %s theme?')):
item = self.themeListWidget.currentItem() item = self.themeListWidget.currentItem()
theme = unicode(item.text()) theme = item.text()
row = self.themeListWidget.row(item) row = self.themeListWidget.row(item)
self.themeListWidget.takeItem(row) self.themeListWidget.takeItem(row)
self.deleteTheme(theme) self.deleteTheme(theme)
@ -373,10 +371,9 @@ class ThemeManager(QtGui.QWidget):
critical_error_message_box(message=translate('OpenLP.ThemeManager', critical_error_message_box(message=translate('OpenLP.ThemeManager',
'You have not selected a theme.')) 'You have not selected a theme.'))
return return
theme = unicode(item.data(QtCore.Qt.UserRole).toString()) theme = item.data(QtCore.Qt.UserRole).toString()
path = QtGui.QFileDialog.getExistingDirectory(self, path = QtGui.QFileDialog.getExistingDirectory(self,
unicode(translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme,
'Save Theme - (%s)')) % theme,
SettingsManager.get_last_dir(self.settingsSection, 1)) SettingsManager.get_last_dir(self.settingsSection, 1))
path = unicode(path) path = unicode(path)
Receiver.send_message(u'cursor_busy') Receiver.send_message(u'cursor_busy')
@ -416,8 +413,8 @@ class ThemeManager(QtGui.QWidget):
files = QtGui.QFileDialog.getOpenFileNames(self, files = QtGui.QFileDialog.getOpenFileNames(self,
translate('OpenLP.ThemeManager', 'Select Theme Import File'), translate('OpenLP.ThemeManager', 'Select Theme Import File'),
SettingsManager.get_last_dir(self.settingsSection), SettingsManager.get_last_dir(self.settingsSection),
unicode(translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager',
'OpenLP Themes (*.theme *.otz)'))) 'OpenLP Themes (*.theme *.otz)'))
log.info(u'New Themes %s', unicode(files)) log.info(u'New Themes %s', unicode(files))
if not files: if not files:
return return
@ -461,8 +458,8 @@ class ThemeManager(QtGui.QWidget):
if os.path.exists(theme): if os.path.exists(theme):
text_name = os.path.splitext(name)[0] text_name = os.path.splitext(name)[0]
if text_name == self.global_theme: if text_name == self.global_theme:
name = unicode(translate('OpenLP.ThemeManager', name = translate(
'%s (default)')) % text_name 'OpenLP.ThemeManager', '%s (default)') % text_name
else: else:
name = text_name name = text_name
thumb = os.path.join(self.thumb_path, u'%s.png' % text_name) thumb = os.path.join(self.thumb_path, u'%s.png' % text_name)
@ -768,7 +765,7 @@ class ThemeManager(QtGui.QWidget):
self.settingsSection + u'/global theme', u'') self.settingsSection + u'/global theme', u'')
if check_item_selected(self.themeListWidget, select_text): if check_item_selected(self.themeListWidget, select_text):
item = self.themeListWidget.currentItem() item = self.themeListWidget.currentItem()
theme = unicode(item.text()) theme = item.text()
# confirm deletion # confirm deletion
if confirm: if confirm:
answer = QtGui.QMessageBox.question(self, confirm_title, answer = QtGui.QMessageBox.question(self, confirm_title,
@ -778,7 +775,7 @@ class ThemeManager(QtGui.QWidget):
if answer == QtGui.QMessageBox.No: if answer == QtGui.QMessageBox.No:
return False return False
# should be the same unless default # should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()): if theme != item.data(QtCore.Qt.UserRole).toString():
critical_error_message_box( critical_error_message_box(
message=translate('OpenLP.ThemeManager', message=translate('OpenLP.ThemeManager',
'You are unable to delete the default theme.')) 'You are unable to delete the default theme.'))
@ -790,8 +787,8 @@ class ThemeManager(QtGui.QWidget):
critical_error_message_box( critical_error_message_box(
translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager',
'Validation Error'), 'Validation Error'),
unicode(translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager',
'Theme %s is used in the %s plugin.')) % \ 'Theme %s is used in the %s plugin.') % \
(theme, plugin.name)) (theme, plugin.name))
return False return False
return True return True

View File

@ -168,7 +168,7 @@ class ThemesTab(SettingsTab):
self.theme_level = ThemeLevel.Global self.theme_level = ThemeLevel.Global
def onDefaultComboBoxChanged(self, value): def onDefaultComboBoxChanged(self, value):
self.global_theme = unicode(self.DefaultComboBox.currentText()) self.global_theme = self.DefaultComboBox.currentText()
self.mainwindow.renderer.set_global_theme( self.mainwindow.renderer.set_global_theme(
self.global_theme, self.theme_level) self.global_theme, self.theme_level)
self.__previewGlobalTheme() self.__previewGlobalTheme()

View File

@ -63,20 +63,20 @@ class WizardStrings(object):
FormatLabel = translate('OpenLP.Ui', 'Format:') FormatLabel = translate('OpenLP.Ui', 'Format:')
HeaderStyle = u'<span style="font-size:14pt; font-weight:600;">%s</span>' HeaderStyle = u'<span style="font-size:14pt; font-weight:600;">%s</span>'
Importing = translate('OpenLP.Ui', 'Importing') Importing = translate('OpenLP.Ui', 'Importing')
ImportingType = unicode(translate('OpenLP.Ui', 'Importing "%s"...')) ImportingType = translate('OpenLP.Ui', 'Importing "%s"...')
ImportSelect = translate('OpenLP.Ui', 'Select Import Source') ImportSelect = translate('OpenLP.Ui', 'Select Import Source')
ImportSelectLong = unicode(translate('OpenLP.Ui', ImportSelectLong = translate('OpenLP.Ui',
'Select the import format and the location to import from.')) 'Select the import format and the location to import from.')
NoSqlite = translate('OpenLP.Ui', 'The openlp.org 1.x importer has been ' NoSqlite = translate('OpenLP.Ui', 'The openlp.org 1.x importer has been '
'disabled due to a missing Python module. If you want to use this ' 'disabled due to a missing Python module. If you want to use this '
'importer, you will need to install the "python-sqlite" ' 'importer, you will need to install the "python-sqlite" '
'module.') 'module.')
OpenTypeFile = unicode(translate('OpenLP.Ui', 'Open %s File')) OpenTypeFile = translate('OpenLP.Ui', 'Open %s File')
PercentSymbolFormat = unicode(translate('OpenLP.Ui', '%p%')) PercentSymbolFormat = translate('OpenLP.Ui', '%p%')
Ready = translate('OpenLP.Ui', 'Ready.') Ready = translate('OpenLP.Ui', 'Ready.')
StartingImport = translate('OpenLP.Ui', 'Starting import...') StartingImport = translate('OpenLP.Ui', 'Starting import...')
YouSpecifyFile = unicode(translate('OpenLP.Ui', 'You need to specify at ' YouSpecifyFile = translate('OpenLP.Ui', 'You need to specify at '
'least one %s file to import from.', 'A file type e.g. OpenSong')) 'least one %s file to import from.', 'A file type e.g. OpenSong')
class OpenLPWizard(QtGui.QWizard): class OpenLPWizard(QtGui.QWizard):

View File

@ -146,7 +146,7 @@ class AlertsPlugin(Plugin):
Plugin.initialise(self) Plugin.initialise(self)
self.toolsAlertItem.setVisible(True) self.toolsAlertItem.setVisible(True)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_action(self.toolsAlertItem, unicode(UiStrings().Tools)) action_list.add_action(self.toolsAlertItem, UiStrings().Tools)
def finalise(self): def finalise(self):
""" """

View File

@ -81,10 +81,10 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
self.alertListWidget.addItem(item_name) self.alertListWidget.addItem(item_name)
def onDisplayClicked(self): def onDisplayClicked(self):
self.triggerAlert(unicode(self.alertTextEdit.text())) self.triggerAlert(self.alertTextEdit.text())
def onDisplayCloseClicked(self): def onDisplayCloseClicked(self):
if self.triggerAlert(unicode(self.alertTextEdit.text())): if self.triggerAlert(self.alertTextEdit.text()):
self.close() self.close()
def onDeleteButtonClicked(self): def onDeleteButtonClicked(self):
@ -109,7 +109,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
'clicking New.')) 'clicking New.'))
else: else:
alert = AlertItem() alert = AlertItem()
alert.text = unicode(self.alertTextEdit.text()) alert.text = self.alertTextEdit.text()
self.manager.save_object(alert) self.manager.save_object(alert)
self.alertTextEdit.setText(u'') self.alertTextEdit.setText(u'')
self.loadList() self.loadList()
@ -120,14 +120,14 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
""" """
if self.item_id: if self.item_id:
alert = self.manager.get_object(AlertItem, self.item_id) alert = self.manager.get_object(AlertItem, self.item_id)
alert.text = unicode(self.alertTextEdit.text()) alert.text = self.alertTextEdit.text()
self.manager.save_object(alert) self.manager.save_object(alert)
self.item_id = None self.item_id = None
self.loadList() self.loadList()
def onTextChanged(self): def onTextChanged(self):
""" """
Enable save button when data has been changed by editing the form Enable save button when data has been changed by editing the form.
""" """
# Only enable the button, if we are editing an item. # Only enable the button, if we are editing an item.
if self.item_id: if self.item_id:
@ -141,26 +141,26 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
def onDoubleClick(self): def onDoubleClick(self):
""" """
List item has been double clicked to display it List item has been double clicked to display it.
""" """
item = self.alertListWidget.selectedIndexes()[0] item = self.alertListWidget.selectedIndexes()[0]
bitem = self.alertListWidget.item(item.row()) bitem = self.alertListWidget.item(item.row())
self.triggerAlert(unicode(bitem.text())) self.triggerAlert(bitem.text())
self.alertTextEdit.setText(unicode(bitem.text())) self.alertTextEdit.setText(bitem.text())
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0] self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
self.saveButton.setEnabled(False) self.saveButton.setEnabled(False)
def onSingleClick(self): def onSingleClick(self):
""" """
List item has been single clicked to add it to List item has been single clicked to add it to the edit field so it can
the edit field so it can be changed. be changed.
""" """
item = self.alertListWidget.selectedIndexes()[0] item = self.alertListWidget.selectedIndexes()[0]
bitem = self.alertListWidget.item(item.row()) bitem = self.alertListWidget.item(item.row())
self.alertTextEdit.setText(unicode(bitem.text())) self.alertTextEdit.setText(bitem.text())
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0] self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
# If the alert does not contain '<>' we clear the ParameterEdit field. # If the alert does not contain '<>' we clear the ParameterEdit field.
if unicode(self.alertTextEdit.text()).find(u'<>') == -1: if self.alertTextEdit.text().find(u'<>') == -1:
self.parameterEdit.setText(u'') self.parameterEdit.setText(u'')
self.saveButton.setEnabled(False) self.saveButton.setEnabled(False)
@ -194,7 +194,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.parameterEdit.setFocus() self.parameterEdit.setFocus()
return False return False
text = text.replace(u'<>', unicode(self.parameterEdit.text())) text = text.replace(u'<>', self.parameterEdit.text())
self.plugin.alertsmanager.displayAlert(text) self.plugin.alertsmanager.displayAlert(text)
return True return True

View File

@ -56,11 +56,9 @@ class BiblePlugin(Plugin):
Plugin.initialise(self) Plugin.initialise(self)
self.importBibleItem.setVisible(True) self.importBibleItem.setVisible(True)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_action(self.importBibleItem, action_list.add_action(self.importBibleItem, UiStrings().Import)
unicode(UiStrings().Import))
# Do not add the action to the list yet. # Do not add the action to the list yet.
#action_list.add_action(self.exportBibleItem, #action_list.add_action(self.exportBibleItem, UiStrings().Export)
# unicode(UiStrings().Export))
# Set to invisible until we can export bibles # Set to invisible until we can export bibles
self.exportBibleItem.setVisible(False) self.exportBibleItem.setVisible(False)
if self.manager.old_bible_databases: if self.manager.old_bible_databases:
@ -74,8 +72,7 @@ class BiblePlugin(Plugin):
self.manager.finalise() self.manager.finalise()
Plugin.finalise(self) Plugin.finalise(self)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.remove_action(self.importBibleItem, action_list.remove_action(self.importBibleItem, UiStrings().Import)
unicode(UiStrings().Import))
self.importBibleItem.setVisible(False) self.importBibleItem.setVisible(False)
#action_list.remove_action(self.exportBibleItem, UiStrings().Export) #action_list.remove_action(self.exportBibleItem, UiStrings().Export)
self.exportBibleItem.setVisible(False) self.exportBibleItem.setVisible(False)

View File

@ -473,9 +473,8 @@ class BibleImportForm(OpenLPWizard):
return False return False
return True return True
elif self.currentPage() == self.licenseDetailsPage: elif self.currentPage() == self.licenseDetailsPage:
license_version = unicode(self.field(u'license_version').toString()) license_version = self.field(u'license_version').toString()
license_copyright = \ license_copyright = self.field(u'license_copyright').toString()
unicode(self.field(u'license_copyright').toString())
path = AppLocation.get_section_data_path(u'bibles') path = AppLocation.get_section_data_path(u'bibles')
if not license_version: if not license_version:
critical_error_message_box(UiStrings().EmptyField, critical_error_message_box(UiStrings().EmptyField,
@ -658,50 +657,48 @@ class BibleImportForm(OpenLPWizard):
Perform the actual import. Perform the actual import.
""" """
bible_type = self.field(u'source_format').toInt()[0] bible_type = self.field(u'source_format').toInt()[0]
license_version = unicode(self.field(u'license_version').toString()) license_version = self.field(u'license_version').toString()
license_copyright = unicode(self.field(u'license_copyright').toString()) license_copyright = self.field(u'license_copyright').toString()
license_permissions = \ license_permissions = self.field(u'license_permissions').toString()
unicode(self.field(u'license_permissions').toString())
importer = None importer = None
if bible_type == BibleFormat.OSIS: if bible_type == BibleFormat.OSIS:
# Import an OSIS bible. # Import an OSIS bible.
importer = self.manager.import_bible(BibleFormat.OSIS, importer = self.manager.import_bible(BibleFormat.OSIS,
name=license_version, name=license_version,
filename=unicode(self.field(u'osis_location').toString()) filename=self.field(u'osis_location').toString()
) )
elif bible_type == BibleFormat.CSV: elif bible_type == BibleFormat.CSV:
# Import a CSV bible. # Import a CSV bible.
importer = self.manager.import_bible(BibleFormat.CSV, importer = self.manager.import_bible(BibleFormat.CSV,
name=license_version, name=license_version,
booksfile=unicode(self.field(u'csv_booksfile').toString()), booksfile=self.field(u'csv_booksfile').toString(),
versefile=unicode(self.field(u'csv_versefile').toString()) versefile=self.field(u'csv_versefile').toString()
) )
elif bible_type == BibleFormat.OpenSong: elif bible_type == BibleFormat.OpenSong:
# Import an OpenSong bible. # Import an OpenSong bible.
importer = self.manager.import_bible(BibleFormat.OpenSong, importer = self.manager.import_bible(BibleFormat.OpenSong,
name=license_version, name=license_version,
filename=unicode(self.field(u'opensong_file').toString()) filename=self.field(u'opensong_file').toString()
) )
elif bible_type == BibleFormat.WebDownload: elif bible_type == BibleFormat.WebDownload:
# Import a bible from the web. # Import a bible from the web.
self.progressBar.setMaximum(1) self.progressBar.setMaximum(1)
download_location = self.field(u'web_location').toInt()[0] download_location = self.field(u'web_location').toInt()[0]
bible_version = unicode(self.webTranslationComboBox.currentText()) bible_version = self.webTranslationComboBox.currentText()
bible = self.web_bible_list[download_location][bible_version] bible = self.web_bible_list[download_location][bible_version]
importer = self.manager.import_bible( importer = self.manager.import_bible(
BibleFormat.WebDownload, name=license_version, BibleFormat.WebDownload, name=license_version,
download_source=WebDownload.Names[download_location], download_source=WebDownload.Names[download_location],
download_name=bible, download_name=bible,
proxy_server=unicode(self.field(u'proxy_server').toString()), proxy_server=self.field(u'proxy_server').toString(),
proxy_username=\ proxy_username=self.field(u'proxy_username').toString(),
unicode(self.field(u'proxy_username').toString()), proxy_password=self.field(u'proxy_password').toString()
proxy_password=unicode(self.field(u'proxy_password').toString())
) )
elif bible_type == BibleFormat.OpenLP1: elif bible_type == BibleFormat.OpenLP1:
# Import an openlp.org 1.x bible. # Import an openlp.org 1.x bible.
importer = self.manager.import_bible(BibleFormat.OpenLP1, importer = self.manager.import_bible(BibleFormat.OpenLP1,
name=license_version, name=license_version,
filename=unicode(self.field(u'openlp1_location').toString()) filename=self.field(u'openlp1_location').toString()
) )
if importer.do_import(license_version): if importer.do_import(license_version):
self.manager.save_meta_data(license_version, license_version, self.manager.save_meta_data(license_version, license_version,

View File

@ -304,7 +304,7 @@ class BibleUpgradeForm(OpenLPWizard):
return True return True
elif self.currentPage() == self.backupPage: elif self.currentPage() == self.backupPage:
if not self.noBackupCheckBox.checkState() == QtCore.Qt.Checked: if not self.noBackupCheckBox.checkState() == QtCore.Qt.Checked:
backup_path = unicode(self.backupDirectoryEdit.text()) backup_path = self.backupDirectoryEdit.text()
if not backup_path: if not backup_path:
critical_error_message_box(UiStrings().EmptyField, critical_error_message_box(UiStrings().EmptyField,
translate('BiblesPlugin.UpgradeWizardForm', translate('BiblesPlugin.UpgradeWizardForm',
@ -401,9 +401,9 @@ class BibleUpgradeForm(OpenLPWizard):
old_bible = OldBibleDB(self.mediaItem, path=self.temp_dir, old_bible = OldBibleDB(self.mediaItem, path=self.temp_dir,
file=filename[0]) file=filename[0])
name = filename[1] name = filename[1]
self.progressLabel.setText(unicode(translate( self.progressLabel.setText(translate(
'BiblesPlugin.UpgradeWizardForm', 'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nUpgrading ...')) % 'Upgrading Bible %s of %s: "%s"\nUpgrading ...') %
(number + 1, max_bibles, name)) (number + 1, max_bibles, name))
self.newbibles[number] = BibleDB(self.mediaItem, path=self.path, self.newbibles[number] = BibleDB(self.mediaItem, path=self.path,
name=name, file=filename[0]) name=name, file=filename[0])
@ -448,9 +448,9 @@ class BibleUpgradeForm(OpenLPWizard):
translate('BiblesPlugin.UpgradeWizardForm', translate('BiblesPlugin.UpgradeWizardForm',
'To upgrade your Web Bibles an Internet connection is ' 'To upgrade your Web Bibles an Internet connection is '
'required.')) 'required.'))
self.incrementProgressBar(unicode(translate( self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm', 'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed')) % 'Upgrading Bible %s of %s: "%s"\nFailed') %
(number + 1, max_bibles, name), (number + 1, max_bibles, name),
self.progressBar.maximum() - self.progressBar.value()) self.progressBar.maximum() - self.progressBar.value())
self.success[number] = False self.success[number] = False
@ -468,9 +468,9 @@ class BibleUpgradeForm(OpenLPWizard):
log.warn(u'Upgrading from "%s" failed' % filename[0]) log.warn(u'Upgrading from "%s" failed' % filename[0])
self.newbibles[number].session.close() self.newbibles[number].session.close()
del self.newbibles[number] del self.newbibles[number]
self.incrementProgressBar(unicode(translate( self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm', 'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed')) % 'Upgrading Bible %s of %s: "%s"\nFailed') %
(number + 1, max_bibles, name), (number + 1, max_bibles, name),
self.progressBar.maximum() - self.progressBar.value()) self.progressBar.maximum() - self.progressBar.value())
self.success[number] = False self.success[number] = False
@ -480,10 +480,10 @@ class BibleUpgradeForm(OpenLPWizard):
if self.stop_import_flag: if self.stop_import_flag:
self.success[number] = False self.success[number] = False
break break
self.incrementProgressBar(unicode(translate( self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm', 'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\n' 'Upgrading Bible %s of %s: "%s"\n'
'Upgrading %s ...')) % 'Upgrading %s ...') %
(number + 1, max_bibles, name, book)) (number + 1, max_bibles, name, book))
book_ref_id = self.newbibles[number].\ book_ref_id = self.newbibles[number].\
get_book_ref_id_by_name(book, len(books), language_id) get_book_ref_id_by_name(book, len(books), language_id)
@ -525,9 +525,9 @@ class BibleUpgradeForm(OpenLPWizard):
log.warn(u'Upgrading books from "%s" failed' % name) log.warn(u'Upgrading books from "%s" failed' % name)
self.newbibles[number].session.close() self.newbibles[number].session.close()
del self.newbibles[number] del self.newbibles[number]
self.incrementProgressBar(unicode(translate( self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm', 'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed')) % 'Upgrading Bible %s of %s: "%s"\nFailed') %
(number + 1, max_bibles, name), (number + 1, max_bibles, name),
self.progressBar.maximum() - self.progressBar.value()) self.progressBar.maximum() - self.progressBar.value())
self.success[number] = False self.success[number] = False
@ -538,10 +538,10 @@ class BibleUpgradeForm(OpenLPWizard):
if self.stop_import_flag: if self.stop_import_flag:
self.success[number] = False self.success[number] = False
break break
self.incrementProgressBar(unicode(translate( self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm', 'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\n' 'Upgrading Bible %s of %s: "%s"\n'
'Upgrading %s ...')) % 'Upgrading %s ...') %
(number + 1, max_bibles, name, book[u'name'])) (number + 1, max_bibles, name, book[u'name']))
book_ref_id = self.newbibles[number].\ book_ref_id = self.newbibles[number].\
get_book_ref_id_by_name(book[u'name'], len(books), get_book_ref_id_by_name(book[u'name'], len(books),
@ -572,18 +572,18 @@ class BibleUpgradeForm(OpenLPWizard):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
self.newbibles[number].session.commit() self.newbibles[number].session.commit()
if not self.success.get(number, True): if not self.success.get(number, True):
self.incrementProgressBar(unicode(translate( self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm', 'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed')) % 'Upgrading Bible %s of %s: "%s"\nFailed') %
(number + 1, max_bibles, name), (number + 1, max_bibles, name),
self.progressBar.maximum() - self.progressBar.value()) self.progressBar.maximum() - self.progressBar.value())
else: else:
self.success[number] = True self.success[number] = True
self.newbibles[number].save_meta(u'name', name) self.newbibles[number].save_meta(u'name', name)
self.incrementProgressBar(unicode(translate( self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm', 'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\n' 'Upgrading Bible %s of %s: "%s"\n'
'Complete')) % 'Complete') %
(number + 1, max_bibles, name)) (number + 1, max_bibles, name))
if number in self.newbibles: if number in self.newbibles:
self.newbibles[number].session.close() self.newbibles[number].session.close()
@ -607,23 +607,22 @@ class BibleUpgradeForm(OpenLPWizard):
# Copy not upgraded bible back. # Copy not upgraded bible back.
shutil.move(os.path.join(self.temp_dir, filename[0]), self.path) shutil.move(os.path.join(self.temp_dir, filename[0]), self.path)
if failed_import > 0: if failed_import > 0:
failed_import_text = unicode(translate( failed_import_text = translate('BiblesPlugin.UpgradeWizardForm',
'BiblesPlugin.UpgradeWizardForm', ', %s failed') % failed_import
', %s failed')) % failed_import
else: else:
failed_import_text = u'' failed_import_text = u''
if successful_import > 0: if successful_import > 0:
if self.includeWebBible: if self.includeWebBible:
self.progressLabel.setText(unicode( self.progressLabel.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading ' translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading '
'Bible(s): %s successful%s\nPlease note that verses from ' 'Bible(s): %s successful%s\nPlease note that verses from '
'Web Bibles will be downloaded on demand and so an ' 'Web Bibles will be downloaded on demand and so an '
'Internet connection is required.')) % 'Internet connection is required.') %
(successful_import, failed_import_text)) (successful_import, failed_import_text))
else: else:
self.progressLabel.setText(unicode( self.progressLabel.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading ' translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading '
'Bible(s): %s successful%s')) % (successful_import, 'Bible(s): %s successful%s') % (successful_import,
failed_import_text)) failed_import_text))
else: else:
self.progressLabel.setText(translate( self.progressLabel.setText(translate(

View File

@ -125,7 +125,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
self.correspondingComboBox.setFocus() self.correspondingComboBox.setFocus()
return False return False
else: else:
cor_book = unicode(self.correspondingComboBox.currentText()) cor_book = self.correspondingComboBox.currentText()
for character in u'\\.^$*+?{}[]()': for character in u'\\.^$*+?{}[]()':
cor_book = cor_book.replace(character, u'\\' + character) cor_book = cor_book.replace(character, u'\\' + character)
books = filter(lambda key: books = filter(lambda key:

View File

@ -116,9 +116,9 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
Exit Dialog and save data Exit Dialog and save data
""" """
log.debug(u'BibleEditForm.accept') log.debug(u'BibleEditForm.accept')
version = unicode(self.versionNameEdit.text()) version = self.versionNameEdit.text()
copyright = unicode(self.copyrightEdit.text()) copyright = self.copyrightEdit.text()
permissions = unicode(self.permissionsEdit.text()) permissions = self.permissionsEdit.text()
book_name_language = self.languageSelectionComboBox.currentIndex() - 1 book_name_language = self.languageSelectionComboBox.currentIndex() - 1
if book_name_language == -1: if book_name_language == -1:
book_name_language = None book_name_language = None
@ -128,7 +128,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
custom_names = {} custom_names = {}
for abbr, book in self.books.iteritems(): for abbr, book in self.books.iteritems():
if book: if book:
custom_names[abbr] = unicode(self.bookNameEdit[abbr].text()) custom_names[abbr] = self.bookNameEdit[abbr].text()
if book.name != custom_names[abbr]: if book.name != custom_names[abbr]:
if not self.validateBook(custom_names[abbr], abbr): if not self.validateBook(custom_names[abbr], abbr):
return return
@ -183,29 +183,29 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
if not new_book_name: if not new_book_name:
self.bookNameEdit[abbreviation].setFocus() self.bookNameEdit[abbreviation].setFocus()
critical_error_message_box(UiStrings().EmptyField, critical_error_message_box(UiStrings().EmptyField,
unicode(translate('BiblesPlugin.BibleEditForm', translate('BiblesPlugin.BibleEditForm',
'You need to specify a book name for "%s".')) % 'You need to specify a book name for "%s".') %
self.book_names[abbreviation]) self.book_names[abbreviation])
return False return False
elif not book_regex.match(new_book_name): elif not book_regex.match(new_book_name):
self.bookNameEdit[abbreviation].setFocus() self.bookNameEdit[abbreviation].setFocus()
critical_error_message_box(UiStrings().EmptyField, critical_error_message_box(UiStrings().EmptyField,
unicode(translate('BiblesPlugin.BibleEditForm', translate('BiblesPlugin.BibleEditForm',
'The book name "%s" is not correct.\nNumbers can only be used ' 'The book name "%s" is not correct.\nNumbers can only be used '
'at the beginning and must\nbe followed by one or more ' 'at the beginning and must\nbe followed by one or more '
'non-numeric characters.')) % new_book_name) 'non-numeric characters.') % new_book_name)
return False return False
for abbr, book in self.books.iteritems(): for abbr, book in self.books.iteritems():
if book: if book:
if abbr == abbreviation: if abbr == abbreviation:
continue continue
if unicode(self.bookNameEdit[abbr].text()) == new_book_name: if self.bookNameEdit[abbr].text() == new_book_name:
self.bookNameEdit[abbreviation].setFocus() self.bookNameEdit[abbreviation].setFocus()
critical_error_message_box( critical_error_message_box(
translate('BiblesPlugin.BibleEditForm', translate('BiblesPlugin.BibleEditForm',
'Duplicate Book Name'), 'Duplicate Book Name'),
unicode(translate('BiblesPlugin.BibleEditForm', translate('BiblesPlugin.BibleEditForm',
'The Book Name "%s" has been entered more than once.')) 'The Book Name "%s" has been entered more than once.')
% new_book_name) % new_book_name)
return False return False
return True return True

View File

@ -181,10 +181,10 @@ def update_reference_separators():
Updates separators and matches for parsing and formating scripture Updates separators and matches for parsing and formating scripture
references. references.
""" """
default_separators = unicode(translate('BiblesPlugin', default_separators = translate('BiblesPlugin',
':|v|V|verse|verses;;-|to;;,|and;;end', ':|v|V|verse|verses;;-|to;;,|and;;end',
'Double-semicolon delimited separators for parsing references. ' 'Double-semicolon delimited separators for parsing references. '
'Consult the developers for further information.')).split(u';;') 'Consult the developers for further information.').split(u';;')
settings = Settings() settings = Settings()
settings.beginGroup(u'bibles') settings.beginGroup(u'bibles')
custom_separators = [ custom_separators = [

View File

@ -107,9 +107,9 @@ class CSVBible(BibleDB):
for line in books_reader: for line in books_reader:
if self.stop_import_flag: if self.stop_import_flag:
break break
self.wizard.incrementProgressBar(unicode( self.wizard.incrementProgressBar(
translate('BiblesPlugin.CSVBible', translate('BiblesPlugin.CSVBible',
'Importing books... %s')) % 'Importing books... %s') %
unicode(line[2], details['encoding'])) unicode(line[2], details['encoding']))
book_ref_id = self.get_book_ref_id_by_name( book_ref_id = self.get_book_ref_id_by_name(
unicode(line[2], details['encoding']), 67, language_id) unicode(line[2], details['encoding']), 67, language_id)
@ -151,9 +151,9 @@ class CSVBible(BibleDB):
if book_ptr != line_book: if book_ptr != line_book:
book = self.get_book(line_book) book = self.get_book(line_book)
book_ptr = book.name book_ptr = book.name
self.wizard.incrementProgressBar(unicode(translate( self.wizard.incrementProgressBar(translate(
'BiblesPlugin.CSVBible', 'Importing verses from %s...', 'BiblesPlugin.CSVBible', 'Importing verses from %s...',
'Importing verses from <book name>...')) % book.name) 'Importing verses from <book name>...') % book.name)
self.session.commit() self.session.commit()
try: try:
verse_text = unicode(line[3], details['encoding']) verse_text = unicode(line[3], details['encoding'])

View File

@ -398,9 +398,9 @@ class HTTPBible(BibleDB):
``True`` on success, ``False`` on failure. ``True`` on success, ``False`` on failure.
""" """
self.wizard.progressBar.setMaximum(68) self.wizard.progressBar.setMaximum(68)
self.wizard.incrementProgressBar(unicode(translate( self.wizard.incrementProgressBar(translate(
'BiblesPlugin.HTTPBible', 'BiblesPlugin.HTTPBible',
'Registering Bible and loading books...'))) 'Registering Bible and loading books...'))
self.save_meta(u'download_source', self.download_source) self.save_meta(u'download_source', self.download_source)
self.save_meta(u'download_name', self.download_name) self.save_meta(u'download_name', self.download_name)
if self.proxy_server: if self.proxy_server:
@ -423,8 +423,8 @@ class HTTPBible(BibleDB):
'failed' % (self.download_source, self.download_name)) 'failed' % (self.download_source, self.download_name))
return False return False
self.wizard.progressBar.setMaximum(len(books)+2) self.wizard.progressBar.setMaximum(len(books)+2)
self.wizard.incrementProgressBar(unicode(translate( self.wizard.incrementProgressBar(translate(
'BiblesPlugin.HTTPBible', 'Registering Language...'))) 'BiblesPlugin.HTTPBible', 'Registering Language...'))
bible = BiblesResourcesDB.get_webbible(self.download_name, bible = BiblesResourcesDB.get_webbible(self.download_name,
self.download_source.lower()) self.download_source.lower())
if bible[u'language_id']: if bible[u'language_id']:
@ -439,9 +439,9 @@ class HTTPBible(BibleDB):
for book in books: for book in books:
if self.stop_import_flag: if self.stop_import_flag:
break break
self.wizard.incrementProgressBar(unicode(translate( self.wizard.incrementProgressBar(translate(
'BiblesPlugin.HTTPBible', 'Importing %s...', 'BiblesPlugin.HTTPBible', 'Importing %s...',
'Importing <book name>...')) % book) 'Importing <book name>...') % book)
book_ref_id = self.get_book_ref_id_by_name(book, len(books), book_ref_id = self.get_book_ref_id_by_name(book, len(books),
language_id) language_id)
if not book_ref_id: if not book_ref_id:

View File

@ -348,7 +348,7 @@ class BibleManager(object):
Receiver.send_message(u'openlp_information_message', { Receiver.send_message(u'openlp_information_message', {
u'title': translate('BiblesPlugin.BibleManager', u'title': translate('BiblesPlugin.BibleManager',
'Scripture Reference Error'), 'Scripture Reference Error'),
u'message': unicode(translate('BiblesPlugin.BibleManager', u'message': translate('BiblesPlugin.BibleManager',
'Your scripture reference is either not supported by ' 'Your scripture reference is either not supported by '
'OpenLP or is invalid. Please make sure your reference ' 'OpenLP or is invalid. Please make sure your reference '
'conforms to one of the following patterns or consult the ' 'conforms to one of the following patterns or consult the '
@ -363,7 +363,7 @@ class BibleManager(object):
'Book Chapter%(verse)sVerse%(range)sChapter%(verse)sVerse', 'Book Chapter%(verse)sVerse%(range)sChapter%(verse)sVerse',
'Please pay attention to the appended "s" of the wildcards ' 'Please pay attention to the appended "s" of the wildcards '
'and refrain from translating the words inside the ' 'and refrain from translating the words inside the '
'names in the brackets.')) % reference_seperators 'names in the brackets.') % reference_seperators
}) })
return None return None

View File

@ -422,7 +422,7 @@ class BibleMediaItem(MediaManagerItem):
""" """
log.debug(u'initialiseAdvancedBible %s, %s', bible, last_book_id) log.debug(u'initialiseAdvancedBible %s, %s', bible, last_book_id)
book_data = self.plugin.manager.get_books(bible) book_data = self.plugin.manager.get_books(bible)
secondbible = unicode(self.advancedSecondComboBox.currentText()) secondbible = self.advancedSecondComboBox.currentText()
if secondbible != u'': if secondbible != u'':
secondbook_data = self.plugin.manager.get_books(secondbible) secondbook_data = self.plugin.manager.get_books(secondbible)
book_data_temp = [] book_data_temp = []
@ -504,10 +504,10 @@ class BibleMediaItem(MediaManagerItem):
# We have to do a 'Reference Search'. # We have to do a 'Reference Search'.
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference: if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
bibles = self.plugin.manager.get_bibles() bibles = self.plugin.manager.get_bibles()
bible = unicode(self.quickVersionComboBox.currentText()) bible = self.quickVersionComboBox.currentText()
if bible: if bible:
book_data = bibles[bible].get_books() book_data = bibles[bible].get_books()
secondbible = unicode(self.quickSecondComboBox.currentText()) secondbible = self.quickSecondComboBox.currentText()
if secondbible != u'': if secondbible != u'':
secondbook_data = bibles[secondbible].get_books() secondbook_data = bibles[secondbible].get_books()
book_data_temp = [] book_data_temp = []
@ -546,9 +546,9 @@ class BibleMediaItem(MediaManagerItem):
def onEditClick(self): def onEditClick(self):
if self.quickTab.isVisible(): if self.quickTab.isVisible():
bible = unicode(self.quickVersionComboBox.currentText()) bible = self.quickVersionComboBox.currentText()
elif self.advancedTab.isVisible(): elif self.advancedTab.isVisible():
bible = unicode(self.advancedVersionComboBox.currentText()) bible = self.advancedVersionComboBox.currentText()
if bible: if bible:
self.editBibleForm = EditBibleForm(self, self.plugin.formParent, self.editBibleForm = EditBibleForm(self, self.plugin.formParent,
self.plugin.manager) self.plugin.manager)
@ -558,13 +558,13 @@ class BibleMediaItem(MediaManagerItem):
def onDeleteClick(self): def onDeleteClick(self):
if self.quickTab.isVisible(): if self.quickTab.isVisible():
bible = unicode(self.quickVersionComboBox.currentText()) bible = self.quickVersionComboBox.currentText()
elif self.advancedTab.isVisible(): elif self.advancedTab.isVisible():
bible = unicode(self.advancedVersionComboBox.currentText()) bible = self.advancedVersionComboBox.currentText()
if bible: if bible:
if QtGui.QMessageBox.question(self, UiStrings().ConfirmDelete, if QtGui.QMessageBox.question(self, UiStrings().ConfirmDelete,
unicode(translate('BiblesPlugin.MediaItem', translate('BiblesPlugin.MediaItem',
'Are you sure you want to delete "%s"?')) % bible, 'Are you sure you want to delete "%s"?') % bible,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No), QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No: QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
@ -609,31 +609,30 @@ class BibleMediaItem(MediaManagerItem):
def onAdvancedVersionComboBox(self): def onAdvancedVersionComboBox(self):
Settings().setValue(self.settingsSection + u'/advanced bible', Settings().setValue(self.settingsSection + u'/advanced bible',
self.advancedVersionComboBox.currentText()) self.advancedVersionComboBox.currentText())
self.initialiseAdvancedBible( self.initialiseAdvancedBible(self.advancedVersionComboBox.currentText(),
unicode(self.advancedVersionComboBox.currentText()),
self.advancedBookComboBox.itemData( self.advancedBookComboBox.itemData(
int(self.advancedBookComboBox.currentIndex()))) int(self.advancedBookComboBox.currentIndex())))
def onAdvancedSecondComboBox(self): def onAdvancedSecondComboBox(self):
self.initialiseAdvancedBible( self.initialiseAdvancedBible(
unicode(self.advancedVersionComboBox.currentText()), self.advancedVersionComboBox.currentText(),
self.advancedBookComboBox.itemData( self.advancedBookComboBox.itemData(
int(self.advancedBookComboBox.currentIndex()))) int(self.advancedBookComboBox.currentIndex())))
def onAdvancedBookComboBox(self): def onAdvancedBookComboBox(self):
item = int(self.advancedBookComboBox.currentIndex()) item = int(self.advancedBookComboBox.currentIndex())
self.initialiseChapterVerse( self.initialiseChapterVerse(
unicode(self.advancedVersionComboBox.currentText()), self.advancedVersionComboBox.currentText(),
unicode(self.advancedBookComboBox.currentText()), self.advancedBookComboBox.currentText(),
unicode(self.advancedBookComboBox.itemData(item).toString())) self.advancedBookComboBox.itemData(item).toString())
def onAdvancedFromVerse(self): def onAdvancedFromVerse(self):
chapter_from = int(self.advancedFromChapter.currentText()) chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.advancedToChapter.currentText()) chapter_to = int(self.advancedToChapter.currentText())
if chapter_from == chapter_to: if chapter_from == chapter_to:
bible = unicode(self.advancedVersionComboBox.currentText()) bible = self.advancedVersionComboBox.currentText()
book_ref_id = unicode(self.advancedBookComboBox.itemData( book_ref_id = self.advancedBookComboBox.itemData(
int(self.advancedBookComboBox.currentIndex())).toString()) int(self.advancedBookComboBox.currentIndex())).toString()
verse_from = int(self.advancedFromVerse.currentText()) verse_from = int(self.advancedFromVerse.currentText())
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id( verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(
bible, book_ref_id, chapter_to) bible, book_ref_id, chapter_to)
@ -641,9 +640,9 @@ class BibleMediaItem(MediaManagerItem):
self.advancedToVerse, True) self.advancedToVerse, True)
def onAdvancedToChapter(self): def onAdvancedToChapter(self):
bible = unicode(self.advancedVersionComboBox.currentText()) bible = self.advancedVersionComboBox.currentText()
book_ref_id = unicode(self.advancedBookComboBox.itemData( book_ref_id = self.advancedBookComboBox.itemData(
int(self.advancedBookComboBox.currentIndex())).toString()) int(self.advancedBookComboBox.currentIndex())).toString()
chapter_from = int(self.advancedFromChapter.currentText()) chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.advancedToChapter.currentText()) chapter_to = int(self.advancedToChapter.currentText())
verse_from = int(self.advancedFromVerse.currentText()) verse_from = int(self.advancedFromVerse.currentText())
@ -656,9 +655,9 @@ class BibleMediaItem(MediaManagerItem):
self.adjustComboBox(1, verse_count, self.advancedToVerse) self.adjustComboBox(1, verse_count, self.advancedToVerse)
def onAdvancedFromChapter(self): def onAdvancedFromChapter(self):
bible = unicode(self.advancedVersionComboBox.currentText()) bible = self.advancedVersionComboBox.currentText()
book_ref_id = unicode(self.advancedBookComboBox.itemData( book_ref_id = self.advancedBookComboBox.itemData(
int(self.advancedBookComboBox.currentIndex())).toString()) int(self.advancedBookComboBox.currentIndex())).toString()
chapter_from = int(self.advancedFromChapter.currentText()) chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.advancedToChapter.currentText()) chapter_to = int(self.advancedToChapter.currentText())
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible, verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible,
@ -695,7 +694,7 @@ class BibleMediaItem(MediaManagerItem):
""" """
log.debug(u'adjustComboBox %s, %s, %s', combo, range_from, range_to) log.debug(u'adjustComboBox %s, %s, %s', combo, range_from, range_to)
if restore: if restore:
old_text = unicode(combo.currentText()) old_text = combo.currentText()
combo.clear() combo.clear()
combo.addItems(map(unicode, range(range_from, range_to + 1))) combo.addItems(map(unicode, range(range_from, range_to + 1)))
if restore and combo.findText(old_text) != -1: if restore and combo.findText(old_text) != -1:
@ -708,11 +707,11 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'Advanced Search Button clicked') log.debug(u'Advanced Search Button clicked')
self.advancedSearchButton.setEnabled(False) self.advancedSearchButton.setEnabled(False)
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
bible = unicode(self.advancedVersionComboBox.currentText()) bible = self.advancedVersionComboBox.currentText()
second_bible = unicode(self.advancedSecondComboBox.currentText()) second_bible = self.advancedSecondComboBox.currentText()
book = unicode(self.advancedBookComboBox.currentText()) book = self.advancedBookComboBox.currentText()
book_ref_id = unicode(self.advancedBookComboBox.itemData( book_ref_id = self.advancedBookComboBox.itemData(
int(self.advancedBookComboBox.currentIndex())).toString()) int(self.advancedBookComboBox.currentIndex())).toString()
chapter_from = self.advancedFromChapter.currentText() chapter_from = self.advancedFromChapter.currentText()
chapter_to = self.advancedToChapter.currentText() chapter_to = self.advancedToChapter.currentText()
verse_from = self.advancedFromVerse.currentText() verse_from = self.advancedFromVerse.currentText()
@ -747,9 +746,9 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'Quick Search Button clicked') log.debug(u'Quick Search Button clicked')
self.quickSearchButton.setEnabled(False) self.quickSearchButton.setEnabled(False)
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
bible = unicode(self.quickVersionComboBox.currentText()) bible = self.quickVersionComboBox.currentText()
second_bible = unicode(self.quickSecondComboBox.currentText()) second_bible = self.quickSecondComboBox.currentText()
text = unicode(self.quickSearchEdit.text()) text = self.quickSearchEdit.text()
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference: if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
# We are doing a 'Reference Search'. # We are doing a 'Reference Search'.
self.search_results = self.plugin.manager.get_verses(bible, text) self.search_results = self.plugin.manager.get_verses(bible, text)
@ -784,11 +783,11 @@ class BibleMediaItem(MediaManagerItem):
if passage_not_found: if passage_not_found:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('BiblesPlugin.MediaItem', 'Information'), translate('BiblesPlugin.MediaItem', 'Information'),
unicode(translate('BiblesPlugin.MediaItem', translate('BiblesPlugin.MediaItem',
'The second Bible does not contain all the verses ' 'The second Bible does not contain all the verses '
'that are in the main Bible. Only verses found in both ' 'that are in the main Bible. Only verses found in both '
'Bibles will be shown. %d verses have not been ' 'Bibles will be shown. %d verses have not been '
'included in the results.')) % count, 'included in the results.') % count,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.search_results = new_search_results self.search_results = new_search_results
self.second_search_results = \ self.second_search_results = \
@ -1083,7 +1082,7 @@ class BibleMediaItem(MediaManagerItem):
""" """
Search for some Bible verses (by reference). Search for some Bible verses (by reference).
""" """
bible = unicode(self.quickVersionComboBox.currentText()) bible = self.quickVersionComboBox.currentText()
search_results = self.plugin.manager.get_verses(bible, string, False, search_results = self.plugin.manager.get_verses(bible, string, False,
showError) showError)
if search_results: if search_results:
@ -1093,7 +1092,7 @@ class BibleMediaItem(MediaManagerItem):
def createItemFromId(self, item_id): def createItemFromId(self, item_id):
item = QtGui.QListWidgetItem() item = QtGui.QListWidgetItem()
bible = unicode(self.quickVersionComboBox.currentText()) bible = self.quickVersionComboBox.currentText()
search_results = self.plugin.manager.get_verses(bible, item_id, False) search_results = self.plugin.manager.get_verses(bible, item_id, False)
items = self.buildDisplayResults(bible, u'', search_results) items = self.buildDisplayResults(bible, u'', search_results)
return items return items

View File

@ -90,9 +90,9 @@ class OpenSongBible(BibleDB):
int(chapter.attrib[u'n'].split()[-1]), int(chapter.attrib[u'n'].split()[-1]),
int(verse.attrib[u'n']), int(verse.attrib[u'n']),
unicode(verse.text)) unicode(verse.text))
self.wizard.incrementProgressBar(unicode(translate( self.wizard.incrementProgressBar(translate(
'BiblesPlugin.Opensong', 'Importing %s %s...', 'BiblesPlugin.Opensong', 'Importing %s %s...',
'Importing <book name> <chapter>...')) % 'Importing <book name> <chapter>...') %
(db_book.name, int(chapter.attrib[u'n'].split()[-1]))) (db_book.name, int(chapter.attrib[u'n'].split()[-1])))
self.session.commit() self.session.commit()
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')

View File

@ -101,7 +101,7 @@ class OSISBible(BibleDB):
osis = codecs.open(self.filename, u'r', details['encoding']) osis = codecs.open(self.filename, u'r', details['encoding'])
repl = replacement repl = replacement
language_id = False language_id = False
# Decide if the bible propably contains only NT or AT and NT or # Decide if the bible propably contains only NT or AT and NT or
# AT, NT and Apocrypha # AT, NT and Apocrypha
if lines_in_file < 11500: if lines_in_file < 11500:
book_count = 27 book_count = 27
@ -157,9 +157,9 @@ class OSISBible(BibleDB):
if last_chapter != chapter: if last_chapter != chapter:
if last_chapter != 0: if last_chapter != 0:
self.session.commit() self.session.commit()
self.wizard.incrementProgressBar(unicode(translate( self.wizard.incrementProgressBar(translate(
'BiblesPlugin.OsisImport', 'Importing %s %s...', 'BiblesPlugin.OsisImport', 'Importing %s %s...',
'Importing <book name> <chapter>...')) % 'Importing <book name> <chapter>...') %
(book_details[u'name'], chapter)) (book_details[u'name'], chapter))
last_chapter = chapter last_chapter = chapter
# All of this rigmarol below is because the mod2osis # All of this rigmarol below is because the mod2osis

View File

@ -129,12 +129,12 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
count = 1 count = 1
for i in range(self.slideListView.count()): for i in range(self.slideListView.count()):
sxml.add_verse_to_lyrics(u'custom', unicode(count), sxml.add_verse_to_lyrics(u'custom', unicode(count),
unicode(self.slideListView.item(i).text())) self.slideListView.item(i).text())
count += 1 count += 1
self.customSlide.title = unicode(self.titleEdit.text()) self.customSlide.title = self.titleEdit.text()
self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8') self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8')
self.customSlide.credits = unicode(self.creditEdit.text()) self.customSlide.credits = self.creditEdit.text()
self.customSlide.theme_name = unicode(self.themeComboBox.currentText()) self.customSlide.theme_name = self.themeComboBox.currentText()
success = self.manager.save_object(self.customSlide) success = self.manager.save_object(self.customSlide)
self.mediaitem.autoSelectId = self.customSlide.id self.mediaitem.autoSelectId = self.customSlide.id
return success return success

View File

@ -229,7 +229,7 @@ class CustomMediaItem(MediaManagerItem):
Settings().setValue(u'%s/last search type' % Settings().setValue(u'%s/last search type' %
self.settingsSection, self.searchTextEdit.currentSearchType()) self.settingsSection, self.searchTextEdit.currentSearchType())
# Reload the list considering the new search type. # Reload the list considering the new search type.
search_keywords = unicode(self.searchTextEdit.displayText()) search_keywords = self.searchTextEdit.displayText()
search_results = [] search_results = []
search_type = self.searchTextEdit.currentSearchType() search_type = self.searchTextEdit.currentSearchType()
if search_type == CustomSearch.Titles: if search_type == CustomSearch.Titles:

View File

@ -110,8 +110,7 @@ class ImageMediaItem(MediaManagerItem):
for row in row_list: for row in row_list:
text = self.listView.item(row) text = self.listView.item(row)
if text: if text:
delete_file(os.path.join(self.servicePath, delete_file(os.path.join(self.servicePath, text.text()))
unicode(text.text())))
self.listView.takeItem(row) self.listView.takeItem(row)
self.plugin.formParent.incrementProgressBar() self.plugin.formParent.incrementProgressBar()
SettingsManager.set_list(self.settingsSection, SettingsManager.set_list(self.settingsSection,
@ -169,7 +168,7 @@ class ImageMediaItem(MediaManagerItem):
missing_items = [] missing_items = []
missing_items_filenames = [] missing_items_filenames = []
for bitem in items: for bitem in items:
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) filename = bitem.data(QtCore.Qt.UserRole).toString()
if not os.path.exists(filename): if not os.path.exists(filename):
missing_items.append(bitem) missing_items.append(bitem)
missing_items_filenames.append(filename) missing_items_filenames.append(filename)
@ -180,22 +179,22 @@ class ImageMediaItem(MediaManagerItem):
if not remote: if not remote:
critical_error_message_box( critical_error_message_box(
translate('ImagePlugin.MediaItem', 'Missing Image(s)'), translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
unicode(translate('ImagePlugin.MediaItem', translate('ImagePlugin.MediaItem',
'The following image(s) no longer exist: %s')) % 'The following image(s) no longer exist: %s') %
u'\n'.join(missing_items_filenames)) u'\n'.join(missing_items_filenames))
return False return False
# We have missing as well as existing images. We ask what to do. # We have missing as well as existing images. We ask what to do.
elif missing_items and QtGui.QMessageBox.question(self, elif missing_items and QtGui.QMessageBox.question(self,
translate('ImagePlugin.MediaItem', 'Missing Image(s)'), translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
unicode(translate('ImagePlugin.MediaItem', 'The following ' translate('ImagePlugin.MediaItem', 'The following '
'image(s) no longer exist: %s\nDo you want to add the other ' 'image(s) no longer exist: %s\nDo you want to add the other '
'images anyway?')) % u'\n'.join(missing_items_filenames), 'images anyway?') % u'\n'.join(missing_items_filenames),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
return False return False
# Continue with the existing images. # Continue with the existing images.
for bitem in items: for bitem in items:
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) filename = bitem.data(QtCore.Qt.UserRole).toString()
name = os.path.split(filename)[1] name = os.path.split(filename)[1]
service_item.add_from_image(filename, name, background) service_item.add_from_image(filename, name, background)
return True return True
@ -224,7 +223,7 @@ class ImageMediaItem(MediaManagerItem):
self.settingsSection + u'/background color', u'#000000')) self.settingsSection + u'/background color', u'#000000'))
item = self.listView.selectedIndexes()[0] item = self.listView.selectedIndexes()[0]
bitem = self.listView.item(item.row()) bitem = self.listView.item(item.row())
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) filename = bitem.data(QtCore.Qt.UserRole).toString()
if os.path.exists(filename): if os.path.exists(filename):
name = os.path.split(filename)[1] name = os.path.split(filename)[1]
if self.plugin.liveController.display.directImage(name, if self.plugin.liveController.display.directImage(name,
@ -236,9 +235,9 @@ class ImageMediaItem(MediaManagerItem):
'There was no display item to amend.')) 'There was no display item to amend.'))
else: else:
critical_error_message_box(UiStrings().LiveBGError, critical_error_message_box(UiStrings().LiveBGError,
unicode(translate('ImagePlugin.MediaItem', translate('ImagePlugin.MediaItem',
'There was a problem replacing your background, ' 'There was a problem replacing your background, '
'the image file "%s" no longer exists.')) % filename) 'the image file "%s" no longer exists.') % filename)
def search(self, string, showError): def search(self, string, showError):
files = SettingsManager.load_list(self.settingsSection, u'images') files = SettingsManager.load_list(self.settingsSection, u'images')

View File

@ -94,16 +94,15 @@ class MediaMediaItem(MediaManagerItem):
def retranslateUi(self): def retranslateUi(self):
self.onNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media') self.onNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem', self.onNewFileMasks = translate('MediaPlugin.MediaItem',
'Videos (%s);;Audio (%s);;%s (*)')) % ( 'Videos (%s);;Audio (%s);;%s (*)') % (
u' '.join(self.plugin.video_extensions_list), u' '.join(self.plugin.video_extensions_list),
u' '.join(self.plugin.audio_extensions_list), UiStrings().AllFiles) u' '.join(self.plugin.audio_extensions_list), UiStrings().AllFiles)
self.replaceAction.setText(UiStrings().ReplaceBG) self.replaceAction.setText(UiStrings().ReplaceBG)
self.replaceAction.setToolTip(UiStrings().ReplaceLiveBG) self.replaceAction.setToolTip(UiStrings().ReplaceLiveBG)
self.resetAction.setText(UiStrings().ResetBG) self.resetAction.setText(UiStrings().ResetBG)
self.resetAction.setToolTip(UiStrings().ResetLiveBG) self.resetAction.setToolTip(UiStrings().ResetLiveBG)
self.automatic = translate('MediaPlugin.MediaItem', self.automatic = translate('MediaPlugin.MediaItem', 'Automatic')
'Automatic')
self.displayTypeLabel.setText( self.displayTypeLabel.setText(
translate('MediaPlugin.MediaItem', 'Use Player:')) translate('MediaPlugin.MediaItem', 'Use Player:'))
@ -171,7 +170,7 @@ class MediaMediaItem(MediaManagerItem):
translate('MediaPlugin.MediaItem', translate('MediaPlugin.MediaItem',
'You must select a media file to replace the background with.')): 'You must select a media file to replace the background with.')):
item = self.listView.currentItem() item = self.listView.currentItem()
filename = unicode(item.data(QtCore.Qt.UserRole).toString()) filename = item.data(QtCore.Qt.UserRole).toString()
if os.path.exists(filename): if os.path.exists(filename):
if self.plugin.liveController.mediaController.video( \ if self.plugin.liveController.mediaController.video( \
self.plugin.liveController, filename, True, True): self.plugin.liveController, filename, True, True):
@ -182,9 +181,9 @@ class MediaMediaItem(MediaManagerItem):
'There was no display item to amend.')) 'There was no display item to amend.'))
else: else:
critical_error_message_box(UiStrings().LiveBGError, critical_error_message_box(UiStrings().LiveBGError,
unicode(translate('MediaPlugin.MediaItem', translate('MediaPlugin.MediaItem',
'There was a problem replacing your background, ' 'There was a problem replacing your background, '
'the media file "%s" no longer exists.')) % filename) 'the media file "%s" no longer exists.') % filename)
def generateSlideData(self, service_item, item=None, xmlVersion=False, def generateSlideData(self, service_item, item=None, xmlVersion=False,
remote=False): remote=False):
@ -192,14 +191,14 @@ class MediaMediaItem(MediaManagerItem):
item = self.listView.currentItem() item = self.listView.currentItem()
if item is None: if item is None:
return False return False
filename = unicode(item.data(QtCore.Qt.UserRole).toString()) filename = item.data(QtCore.Qt.UserRole).toString()
if not os.path.exists(filename): if not os.path.exists(filename):
if not remote: if not remote:
# File is no longer present # File is no longer present
critical_error_message_box( critical_error_message_box(
translate('MediaPlugin.MediaItem', 'Missing Media File'), translate('MediaPlugin.MediaItem', 'Missing Media File'),
unicode(translate('MediaPlugin.MediaItem', translate('MediaPlugin.MediaItem',
'The file %s no longer exists.')) % filename) 'The file %s no longer exists.') % filename)
return False return False
self.mediaLength = 0 self.mediaLength = 0
if self.plugin.mediaController.video( \ if self.plugin.mediaController.video( \
@ -234,8 +233,8 @@ class MediaMediaItem(MediaManagerItem):
the settings the settings
""" """
self.populateDisplayTypes() self.populateDisplayTypes()
self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem', self.onNewFileMasks = translate('MediaPlugin.MediaItem',
'Videos (%s);;Audio (%s);;%s (*)')) % ( 'Videos (%s);;Audio (%s);;%s (*)') % (
u' '.join(self.plugin.video_extensions_list), u' '.join(self.plugin.video_extensions_list),
u' '.join(self.plugin.audio_extensions_list), UiStrings().AllFiles) u' '.join(self.plugin.audio_extensions_list), UiStrings().AllFiles)

View File

@ -122,9 +122,8 @@ class MediaTab(SettingsTab):
if player.available: if player.available:
checkbox.setText(player.display_name) checkbox.setText(player.display_name)
else: else:
checkbox.setText( checkbox.setText(translate('MediaPlugin.MediaTab',
unicode(translate('MediaPlugin.MediaTab', '%s (unavailable)') % player.display_name)
'%s (unavailable)')) % player.display_name)
self.playerOrderGroupBox.setTitle( self.playerOrderGroupBox.setTitle(
translate('MediaPlugin.MediaTab', 'Player Order')) translate('MediaPlugin.MediaTab', 'Player Order'))
self.advancedGroupBox.setTitle(UiStrings().Advanced) self.advancedGroupBox.setTitle(UiStrings().Advanced)

View File

@ -87,8 +87,8 @@ class PresentationMediaItem(MediaManagerItem):
if fileType.find(type) == -1: if fileType.find(type) == -1:
fileType += u'*.%s ' % type fileType += u'*.%s ' % type
self.plugin.serviceManager.supportedSuffixes(type) self.plugin.serviceManager.supportedSuffixes(type)
self.onNewFileMasks = unicode(translate('PresentationPlugin.MediaItem', self.onNewFileMasks = translate('PresentationPlugin.MediaItem',
'Presentations (%s)')) % fileType 'Presentations (%s)') % fileType
def requiredIcons(self): def requiredIcons(self):
""" """
@ -258,15 +258,15 @@ class PresentationMediaItem(MediaManagerItem):
items = self.listView.selectedItems() items = self.listView.selectedItems()
if len(items) > 1: if len(items) > 1:
return False return False
service_item.title = unicode(self.displayTypeComboBox.currentText()) service_item.title = self.displayTypeComboBox.currentText()
service_item.shortname = unicode(self.displayTypeComboBox.currentText()) service_item.shortname = self.displayTypeComboBox.currentText()
service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay) service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay) service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay)
shortname = service_item.shortname shortname = service_item.shortname
if not shortname: if not shortname:
return False return False
for bitem in items: for bitem in items:
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) filename = bitem.data(QtCore.Qt.UserRole).toString()
if os.path.exists(filename): if os.path.exists(filename):
if shortname == self.Automatic: if shortname == self.Automatic:
service_item.shortname = self.findControllerByType(filename) service_item.shortname = self.findControllerByType(filename)
@ -292,10 +292,9 @@ class PresentationMediaItem(MediaManagerItem):
critical_error_message_box( critical_error_message_box(
translate('PresentationPlugin.MediaItem', translate('PresentationPlugin.MediaItem',
'Missing Presentation'), 'Missing Presentation'),
unicode(translate( translate('PresentationPlugin.MediaItem',
'PresentationPlugin.MediaItem',
'The presentation %s is incomplete,' 'The presentation %s is incomplete,'
' please reload.')) % filename) ' please reload.') % filename)
return False return False
else: else:
# File is no longer present # File is no longer present
@ -303,8 +302,8 @@ class PresentationMediaItem(MediaManagerItem):
critical_error_message_box( critical_error_message_box(
translate('PresentationPlugin.MediaItem', translate('PresentationPlugin.MediaItem',
'Missing Presentation'), 'Missing Presentation'),
unicode(translate('PresentationPlugin.MediaItem', translate('PresentationPlugin.MediaItem',
'The presentation %s no longer exists.')) % filename) 'The presentation %s no longer exists.') % filename)
return False return False
def findControllerByType(self, filename): def findControllerByType(self, filename):

View File

@ -92,8 +92,8 @@ class PresentationTab(SettingsTab):
checkbox.setText(controller.name) checkbox.setText(controller.name)
else: else:
checkbox.setText( checkbox.setText(
unicode(translate('PresentationPlugin.PresentationTab', translate('PresentationPlugin.PresentationTab',
'%s (unavailable)')) % controller.name) '%s (unavailable)') % controller.name)
def load(self): def load(self):
""" """

View File

@ -336,7 +336,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
row_label = [] row_label = []
for row in range(self.verseListWidget.rowCount()): for row in range(self.verseListWidget.rowCount()):
item = self.verseListWidget.item(row, 0) item = self.verseListWidget.item(row, 0)
verse_def = unicode(item.data(QtCore.Qt.UserRole).toString()) verse_def = item.data(QtCore.Qt.UserRole).toString()
verse_tag = VerseType.translated_tag(verse_def[0]) verse_tag = VerseType.translated_tag(verse_def[0])
row_def = u'%s%s' % (verse_tag, verse_def[1:]) row_def = u'%s%s' % (verse_tag, verse_def[1:])
row_label.append(row_def) row_label.append(row_def)
@ -346,7 +346,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def onAuthorAddButtonClicked(self): def onAuthorAddButtonClicked(self):
item = int(self.authorsComboBox.currentIndex()) item = int(self.authorsComboBox.currentIndex())
text = unicode(self.authorsComboBox.currentText()).strip(u' \r\n\t') text = self.authorsComboBox.currentText().strip(u' \r\n\t')
# This if statement is for OS X, which doesn't seem to work well with # This if statement is for OS X, which doesn't seem to work well with
# the QCompleter autocompletion class. See bug #812628. # the QCompleter autocompletion class. See bug #812628.
if text in self.authors: if text in self.authors:
@ -409,7 +409,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def onTopicAddButtonClicked(self): def onTopicAddButtonClicked(self):
item = int(self.topicsComboBox.currentIndex()) item = int(self.topicsComboBox.currentIndex())
text = unicode(self.topicsComboBox.currentText()) text = 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'), translate('SongsPlugin.EditSongForm', 'Add Topic'),
@ -479,7 +479,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
item = self.verseListWidget.currentItem() item = self.verseListWidget.currentItem()
if item: if item:
tempText = item.text() tempText = item.text()
verseId = unicode(item.data(QtCore.Qt.UserRole).toString()) verseId = item.data(QtCore.Qt.UserRole).toString()
self.verseForm.setVerse(tempText, True, verseId) self.verseForm.setVerse(tempText, True, verseId)
if self.verseForm.exec_(): if self.verseForm.exec_():
after_text, verse_tag, verse_num = self.verseForm.getVerse() after_text, verse_tag, verse_num = self.verseForm.getVerse()
@ -509,7 +509,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if self.verseListWidget.rowCount() > 0: if self.verseListWidget.rowCount() > 0:
for row in range(self.verseListWidget.rowCount()): for row in range(self.verseListWidget.rowCount()):
item = self.verseListWidget.item(row, 0) item = self.verseListWidget.item(row, 0)
field = unicode(item.data(QtCore.Qt.UserRole).toString()) field = item.data(QtCore.Qt.UserRole).toString()
verse_tag = VerseType.translated_name(field[0]) verse_tag = VerseType.translated_name(field[0])
verse_num = field[1:] verse_num = field[1:]
verse_list += u'---[%s:%s]---\n' % (verse_tag, verse_num) verse_list += u'---[%s:%s]---\n' % (verse_tag, verse_num)
@ -576,7 +576,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
order = self.__extractVerseOrder(text) order = self.__extractVerseOrder(text)
for index in range(self.verseListWidget.rowCount()): for index in range(self.verseListWidget.rowCount()):
verse = self.verseListWidget.item(index, 0) verse = self.verseListWidget.item(index, 0)
verse = unicode(verse.data(QtCore.Qt.UserRole).toString()) verse = verse.data(QtCore.Qt.UserRole).toString()
if verse not in verse_names: if verse not in verse_names:
verses.append(verse) verses.append(verse)
verse_names.append(u'%s%s' % ( verse_names.append(u'%s%s' % (
@ -617,7 +617,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
order = self.__extractVerseOrder(verse_order) order = self.__extractVerseOrder(verse_order)
for index in range(verse_count): for index in range(verse_count):
verse = self.verseListWidget.item(index, 0) verse = self.verseListWidget.item(index, 0)
verse = unicode(verse.data(QtCore.Qt.UserRole).toString()) verse = verse.data(QtCore.Qt.UserRole).toString()
if verse not in verse_names: if verse not in verse_names:
verses.append(verse) verses.append(verse)
verse_names.append(u'%s%s' % ( verse_names.append(u'%s%s' % (
@ -628,15 +628,15 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if invalid_verses: if invalid_verses:
valid = create_separated_list(verse_names) valid = create_separated_list(verse_names)
if len(invalid_verses) > 1: if len(invalid_verses) > 1:
critical_error_message_box(message=unicode(translate( critical_error_message_box(message=translate(
'SongsPlugin.EditSongForm', 'The verse order is invalid. ' 'SongsPlugin.EditSongForm', 'The verse order is invalid. '
'There are no verses corresponding to %s. Valid entries ' 'There are no verses corresponding to %s. Valid entries '
'are %s.')) % (u', '.join(invalid_verses), valid)) 'are %s.') % (u', '.join(invalid_verses), valid))
else: else:
critical_error_message_box(message=unicode(translate( critical_error_message_box(message=translate(
'SongsPlugin.EditSongForm', 'The verse order is invalid. ' 'SongsPlugin.EditSongForm', 'The verse order is invalid. '
'There is no verse corresponding to %s. Valid entries ' 'There is no verse corresponding to %s. Valid entries '
'are %s.')) % (invalid_verses[0], valid)) 'are %s.') % (invalid_verses[0], valid))
return len(invalid_verses) == 0 return len(invalid_verses) == 0
def __validateSong(self): def __validateSong(self):
@ -673,7 +673,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.verseListWidget.rowCount()) self.verseListWidget.rowCount())
if not result: if not result:
return False return False
text = unicode(self.songBookComboBox.currentText()) text = 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'), translate('SongsPlugin.EditSongForm', 'Add Book'),
@ -699,7 +699,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def onMaintenanceButtonClicked(self): def onMaintenanceButtonClicked(self):
temp_song_book = None temp_song_book = None
item = int(self.songBookComboBox.currentIndex()) item = int(self.songBookComboBox.currentIndex())
text = unicode(self.songBookComboBox.currentText()) text = self.songBookComboBox.currentText()
if item == 0 and text: if item == 0 and text:
temp_song_book = text temp_song_book = text
self.mediaitem.songMaintenanceForm.exec_() self.mediaitem.songMaintenanceForm.exec_()
@ -718,7 +718,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
A button (QPushButton). A button (QPushButton).
""" """
log.debug(u'onPreview') log.debug(u'onPreview')
if unicode(button.objectName()) == u'previewButton': if button.objectName() == u'previewButton':
self.saveSong(True) self.saveSong(True)
Receiver.send_message(u'songs_preview') Receiver.send_message(u'songs_preview')
@ -826,30 +826,30 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
# Song() is in a partially complete state. # Song() is in a partially complete state.
if not self.song: if not self.song:
self.song = Song() self.song = Song()
self.song.title = unicode(self.titleEdit.text()) self.song.title = self.titleEdit.text()
self.song.alternate_title = unicode(self.alternativeEdit.text()) self.song.alternate_title = self.alternativeEdit.text()
self.song.copyright = unicode(self.copyrightEdit.text()) self.song.copyright = self.copyrightEdit.text()
# Values will be set when cleaning the song. # Values will be set when cleaning the song.
self.song.search_title = u'' self.song.search_title = u''
self.song.search_lyrics = u'' self.song.search_lyrics = u''
self.song.verse_order = u'' self.song.verse_order = u''
self.song.comments = unicode(self.commentsEdit.toPlainText()) self.song.comments = self.commentsEdit.toPlainText()
ordertext = unicode(self.verseOrderEdit.text()) ordertext = self.verseOrderEdit.text()
order = [] order = []
for item in ordertext.split(): for item in ordertext.split():
verse_tag = VerseType.Tags[VerseType.from_translated_tag(item[0])] verse_tag = VerseType.Tags[VerseType.from_translated_tag(item[0])]
verse_num = item[1:].lower() verse_num = item[1:].lower()
order.append(u'%s%s' % (verse_tag, verse_num)) order.append(u'%s%s' % (verse_tag, verse_num))
self.song.verse_order = u' '.join(order) self.song.verse_order = u' '.join(order)
self.song.ccli_number = unicode(self.CCLNumberEdit.text()) self.song.ccli_number = self.CCLNumberEdit.text()
self.song.song_number = unicode(self.songBookNumberEdit.text()) self.song.song_number = self.songBookNumberEdit.text()
book_name = unicode(self.songBookComboBox.currentText()) book_name = self.songBookComboBox.currentText()
if book_name: if book_name:
self.song.book = self.manager.get_object_filtered(Book, self.song.book = self.manager.get_object_filtered(Book,
Book.name == book_name) Book.name == book_name)
else: else:
self.song.book = None self.song.book = None
theme_name = unicode(self.themeComboBox.currentText()) theme_name = self.themeComboBox.currentText()
if theme_name: if theme_name:
self.song.theme_name = theme_name self.song.theme_name = theme_name
else: else:
@ -879,7 +879,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
files = [] files = []
for row in xrange(self.audioListWidget.count()): for row in xrange(self.audioListWidget.count()):
item = self.audioListWidget.item(row) item = self.audioListWidget.item(row)
filename = unicode(item.data(QtCore.Qt.UserRole).toString()) filename = item.data(QtCore.Qt.UserRole).toString()
if not filename.startswith(save_path): if not filename.startswith(save_path):
oldfile, filename = filename, os.path.join(save_path, oldfile, filename = filename, os.path.join(save_path,
os.path.split(filename)[1]) os.path.split(filename)[1])
@ -916,11 +916,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
multiple = [] multiple = []
for i in range(self.verseListWidget.rowCount()): for i in range(self.verseListWidget.rowCount()):
item = self.verseListWidget.item(i, 0) item = self.verseListWidget.item(i, 0)
verseId = unicode(item.data(QtCore.Qt.UserRole).toString()) verseId = item.data(QtCore.Qt.UserRole).toString()
verse_tag = verseId[0] verse_tag = verseId[0]
verse_num = verseId[1:] verse_num = verseId[1:]
sxml.add_verse_to_lyrics(verse_tag, verse_num, sxml.add_verse_to_lyrics(verse_tag, verse_num, item.text())
unicode(item.text()))
if verse_num > u'1' and verse_tag not in multiple: if verse_num > u'1' and verse_tag not in multiple:
multiple.append(verse_tag) multiple.append(verse_tag)
self.song.lyrics = unicode(sxml.extract_xml(), u'utf-8') self.song.lyrics = unicode(sxml.extract_xml(), u'utf-8')

View File

@ -96,7 +96,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
and the cursor's position. and the cursor's position.
""" """
position = self.verseTextEdit.textCursor().position() position = self.verseTextEdit.textCursor().position()
text = unicode(self.verseTextEdit.toPlainText()) text = self.verseTextEdit.toPlainText()
verse_name = VerseType.TranslatedNames[ verse_name = VerseType.TranslatedNames[
self.verseTypeComboBox.currentIndex()] self.verseTypeComboBox.currentIndex()]
if not text: if not text:
@ -126,7 +126,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
position and adjusts the ComboBox and SpinBox to these values. position and adjusts the ComboBox and SpinBox to these values.
""" """
position = self.verseTextEdit.textCursor().position() position = self.verseTextEdit.textCursor().position()
text = unicode(self.verseTextEdit.toPlainText()) text = self.verseTextEdit.toPlainText()
if not text: if not text:
return return
if text.rfind(u'[', 0, position) > text.rfind(u']', 0, position) and \ if text.rfind(u'[', 0, position) > text.rfind(u']', 0, position) and \

View File

@ -52,6 +52,6 @@ class MediaFilesForm(QtGui.QDialog, Ui_MediaFilesDialog):
self.fileListWidget.addItem(item) self.fileListWidget.addItem(item)
def getSelectedFiles(self): def getSelectedFiles(self):
return map(lambda x: unicode(x.data(QtCore.Qt.UserRole).toString()), return map(lambda item: item.data(QtCore.Qt.UserRole).toString(),
self.fileListWidget.selectedItems()) self.fileListWidget.selectedItems())

View File

@ -286,8 +286,7 @@ class SongExportForm(OpenLPWizard):
song.data(QtCore.Qt.UserRole).toPyObject() song.data(QtCore.Qt.UserRole).toPyObject()
for song in self._findListWidgetItems(self.selectedListWidget) for song in self._findListWidgetItems(self.selectedListWidget)
] ]
exporter = OpenLyricsExport( exporter = OpenLyricsExport(self, songs, self.directoryLineEdit.text())
self, songs, unicode(self.directoryLineEdit.text()))
if exporter.do_export(): if exporter.do_export():
self.progressLabel.setText( self.progressLabel.setText(
translate('SongsPlugin.SongExportForm', 'Finished export. To ' translate('SongsPlugin.SongExportForm', 'Finished export. To '
@ -309,9 +308,8 @@ class SongExportForm(OpenLPWizard):
``text`` ``text``
The text to search for. (unicode string) The text to search for. (unicode string)
""" """
#TODO: check if unicode() can be removed. return [
return [item for item in listWidget.findItems( item for item in listWidget.findItems(text, QtCore.Qt.MatchContains)
unicode(text), QtCore.Qt.MatchContains)
] ]
def onItemActivated(self, item): def onItemActivated(self, item):
@ -333,13 +331,11 @@ class SongExportForm(OpenLPWizard):
will be hidden, but not unchecked! will be hidden, but not unchecked!
``text`` ``text``
The text of the *searchLineEdit*. (QString) The text of the *searchLineEdit*.
""" """
#TODO: check if unicode() can be removed.
print type(text)
search_result = [ search_result = [
song for song in self._findListWidgetItems( song for song in self._findListWidgetItems(
self.availableListWidget, unicode(text)) self.availableListWidget, text)
] ]
for item in self._findListWidgetItems(self.availableListWidget): for item in self._findListWidgetItems(self.availableListWidget):
item.setHidden(item not in search_result) item.setHidden(item not in search_result)
@ -367,11 +363,11 @@ class SongExportForm(OpenLPWizard):
Called when the *directoryButton* was clicked. Opens a dialog and writes Called when the *directoryButton* was clicked. Opens a dialog and writes
the path to *directoryLineEdit*. the path to *directoryLineEdit*.
""" """
path = unicode(QtGui.QFileDialog.getExistingDirectory(self, path = QtGui.QFileDialog.getExistingDirectory(self,
translate('SongsPlugin.ExportWizardForm', translate('SongsPlugin.ExportWizardForm',
'Select Destination Folder'), 'Select Destination Folder'),
SettingsManager.get_last_dir(self.plugin.settingsSection, 1), SettingsManager.get_last_dir(self.plugin.settingsSection, 1),
options=QtGui.QFileDialog.ShowDirsOnly)) options=QtGui.QFileDialog.ShowDirsOnly)
SettingsManager.set_last_dir(self.plugin.settingsSection, path, 1) SettingsManager.set_last_dir(self.plugin.settingsSection, path, 1)
self.directoryLineEdit.setText(path) self.directoryLineEdit.setText(path)

View File

@ -516,7 +516,7 @@ class SongImportForm(OpenLPWizard):
""" """
Return a list of file from the listbox Return a list of file from the listbox
""" """
return [unicode(listbox.item(i).text()) for i in range(listbox.count())] return [listbox.item(i).text() for i in range(listbox.count())]
def removeSelectedItems(self, listbox): def removeSelectedItems(self, listbox):
""" """
@ -786,12 +786,12 @@ class SongImportForm(OpenLPWizard):
if source_format == SongFormat.OpenLP2: if source_format == SongFormat.OpenLP2:
# Import an OpenLP 2.0 database # Import an OpenLP 2.0 database
importer = self.plugin.importSongs(SongFormat.OpenLP2, importer = self.plugin.importSongs(SongFormat.OpenLP2,
filename=unicode(self.openLP2FilenameEdit.text()) filename=self.openLP2FilenameEdit.text()
) )
elif source_format == SongFormat.OpenLP1: elif source_format == SongFormat.OpenLP1:
# Import an openlp.org database # Import an openlp.org database
importer = self.plugin.importSongs(SongFormat.OpenLP1, importer = self.plugin.importSongs(SongFormat.OpenLP1,
filename=unicode(self.openLP1FilenameEdit.text()), filename=self.openLP1FilenameEdit.text(),
plugin=self.plugin plugin=self.plugin
) )
elif source_format == SongFormat.OpenLyrics: elif source_format == SongFormat.OpenLyrics:
@ -841,12 +841,12 @@ class SongImportForm(OpenLPWizard):
elif source_format == SongFormat.EasySlides: elif source_format == SongFormat.EasySlides:
# Import an EasySlides export file # Import an EasySlides export file
importer = self.plugin.importSongs(SongFormat.EasySlides, importer = self.plugin.importSongs(SongFormat.EasySlides,
filename=unicode(self.easySlidesFilenameEdit.text()) filename=self.easySlidesFilenameEdit.text()
) )
elif source_format == SongFormat.EasyWorship: elif source_format == SongFormat.EasyWorship:
# Import an EasyWorship database # Import an EasyWorship database
importer = self.plugin.importSongs(SongFormat.EasyWorship, importer = self.plugin.importSongs(SongFormat.EasyWorship,
filename=unicode(self.ewFilenameEdit.text()) filename=self.ewFilenameEdit.text()
) )
elif source_format == SongFormat.SongBeamer: elif source_format == SongFormat.SongBeamer:
# Import SongBeamer songs # Import SongBeamer songs

View File

@ -208,9 +208,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform.setAutoDisplayName(True) self.authorform.setAutoDisplayName(True)
if self.authorform.exec_(): if self.authorform.exec_():
author = Author.populate( author = Author.populate(
first_name=unicode(self.authorform.firstNameEdit.text()), first_name=self.authorform.firstNameEdit.text(),
last_name=unicode(self.authorform.lastNameEdit.text()), last_name=self.authorform.lastNameEdit.text(),
display_name=unicode(self.authorform.displayEdit.text())) display_name=self.authorform.displayEdit.text())
if self.checkAuthor(author): if self.checkAuthor(author):
if self.manager.save_object(author): if self.manager.save_object(author):
self.resetAuthors() self.resetAuthors()
@ -225,7 +225,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onTopicAddButtonClicked(self): def onTopicAddButtonClicked(self):
if self.topicform.exec_(): if self.topicform.exec_():
topic = Topic.populate(name=unicode(self.topicform.nameEdit.text())) topic = Topic.populate(name=self.topicform.nameEdit.text())
if self.checkTopic(topic): if self.checkTopic(topic):
if self.manager.save_object(topic): if self.manager.save_object(topic):
self.resetTopics() self.resetTopics()
@ -240,8 +240,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onBookAddButtonClicked(self): def onBookAddButtonClicked(self):
if self.bookform.exec_(): if self.bookform.exec_():
book = Book.populate(name=unicode(self.bookform.nameEdit.text()), book = Book.populate(name=self.bookform.nameEdit.text(),
publisher=unicode(self.bookform.publisherEdit.text())) publisher=self.bookform.publisherEdit.text())
if self.checkBook(book): if self.checkBook(book):
if self.manager.save_object(book): if self.manager.save_object(book):
self.resetBooks() self.resetBooks()
@ -269,9 +269,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
temp_last_name = author.last_name temp_last_name = author.last_name
temp_display_name = author.display_name temp_display_name = author.display_name
if self.authorform.exec_(False): if self.authorform.exec_(False):
author.first_name = unicode(self.authorform.firstNameEdit.text()) author.first_name = self.authorform.firstNameEdit.text()
author.last_name = unicode(self.authorform.lastNameEdit.text()) author.last_name = self.authorform.lastNameEdit.text()
author.display_name = unicode(self.authorform.displayEdit.text()) author.display_name = self.authorform.displayEdit.text()
if self.checkAuthor(author, True): if self.checkAuthor(author, True):
if self.manager.save_object(author): if self.manager.save_object(author):
self.resetAuthors() self.resetAuthors()
@ -280,10 +280,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
critical_error_message_box( critical_error_message_box(
message=translate('SongsPlugin.SongMaintenanceForm', message=translate('SongsPlugin.SongMaintenanceForm',
'Could not save your changes.')) 'Could not save your changes.'))
elif critical_error_message_box(message=unicode(translate( elif critical_error_message_box(message=translate(
'SongsPlugin.SongMaintenanceForm', 'The author %s already ' 'SongsPlugin.SongMaintenanceForm', 'The author %s already '
'exists. Would you like to make songs with author %s use ' 'exists. Would you like to make songs with author %s use '
'the existing author %s?')) % (author.display_name, 'the existing author %s?') % (author.display_name,
temp_display_name, author.display_name), temp_display_name, author.display_name),
parent=self, question=True) == QtGui.QMessageBox.Yes: parent=self, question=True) == QtGui.QMessageBox.Yes:
self.__mergeObjects(author, self.mergeAuthors, self.__mergeObjects(author, self.mergeAuthors,
@ -308,7 +308,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
# Save the topic's name for the case that he has to be restored. # Save the topic's name for the case that he has to be restored.
temp_name = topic.name temp_name = topic.name
if self.topicform.exec_(False): if self.topicform.exec_(False):
topic.name = unicode(self.topicform.nameEdit.text()) topic.name = self.topicform.nameEdit.text()
if self.checkTopic(topic, True): if self.checkTopic(topic, True):
if self.manager.save_object(topic): if self.manager.save_object(topic):
self.resetTopics() self.resetTopics()
@ -317,9 +317,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
message=translate('SongsPlugin.SongMaintenanceForm', message=translate('SongsPlugin.SongMaintenanceForm',
'Could not save your changes.')) 'Could not save your changes.'))
elif critical_error_message_box( elif critical_error_message_box(
message=unicode(translate('SongsPlugin.SongMaintenanceForm', message=translate('SongsPlugin.SongMaintenanceForm',
'The topic %s already exists. Would you like to make songs ' 'The topic %s already exists. Would you like to make songs '
'with topic %s use the existing topic %s?')) % (topic.name, 'with topic %s use the existing topic %s?') % (topic.name,
temp_name, topic.name), temp_name, topic.name),
parent=self, question=True) == QtGui.QMessageBox.Yes: parent=self, question=True) == QtGui.QMessageBox.Yes:
self.__mergeObjects(topic, self.mergeTopics, self.resetTopics) self.__mergeObjects(topic, self.mergeTopics, self.resetTopics)
@ -345,8 +345,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
temp_name = book.name temp_name = book.name
temp_publisher = book.publisher temp_publisher = book.publisher
if self.bookform.exec_(False): if self.bookform.exec_(False):
book.name = unicode(self.bookform.nameEdit.text()) book.name = self.bookform.nameEdit.text()
book.publisher = unicode(self.bookform.publisherEdit.text()) book.publisher = self.bookform.publisherEdit.text()
if self.checkBook(book, True): if self.checkBook(book, True):
if self.manager.save_object(book): if self.manager.save_object(book):
self.resetBooks() self.resetBooks()
@ -355,9 +355,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
message=translate('SongsPlugin.SongMaintenanceForm', message=translate('SongsPlugin.SongMaintenanceForm',
'Could not save your changes.')) 'Could not save your changes.'))
elif critical_error_message_box( elif critical_error_message_box(
message=unicode(translate('SongsPlugin.SongMaintenanceForm', message=translate('SongsPlugin.SongMaintenanceForm',
'The book %s already exists. Would you like to make songs ' 'The book %s already exists. Would you like to make songs '
'with book %s use the existing book %s?')) % (book.name, 'with book %s use the existing book %s?') % (book.name,
temp_name, book.name), temp_name, book.name),
parent=self, question=True) == QtGui.QMessageBox.Yes: parent=self, question=True) == QtGui.QMessageBox.Yes:
self.__mergeObjects(book, self.mergeBooks, self.resetBooks) self.__mergeObjects(book, self.mergeBooks, self.resetBooks)

View File

@ -60,13 +60,13 @@ class VerseType(object):
Tags = [name[0].lower() for name in Names] Tags = [name[0].lower() for name in Names]
TranslatedNames = [ TranslatedNames = [
unicode(translate('SongsPlugin.VerseType', 'Verse')), translate('SongsPlugin.VerseType', 'Verse'),
unicode(translate('SongsPlugin.VerseType', 'Chorus')), translate('SongsPlugin.VerseType', 'Chorus'),
unicode(translate('SongsPlugin.VerseType', 'Bridge')), translate('SongsPlugin.VerseType', 'Bridge'),
unicode(translate('SongsPlugin.VerseType', 'Pre-Chorus')), translate('SongsPlugin.VerseType', 'Pre-Chorus'),
unicode(translate('SongsPlugin.VerseType', 'Intro')), translate('SongsPlugin.VerseType', 'Intro'),
unicode(translate('SongsPlugin.VerseType', 'Ending')), translate('SongsPlugin.VerseType', 'Ending'),
unicode(translate('SongsPlugin.VerseType', 'Other'))] translate('SongsPlugin.VerseType', 'Other')]
TranslatedTags = [name[0].lower() for name in TranslatedNames] TranslatedTags = [name[0].lower() for name in TranslatedNames]
@staticmethod @staticmethod

View File

@ -258,8 +258,8 @@ class EasyWorshipSongImport(SongImport):
if copy: if copy:
self.copyright += u', ' self.copyright += u', '
self.copyright += \ self.copyright += \
unicode(translate('SongsPlugin.EasyWorshipSongImport', translate('SongsPlugin.EasyWorshipSongImport',
'Administered by %s')) % admin 'Administered by %s') % admin
if ccli: if ccli:
self.ccliNumber = ccli self.ccliNumber = ccli
if authors: if authors:

View File

@ -65,9 +65,8 @@ class OpenLyricsExport(object):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
if self.parent.stop_export_flag: if self.parent.stop_export_flag:
return False return False
self.parent.incrementProgressBar(unicode(translate( self.parent.incrementProgressBar(translate(
'SongsPlugin.OpenLyricsExport', 'Exporting "%s"...')) % 'SongsPlugin.OpenLyricsExport', 'Exporting "%s"...') % song.title)
song.title)
xml = openLyrics.song_to_xml(song) xml = openLyrics.song_to_xml(song)
tree = etree.ElementTree(etree.fromstring(xml)) tree = etree.ElementTree(etree.fromstring(xml))
filename = u'%s (%s)' % (song.title, filename = u'%s (%s)' % (song.title,

View File

@ -74,8 +74,8 @@ class PowerSongImport(SongImport):
Receive a list of files to import. Receive a list of files to import.
""" """
if not isinstance(self.importSource, list): if not isinstance(self.importSource, list):
self.logError(unicode(translate('SongsPlugin.PowerSongImport', self.logError(translate('SongsPlugin.PowerSongImport',
'No files to import.'))) 'No files to import.'))
return return
self.importWizard.progressBar.setMaximum(len(self.importSource)) self.importWizard.progressBar.setMaximum(len(self.importSource))
for file in self.importSource: for file in self.importSource:

View File

@ -98,8 +98,7 @@ class SongImport(QtCore.QObject):
self.verseOrderList = [] self.verseOrderList = []
self.verses = [] self.verses = []
self.verseCounts = {} self.verseCounts = {}
self.copyrightString = unicode(translate( self.copyrightString = translate('SongsPlugin.SongImport', 'copyright')
'SongsPlugin.SongImport', 'copyright'))
def logError(self, filepath, reason=SongStrings.SongIncomplete): def logError(self, filepath, reason=SongStrings.SongIncomplete):
""" """

View File

@ -718,15 +718,15 @@ class OpenLyrics(object):
except AttributeError: except AttributeError:
raise OpenLyricsError(OpenLyricsError.LyricsError, raise OpenLyricsError(OpenLyricsError.LyricsError,
'<lyrics> tag is missing.', '<lyrics> tag is missing.',
unicode(translate('OpenLP.OpenLyricsImportError', translate('OpenLP.OpenLyricsImportError',
'<lyrics> tag is missing.'))) '<lyrics> tag is missing.'))
try: try:
verse_list = lyrics.verse verse_list = lyrics.verse
except AttributeError: except AttributeError:
raise OpenLyricsError(OpenLyricsError.VerseError, raise OpenLyricsError(OpenLyricsError.VerseError,
'<verse> tag is missing.', '<verse> tag is missing.',
unicode(translate('OpenLP.OpenLyricsImportError', translate('OpenLP.OpenLyricsImportError',
'<verse> tag is missing.'))) '<verse> tag is missing.'))
# Loop over the "verse" elements. # Loop over the "verse" elements.
for verse in verse_list: for verse in verse_list:
text = u'' text = u''

View File

@ -74,10 +74,9 @@ class SongsPlugin(Plugin):
self.songExportItem.setVisible(True) self.songExportItem.setVisible(True)
self.toolsReindexItem.setVisible(True) self.toolsReindexItem.setVisible(True)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_action(self.songImportItem, unicode(UiStrings().Import)) action_list.add_action(self.songImportItem, UiStrings().Import)
action_list.add_action(self.songExportItem, unicode(UiStrings().Export)) action_list.add_action(self.songExportItem, UiStrings().Export)
action_list.add_action(self.toolsReindexItem, action_list.add_action(self.toolsReindexItem, UiStrings().Tools)
unicode(UiStrings().Tools))
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'servicemanager_new_service'), QtCore.SIGNAL(u'servicemanager_new_service'),
self.clearTemporarySongs) self.clearTemporarySongs)
@ -268,12 +267,9 @@ class SongsPlugin(Plugin):
self.songExportItem.setVisible(False) self.songExportItem.setVisible(False)
self.toolsReindexItem.setVisible(False) self.toolsReindexItem.setVisible(False)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.remove_action(self.songImportItem, action_list.remove_action(self.songImportItem, UiStrings().Import)
unicode(UiStrings().Import)) action_list.remove_action(self.songExportItem, UiStrings().Export)
action_list.remove_action(self.songExportItem, action_list.remove_action(self.toolsReindexItem, UiStrings().Tools)
unicode(UiStrings().Export))
action_list.remove_action(self.toolsReindexItem,
unicode(UiStrings().Tools))
Plugin.finalise(self) Plugin.finalise(self)
def clearTemporarySongs(self): def clearTemporarySongs(self):

View File

@ -59,11 +59,11 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
year = QtCore.QDate().currentDate().year() year = QtCore.QDate().currentDate().year()
if QtCore.QDate().currentDate().month() < 9: if QtCore.QDate().currentDate().month() < 9:
year -= 1 year -= 1
toDate = Settings().value( # TODO: check toDate()
u'songusage/to date', QtCore.QDate(year, 8, 31)).toDate() toDate = Settings().value(self.plugin.settingsSection +
fromDate = Settings().value( u'/to date', QtCore.QDate(year, 8, 31)).toDate()
u'songusage/from date', fromDate = Settings().value(self.plugin.settingsSection +
QtCore.QDate(year - 1, 9, 1)).toDate() u'/from date', QtCore.QDate(year - 1, 9, 1)).toDate()
self.fromDate.setSelectedDate(fromDate) self.fromDate.setSelectedDate(fromDate)
self.toDate.setSelectedDate(toDate) self.toDate.setSelectedDate(toDate)
self.fileLineEdit.setText( self.fileLineEdit.setText(
@ -87,25 +87,25 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
Ok was triggered so lets save the data and run the report Ok was triggered so lets save the data and run the report
""" """
log.debug(u'accept') log.debug(u'accept')
path = unicode(self.fileLineEdit.text()) path = self.fileLineEdit.text()
if path == u'': if not path:
Receiver.send_message(u'openlp_error_message', { Receiver.send_message(u'openlp_error_message', {
u'title': translate('SongUsagePlugin.SongUsageDetailForm', u'title': translate('SongUsagePlugin.SongUsageDetailForm',
'Output Path Not Selected'), 'Output Path Not Selected'),
u'message': unicode(translate( u'message': translate(
'SongUsagePlugin.SongUsageDetailForm', 'You have not set a ' 'SongUsagePlugin.SongUsageDetailForm', 'You have not set a '
'valid output location for your song usage report. Please ' 'valid output location for your song usage report. Please '
'select an existing path on your computer.'))}) 'select an existing path on your computer.')})
return return
check_directory_exists(path) check_directory_exists(path)
filename = unicode(translate('SongUsagePlugin.SongUsageDetailForm', filename = translate('SongUsagePlugin.SongUsageDetailForm',
'usage_detail_%s_%s.txt')) % ( 'usage_detail_%s_%s.txt') % (
self.fromDate.selectedDate().toString(u'ddMMyyyy'), self.fromDate.selectedDate().toString(u'ddMMyyyy'),
self.toDate.selectedDate().toString(u'ddMMyyyy')) self.toDate.selectedDate().toString(u'ddMMyyyy'))
Settings().setValue(u'songusage/from date', Settings().setValue(self.plugin.settingsSection +
self.fromDate.selectedDate()) u'/from date', self.fromDate.selectedDate())
Settings().setValue(u'songusage/to date', Settings().setValue(self.plugin.settingsSection +
self.toDate.selectedDate()) u'/to date', self.toDate.selectedDate())
usage = self.plugin.manager.get_all_objects( usage = self.plugin.manager.get_all_objects(
SongUsageItem, and_( SongUsageItem, and_(
SongUsageItem.usagedate >= self.fromDate.selectedDate().toPyDate(), SongUsageItem.usagedate >= self.fromDate.selectedDate().toPyDate(),
@ -125,9 +125,9 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
Receiver.send_message(u'openlp_information_message', { Receiver.send_message(u'openlp_information_message', {
u'title': translate('SongUsagePlugin.SongUsageDetailForm', u'title': translate('SongUsagePlugin.SongUsageDetailForm',
'Report Creation'), 'Report Creation'),
u'message': unicode(translate( u'message': translate(
'SongUsagePlugin.SongUsageDetailForm', 'Report \n%s \n' 'SongUsagePlugin.SongUsageDetailForm', 'Report \n%s \n'
'has been successfully created. ')) % outname}) 'has been successfully created. ') % outname})
except IOError: except IOError:
log.exception(u'Failed to write out song usage records') log.exception(u'Failed to write out song usage records')
finally: finally:

View File

@ -112,8 +112,7 @@ class SongUsagePlugin(Plugin):
QtCore.SIGNAL(u'visibilityChanged(bool)'), QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.songUsageStatus.setChecked) self.songUsageStatus.setChecked)
QtCore.QObject.connect(self.songUsageActiveButton, QtCore.QObject.connect(self.songUsageActiveButton,
QtCore.SIGNAL(u'toggled(bool)'), QtCore.SIGNAL(u'toggled(bool)'), self.toggleSongUsageState)
self.toggleSongUsageState)
self.songUsageMenu.menuAction().setVisible(False) self.songUsageMenu.menuAction().setVisible(False)
def initialise(self): def initialise(self):
@ -131,11 +130,11 @@ class SongUsagePlugin(Plugin):
self.setButtonState() self.setButtonState()
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_action(self.songUsageStatus, action_list.add_action(self.songUsageStatus,
unicode(translate('SongUsagePlugin', 'Song Usage'))) translate('SongUsagePlugin', 'Song Usage'))
action_list.add_action(self.songUsageDelete, action_list.add_action(self.songUsageDelete,
unicode(translate('SongUsagePlugin', 'Song Usage'))) translate('SongUsagePlugin', 'Song Usage'))
action_list.add_action(self.songUsageReport, action_list.add_action(self.songUsageReport,
unicode(translate('SongUsagePlugin', 'Song Usage'))) translate('SongUsagePlugin', 'Song Usage'))
self.songUsageDeleteForm = SongUsageDeleteForm(self.manager, self.songUsageDeleteForm = SongUsageDeleteForm(self.manager,
self.formParent) self.formParent)
self.songUsageDetailForm = SongUsageDetailForm(self, self.formParent) self.songUsageDetailForm = SongUsageDetailForm(self, self.formParent)
@ -152,11 +151,11 @@ class SongUsagePlugin(Plugin):
self.songUsageMenu.menuAction().setVisible(False) self.songUsageMenu.menuAction().setVisible(False)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.remove_action(self.songUsageStatus, action_list.remove_action(self.songUsageStatus,
unicode(translate('SongUsagePlugin', 'Song Usage'))) translate('SongUsagePlugin', 'Song Usage'))
action_list.remove_action(self.songUsageDelete, action_list.remove_action(self.songUsageDelete,
unicode(translate('SongUsagePlugin', 'Song Usage'))) translate('SongUsagePlugin', 'Song Usage'))
action_list.remove_action(self.songUsageReport, action_list.remove_action(self.songUsageReport,
unicode(translate('SongUsagePlugin', 'Song Usage'))) translate('SongUsagePlugin', 'Song Usage'))
self.songUsageActiveButton.hide() self.songUsageActiveButton.hide()
# stop any events being processed # stop any events being processed
self.songUsageActive = False self.songUsageActive = False
@ -167,8 +166,7 @@ class SongUsagePlugin(Plugin):
the UI when necessary, the UI when necessary,
""" """
self.songUsageActive = not self.songUsageActive self.songUsageActive = not self.songUsageActive
Settings().setValue(self.settingsSection + u'/active', Settings().setValue(self.settingsSection + u'/active', self.songUsageActive)
self.songUsageActive)
self.setButtonState() self.setButtonState()
def setButtonState(self): def setButtonState(self):
@ -198,15 +196,13 @@ class SongUsagePlugin(Plugin):
""" """
Song Usage for which has been displayed Song Usage for which has been displayed
""" """
self._add_song_usage(unicode(translate('SongUsagePlugin', self._add_song_usage(translate('SongUsagePlugin', 'display'), item)
'display')), item)
def printSongUsage(self, item): def printSongUsage(self, item):
""" """
Song Usage for which has been printed Song Usage for which has been printed
""" """
self._add_song_usage(unicode(translate('SongUsagePlugin', self._add_song_usage(translate('SongUsagePlugin', 'printed'), item)
'printed')), item)
def _add_song_usage(self, source, item): def _add_song_usage(self, source, item):
audit = item[0].audit audit = item[0].audit