diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py
index 9f29e55b4..1c8d9e2b6 100644
--- a/openlp/core/__init__.py
+++ b/openlp/core/__init__.py
@@ -194,7 +194,7 @@ class OpenLP(QtGui.QApplication):
if event.type() == QtCore.QEvent.FileOpen:
file_name = event.file()
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
else:
return QtGui.QApplication.event(self, event)
diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py
index e359b0047..4f49e4d58 100644
--- a/openlp/core/lib/__init__.py
+++ b/openlp/core/lib/__init__.py
@@ -371,22 +371,22 @@ def create_separated_list(stringlist):
List of unicode strings
"""
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:
return u''
elif len(stringlist) == 1:
return stringlist[0]
elif len(stringlist) == 2:
- return unicode(translate('OpenLP.core.lib', '%1 and %2',
- 'Locale list separator: 2 items').arg(stringlist[0], stringlist[1]))
+ return translate('OpenLP.core.lib', '%1 and %2',
+ 'Locale list separator: 2 items').arg(stringlist[0], stringlist[1])
else:
- merged = unicode(translate('OpenLP.core.lib', '%1, and %2',
- u'Locale list separator: end').arg(stringlist[-2], stringlist[-1]))
+ merged = translate('OpenLP.core.lib', '%1, and %2',
+ u'Locale list separator: end').arg(stringlist[-2], stringlist[-1])
for index in reversed(range(1, len(stringlist) - 2)):
- merged = unicode(translate('OpenLP.core.lib', '%1, %2',
- u'Locale list separator: middle').arg(stringlist[index], merged))
- return unicode(translate('OpenLP.core.lib', '%1, %2',
- u'Locale list separator: start').arg(stringlist[0], merged))
+ merged = translate('OpenLP.core.lib', '%1, %2',
+ u'Locale list separator: middle').arg(stringlist[index], merged)
+ return translate('OpenLP.core.lib', '%1, %2',
+ u'Locale list separator: start').arg(stringlist[0], merged)
from eventreceiver import Receiver
diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py
index 7da71afc9..e45a4ca1c 100644
--- a/openlp/core/lib/db.py
+++ b/openlp/core/lib/db.py
@@ -208,11 +208,11 @@ class Manager(object):
if db_ver > up_ver:
critical_error_message_box(
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 '
'OpenLP. The database is version %d, while OpenLP '
'expects version %d. The database will not be loaded.'
- '\n\nDatabase: %s')) % \
+ '\n\nDatabase: %s') % \
(db_ver, up_ver, self.db_url)
)
return
@@ -222,8 +222,8 @@ class Manager(object):
log.exception(u'Error loading database: %s', self.db_url)
critical_error_message_box(
translate('OpenLP.Manager', 'Database Error'),
- unicode(translate('OpenLP.Manager', 'OpenLP cannot load your '
- 'database.\n\nDatabase: %s')) % self.db_url
+ translate('OpenLP.Manager', 'OpenLP cannot load your '
+ 'database.\n\nDatabase: %s') % self.db_url
)
def save_object(self, object_instance, commit=True):
diff --git a/openlp/core/lib/listwidgetwithdnd.py b/openlp/core/lib/listwidgetwithdnd.py
index 9e9787914..661f95b2e 100644
--- a/openlp/core/lib/listwidgetwithdnd.py
+++ b/openlp/core/lib/listwidgetwithdnd.py
@@ -98,7 +98,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
event.accept()
files = []
for url in event.mimeData().urls():
- localFile = unicode(url.toLocalFile())
+ localFile = url.toLocalFile()
if os.path.isfile(localFile):
files.append(localFile)
elif os.path.isdir(localFile):
diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py
index aee0af32d..881efb28b 100644
--- a/openlp/core/lib/mediamanageritem.py
+++ b/openlp/core/lib/mediamanageritem.py
@@ -336,7 +336,7 @@ class MediaManagerItem(QtGui.QWidget):
self, self.onNewPrompt,
SettingsManager.get_last_dir(self.settingsSection),
self.onNewFileMasks)
- log.info(u'New files(s) %s', unicode(files))
+ log.info(u'New files(s) %s', files)
if files:
Receiver.send_message(u'cursor_busy')
self.validateAndLoad(files)
@@ -359,9 +359,8 @@ class MediaManagerItem(QtGui.QWidget):
critical_error_message_box(
translate('OpenLP.MediaManagerItem',
'Invalid File Type'),
- unicode(translate('OpenLP.MediaManagerItem',
- 'Invalid File %s.\nSuffix not supported'))
- % file)
+ translate('OpenLP.MediaManagerItem',
+ 'Invalid File %s.\nSuffix not supported') % file)
errorShown = True
else:
newFiles.append(file)
@@ -379,9 +378,9 @@ class MediaManagerItem(QtGui.QWidget):
names = []
fullList = []
for count in range(self.listView.count()):
- names.append(unicode(self.listView.item(count).text()))
- fullList.append(unicode(self.listView.item(count).
- data(QtCore.Qt.UserRole).toString()))
+ names.append(self.listView.item(count).text())
+ fullList.append(self.listView.item(count).
+ data(QtCore.Qt.UserRole).toString())
duplicatesFound = False
filesAdded = False
for file in files:
@@ -401,8 +400,8 @@ class MediaManagerItem(QtGui.QWidget):
if duplicatesFound:
critical_error_message_box(
UiStrings().Duplicate,
- unicode(translate('OpenLP.MediaManagerItem',
- 'Duplicate files were found on import and were ignored.')))
+ translate('OpenLP.MediaManagerItem',
+ 'Duplicate files were found on import and were ignored.'))
def contextMenu(self, point):
item = self.listView.itemAt(point)
@@ -421,7 +420,7 @@ class MediaManagerItem(QtGui.QWidget):
filelist = []
while count < self.listView.count():
bitem = self.listView.item(count)
- filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
+ filename = bitem.data(QtCore.Qt.UserRole).toString()
filelist.append(filename)
count += 1
return filelist
@@ -573,8 +572,8 @@ class MediaManagerItem(QtGui.QWidget):
QtGui.QMessageBox.information(self,
translate('OpenLP.MediaManagerItem',
'Invalid Service Item'),
- unicode(translate('OpenLP.MediaManagerItem',
- 'You must select a %s service item.')) % self.title)
+ translate('OpenLP.MediaManagerItem',
+ 'You must select a %s service item.') % self.title)
def buildServiceItem(self, item=None, xmlVersion=False, remote=False):
"""
diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py
index 36314ac7f..d2a3d6575 100644
--- a/openlp/core/lib/serviceitem.py
+++ b/openlp/core/lib/serviceitem.py
@@ -464,12 +464,12 @@ class ServiceItem(object):
start = None
end = None
if self.start_time != 0:
- start = unicode(translate('OpenLP.ServiceItem',
- 'Start: %s')) % \
+ start = translate('OpenLP.ServiceItem',
+ 'Start: %s') % \
unicode(datetime.timedelta(seconds=self.start_time))
if self.media_length != 0:
- end = unicode(translate('OpenLP.ServiceItem',
- 'Length: %s')) % \
+ end = translate('OpenLP.ServiceItem',
+ 'Length: %s') % \
unicode(datetime.timedelta(seconds=self.media_length))
if not start and not end:
return u''
diff --git a/openlp/core/lib/spelltextedit.py b/openlp/core/lib/spelltextedit.py
index 310c219b5..d855f0ec9 100644
--- a/openlp/core/lib/spelltextedit.py
+++ b/openlp/core/lib/spelltextedit.py
@@ -100,7 +100,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
# Check if the selected word is misspelled and offer spelling
# suggestions if it is.
if ENCHANT_AVAILABLE and self.textCursor().hasSelection():
- text = unicode(self.textCursor().selectedText())
+ text = self.textCursor().selectedText()
if not self.dictionary.check(text):
spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',
'Spelling Suggestions'))
diff --git a/openlp/core/lib/toolbar.py b/openlp/core/lib/toolbar.py
index 44df193e1..b797c3389 100644
--- a/openlp/core/lib/toolbar.py
+++ b/openlp/core/lib/toolbar.py
@@ -66,7 +66,7 @@ class OpenLPToolbar(QtGui.QToolBar):
Add a widget and store it's handle under the widgets object name.
"""
action = self.addWidget(widget)
- self.actions[unicode(widget.objectName())] = action
+ self.actions[widget.objectName()] = action
def setWidgetVisible(self, widgets, visible=True):
"""
diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py
index 2ab67c180..a8f24f8eb 100644
--- a/openlp/core/lib/ui.py
+++ b/openlp/core/lib/ui.py
@@ -66,7 +66,7 @@ class UiStrings(object):
self.CreateService = translate('OpenLP.Ui', 'Create a new service.')
self.ConfirmDelete = translate('OpenLP.Ui', 'Confirm Delete')
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.DisplayStyle = translate('OpenLP.Ui', 'Display style:')
self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error')
@@ -127,7 +127,7 @@ class UiStrings(object):
self.Split = translate('OpenLP.Ui', 'Optional &Split')
self.SplitToolTip = translate('OpenLP.Ui', 'Split a slide into two '
'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',
'Stop Play Slides in Loop')
self.StopPlaySlidesToEnd = translate('OpenLP.Ui',
diff --git a/openlp/core/ui/aboutdialog.py b/openlp/core/ui/aboutdialog.py
index f0908b729..5e46a622f 100644
--- a/openlp/core/ui/aboutdialog.py
+++ b/openlp/core/ui/aboutdialog.py
@@ -139,7 +139,7 @@ class Ui_AboutDialog(object):
}
documentors = [u'Wesley "wrst" Stout',
u'John "jseagull1" Cegalis (lead)']
- self.creditsTextEdit.setPlainText(unicode(translate('OpenLP.AboutForm',
+ self.creditsTextEdit.setPlainText(translate('OpenLP.AboutForm',
'Project Lead\n'
' %s\n'
'\n'
@@ -200,7 +200,7 @@ class Ui_AboutDialog(object):
' God our Father, for sending His Son to die\n'
' on the cross, setting us free from sin. We\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(packagers), u'\n '.join(translators[u'af']),
u'\n '.join(translators[u'de']),
@@ -218,9 +218,9 @@ class Ui_AboutDialog(object):
self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.creditsTab),
translate('OpenLP.AboutForm', 'Credits'))
- copyright = unicode(translate('OpenLP.AboutForm',
+ copyright = translate('OpenLP.AboutForm',
'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'Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin K\xf6hler, '
u'Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias '
diff --git a/openlp/core/ui/aboutform.py b/openlp/core/ui/aboutform.py
index e2ccbc3c3..836289b5c 100644
--- a/openlp/core/ui/aboutform.py
+++ b/openlp/core/ui/aboutform.py
@@ -47,7 +47,7 @@ class AboutForm(QtGui.QDialog, Ui_AboutDialog):
about_text = about_text.replace(u'',
applicationVersion[u'version'])
if applicationVersion[u'build']:
- build_text = unicode(translate('OpenLP.AboutForm', ' build %s')) % \
+ build_text = translate('OpenLP.AboutForm', ' build %s') % \
applicationVersion[u'build']
else:
build_text = u''
diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py
index 55547cbbd..20c71460d 100644
--- a/openlp/core/ui/advancedtab.py
+++ b/openlp/core/ui/advancedtab.py
@@ -52,12 +52,12 @@ class AdvancedTab(SettingsTab):
# 11 o'clock is the most popular time for morning service.
self.defaultServiceHour = 11
self.defaultServiceMinute = 0
- self.defaultServiceName = unicode(translate('OpenLP.AdvancedTab',
+ self.defaultServiceName = translate('OpenLP.AdvancedTab',
'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: '
'/\\?*|<>\[\]":+\n'
'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.defaultColor = u'#ffffff'
self.iconPath = u':/system/system_settings.png'
@@ -299,9 +299,9 @@ class AdvancedTab(SettingsTab):
translate('OpenLP.AdvancedTab', 'Name:'))
self.serviceNameEdit.setToolTip(translate('OpenLP.AdvancedTab',
'Consult the OpenLP manual for usage.'))
- self.serviceNameRevertButton.setToolTip(unicode(
+ self.serviceNameRevertButton.setToolTip(
translate('OpenLP.AdvancedTab',
- 'Revert to the default service name "%s".')) %
+ 'Revert to the default service name "%s".') %
self.defaultServiceName)
self.serviceNameExampleLabel.setText(translate('OpenLP.AdvancedTab',
'Example:'))
@@ -397,7 +397,7 @@ class AdvancedTab(SettingsTab):
settings.beginGroup(self.settingsSection)
settings.setValue(u'default service enabled',
self.serviceNameCheckBox.isChecked())
- service_name = unicode(self.serviceNameEdit.text())
+ service_name = self.serviceNameEdit.text()
preset_is_valid = self.generateServiceNameExample()[0]
if service_name == self.defaultServiceName or not preset_is_valid:
settings.remove(u'default service name')
diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py
index 7ea3a5bc1..cd2312790 100644
--- a/openlp/core/ui/exceptionform.py
+++ b/openlp/core/ui/exceptionform.py
@@ -110,10 +110,10 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
def _createReport(self):
openlp_version = get_application_version()
- description = unicode(self.descriptionTextEdit.toPlainText())
- traceback = unicode(self.exceptionTextEdit.toPlainText())
- system = unicode(translate('OpenLP.ExceptionForm',
- 'Platform: %s\n')) % platform.platform()
+ description = self.descriptionTextEdit.toPlainText()
+ traceback = self.exceptionTextEdit.toPlainText()
+ system = translate('OpenLP.ExceptionForm',
+ 'Platform: %s\n') % platform.platform()
libraries = u'Python: %s\n' % platform.python_version() + \
u'Qt4: %s\n' % Qt.qVersion() + \
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.
"""
- report_text = unicode(translate('OpenLP.ExceptionForm',
+ report_text = translate('OpenLP.ExceptionForm',
'**OpenLP Bug Report**\n'
'Version: %s\n\n'
'--- Details of the Exception. ---\n\n%s\n\n '
'--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n'
- '--- Library Versions ---\n%s\n'))
+ '--- Library Versions ---\n%s\n')
filename = QtGui.QFileDialog.getSaveFileName(self,
translate('OpenLP.ExceptionForm', 'Save Crash Report'),
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
system informations.
"""
- body = unicode(translate('OpenLP.ExceptionForm',
+ body = translate('OpenLP.ExceptionForm',
'*OpenLP Bug Report*\n'
'Version: %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'
'--- Library Versions ---\n%s\n',
'Please add the information that bug reports are favoured written '
- 'in English.'))
+ 'in English.')
content = self._createReport()
source = u''
exception = u''
@@ -209,8 +209,8 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
else:
self.__buttonState(False)
self.descriptionWordCount.setText(
- unicode(translate('OpenLP.ExceptionDialog',
- 'Description characters to enter : %s')) % count)
+ translate('OpenLP.ExceptionDialog',
+ 'Description characters to enter : %s') % count)
def onAttachFileButtonClicked(self):
files = QtGui.QFileDialog.getOpenFileName(
diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py
index b0630e5fb..d17b65927 100644
--- a/openlp/core/ui/firsttimeform.py
+++ b/openlp/core/ui/firsttimeform.py
@@ -87,8 +87,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self.config.readfp(io.BytesIO(files))
self.updateScreenListCombo()
self.downloadCanceled = False
- self.downloading = unicode(translate('OpenLP.FirstTimeWizard',
- 'Downloading %s...'))
+ self.downloading = translate('OpenLP.FirstTimeWizard',
+ 'Downloading %s...')
QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
self.onCancelButtonClicked)
QtCore.QObject.connect(self.noInternetFinishButton,
@@ -435,7 +435,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
while bibles_iterator.value():
item = bibles_iterator.value()
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.previous_size = 0
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()):
item = self.themesListWidget.item(i)
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.previous_size = 0
self.urlGetFile(u'%s%s' % (self.web, theme),
diff --git a/openlp/core/ui/formattingtagform.py b/openlp/core/ui/formattingtagform.py
index 1084d6a3d..1f6fdf7bd 100644
--- a/openlp/core/ui/formattingtagform.py
+++ b/openlp/core/ui/formattingtagform.py
@@ -155,18 +155,18 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
html_expands = FormattingTags.get_html_tags()
if self.selected != -1:
html = html_expands[self.selected]
- tag = unicode(self.tagLineEdit.text())
+ tag = self.tagLineEdit.text()
for linenumber, html1 in enumerate(html_expands):
if self._strip(html1[u'start tag']) == tag and \
linenumber != self.selected:
critical_error_message_box(
translate('OpenLP.FormattingTagForm', 'Update Error'),
- unicode(translate('OpenLP.FormattingTagForm',
- 'Tag %s already defined.')) % tag)
+ translate('OpenLP.FormattingTagForm',
+ 'Tag %s already defined.') % tag)
return
- html[u'desc'] = unicode(self.descriptionLineEdit.text())
- html[u'start html'] = unicode(self.startTagLineEdit.text())
- html[u'end html'] = unicode(self.endTagLineEdit.text())
+ html[u'desc'] = self.descriptionLineEdit.text()
+ html[u'start html'] = self.startTagLineEdit.text()
+ html[u'end html'] = self.endTagLineEdit.text()
html[u'start tag'] = u'{%s}' % tag
html[u'end tag'] = u'{/%s}' % tag
# Keep temporary tags when the user changes one.
diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py
index f430ec1c9..34d5434ec 100644
--- a/openlp/core/ui/maindisplay.py
+++ b/openlp/core/ui/maindisplay.py
@@ -257,7 +257,7 @@ class MainDisplay(Display):
height = self.frame.evaluateJavaScript(js)
if shrink:
if text:
- alert_height = int(height)
+ alert_height = int(height.toString())
self.resize(self.width(), alert_height)
self.setVisible(True)
if location == AlertLocation.Middle:
diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py
index 3daa11dab..a8ddb9235 100644
--- a/openlp/core/ui/mainwindow.py
+++ b/openlp/core/ui/mainwindow.py
@@ -173,7 +173,7 @@ class Ui_MainWindow(object):
self.themeManagerDock)
# Create the menu items
action_list = ActionList.get_instance()
- action_list.add_category(unicode(UiStrings().File),
+ action_list.add_category(UiStrings().File,
CategoryOrder.standardMenu)
self.fileNewItem = create_action(mainWindow, u'fileNewItem',
icon=u':/general/general_new.png',
@@ -202,19 +202,19 @@ class Ui_MainWindow(object):
icon=u':/system/system_exit.png',
shortcuts=[QtGui.QKeySequence(u'Alt+F4')],
category=UiStrings().File, triggers=mainWindow.close)
- action_list.add_category(unicode(UiStrings().Import),
+ action_list.add_category(UiStrings().Import,
CategoryOrder.standardMenu)
self.importThemeItem = create_action(mainWindow,
u'importThemeItem', category=UiStrings().Import)
self.importLanguageItem = create_action(mainWindow,
u'importLanguageItem')#, category=UiStrings().Import)
- action_list.add_category(unicode(UiStrings().Export),
+ action_list.add_category(UiStrings().Export,
CategoryOrder.standardMenu)
self.exportThemeItem = create_action(mainWindow,
u'exportThemeItem', category=UiStrings().Export)
self.exportLanguageItem = create_action(mainWindow,
u'exportLanguageItem')#, category=UiStrings().Export)
- action_list.add_category(unicode(UiStrings().View),
+ action_list.add_category(UiStrings().View,
CategoryOrder.standardMenu)
self.viewMediaManagerItem = create_action(mainWindow,
u'viewMediaManagerItem', shortcuts=[QtGui.QKeySequence(u'F8')],
@@ -239,7 +239,7 @@ class Ui_MainWindow(object):
category=UiStrings().View, triggers=self.setLivePanelVisibility)
self.lockPanel = create_action(mainWindow, u'lockPanel',
checked=panelLocked, triggers=self.setLockPanel)
- action_list.add_category(unicode(UiStrings().ViewMode),
+ action_list.add_category(UiStrings().ViewMode,
CategoryOrder.standardMenu)
self.modeDefaultItem = create_action(mainWindow, u'modeDefaultItem',
checked=False, category=UiStrings().ViewMode)
@@ -252,8 +252,7 @@ class Ui_MainWindow(object):
self.modeGroup.addAction(self.modeSetupItem)
self.modeGroup.addAction(self.modeLiveItem)
self.modeDefaultItem.setChecked(True)
- action_list.add_category(unicode(UiStrings().Tools),
- CategoryOrder.standardMenu)
+ action_list.add_category(UiStrings().Tools, CategoryOrder.standardMenu)
self.toolsAddToolItem = create_action(mainWindow,
u'toolsAddToolItem', icon=u':/tools/tools_add.png',
category=UiStrings().Tools)
@@ -265,7 +264,7 @@ class Ui_MainWindow(object):
category=UiStrings().Tools)
self.updateThemeImages = create_action(mainWindow,
u'updateThemeImages', category=UiStrings().Tools)
- action_list.add_category(unicode(UiStrings().Settings),
+ action_list.add_category(UiStrings().Settings,
CategoryOrder.standardMenu)
self.settingsPluginListItem = create_action(mainWindow,
u'settingsPluginListItem',
@@ -300,8 +299,7 @@ class Ui_MainWindow(object):
u'settingsImportItem', category=UiStrings().Settings)
self.settingsExportItem = create_action(mainWindow,
u'settingsExportItem', category=UiStrings().Settings)
- action_list.add_category(unicode(UiStrings().Help),
- CategoryOrder.standardMenu)
+ action_list.add_category(UiStrings().Help, CategoryOrder.standardMenu)
self.aboutItem = create_action(mainWindow, u'aboutItem',
icon=u':/system/system_about.png',
shortcuts=[QtGui.QKeySequence(u'Ctrl+F1')],
@@ -497,8 +495,8 @@ class Ui_MainWindow(object):
translate('OpenLP.MainWindow', '&Web Site'))
for item in self.languageGroup.actions():
item.setText(item.objectName())
- item.setStatusTip(unicode(translate('OpenLP.MainWindow',
- 'Set the interface language to %s')) % item.objectName())
+ item.setStatusTip(translate('OpenLP.MainWindow',
+ 'Set the interface language to %s') % item.objectName())
self.autoLanguageItem.setText(
translate('OpenLP.MainWindow', '&Autodetect'))
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.
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 '
'currently running version %s). \n\nYou can download the latest '
- 'version from http://openlp.org/.'))
+ 'version from http://openlp.org/.')
QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'OpenLP Version Updated'),
version_text % (version, get_application_version()[u'full']))
@@ -928,11 +926,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
return
- import_file_name = unicode(QtGui.QFileDialog.getOpenFileName(self,
- translate('OpenLP.MainWindow', 'Open File'),
- '',
+ import_file_name = QtGui.QFileDialog.getOpenFileName(self,
+ translate('OpenLP.MainWindow', 'Open File'), '',
translate('OpenLP.MainWindow',
- 'OpenLP Export Settings Files (*.conf)')))
+ 'OpenLP Export Settings Files (*.conf)'))
if not import_file_name:
return
setting_sections = []
@@ -1003,10 +1000,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
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',
- 'OpenLP Export Settings File (*.conf)')))
+ 'OpenLP Export Settings File (*.conf)'))
if not export_file_name:
return
# Make sure it's a .conf file.
@@ -1218,8 +1215,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def defaultThemeChanged(self, theme):
self.defaultThemeLabel.setText(
- unicode(translate('OpenLP.MainWindow', 'Default Theme: %s')) %
- theme)
+ translate('OpenLP.MainWindow', 'Default Theme: %s') % theme)
def toggleMediaManager(self):
self.mediaManagerDock.setVisible(not self.mediaManagerDock.isVisible())
diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py
index 2fb0c6fd4..541c61763 100644
--- a/openlp/core/ui/media/mediacontroller.py
+++ b/openlp/core/ui/media/mediacontroller.py
@@ -324,8 +324,7 @@ class MediaController(object):
# Media could not be loaded correctly
critical_error_message_box(
translate('MediaPlugin.MediaItem', 'Unsupported File'),
- unicode(translate('MediaPlugin.MediaItem',
- 'Unsupported File')))
+ translate('MediaPlugin.MediaItem', 'Unsupported File'))
return False
# dont care about actual theme, set a black background
if controller.isLive and not controller.media_info.is_background:
@@ -339,8 +338,7 @@ class MediaController(object):
if not self.video_play([controller]):
critical_error_message_box(
translate('MediaPlugin.MediaItem', 'Unsupported File'),
- unicode(translate('MediaPlugin.MediaItem',
- 'Unsupported File')))
+ translate('MediaPlugin.MediaItem', 'Unsupported File'))
return False
self.set_controls_visible(controller, True)
log.debug(u'use %s controller' % self.curDisplayMediaPlayer[display])
diff --git a/openlp/core/ui/pluginform.py b/openlp/core/ui/pluginform.py
index 435181568..8912e604e 100644
--- a/openlp/core/ui/pluginform.py
+++ b/openlp/core/ui/pluginform.py
@@ -71,22 +71,19 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
plugin.status = int(plugin.status)
# Set the little status text in brackets next to the plugin name.
if plugin.status == PluginStatus.Disabled:
- status_text = unicode(
- translate('OpenLP.PluginForm', '%s (Disabled)'))
+ status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
elif plugin.status == PluginStatus.Active:
- status_text = unicode(
- translate('OpenLP.PluginForm', '%s (Active)'))
+ status_text = translate('OpenLP.PluginForm', '%s (Active)')
else:
# PluginStatus.Inactive
- status_text = unicode(
- translate('OpenLP.PluginForm', '%s (Inactive)'))
+ status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
item.setText(status_text % plugin.nameStrings[u'singular'])
# If the plugin has an icon, set it!
if plugin.icon:
item.setIcon(plugin.icon)
self.pluginListWidget.addItem(item)
pluginListWidth = max(pluginListWidth, self.fontMetrics().width(
- unicode(translate('OpenLP.PluginForm', '%s (Inactive)')) %
+ translate('OpenLP.PluginForm', '%s (Inactive)') %
plugin.nameStrings[u'singular']))
self.pluginListWidget.setFixedWidth(pluginListWidth +
self.pluginListWidget.iconSize().width() + 48)
@@ -136,16 +133,12 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
self.activePlugin.appStartup()
else:
self.activePlugin.toggleStatus(PluginStatus.Inactive)
- status_text = unicode(
- translate('OpenLP.PluginForm', '%s (Inactive)'))
+ status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
if self.activePlugin.status == PluginStatus.Active:
- status_text = unicode(
- translate('OpenLP.PluginForm', '%s (Active)'))
+ status_text = translate('OpenLP.PluginForm', '%s (Active)')
elif self.activePlugin.status == PluginStatus.Inactive:
- status_text = unicode(
- translate('OpenLP.PluginForm', '%s (Inactive)'))
+ status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
elif self.activePlugin.status == PluginStatus.Disabled:
- status_text = unicode(
- translate('OpenLP.PluginForm', '%s (Disabled)'))
+ status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
self.pluginListWidget.currentItem().setText(
status_text % self.activePlugin.nameStrings[u'singular'])
diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py
index 3cf55713b..1650849e0 100644
--- a/openlp/core/ui/printserviceform.py
+++ b/openlp/core/ui/printserviceform.py
@@ -172,8 +172,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
"""
html_data = self._addElement(u'html')
self._addElement(u'head', parent=html_data)
- self._addElement(u'title', unicode(self.titleLineEdit.text()),
- html_data.head)
+ self._addElement(u'title', self.titleLineEdit.text(), html_data.head)
css_path = os.path.join(
AppLocation.get_data_path(), u'service_print.css')
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,
attribute=(u'type', u'text/css'))
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')
for index, item in enumerate(self.serviceManager.serviceItems):
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,
classId=u'itemNotesTitle')
self._addElement(u'span',
- cgi.escape(unicode(item.notes)).replace(u'\n', u'
'), p,
+ cgi.escape(item.notes).replace(u'\n', u'
'), p,
classId=u'itemNotesText')
# Add play length of media files.
if item.is_media() and self.metaDataCheckBox.isChecked():
diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py
index 48abc500a..78ca788de 100644
--- a/openlp/core/ui/servicemanager.py
+++ b/openlp/core/ui/servicemanager.py
@@ -174,7 +174,7 @@ class ServiceManager(QtGui.QWidget):
self.orderToolbar = OpenLPToolbar(self)
action_list = ActionList.get_instance()
action_list.add_category(
- unicode(UiStrings().Service), CategoryOrder.standardToolbar)
+ UiStrings().Service, CategoryOrder.standardToolbar)
self.serviceManagerList.moveTop = self.orderToolbar.addToolbarAction(
u'moveTop', text=translate('OpenLP.ServiceManager', 'Move to &top'),
icon=u':/services/service_top.png', tooltip=translate(
@@ -405,13 +405,13 @@ class ServiceManager(QtGui.QWidget):
elif result == QtGui.QMessageBox.Save:
self.saveFile()
if not loadFile:
- fileName = unicode(QtGui.QFileDialog.getOpenFileName(
+ fileName = QtGui.QFileDialog.getOpenFileName(
self.mainwindow,
translate('OpenLP.ServiceManager', 'Open File'),
SettingsManager.get_last_dir(
self.mainwindow.serviceManagerSettingsSection),
translate('OpenLP.ServiceManager',
- 'OpenLP Service Files (*.osz)')))
+ 'OpenLP Service Files (*.osz)'))
if not fileName:
return False
else:
@@ -503,11 +503,11 @@ class ServiceManager(QtGui.QWidget):
if not os.path.exists(path_from):
if not skipMissing:
Receiver.send_message(u'cursor_normal')
- title = unicode(translate('OpenLP.ServiceManager',
- 'Service File Missing'))
- message = unicode(translate('OpenLP.ServiceManager',
+ title = translate('OpenLP.ServiceManager',
+ 'Service File Missing')
+ message = translate('OpenLP.ServiceManager',
'File missing from service\n\n %s \n\n'
- 'Continue saving?' % path_from ))
+ 'Continue saving?' % path_from )
answer = QtGui.QMessageBox.critical(self, title,
message,
QtGui.QMessageBox.StandardButtons(
@@ -621,9 +621,9 @@ class ServiceManager(QtGui.QWidget):
directory = SettingsManager.get_last_dir(
self.mainwindow.serviceManagerSettingsSection)
path = os.path.join(directory, default_filename)
- fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow,
+ fileName = QtGui.QFileDialog.getSaveFileName(self.mainwindow,
UiStrings().SaveService, path,
- translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)')))
+ translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)'))
if not fileName:
return False
if os.path.splitext(fileName)[1] == u'':
@@ -1043,16 +1043,16 @@ class ServiceManager(QtGui.QWidget):
tips = []
if serviceitem.temporary_edit:
tips.append(u'%s: %s' %
- (unicode(translate('OpenLP.ServiceManager', 'Edit')),
- (unicode(translate('OpenLP.ServiceManager',
- 'Service copy only')))))
+ (translate('OpenLP.ServiceManager', 'Edit'),
+ (translate('OpenLP.ServiceManager',
+ 'Service copy only'))))
if serviceitem.theme and serviceitem.theme != -1:
tips.append(u'%s: %s' %
- (unicode(translate('OpenLP.ServiceManager', 'Slide theme')),
- serviceitem.theme))
+ (translate('OpenLP.ServiceManager', 'Slide theme')),
+ serviceitem.theme)
if serviceitem.notes:
tips.append(u'%s: %s' %
- (unicode(translate('OpenLP.ServiceManager', 'Notes')),
+ (translate('OpenLP.ServiceManager', 'Notes'),
cgi.escape(unicode(serviceitem.notes))))
if item[u'service_item'] \
.is_capable(ItemCapabilities.HasVariableStartTime):
@@ -1099,7 +1099,7 @@ class ServiceManager(QtGui.QWidget):
Set the theme for the current service.
"""
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)
Settings().setValue(
self.mainwindow.serviceManagerSettingsSection +
@@ -1358,11 +1358,11 @@ class ServiceManager(QtGui.QWidget):
event.setDropAction(QtCore.Qt.CopyAction)
event.accept()
for url in link.urls():
- filename = unicode(url.toLocalFile())
+ filename = url.toLocalFile()
if filename.endswith(u'.osz'):
self.onLoadServiceClicked(filename)
elif link.hasText():
- plugin = unicode(link.text())
+ plugin = link.text()
item = self.serviceManagerList.itemAt(event.pos())
# ServiceManager started the drag and drop
if plugin == u'ServiceManager':
@@ -1434,7 +1434,7 @@ class ServiceManager(QtGui.QWidget):
self.regenerateServiceItems()
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.
if not theme:
theme = None
diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py
index 377da339f..fe62f3d16 100644
--- a/openlp/core/ui/shortcutlistform.py
+++ b/openlp/core/ui/shortcutlistform.py
@@ -128,7 +128,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
continue
item = QtGui.QTreeWidgetItem([category.name])
for action in category.actions:
- actionText = REMOVE_AMPERSAND.sub('', unicode(action.text()))
+ actionText = REMOVE_AMPERSAND.sub('', action.text())
actionItem = QtGui.QTreeWidgetItem([actionText])
actionItem.setIcon(0, action.icon())
actionItem.setData(0, QtCore.Qt.UserRole, action)
@@ -441,9 +441,9 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
Receiver.send_message(u'openlp_warning_message', {
u'title': translate('OpenLP.ShortcutListDialog',
'Duplicate Shortcut'),
- u'message': unicode(translate('OpenLP.ShortcutListDialog',
+ u'message': translate('OpenLP.ShortcutListDialog',
'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
diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py
index 2dff89bc3..aaff6137c 100644
--- a/openlp/core/ui/slidecontroller.py
+++ b/openlp/core/ui/slidecontroller.py
@@ -446,7 +446,7 @@ class SlideController(Controller):
SONGS_PLUGIN_AVAILABLE = True
except ImportError:
SONGS_PLUGIN_AVAILABLE = False
- sender_name = unicode(self.sender().objectName())
+ sender_name = self.sender().objectName()
verse_type = sender_name[15:] \
if sender_name[:15] == u'shortcutAction_' else u''
if SONGS_PLUGIN_AVAILABLE:
@@ -647,7 +647,7 @@ class SlideController(Controller):
framenumber, width / self.ratio)
def onSongBarHandler(self):
- request = unicode(self.sender().text())
+ request = self.sender().text()
slide_no = self.slideList[request]
self.__updatePreviewSelection(slide_no)
self.slideSelected()
diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py
index 1a9f142f7..25e4c1cf5 100644
--- a/openlp/core/ui/themeform.py
+++ b/openlp/core/ui/themeform.py
@@ -208,8 +208,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
"""
Updates the lines on a page on the wizard
"""
- self.mainLineCountLabel.setText(unicode(translate('OpenLP.ThemeForm',
- '(approximately %d lines per slide)')) % int(lines))
+ self.mainLineCountLabel.setText(translate('OpenLP.ThemeForm',
+ '(approximately %d lines per slide)') % int(lines))
def resizeEvent(self, event=None):
"""
@@ -319,8 +319,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.themeNameEdit.setVisible(not edit)
self.edit_mode = edit
if edit:
- self.setWindowTitle(unicode(translate('OpenLP.ThemeWizard',
- 'Edit Theme - %s')) % self.theme.theme_name)
+ self.setWindowTitle(translate('OpenLP.ThemeWizard',
+ 'Edit Theme - %s') % self.theme.theme_name)
self.next()
else:
self.setWindowTitle(UiStrings().NewTheme)
@@ -550,23 +550,20 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
return
log.debug(u'updateTheme')
# main page
- self.theme.font_main_name = \
- unicode(self.mainFontComboBox.currentFont().family())
- self.theme.font_main_size = \
- self.field(u'mainSizeSpinBox').toInt()[0]
+ self.theme.font_main_name = self.mainFontComboBox.currentFont().family()
+ self.theme.font_main_size = self.field(u'mainSizeSpinBox').toInt()[0]
self.theme.font_main_line_adjustment = \
self.field(u'lineSpacingSpinBox').toInt()[0]
self.theme.font_main_outline_size = \
self.field(u'outlineSizeSpinBox').toInt()[0]
self.theme.font_main_shadow_size = \
self.field(u'shadowSizeSpinBox').toInt()[0]
- self.theme.font_main_bold = \
- self.field(u'mainBoldCheckBox').toBool()
+ self.theme.font_main_bold = self.field(u'mainBoldCheckBox').toBool()
self.theme.font_main_italics = \
self.field(u'mainItalicsCheckBox').toBool()
# footer page
self.theme.font_footer_name = \
- unicode(self.footerFontComboBox.currentFont().family())
+ self.footerFontComboBox.currentFont().family()
self.theme.font_footer_size = \
self.field(u'footerSizeSpinBox').toInt()[0]
# position page
@@ -594,7 +591,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
Lets save the theme as Finish has been triggered
"""
# 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:
critical_error_message_box(
translate('OpenLP.ThemeForm', 'Theme Name Missing'),
diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py
index bfbac5fc1..b153310d5 100644
--- a/openlp/core/ui/thememanager.py
+++ b/openlp/core/ui/thememanager.py
@@ -173,8 +173,8 @@ class ThemeManager(QtGui.QWidget):
"""
if item is None:
return
- real_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString())
- theme_name = unicode(item.text())
+ real_theme_name = item.data(QtCore.Qt.UserRole).toString()
+ theme_name = item.text()
# If default theme restrict actions
if real_theme_name == theme_name:
self.deleteToolbarAction.setVisible(True)
@@ -189,8 +189,8 @@ class ThemeManager(QtGui.QWidget):
item = self.themeListWidget.itemAt(point)
if item is None:
return
- real_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString())
- theme_name = unicode(item.text())
+ real_theme_name = item.data(QtCore.Qt.UserRole).toString()
+ theme_name = item.text()
self.deleteAction.setVisible(False)
self.renameAction.setVisible(False)
self.globalAction.setVisible(False)
@@ -211,13 +211,13 @@ class ThemeManager(QtGui.QWidget):
# reset the old name
item = self.themeListWidget.item(count)
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:
self.themeListWidget.item(count).setText(new_name)
# Set the new name
if theme_name == new_name:
- name = unicode(translate('OpenLP.ThemeManager',
- '%s (default)')) % new_name
+ name = translate('OpenLP.ThemeManager',
+ '%s (default)') % new_name
self.themeListWidget.item(count).setText(name)
self.deleteToolbarAction.setVisible(
item not in self.themeListWidget.selectedItems())
@@ -233,15 +233,14 @@ class ThemeManager(QtGui.QWidget):
item = self.themeListWidget.item(count)
old_name = item.text()
# 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(
- unicode(item.data(QtCore.Qt.UserRole).toString()))
+ item.data(QtCore.Qt.UserRole).toString())
# Set the new name
if count == selected_row:
- self.global_theme = unicode(
- self.themeListWidget.item(count).text())
- name = unicode(translate('OpenLP.ThemeManager',
- '%s (default)')) % self.global_theme
+ self.global_theme = self.themeListWidget.item(count).text()
+ name = translate('OpenLP.ThemeManager',
+ '%s (default)') % self.global_theme
self.themeListWidget.item(count).setText(name)
Settings().setValue(
self.settingsSection + u'/global theme', self.global_theme)
@@ -262,16 +261,16 @@ class ThemeManager(QtGui.QWidget):
"""
Renames an existing theme to a new name
"""
- if self._validate_theme_action(unicode(translate('OpenLP.ThemeManager',
- 'You must select a theme to rename.')),
- unicode(translate('OpenLP.ThemeManager', 'Rename Confirmation')),
- unicode(translate('OpenLP.ThemeManager', 'Rename %s theme?')),
+ if self._validate_theme_action(translate('OpenLP.ThemeManager',
+ 'You must select a theme to rename.'),
+ translate('OpenLP.ThemeManager', 'Rename Confirmation'),
+ translate('OpenLP.ThemeManager', 'Rename %s theme?'),
False, False):
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)
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:
return
if self.checkIfThemeExists(new_theme_name):
@@ -288,12 +287,12 @@ class ThemeManager(QtGui.QWidget):
Copies an existing theme to a new name
"""
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(
- unicode(translate('OpenLP.ThemeManager',
- 'Copy of %s', 'Copy of ')) % old_theme_name)
+ translate('OpenLP.ThemeManager',
+ 'Copy of %s', 'Copy of ') % old_theme_name)
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):
theme_data = self.getThemeData(old_theme_name)
self.cloneThemeData(theme_data, new_theme_name)
@@ -322,8 +321,7 @@ class ThemeManager(QtGui.QWidget):
translate('OpenLP.ThemeManager',
'You must select a theme to edit.')):
item = self.themeListWidget.currentItem()
- theme = self.getThemeData(
- unicode(item.data(QtCore.Qt.UserRole).toString()))
+ theme = self.getThemeData(item.data(QtCore.Qt.UserRole).toString())
if theme.background_type == u'image':
self.old_background_image = theme.background_filename
self.themeForm.theme = theme
@@ -334,12 +332,12 @@ class ThemeManager(QtGui.QWidget):
"""
Delete a theme
"""
- if self._validate_theme_action(unicode(translate('OpenLP.ThemeManager',
- 'You must select a theme to delete.')),
- unicode(translate('OpenLP.ThemeManager', 'Delete Confirmation')),
- unicode(translate('OpenLP.ThemeManager', 'Delete %s theme?'))):
+ if self._validate_theme_action(translate('OpenLP.ThemeManager',
+ 'You must select a theme to delete.'),
+ translate('OpenLP.ThemeManager', 'Delete Confirmation'),
+ translate('OpenLP.ThemeManager', 'Delete %s theme?')):
item = self.themeListWidget.currentItem()
- theme = unicode(item.text())
+ theme = item.text()
row = self.themeListWidget.row(item)
self.themeListWidget.takeItem(row)
self.deleteTheme(theme)
@@ -373,10 +371,9 @@ class ThemeManager(QtGui.QWidget):
critical_error_message_box(message=translate('OpenLP.ThemeManager',
'You have not selected a theme.'))
return
- theme = unicode(item.data(QtCore.Qt.UserRole).toString())
+ theme = item.data(QtCore.Qt.UserRole).toString()
path = QtGui.QFileDialog.getExistingDirectory(self,
- unicode(translate('OpenLP.ThemeManager',
- 'Save Theme - (%s)')) % theme,
+ translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme,
SettingsManager.get_last_dir(self.settingsSection, 1))
path = unicode(path)
Receiver.send_message(u'cursor_busy')
@@ -416,8 +413,8 @@ class ThemeManager(QtGui.QWidget):
files = QtGui.QFileDialog.getOpenFileNames(self,
translate('OpenLP.ThemeManager', 'Select Theme Import File'),
SettingsManager.get_last_dir(self.settingsSection),
- unicode(translate('OpenLP.ThemeManager',
- 'OpenLP Themes (*.theme *.otz)')))
+ translate('OpenLP.ThemeManager',
+ 'OpenLP Themes (*.theme *.otz)'))
log.info(u'New Themes %s', unicode(files))
if not files:
return
@@ -461,8 +458,8 @@ class ThemeManager(QtGui.QWidget):
if os.path.exists(theme):
text_name = os.path.splitext(name)[0]
if text_name == self.global_theme:
- name = unicode(translate('OpenLP.ThemeManager',
- '%s (default)')) % text_name
+ name = translate(
+ 'OpenLP.ThemeManager', '%s (default)') % text_name
else:
name = 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'')
if check_item_selected(self.themeListWidget, select_text):
item = self.themeListWidget.currentItem()
- theme = unicode(item.text())
+ theme = item.text()
# confirm deletion
if confirm:
answer = QtGui.QMessageBox.question(self, confirm_title,
@@ -778,7 +775,7 @@ class ThemeManager(QtGui.QWidget):
if answer == QtGui.QMessageBox.No:
return False
# 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(
message=translate('OpenLP.ThemeManager',
'You are unable to delete the default theme.'))
@@ -790,8 +787,8 @@ class ThemeManager(QtGui.QWidget):
critical_error_message_box(
translate('OpenLP.ThemeManager',
'Validation Error'),
- unicode(translate('OpenLP.ThemeManager',
- 'Theme %s is used in the %s plugin.')) % \
+ translate('OpenLP.ThemeManager',
+ 'Theme %s is used in the %s plugin.') % \
(theme, plugin.name))
return False
return True
diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py
index d078cfdac..7eba9ec46 100644
--- a/openlp/core/ui/themestab.py
+++ b/openlp/core/ui/themestab.py
@@ -168,7 +168,7 @@ class ThemesTab(SettingsTab):
self.theme_level = ThemeLevel.Global
def onDefaultComboBoxChanged(self, value):
- self.global_theme = unicode(self.DefaultComboBox.currentText())
+ self.global_theme = self.DefaultComboBox.currentText()
self.mainwindow.renderer.set_global_theme(
self.global_theme, self.theme_level)
self.__previewGlobalTheme()
diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py
index 500d958fd..d54ed077c 100644
--- a/openlp/core/ui/wizard.py
+++ b/openlp/core/ui/wizard.py
@@ -63,20 +63,20 @@ class WizardStrings(object):
FormatLabel = translate('OpenLP.Ui', 'Format:')
HeaderStyle = u'%s'
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')
- ImportSelectLong = unicode(translate('OpenLP.Ui',
- 'Select the import format and the location to import from.'))
+ ImportSelectLong = translate('OpenLP.Ui',
+ 'Select the import format and the location to import from.')
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 '
'importer, you will need to install the "python-sqlite" '
'module.')
- OpenTypeFile = unicode(translate('OpenLP.Ui', 'Open %s File'))
- PercentSymbolFormat = unicode(translate('OpenLP.Ui', '%p%'))
+ OpenTypeFile = translate('OpenLP.Ui', 'Open %s File')
+ PercentSymbolFormat = translate('OpenLP.Ui', '%p%')
Ready = translate('OpenLP.Ui', 'Ready.')
StartingImport = translate('OpenLP.Ui', 'Starting import...')
- YouSpecifyFile = unicode(translate('OpenLP.Ui', 'You need to specify at '
- 'least one %s file to import from.', 'A file type e.g. OpenSong'))
+ YouSpecifyFile = translate('OpenLP.Ui', 'You need to specify at '
+ 'least one %s file to import from.', 'A file type e.g. OpenSong')
class OpenLPWizard(QtGui.QWizard):
diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py
index 03078b5cb..787d903de 100644
--- a/openlp/plugins/alerts/alertsplugin.py
+++ b/openlp/plugins/alerts/alertsplugin.py
@@ -146,7 +146,7 @@ class AlertsPlugin(Plugin):
Plugin.initialise(self)
self.toolsAlertItem.setVisible(True)
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):
"""
diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py
index d494d2a4d..8f86be7b1 100644
--- a/openlp/plugins/alerts/forms/alertform.py
+++ b/openlp/plugins/alerts/forms/alertform.py
@@ -81,10 +81,10 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
self.alertListWidget.addItem(item_name)
def onDisplayClicked(self):
- self.triggerAlert(unicode(self.alertTextEdit.text()))
+ self.triggerAlert(self.alertTextEdit.text())
def onDisplayCloseClicked(self):
- if self.triggerAlert(unicode(self.alertTextEdit.text())):
+ if self.triggerAlert(self.alertTextEdit.text()):
self.close()
def onDeleteButtonClicked(self):
@@ -109,7 +109,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
'clicking New.'))
else:
alert = AlertItem()
- alert.text = unicode(self.alertTextEdit.text())
+ alert.text = self.alertTextEdit.text()
self.manager.save_object(alert)
self.alertTextEdit.setText(u'')
self.loadList()
@@ -120,14 +120,14 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
"""
if 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.item_id = None
self.loadList()
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.
if self.item_id:
@@ -141,26 +141,26 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
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]
bitem = self.alertListWidget.item(item.row())
- self.triggerAlert(unicode(bitem.text()))
- self.alertTextEdit.setText(unicode(bitem.text()))
+ self.triggerAlert(bitem.text())
+ self.alertTextEdit.setText(bitem.text())
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
self.saveButton.setEnabled(False)
def onSingleClick(self):
"""
- List item has been single clicked to add it to
- the edit field so it can be changed.
+ List item has been single clicked to add it to the edit field so it can
+ be changed.
"""
item = self.alertListWidget.selectedIndexes()[0]
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]
# 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.saveButton.setEnabled(False)
@@ -194,7 +194,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.parameterEdit.setFocus()
return False
- text = text.replace(u'<>', unicode(self.parameterEdit.text()))
+ text = text.replace(u'<>', self.parameterEdit.text())
self.plugin.alertsmanager.displayAlert(text)
return True
diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py
index 193960102..5729efcb3 100644
--- a/openlp/plugins/bibles/bibleplugin.py
+++ b/openlp/plugins/bibles/bibleplugin.py
@@ -56,11 +56,9 @@ class BiblePlugin(Plugin):
Plugin.initialise(self)
self.importBibleItem.setVisible(True)
action_list = ActionList.get_instance()
- action_list.add_action(self.importBibleItem,
- unicode(UiStrings().Import))
+ action_list.add_action(self.importBibleItem, UiStrings().Import)
# Do not add the action to the list yet.
- #action_list.add_action(self.exportBibleItem,
- # unicode(UiStrings().Export))
+ #action_list.add_action(self.exportBibleItem, UiStrings().Export)
# Set to invisible until we can export bibles
self.exportBibleItem.setVisible(False)
if self.manager.old_bible_databases:
@@ -74,8 +72,7 @@ class BiblePlugin(Plugin):
self.manager.finalise()
Plugin.finalise(self)
action_list = ActionList.get_instance()
- action_list.remove_action(self.importBibleItem,
- unicode(UiStrings().Import))
+ action_list.remove_action(self.importBibleItem, UiStrings().Import)
self.importBibleItem.setVisible(False)
#action_list.remove_action(self.exportBibleItem, UiStrings().Export)
self.exportBibleItem.setVisible(False)
diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py
index 299c7430a..736cde23b 100644
--- a/openlp/plugins/bibles/forms/bibleimportform.py
+++ b/openlp/plugins/bibles/forms/bibleimportform.py
@@ -473,9 +473,8 @@ class BibleImportForm(OpenLPWizard):
return False
return True
elif self.currentPage() == self.licenseDetailsPage:
- license_version = unicode(self.field(u'license_version').toString())
- license_copyright = \
- unicode(self.field(u'license_copyright').toString())
+ license_version = self.field(u'license_version').toString()
+ license_copyright = self.field(u'license_copyright').toString()
path = AppLocation.get_section_data_path(u'bibles')
if not license_version:
critical_error_message_box(UiStrings().EmptyField,
@@ -658,50 +657,48 @@ class BibleImportForm(OpenLPWizard):
Perform the actual import.
"""
bible_type = self.field(u'source_format').toInt()[0]
- license_version = unicode(self.field(u'license_version').toString())
- license_copyright = unicode(self.field(u'license_copyright').toString())
- license_permissions = \
- unicode(self.field(u'license_permissions').toString())
+ license_version = self.field(u'license_version').toString()
+ license_copyright = self.field(u'license_copyright').toString()
+ license_permissions = self.field(u'license_permissions').toString()
importer = None
if bible_type == BibleFormat.OSIS:
# Import an OSIS bible.
importer = self.manager.import_bible(BibleFormat.OSIS,
name=license_version,
- filename=unicode(self.field(u'osis_location').toString())
+ filename=self.field(u'osis_location').toString()
)
elif bible_type == BibleFormat.CSV:
# Import a CSV bible.
importer = self.manager.import_bible(BibleFormat.CSV,
name=license_version,
- booksfile=unicode(self.field(u'csv_booksfile').toString()),
- versefile=unicode(self.field(u'csv_versefile').toString())
+ booksfile=self.field(u'csv_booksfile').toString(),
+ versefile=self.field(u'csv_versefile').toString()
)
elif bible_type == BibleFormat.OpenSong:
# Import an OpenSong bible.
importer = self.manager.import_bible(BibleFormat.OpenSong,
name=license_version,
- filename=unicode(self.field(u'opensong_file').toString())
+ filename=self.field(u'opensong_file').toString()
)
elif bible_type == BibleFormat.WebDownload:
# Import a bible from the web.
self.progressBar.setMaximum(1)
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]
importer = self.manager.import_bible(
BibleFormat.WebDownload, name=license_version,
download_source=WebDownload.Names[download_location],
download_name=bible,
- proxy_server=unicode(self.field(u'proxy_server').toString()),
- proxy_username=\
- unicode(self.field(u'proxy_username').toString()),
- proxy_password=unicode(self.field(u'proxy_password').toString())
+ proxy_server=self.field(u'proxy_server').toString(),
+ proxy_username=self.field(u'proxy_username').toString(),
+ proxy_password=self.field(u'proxy_password').toString()
)
elif bible_type == BibleFormat.OpenLP1:
# Import an openlp.org 1.x bible.
importer = self.manager.import_bible(BibleFormat.OpenLP1,
name=license_version,
- filename=unicode(self.field(u'openlp1_location').toString())
+ filename=self.field(u'openlp1_location').toString()
)
if importer.do_import(license_version):
self.manager.save_meta_data(license_version, license_version,
diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py
index fddefec36..c87a7ead0 100644
--- a/openlp/plugins/bibles/forms/bibleupgradeform.py
+++ b/openlp/plugins/bibles/forms/bibleupgradeform.py
@@ -304,7 +304,7 @@ class BibleUpgradeForm(OpenLPWizard):
return True
elif self.currentPage() == self.backupPage:
if not self.noBackupCheckBox.checkState() == QtCore.Qt.Checked:
- backup_path = unicode(self.backupDirectoryEdit.text())
+ backup_path = self.backupDirectoryEdit.text()
if not backup_path:
critical_error_message_box(UiStrings().EmptyField,
translate('BiblesPlugin.UpgradeWizardForm',
@@ -401,9 +401,9 @@ class BibleUpgradeForm(OpenLPWizard):
old_bible = OldBibleDB(self.mediaItem, path=self.temp_dir,
file=filename[0])
name = filename[1]
- self.progressLabel.setText(unicode(translate(
+ self.progressLabel.setText(translate(
'BiblesPlugin.UpgradeWizardForm',
- 'Upgrading Bible %s of %s: "%s"\nUpgrading ...')) %
+ 'Upgrading Bible %s of %s: "%s"\nUpgrading ...') %
(number + 1, max_bibles, name))
self.newbibles[number] = BibleDB(self.mediaItem, path=self.path,
name=name, file=filename[0])
@@ -448,9 +448,9 @@ class BibleUpgradeForm(OpenLPWizard):
translate('BiblesPlugin.UpgradeWizardForm',
'To upgrade your Web Bibles an Internet connection is '
'required.'))
- self.incrementProgressBar(unicode(translate(
+ self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm',
- 'Upgrading Bible %s of %s: "%s"\nFailed')) %
+ 'Upgrading Bible %s of %s: "%s"\nFailed') %
(number + 1, max_bibles, name),
self.progressBar.maximum() - self.progressBar.value())
self.success[number] = False
@@ -468,9 +468,9 @@ class BibleUpgradeForm(OpenLPWizard):
log.warn(u'Upgrading from "%s" failed' % filename[0])
self.newbibles[number].session.close()
del self.newbibles[number]
- self.incrementProgressBar(unicode(translate(
+ self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm',
- 'Upgrading Bible %s of %s: "%s"\nFailed')) %
+ 'Upgrading Bible %s of %s: "%s"\nFailed') %
(number + 1, max_bibles, name),
self.progressBar.maximum() - self.progressBar.value())
self.success[number] = False
@@ -480,10 +480,10 @@ class BibleUpgradeForm(OpenLPWizard):
if self.stop_import_flag:
self.success[number] = False
break
- self.incrementProgressBar(unicode(translate(
+ self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\n'
- 'Upgrading %s ...')) %
+ 'Upgrading %s ...') %
(number + 1, max_bibles, name, book))
book_ref_id = self.newbibles[number].\
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)
self.newbibles[number].session.close()
del self.newbibles[number]
- self.incrementProgressBar(unicode(translate(
+ self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm',
- 'Upgrading Bible %s of %s: "%s"\nFailed')) %
+ 'Upgrading Bible %s of %s: "%s"\nFailed') %
(number + 1, max_bibles, name),
self.progressBar.maximum() - self.progressBar.value())
self.success[number] = False
@@ -538,10 +538,10 @@ class BibleUpgradeForm(OpenLPWizard):
if self.stop_import_flag:
self.success[number] = False
break
- self.incrementProgressBar(unicode(translate(
+ self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\n'
- 'Upgrading %s ...')) %
+ 'Upgrading %s ...') %
(number + 1, max_bibles, name, book[u'name']))
book_ref_id = self.newbibles[number].\
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')
self.newbibles[number].session.commit()
if not self.success.get(number, True):
- self.incrementProgressBar(unicode(translate(
+ self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm',
- 'Upgrading Bible %s of %s: "%s"\nFailed')) %
+ 'Upgrading Bible %s of %s: "%s"\nFailed') %
(number + 1, max_bibles, name),
self.progressBar.maximum() - self.progressBar.value())
else:
self.success[number] = True
self.newbibles[number].save_meta(u'name', name)
- self.incrementProgressBar(unicode(translate(
+ self.incrementProgressBar(translate(
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\n'
- 'Complete')) %
+ 'Complete') %
(number + 1, max_bibles, name))
if number in self.newbibles:
self.newbibles[number].session.close()
@@ -607,23 +607,22 @@ class BibleUpgradeForm(OpenLPWizard):
# Copy not upgraded bible back.
shutil.move(os.path.join(self.temp_dir, filename[0]), self.path)
if failed_import > 0:
- failed_import_text = unicode(translate(
- 'BiblesPlugin.UpgradeWizardForm',
- ', %s failed')) % failed_import
+ failed_import_text = translate('BiblesPlugin.UpgradeWizardForm',
+ ', %s failed') % failed_import
else:
failed_import_text = u''
if successful_import > 0:
if self.includeWebBible:
- self.progressLabel.setText(unicode(
+ self.progressLabel.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading '
'Bible(s): %s successful%s\nPlease note that verses from '
'Web Bibles will be downloaded on demand and so an '
- 'Internet connection is required.')) %
+ 'Internet connection is required.') %
(successful_import, failed_import_text))
else:
- self.progressLabel.setText(unicode(
+ self.progressLabel.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading '
- 'Bible(s): %s successful%s')) % (successful_import,
+ 'Bible(s): %s successful%s') % (successful_import,
failed_import_text))
else:
self.progressLabel.setText(translate(
diff --git a/openlp/plugins/bibles/forms/booknameform.py b/openlp/plugins/bibles/forms/booknameform.py
index 493dc9c1d..690d77d48 100644
--- a/openlp/plugins/bibles/forms/booknameform.py
+++ b/openlp/plugins/bibles/forms/booknameform.py
@@ -125,7 +125,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
self.correspondingComboBox.setFocus()
return False
else:
- cor_book = unicode(self.correspondingComboBox.currentText())
+ cor_book = self.correspondingComboBox.currentText()
for character in u'\\.^$*+?{}[]()':
cor_book = cor_book.replace(character, u'\\' + character)
books = filter(lambda key:
diff --git a/openlp/plugins/bibles/forms/editbibleform.py b/openlp/plugins/bibles/forms/editbibleform.py
index 87ad86200..2c828ac23 100644
--- a/openlp/plugins/bibles/forms/editbibleform.py
+++ b/openlp/plugins/bibles/forms/editbibleform.py
@@ -116,9 +116,9 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
Exit Dialog and save data
"""
log.debug(u'BibleEditForm.accept')
- version = unicode(self.versionNameEdit.text())
- copyright = unicode(self.copyrightEdit.text())
- permissions = unicode(self.permissionsEdit.text())
+ version = self.versionNameEdit.text()
+ copyright = self.copyrightEdit.text()
+ permissions = self.permissionsEdit.text()
book_name_language = self.languageSelectionComboBox.currentIndex() - 1
if book_name_language == -1:
book_name_language = None
@@ -128,7 +128,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
custom_names = {}
for abbr, book in self.books.iteritems():
if book:
- custom_names[abbr] = unicode(self.bookNameEdit[abbr].text())
+ custom_names[abbr] = self.bookNameEdit[abbr].text()
if book.name != custom_names[abbr]:
if not self.validateBook(custom_names[abbr], abbr):
return
@@ -183,29 +183,29 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
if not new_book_name:
self.bookNameEdit[abbreviation].setFocus()
critical_error_message_box(UiStrings().EmptyField,
- unicode(translate('BiblesPlugin.BibleEditForm',
- 'You need to specify a book name for "%s".')) %
+ translate('BiblesPlugin.BibleEditForm',
+ 'You need to specify a book name for "%s".') %
self.book_names[abbreviation])
return False
elif not book_regex.match(new_book_name):
self.bookNameEdit[abbreviation].setFocus()
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 '
'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
for abbr, book in self.books.iteritems():
if book:
if abbr == abbreviation:
continue
- if unicode(self.bookNameEdit[abbr].text()) == new_book_name:
+ if self.bookNameEdit[abbr].text() == new_book_name:
self.bookNameEdit[abbreviation].setFocus()
critical_error_message_box(
translate('BiblesPlugin.BibleEditForm',
'Duplicate Book Name'),
- unicode(translate('BiblesPlugin.BibleEditForm',
- 'The Book Name "%s" has been entered more than once.'))
+ translate('BiblesPlugin.BibleEditForm',
+ 'The Book Name "%s" has been entered more than once.')
% new_book_name)
return False
return True
diff --git a/openlp/plugins/bibles/lib/__init__.py b/openlp/plugins/bibles/lib/__init__.py
index 3543c10a5..1148294c6 100644
--- a/openlp/plugins/bibles/lib/__init__.py
+++ b/openlp/plugins/bibles/lib/__init__.py
@@ -181,10 +181,10 @@ def update_reference_separators():
Updates separators and matches for parsing and formating scripture
references.
"""
- default_separators = unicode(translate('BiblesPlugin',
+ default_separators = translate('BiblesPlugin',
':|v|V|verse|verses;;-|to;;,|and;;end',
'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.beginGroup(u'bibles')
custom_separators = [
diff --git a/openlp/plugins/bibles/lib/csvbible.py b/openlp/plugins/bibles/lib/csvbible.py
index cd4b921a1..99bd5d6a5 100644
--- a/openlp/plugins/bibles/lib/csvbible.py
+++ b/openlp/plugins/bibles/lib/csvbible.py
@@ -107,9 +107,9 @@ class CSVBible(BibleDB):
for line in books_reader:
if self.stop_import_flag:
break
- self.wizard.incrementProgressBar(unicode(
+ self.wizard.incrementProgressBar(
translate('BiblesPlugin.CSVBible',
- 'Importing books... %s')) %
+ 'Importing books... %s') %
unicode(line[2], details['encoding']))
book_ref_id = self.get_book_ref_id_by_name(
unicode(line[2], details['encoding']), 67, language_id)
@@ -151,9 +151,9 @@ class CSVBible(BibleDB):
if book_ptr != line_book:
book = self.get_book(line_book)
book_ptr = book.name
- self.wizard.incrementProgressBar(unicode(translate(
+ self.wizard.incrementProgressBar(translate(
'BiblesPlugin.CSVBible', 'Importing verses from %s...',
- 'Importing verses from ...')) % book.name)
+ 'Importing verses from ...') % book.name)
self.session.commit()
try:
verse_text = unicode(line[3], details['encoding'])
diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py
index fb79b26e1..deb531bf8 100644
--- a/openlp/plugins/bibles/lib/http.py
+++ b/openlp/plugins/bibles/lib/http.py
@@ -398,9 +398,9 @@ class HTTPBible(BibleDB):
``True`` on success, ``False`` on failure.
"""
self.wizard.progressBar.setMaximum(68)
- self.wizard.incrementProgressBar(unicode(translate(
+ self.wizard.incrementProgressBar(translate(
'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_name', self.download_name)
if self.proxy_server:
@@ -423,8 +423,8 @@ class HTTPBible(BibleDB):
'failed' % (self.download_source, self.download_name))
return False
self.wizard.progressBar.setMaximum(len(books)+2)
- self.wizard.incrementProgressBar(unicode(translate(
- 'BiblesPlugin.HTTPBible', 'Registering Language...')))
+ self.wizard.incrementProgressBar(translate(
+ 'BiblesPlugin.HTTPBible', 'Registering Language...'))
bible = BiblesResourcesDB.get_webbible(self.download_name,
self.download_source.lower())
if bible[u'language_id']:
@@ -439,9 +439,9 @@ class HTTPBible(BibleDB):
for book in books:
if self.stop_import_flag:
break
- self.wizard.incrementProgressBar(unicode(translate(
+ self.wizard.incrementProgressBar(translate(
'BiblesPlugin.HTTPBible', 'Importing %s...',
- 'Importing ...')) % book)
+ 'Importing ...') % book)
book_ref_id = self.get_book_ref_id_by_name(book, len(books),
language_id)
if not book_ref_id:
diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py
index c2091895a..1008c5570 100644
--- a/openlp/plugins/bibles/lib/manager.py
+++ b/openlp/plugins/bibles/lib/manager.py
@@ -348,7 +348,7 @@ class BibleManager(object):
Receiver.send_message(u'openlp_information_message', {
u'title': translate('BiblesPlugin.BibleManager',
'Scripture Reference Error'),
- u'message': unicode(translate('BiblesPlugin.BibleManager',
+ u'message': translate('BiblesPlugin.BibleManager',
'Your scripture reference is either not supported by '
'OpenLP or is invalid. Please make sure your reference '
'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',
'Please pay attention to the appended "s" of the wildcards '
'and refrain from translating the words inside the '
- 'names in the brackets.')) % reference_seperators
+ 'names in the brackets.') % reference_seperators
})
return None
diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py
index 2778ee42b..4faa1bc37 100644
--- a/openlp/plugins/bibles/lib/mediaitem.py
+++ b/openlp/plugins/bibles/lib/mediaitem.py
@@ -422,7 +422,7 @@ class BibleMediaItem(MediaManagerItem):
"""
log.debug(u'initialiseAdvancedBible %s, %s', bible, last_book_id)
book_data = self.plugin.manager.get_books(bible)
- secondbible = unicode(self.advancedSecondComboBox.currentText())
+ secondbible = self.advancedSecondComboBox.currentText()
if secondbible != u'':
secondbook_data = self.plugin.manager.get_books(secondbible)
book_data_temp = []
@@ -504,10 +504,10 @@ class BibleMediaItem(MediaManagerItem):
# We have to do a 'Reference Search'.
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
bibles = self.plugin.manager.get_bibles()
- bible = unicode(self.quickVersionComboBox.currentText())
+ bible = self.quickVersionComboBox.currentText()
if bible:
book_data = bibles[bible].get_books()
- secondbible = unicode(self.quickSecondComboBox.currentText())
+ secondbible = self.quickSecondComboBox.currentText()
if secondbible != u'':
secondbook_data = bibles[secondbible].get_books()
book_data_temp = []
@@ -546,9 +546,9 @@ class BibleMediaItem(MediaManagerItem):
def onEditClick(self):
if self.quickTab.isVisible():
- bible = unicode(self.quickVersionComboBox.currentText())
+ bible = self.quickVersionComboBox.currentText()
elif self.advancedTab.isVisible():
- bible = unicode(self.advancedVersionComboBox.currentText())
+ bible = self.advancedVersionComboBox.currentText()
if bible:
self.editBibleForm = EditBibleForm(self, self.plugin.formParent,
self.plugin.manager)
@@ -558,13 +558,13 @@ class BibleMediaItem(MediaManagerItem):
def onDeleteClick(self):
if self.quickTab.isVisible():
- bible = unicode(self.quickVersionComboBox.currentText())
+ bible = self.quickVersionComboBox.currentText()
elif self.advancedTab.isVisible():
- bible = unicode(self.advancedVersionComboBox.currentText())
+ bible = self.advancedVersionComboBox.currentText()
if bible:
if QtGui.QMessageBox.question(self, UiStrings().ConfirmDelete,
- unicode(translate('BiblesPlugin.MediaItem',
- 'Are you sure you want to delete "%s"?')) % bible,
+ translate('BiblesPlugin.MediaItem',
+ 'Are you sure you want to delete "%s"?') % bible,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
@@ -609,31 +609,30 @@ class BibleMediaItem(MediaManagerItem):
def onAdvancedVersionComboBox(self):
Settings().setValue(self.settingsSection + u'/advanced bible',
self.advancedVersionComboBox.currentText())
- self.initialiseAdvancedBible(
- unicode(self.advancedVersionComboBox.currentText()),
+ self.initialiseAdvancedBible(self.advancedVersionComboBox.currentText(),
self.advancedBookComboBox.itemData(
int(self.advancedBookComboBox.currentIndex())))
def onAdvancedSecondComboBox(self):
self.initialiseAdvancedBible(
- unicode(self.advancedVersionComboBox.currentText()),
+ self.advancedVersionComboBox.currentText(),
self.advancedBookComboBox.itemData(
int(self.advancedBookComboBox.currentIndex())))
def onAdvancedBookComboBox(self):
item = int(self.advancedBookComboBox.currentIndex())
self.initialiseChapterVerse(
- unicode(self.advancedVersionComboBox.currentText()),
- unicode(self.advancedBookComboBox.currentText()),
- unicode(self.advancedBookComboBox.itemData(item).toString()))
+ self.advancedVersionComboBox.currentText(),
+ self.advancedBookComboBox.currentText(),
+ self.advancedBookComboBox.itemData(item).toString())
def onAdvancedFromVerse(self):
chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.advancedToChapter.currentText())
if chapter_from == chapter_to:
- bible = unicode(self.advancedVersionComboBox.currentText())
- book_ref_id = unicode(self.advancedBookComboBox.itemData(
- int(self.advancedBookComboBox.currentIndex())).toString())
+ bible = self.advancedVersionComboBox.currentText()
+ book_ref_id = self.advancedBookComboBox.itemData(
+ int(self.advancedBookComboBox.currentIndex())).toString()
verse_from = int(self.advancedFromVerse.currentText())
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(
bible, book_ref_id, chapter_to)
@@ -641,9 +640,9 @@ class BibleMediaItem(MediaManagerItem):
self.advancedToVerse, True)
def onAdvancedToChapter(self):
- bible = unicode(self.advancedVersionComboBox.currentText())
- book_ref_id = unicode(self.advancedBookComboBox.itemData(
- int(self.advancedBookComboBox.currentIndex())).toString())
+ bible = self.advancedVersionComboBox.currentText()
+ book_ref_id = self.advancedBookComboBox.itemData(
+ int(self.advancedBookComboBox.currentIndex())).toString()
chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.advancedToChapter.currentText())
verse_from = int(self.advancedFromVerse.currentText())
@@ -656,9 +655,9 @@ class BibleMediaItem(MediaManagerItem):
self.adjustComboBox(1, verse_count, self.advancedToVerse)
def onAdvancedFromChapter(self):
- bible = unicode(self.advancedVersionComboBox.currentText())
- book_ref_id = unicode(self.advancedBookComboBox.itemData(
- int(self.advancedBookComboBox.currentIndex())).toString())
+ bible = self.advancedVersionComboBox.currentText()
+ book_ref_id = self.advancedBookComboBox.itemData(
+ int(self.advancedBookComboBox.currentIndex())).toString()
chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.advancedToChapter.currentText())
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)
if restore:
- old_text = unicode(combo.currentText())
+ old_text = combo.currentText()
combo.clear()
combo.addItems(map(unicode, range(range_from, range_to + 1)))
if restore and combo.findText(old_text) != -1:
@@ -708,11 +707,11 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'Advanced Search Button clicked')
self.advancedSearchButton.setEnabled(False)
Receiver.send_message(u'openlp_process_events')
- bible = unicode(self.advancedVersionComboBox.currentText())
- second_bible = unicode(self.advancedSecondComboBox.currentText())
- book = unicode(self.advancedBookComboBox.currentText())
- book_ref_id = unicode(self.advancedBookComboBox.itemData(
- int(self.advancedBookComboBox.currentIndex())).toString())
+ bible = self.advancedVersionComboBox.currentText()
+ second_bible = self.advancedSecondComboBox.currentText()
+ book = self.advancedBookComboBox.currentText()
+ book_ref_id = self.advancedBookComboBox.itemData(
+ int(self.advancedBookComboBox.currentIndex())).toString()
chapter_from = self.advancedFromChapter.currentText()
chapter_to = self.advancedToChapter.currentText()
verse_from = self.advancedFromVerse.currentText()
@@ -747,9 +746,9 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'Quick Search Button clicked')
self.quickSearchButton.setEnabled(False)
Receiver.send_message(u'openlp_process_events')
- bible = unicode(self.quickVersionComboBox.currentText())
- second_bible = unicode(self.quickSecondComboBox.currentText())
- text = unicode(self.quickSearchEdit.text())
+ bible = self.quickVersionComboBox.currentText()
+ second_bible = self.quickSecondComboBox.currentText()
+ text = self.quickSearchEdit.text()
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
# We are doing a 'Reference Search'.
self.search_results = self.plugin.manager.get_verses(bible, text)
@@ -784,11 +783,11 @@ class BibleMediaItem(MediaManagerItem):
if passage_not_found:
QtGui.QMessageBox.information(self,
translate('BiblesPlugin.MediaItem', 'Information'),
- unicode(translate('BiblesPlugin.MediaItem',
+ translate('BiblesPlugin.MediaItem',
'The second Bible does not contain all the verses '
'that are in the main Bible. Only verses found in both '
'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))
self.search_results = new_search_results
self.second_search_results = \
@@ -1083,7 +1082,7 @@ class BibleMediaItem(MediaManagerItem):
"""
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,
showError)
if search_results:
@@ -1093,7 +1092,7 @@ class BibleMediaItem(MediaManagerItem):
def createItemFromId(self, item_id):
item = QtGui.QListWidgetItem()
- bible = unicode(self.quickVersionComboBox.currentText())
+ bible = self.quickVersionComboBox.currentText()
search_results = self.plugin.manager.get_verses(bible, item_id, False)
items = self.buildDisplayResults(bible, u'', search_results)
return items
diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py
index 856e9057e..180e6032f 100644
--- a/openlp/plugins/bibles/lib/opensong.py
+++ b/openlp/plugins/bibles/lib/opensong.py
@@ -90,9 +90,9 @@ class OpenSongBible(BibleDB):
int(chapter.attrib[u'n'].split()[-1]),
int(verse.attrib[u'n']),
unicode(verse.text))
- self.wizard.incrementProgressBar(unicode(translate(
+ self.wizard.incrementProgressBar(translate(
'BiblesPlugin.Opensong', 'Importing %s %s...',
- 'Importing ...')) %
+ 'Importing ...') %
(db_book.name, int(chapter.attrib[u'n'].split()[-1])))
self.session.commit()
Receiver.send_message(u'openlp_process_events')
diff --git a/openlp/plugins/bibles/lib/osis.py b/openlp/plugins/bibles/lib/osis.py
index 7300bd032..5a2fb53cd 100644
--- a/openlp/plugins/bibles/lib/osis.py
+++ b/openlp/plugins/bibles/lib/osis.py
@@ -101,7 +101,7 @@ class OSISBible(BibleDB):
osis = codecs.open(self.filename, u'r', details['encoding'])
repl = replacement
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
if lines_in_file < 11500:
book_count = 27
@@ -157,9 +157,9 @@ class OSISBible(BibleDB):
if last_chapter != chapter:
if last_chapter != 0:
self.session.commit()
- self.wizard.incrementProgressBar(unicode(translate(
+ self.wizard.incrementProgressBar(translate(
'BiblesPlugin.OsisImport', 'Importing %s %s...',
- 'Importing ...')) %
+ 'Importing ...') %
(book_details[u'name'], chapter))
last_chapter = chapter
# All of this rigmarol below is because the mod2osis
diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py
index afa96d237..4ef083c51 100644
--- a/openlp/plugins/custom/forms/editcustomform.py
+++ b/openlp/plugins/custom/forms/editcustomform.py
@@ -129,12 +129,12 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
count = 1
for i in range(self.slideListView.count()):
sxml.add_verse_to_lyrics(u'custom', unicode(count),
- unicode(self.slideListView.item(i).text()))
+ self.slideListView.item(i).text())
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.credits = unicode(self.creditEdit.text())
- self.customSlide.theme_name = unicode(self.themeComboBox.currentText())
+ self.customSlide.credits = self.creditEdit.text()
+ self.customSlide.theme_name = self.themeComboBox.currentText()
success = self.manager.save_object(self.customSlide)
self.mediaitem.autoSelectId = self.customSlide.id
return success
diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py
index bea2858d8..338dd7201 100644
--- a/openlp/plugins/custom/lib/mediaitem.py
+++ b/openlp/plugins/custom/lib/mediaitem.py
@@ -229,7 +229,7 @@ class CustomMediaItem(MediaManagerItem):
Settings().setValue(u'%s/last search type' %
self.settingsSection, self.searchTextEdit.currentSearchType())
# Reload the list considering the new search type.
- search_keywords = unicode(self.searchTextEdit.displayText())
+ search_keywords = self.searchTextEdit.displayText()
search_results = []
search_type = self.searchTextEdit.currentSearchType()
if search_type == CustomSearch.Titles:
diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py
index 56f8203e7..b318ed55d 100644
--- a/openlp/plugins/images/lib/mediaitem.py
+++ b/openlp/plugins/images/lib/mediaitem.py
@@ -110,8 +110,7 @@ class ImageMediaItem(MediaManagerItem):
for row in row_list:
text = self.listView.item(row)
if text:
- delete_file(os.path.join(self.servicePath,
- unicode(text.text())))
+ delete_file(os.path.join(self.servicePath, text.text()))
self.listView.takeItem(row)
self.plugin.formParent.incrementProgressBar()
SettingsManager.set_list(self.settingsSection,
@@ -169,7 +168,7 @@ class ImageMediaItem(MediaManagerItem):
missing_items = []
missing_items_filenames = []
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):
missing_items.append(bitem)
missing_items_filenames.append(filename)
@@ -180,22 +179,22 @@ class ImageMediaItem(MediaManagerItem):
if not remote:
critical_error_message_box(
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
- unicode(translate('ImagePlugin.MediaItem',
- 'The following image(s) no longer exist: %s')) %
+ translate('ImagePlugin.MediaItem',
+ 'The following image(s) no longer exist: %s') %
u'\n'.join(missing_items_filenames))
return False
# We have missing as well as existing images. We ask what to do.
elif missing_items and QtGui.QMessageBox.question(self,
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 '
- 'images anyway?')) % u'\n'.join(missing_items_filenames),
+ 'images anyway?') % u'\n'.join(missing_items_filenames),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
return False
# Continue with the existing images.
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]
service_item.add_from_image(filename, name, background)
return True
@@ -224,7 +223,7 @@ class ImageMediaItem(MediaManagerItem):
self.settingsSection + u'/background color', u'#000000'))
item = self.listView.selectedIndexes()[0]
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):
name = os.path.split(filename)[1]
if self.plugin.liveController.display.directImage(name,
@@ -236,9 +235,9 @@ class ImageMediaItem(MediaManagerItem):
'There was no display item to amend.'))
else:
critical_error_message_box(UiStrings().LiveBGError,
- unicode(translate('ImagePlugin.MediaItem',
+ translate('ImagePlugin.MediaItem',
'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):
files = SettingsManager.load_list(self.settingsSection, u'images')
diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py
index efe045a02..15cd5e6aa 100644
--- a/openlp/plugins/media/lib/mediaitem.py
+++ b/openlp/plugins/media/lib/mediaitem.py
@@ -94,16 +94,15 @@ class MediaMediaItem(MediaManagerItem):
def retranslateUi(self):
self.onNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
- self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
- 'Videos (%s);;Audio (%s);;%s (*)')) % (
+ self.onNewFileMasks = translate('MediaPlugin.MediaItem',
+ 'Videos (%s);;Audio (%s);;%s (*)') % (
u' '.join(self.plugin.video_extensions_list),
u' '.join(self.plugin.audio_extensions_list), UiStrings().AllFiles)
self.replaceAction.setText(UiStrings().ReplaceBG)
self.replaceAction.setToolTip(UiStrings().ReplaceLiveBG)
self.resetAction.setText(UiStrings().ResetBG)
self.resetAction.setToolTip(UiStrings().ResetLiveBG)
- self.automatic = translate('MediaPlugin.MediaItem',
- 'Automatic')
+ self.automatic = translate('MediaPlugin.MediaItem', 'Automatic')
self.displayTypeLabel.setText(
translate('MediaPlugin.MediaItem', 'Use Player:'))
@@ -171,7 +170,7 @@ class MediaMediaItem(MediaManagerItem):
translate('MediaPlugin.MediaItem',
'You must select a media file to replace the background with.')):
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 self.plugin.liveController.mediaController.video( \
self.plugin.liveController, filename, True, True):
@@ -182,9 +181,9 @@ class MediaMediaItem(MediaManagerItem):
'There was no display item to amend.'))
else:
critical_error_message_box(UiStrings().LiveBGError,
- unicode(translate('MediaPlugin.MediaItem',
+ translate('MediaPlugin.MediaItem',
'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,
remote=False):
@@ -192,14 +191,14 @@ class MediaMediaItem(MediaManagerItem):
item = self.listView.currentItem()
if item is None:
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 remote:
# File is no longer present
critical_error_message_box(
translate('MediaPlugin.MediaItem', 'Missing Media File'),
- unicode(translate('MediaPlugin.MediaItem',
- 'The file %s no longer exists.')) % filename)
+ translate('MediaPlugin.MediaItem',
+ 'The file %s no longer exists.') % filename)
return False
self.mediaLength = 0
if self.plugin.mediaController.video( \
@@ -234,8 +233,8 @@ class MediaMediaItem(MediaManagerItem):
the settings
"""
self.populateDisplayTypes()
- self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
- 'Videos (%s);;Audio (%s);;%s (*)')) % (
+ self.onNewFileMasks = translate('MediaPlugin.MediaItem',
+ 'Videos (%s);;Audio (%s);;%s (*)') % (
u' '.join(self.plugin.video_extensions_list),
u' '.join(self.plugin.audio_extensions_list), UiStrings().AllFiles)
diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py
index df17bfca6..4fefb23c7 100644
--- a/openlp/plugins/media/lib/mediatab.py
+++ b/openlp/plugins/media/lib/mediatab.py
@@ -122,9 +122,8 @@ class MediaTab(SettingsTab):
if player.available:
checkbox.setText(player.display_name)
else:
- checkbox.setText(
- unicode(translate('MediaPlugin.MediaTab',
- '%s (unavailable)')) % player.display_name)
+ checkbox.setText(translate('MediaPlugin.MediaTab',
+ '%s (unavailable)') % player.display_name)
self.playerOrderGroupBox.setTitle(
translate('MediaPlugin.MediaTab', 'Player Order'))
self.advancedGroupBox.setTitle(UiStrings().Advanced)
diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py
index 76897c355..1bfb4f123 100644
--- a/openlp/plugins/presentations/lib/mediaitem.py
+++ b/openlp/plugins/presentations/lib/mediaitem.py
@@ -87,8 +87,8 @@ class PresentationMediaItem(MediaManagerItem):
if fileType.find(type) == -1:
fileType += u'*.%s ' % type
self.plugin.serviceManager.supportedSuffixes(type)
- self.onNewFileMasks = unicode(translate('PresentationPlugin.MediaItem',
- 'Presentations (%s)')) % fileType
+ self.onNewFileMasks = translate('PresentationPlugin.MediaItem',
+ 'Presentations (%s)') % fileType
def requiredIcons(self):
"""
@@ -258,15 +258,15 @@ class PresentationMediaItem(MediaManagerItem):
items = self.listView.selectedItems()
if len(items) > 1:
return False
- service_item.title = unicode(self.displayTypeComboBox.currentText())
- service_item.shortname = unicode(self.displayTypeComboBox.currentText())
+ service_item.title = self.displayTypeComboBox.currentText()
+ service_item.shortname = self.displayTypeComboBox.currentText()
service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay)
shortname = service_item.shortname
if not shortname:
return False
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 shortname == self.Automatic:
service_item.shortname = self.findControllerByType(filename)
@@ -292,10 +292,9 @@ class PresentationMediaItem(MediaManagerItem):
critical_error_message_box(
translate('PresentationPlugin.MediaItem',
'Missing Presentation'),
- unicode(translate(
- 'PresentationPlugin.MediaItem',
+ translate('PresentationPlugin.MediaItem',
'The presentation %s is incomplete,'
- ' please reload.')) % filename)
+ ' please reload.') % filename)
return False
else:
# File is no longer present
@@ -303,8 +302,8 @@ class PresentationMediaItem(MediaManagerItem):
critical_error_message_box(
translate('PresentationPlugin.MediaItem',
'Missing Presentation'),
- unicode(translate('PresentationPlugin.MediaItem',
- 'The presentation %s no longer exists.')) % filename)
+ translate('PresentationPlugin.MediaItem',
+ 'The presentation %s no longer exists.') % filename)
return False
def findControllerByType(self, filename):
diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py
index 5338eb132..6c972fed1 100644
--- a/openlp/plugins/presentations/lib/presentationtab.py
+++ b/openlp/plugins/presentations/lib/presentationtab.py
@@ -92,8 +92,8 @@ class PresentationTab(SettingsTab):
checkbox.setText(controller.name)
else:
checkbox.setText(
- unicode(translate('PresentationPlugin.PresentationTab',
- '%s (unavailable)')) % controller.name)
+ translate('PresentationPlugin.PresentationTab',
+ '%s (unavailable)') % controller.name)
def load(self):
"""
diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py
index 0bcf60b07..cda715d77 100644
--- a/openlp/plugins/songs/forms/editsongform.py
+++ b/openlp/plugins/songs/forms/editsongform.py
@@ -336,7 +336,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
row_label = []
for row in range(self.verseListWidget.rowCount()):
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])
row_def = u'%s%s' % (verse_tag, verse_def[1:])
row_label.append(row_def)
@@ -346,7 +346,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def onAuthorAddButtonClicked(self):
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
# the QCompleter autocompletion class. See bug #812628.
if text in self.authors:
@@ -409,7 +409,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def onTopicAddButtonClicked(self):
item = int(self.topicsComboBox.currentIndex())
- text = unicode(self.topicsComboBox.currentText())
+ text = self.topicsComboBox.currentText()
if item == 0 and text:
if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Topic'),
@@ -479,7 +479,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
item = self.verseListWidget.currentItem()
if item:
tempText = item.text()
- verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
+ verseId = item.data(QtCore.Qt.UserRole).toString()
self.verseForm.setVerse(tempText, True, verseId)
if self.verseForm.exec_():
after_text, verse_tag, verse_num = self.verseForm.getVerse()
@@ -509,7 +509,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if self.verseListWidget.rowCount() > 0:
for row in range(self.verseListWidget.rowCount()):
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_num = field[1:]
verse_list += u'---[%s:%s]---\n' % (verse_tag, verse_num)
@@ -576,7 +576,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
order = self.__extractVerseOrder(text)
for index in range(self.verseListWidget.rowCount()):
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:
verses.append(verse)
verse_names.append(u'%s%s' % (
@@ -617,7 +617,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
order = self.__extractVerseOrder(verse_order)
for index in range(verse_count):
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:
verses.append(verse)
verse_names.append(u'%s%s' % (
@@ -628,15 +628,15 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if invalid_verses:
valid = create_separated_list(verse_names)
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. '
'There are no verses corresponding to %s. Valid entries '
- 'are %s.')) % (u', '.join(invalid_verses), valid))
+ 'are %s.') % (u', '.join(invalid_verses), valid))
else:
- critical_error_message_box(message=unicode(translate(
+ critical_error_message_box(message=translate(
'SongsPlugin.EditSongForm', 'The verse order is invalid. '
'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
def __validateSong(self):
@@ -673,7 +673,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.verseListWidget.rowCount())
if not result:
return False
- text = unicode(self.songBookComboBox.currentText())
+ text = self.songBookComboBox.currentText()
if self.songBookComboBox.findText(text, QtCore.Qt.MatchExactly) < 0:
if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Book'),
@@ -699,7 +699,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def onMaintenanceButtonClicked(self):
temp_song_book = None
item = int(self.songBookComboBox.currentIndex())
- text = unicode(self.songBookComboBox.currentText())
+ text = self.songBookComboBox.currentText()
if item == 0 and text:
temp_song_book = text
self.mediaitem.songMaintenanceForm.exec_()
@@ -718,7 +718,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
A button (QPushButton).
"""
log.debug(u'onPreview')
- if unicode(button.objectName()) == u'previewButton':
+ if button.objectName() == u'previewButton':
self.saveSong(True)
Receiver.send_message(u'songs_preview')
@@ -826,30 +826,30 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
# Song() is in a partially complete state.
if not self.song:
self.song = Song()
- self.song.title = unicode(self.titleEdit.text())
- self.song.alternate_title = unicode(self.alternativeEdit.text())
- self.song.copyright = unicode(self.copyrightEdit.text())
+ self.song.title = self.titleEdit.text()
+ self.song.alternate_title = self.alternativeEdit.text()
+ self.song.copyright = self.copyrightEdit.text()
# Values will be set when cleaning the song.
self.song.search_title = u''
self.song.search_lyrics = u''
self.song.verse_order = u''
- self.song.comments = unicode(self.commentsEdit.toPlainText())
- ordertext = unicode(self.verseOrderEdit.text())
+ self.song.comments = self.commentsEdit.toPlainText()
+ ordertext = self.verseOrderEdit.text()
order = []
for item in ordertext.split():
verse_tag = VerseType.Tags[VerseType.from_translated_tag(item[0])]
verse_num = item[1:].lower()
order.append(u'%s%s' % (verse_tag, verse_num))
self.song.verse_order = u' '.join(order)
- self.song.ccli_number = unicode(self.CCLNumberEdit.text())
- self.song.song_number = unicode(self.songBookNumberEdit.text())
- book_name = unicode(self.songBookComboBox.currentText())
+ self.song.ccli_number = self.CCLNumberEdit.text()
+ self.song.song_number = self.songBookNumberEdit.text()
+ book_name = self.songBookComboBox.currentText()
if book_name:
self.song.book = self.manager.get_object_filtered(Book,
Book.name == book_name)
else:
self.song.book = None
- theme_name = unicode(self.themeComboBox.currentText())
+ theme_name = self.themeComboBox.currentText()
if theme_name:
self.song.theme_name = theme_name
else:
@@ -879,7 +879,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
files = []
for row in xrange(self.audioListWidget.count()):
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):
oldfile, filename = filename, os.path.join(save_path,
os.path.split(filename)[1])
@@ -916,11 +916,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
multiple = []
for i in range(self.verseListWidget.rowCount()):
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_num = verseId[1:]
- sxml.add_verse_to_lyrics(verse_tag, verse_num,
- unicode(item.text()))
+ sxml.add_verse_to_lyrics(verse_tag, verse_num, item.text())
if verse_num > u'1' and verse_tag not in multiple:
multiple.append(verse_tag)
self.song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
diff --git a/openlp/plugins/songs/forms/editverseform.py b/openlp/plugins/songs/forms/editverseform.py
index 21285f39d..172f7ad49 100644
--- a/openlp/plugins/songs/forms/editverseform.py
+++ b/openlp/plugins/songs/forms/editverseform.py
@@ -96,7 +96,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
and the cursor's position.
"""
position = self.verseTextEdit.textCursor().position()
- text = unicode(self.verseTextEdit.toPlainText())
+ text = self.verseTextEdit.toPlainText()
verse_name = VerseType.TranslatedNames[
self.verseTypeComboBox.currentIndex()]
if not text:
@@ -126,7 +126,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
position and adjusts the ComboBox and SpinBox to these values.
"""
position = self.verseTextEdit.textCursor().position()
- text = unicode(self.verseTextEdit.toPlainText())
+ text = self.verseTextEdit.toPlainText()
if not text:
return
if text.rfind(u'[', 0, position) > text.rfind(u']', 0, position) and \
diff --git a/openlp/plugins/songs/forms/mediafilesform.py b/openlp/plugins/songs/forms/mediafilesform.py
index db40eea63..49fcc0137 100644
--- a/openlp/plugins/songs/forms/mediafilesform.py
+++ b/openlp/plugins/songs/forms/mediafilesform.py
@@ -52,6 +52,6 @@ class MediaFilesForm(QtGui.QDialog, Ui_MediaFilesDialog):
self.fileListWidget.addItem(item)
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())
diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py
index 498191f53..f213bc27d 100644
--- a/openlp/plugins/songs/forms/songexportform.py
+++ b/openlp/plugins/songs/forms/songexportform.py
@@ -286,8 +286,7 @@ class SongExportForm(OpenLPWizard):
song.data(QtCore.Qt.UserRole).toPyObject()
for song in self._findListWidgetItems(self.selectedListWidget)
]
- exporter = OpenLyricsExport(
- self, songs, unicode(self.directoryLineEdit.text()))
+ exporter = OpenLyricsExport(self, songs, self.directoryLineEdit.text())
if exporter.do_export():
self.progressLabel.setText(
translate('SongsPlugin.SongExportForm', 'Finished export. To '
@@ -309,9 +308,8 @@ class SongExportForm(OpenLPWizard):
``text``
The text to search for. (unicode string)
"""
- #TODO: check if unicode() can be removed.
- return [item for item in listWidget.findItems(
- unicode(text), QtCore.Qt.MatchContains)
+ return [
+ item for item in listWidget.findItems(text, QtCore.Qt.MatchContains)
]
def onItemActivated(self, item):
@@ -333,13 +331,11 @@ class SongExportForm(OpenLPWizard):
will be hidden, but not unchecked!
``text``
- The text of the *searchLineEdit*. (QString)
+ The text of the *searchLineEdit*.
"""
- #TODO: check if unicode() can be removed.
- print type(text)
search_result = [
song for song in self._findListWidgetItems(
- self.availableListWidget, unicode(text))
+ self.availableListWidget, text)
]
for item in self._findListWidgetItems(self.availableListWidget):
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
the path to *directoryLineEdit*.
"""
- path = unicode(QtGui.QFileDialog.getExistingDirectory(self,
+ path = QtGui.QFileDialog.getExistingDirectory(self,
translate('SongsPlugin.ExportWizardForm',
'Select Destination Folder'),
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)
self.directoryLineEdit.setText(path)
diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py
index 65d769792..2d8322ff3 100644
--- a/openlp/plugins/songs/forms/songimportform.py
+++ b/openlp/plugins/songs/forms/songimportform.py
@@ -516,7 +516,7 @@ class SongImportForm(OpenLPWizard):
"""
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):
"""
@@ -786,12 +786,12 @@ class SongImportForm(OpenLPWizard):
if source_format == SongFormat.OpenLP2:
# Import an OpenLP 2.0 database
importer = self.plugin.importSongs(SongFormat.OpenLP2,
- filename=unicode(self.openLP2FilenameEdit.text())
+ filename=self.openLP2FilenameEdit.text()
)
elif source_format == SongFormat.OpenLP1:
# Import an openlp.org database
importer = self.plugin.importSongs(SongFormat.OpenLP1,
- filename=unicode(self.openLP1FilenameEdit.text()),
+ filename=self.openLP1FilenameEdit.text(),
plugin=self.plugin
)
elif source_format == SongFormat.OpenLyrics:
@@ -841,12 +841,12 @@ class SongImportForm(OpenLPWizard):
elif source_format == SongFormat.EasySlides:
# Import an EasySlides export file
importer = self.plugin.importSongs(SongFormat.EasySlides,
- filename=unicode(self.easySlidesFilenameEdit.text())
+ filename=self.easySlidesFilenameEdit.text()
)
elif source_format == SongFormat.EasyWorship:
# Import an EasyWorship database
importer = self.plugin.importSongs(SongFormat.EasyWorship,
- filename=unicode(self.ewFilenameEdit.text())
+ filename=self.ewFilenameEdit.text()
)
elif source_format == SongFormat.SongBeamer:
# Import SongBeamer songs
diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py
index 51bb37e00..5df73634c 100644
--- a/openlp/plugins/songs/forms/songmaintenanceform.py
+++ b/openlp/plugins/songs/forms/songmaintenanceform.py
@@ -208,9 +208,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform.setAutoDisplayName(True)
if self.authorform.exec_():
author = Author.populate(
- first_name=unicode(self.authorform.firstNameEdit.text()),
- last_name=unicode(self.authorform.lastNameEdit.text()),
- display_name=unicode(self.authorform.displayEdit.text()))
+ first_name=self.authorform.firstNameEdit.text(),
+ last_name=self.authorform.lastNameEdit.text(),
+ display_name=self.authorform.displayEdit.text())
if self.checkAuthor(author):
if self.manager.save_object(author):
self.resetAuthors()
@@ -225,7 +225,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onTopicAddButtonClicked(self):
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.manager.save_object(topic):
self.resetTopics()
@@ -240,8 +240,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onBookAddButtonClicked(self):
if self.bookform.exec_():
- book = Book.populate(name=unicode(self.bookform.nameEdit.text()),
- publisher=unicode(self.bookform.publisherEdit.text()))
+ book = Book.populate(name=self.bookform.nameEdit.text(),
+ publisher=self.bookform.publisherEdit.text())
if self.checkBook(book):
if self.manager.save_object(book):
self.resetBooks()
@@ -269,9 +269,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
temp_last_name = author.last_name
temp_display_name = author.display_name
if self.authorform.exec_(False):
- author.first_name = unicode(self.authorform.firstNameEdit.text())
- author.last_name = unicode(self.authorform.lastNameEdit.text())
- author.display_name = unicode(self.authorform.displayEdit.text())
+ author.first_name = self.authorform.firstNameEdit.text()
+ author.last_name = self.authorform.lastNameEdit.text()
+ author.display_name = self.authorform.displayEdit.text()
if self.checkAuthor(author, True):
if self.manager.save_object(author):
self.resetAuthors()
@@ -280,10 +280,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
critical_error_message_box(
message=translate('SongsPlugin.SongMaintenanceForm',
'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 '
'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),
parent=self, question=True) == QtGui.QMessageBox.Yes:
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.
temp_name = topic.name
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.manager.save_object(topic):
self.resetTopics()
@@ -317,9 +317,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
message=translate('SongsPlugin.SongMaintenanceForm',
'Could not save your changes.'))
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 '
- 'with topic %s use the existing topic %s?')) % (topic.name,
+ 'with topic %s use the existing topic %s?') % (topic.name,
temp_name, topic.name),
parent=self, question=True) == QtGui.QMessageBox.Yes:
self.__mergeObjects(topic, self.mergeTopics, self.resetTopics)
@@ -345,8 +345,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
temp_name = book.name
temp_publisher = book.publisher
if self.bookform.exec_(False):
- book.name = unicode(self.bookform.nameEdit.text())
- book.publisher = unicode(self.bookform.publisherEdit.text())
+ book.name = self.bookform.nameEdit.text()
+ book.publisher = self.bookform.publisherEdit.text()
if self.checkBook(book, True):
if self.manager.save_object(book):
self.resetBooks()
@@ -355,9 +355,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
message=translate('SongsPlugin.SongMaintenanceForm',
'Could not save your changes.'))
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 '
- 'with book %s use the existing book %s?')) % (book.name,
+ 'with book %s use the existing book %s?') % (book.name,
temp_name, book.name),
parent=self, question=True) == QtGui.QMessageBox.Yes:
self.__mergeObjects(book, self.mergeBooks, self.resetBooks)
diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py
index 44cf8e113..42df6615e 100644
--- a/openlp/plugins/songs/lib/__init__.py
+++ b/openlp/plugins/songs/lib/__init__.py
@@ -60,13 +60,13 @@ class VerseType(object):
Tags = [name[0].lower() for name in Names]
TranslatedNames = [
- unicode(translate('SongsPlugin.VerseType', 'Verse')),
- unicode(translate('SongsPlugin.VerseType', 'Chorus')),
- unicode(translate('SongsPlugin.VerseType', 'Bridge')),
- unicode(translate('SongsPlugin.VerseType', 'Pre-Chorus')),
- unicode(translate('SongsPlugin.VerseType', 'Intro')),
- unicode(translate('SongsPlugin.VerseType', 'Ending')),
- unicode(translate('SongsPlugin.VerseType', 'Other'))]
+ translate('SongsPlugin.VerseType', 'Verse'),
+ translate('SongsPlugin.VerseType', 'Chorus'),
+ translate('SongsPlugin.VerseType', 'Bridge'),
+ translate('SongsPlugin.VerseType', 'Pre-Chorus'),
+ translate('SongsPlugin.VerseType', 'Intro'),
+ translate('SongsPlugin.VerseType', 'Ending'),
+ translate('SongsPlugin.VerseType', 'Other')]
TranslatedTags = [name[0].lower() for name in TranslatedNames]
@staticmethod
diff --git a/openlp/plugins/songs/lib/ewimport.py b/openlp/plugins/songs/lib/ewimport.py
index d58734610..87d89b247 100644
--- a/openlp/plugins/songs/lib/ewimport.py
+++ b/openlp/plugins/songs/lib/ewimport.py
@@ -258,8 +258,8 @@ class EasyWorshipSongImport(SongImport):
if copy:
self.copyright += u', '
self.copyright += \
- unicode(translate('SongsPlugin.EasyWorshipSongImport',
- 'Administered by %s')) % admin
+ translate('SongsPlugin.EasyWorshipSongImport',
+ 'Administered by %s') % admin
if ccli:
self.ccliNumber = ccli
if authors:
diff --git a/openlp/plugins/songs/lib/openlyricsexport.py b/openlp/plugins/songs/lib/openlyricsexport.py
index d5ffcb1a4..1d17c48b5 100644
--- a/openlp/plugins/songs/lib/openlyricsexport.py
+++ b/openlp/plugins/songs/lib/openlyricsexport.py
@@ -65,9 +65,8 @@ class OpenLyricsExport(object):
Receiver.send_message(u'openlp_process_events')
if self.parent.stop_export_flag:
return False
- self.parent.incrementProgressBar(unicode(translate(
- 'SongsPlugin.OpenLyricsExport', 'Exporting "%s"...')) %
- song.title)
+ self.parent.incrementProgressBar(translate(
+ 'SongsPlugin.OpenLyricsExport', 'Exporting "%s"...') % song.title)
xml = openLyrics.song_to_xml(song)
tree = etree.ElementTree(etree.fromstring(xml))
filename = u'%s (%s)' % (song.title,
diff --git a/openlp/plugins/songs/lib/powersongimport.py b/openlp/plugins/songs/lib/powersongimport.py
index 31491398c..2d558b62b 100644
--- a/openlp/plugins/songs/lib/powersongimport.py
+++ b/openlp/plugins/songs/lib/powersongimport.py
@@ -74,8 +74,8 @@ class PowerSongImport(SongImport):
Receive a list of files to import.
"""
if not isinstance(self.importSource, list):
- self.logError(unicode(translate('SongsPlugin.PowerSongImport',
- 'No files to import.')))
+ self.logError(translate('SongsPlugin.PowerSongImport',
+ 'No files to import.'))
return
self.importWizard.progressBar.setMaximum(len(self.importSource))
for file in self.importSource:
diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py
index 9bfdce124..9dafacbe4 100644
--- a/openlp/plugins/songs/lib/songimport.py
+++ b/openlp/plugins/songs/lib/songimport.py
@@ -98,8 +98,7 @@ class SongImport(QtCore.QObject):
self.verseOrderList = []
self.verses = []
self.verseCounts = {}
- self.copyrightString = unicode(translate(
- 'SongsPlugin.SongImport', 'copyright'))
+ self.copyrightString = translate('SongsPlugin.SongImport', 'copyright')
def logError(self, filepath, reason=SongStrings.SongIncomplete):
"""
diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py
index 45dac95b9..3d50d3594 100644
--- a/openlp/plugins/songs/lib/xml.py
+++ b/openlp/plugins/songs/lib/xml.py
@@ -718,15 +718,15 @@ class OpenLyrics(object):
except AttributeError:
raise OpenLyricsError(OpenLyricsError.LyricsError,
' tag is missing.',
- unicode(translate('OpenLP.OpenLyricsImportError',
- ' tag is missing.')))
+ translate('OpenLP.OpenLyricsImportError',
+ ' tag is missing.'))
try:
verse_list = lyrics.verse
except AttributeError:
raise OpenLyricsError(OpenLyricsError.VerseError,
' tag is missing.',
- unicode(translate('OpenLP.OpenLyricsImportError',
- ' tag is missing.')))
+ translate('OpenLP.OpenLyricsImportError',
+ ' tag is missing.'))
# Loop over the "verse" elements.
for verse in verse_list:
text = u''
diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py
index 4d59186e5..8e85cfcff 100644
--- a/openlp/plugins/songs/songsplugin.py
+++ b/openlp/plugins/songs/songsplugin.py
@@ -74,10 +74,9 @@ class SongsPlugin(Plugin):
self.songExportItem.setVisible(True)
self.toolsReindexItem.setVisible(True)
action_list = ActionList.get_instance()
- action_list.add_action(self.songImportItem, unicode(UiStrings().Import))
- action_list.add_action(self.songExportItem, unicode(UiStrings().Export))
- action_list.add_action(self.toolsReindexItem,
- unicode(UiStrings().Tools))
+ action_list.add_action(self.songImportItem, UiStrings().Import)
+ action_list.add_action(self.songExportItem, UiStrings().Export)
+ action_list.add_action(self.toolsReindexItem, UiStrings().Tools)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'servicemanager_new_service'),
self.clearTemporarySongs)
@@ -268,12 +267,9 @@ class SongsPlugin(Plugin):
self.songExportItem.setVisible(False)
self.toolsReindexItem.setVisible(False)
action_list = ActionList.get_instance()
- action_list.remove_action(self.songImportItem,
- unicode(UiStrings().Import))
- action_list.remove_action(self.songExportItem,
- unicode(UiStrings().Export))
- action_list.remove_action(self.toolsReindexItem,
- unicode(UiStrings().Tools))
+ action_list.remove_action(self.songImportItem, UiStrings().Import)
+ action_list.remove_action(self.songExportItem, UiStrings().Export)
+ action_list.remove_action(self.toolsReindexItem, UiStrings().Tools)
Plugin.finalise(self)
def clearTemporarySongs(self):
diff --git a/openlp/plugins/songusage/forms/songusagedetailform.py b/openlp/plugins/songusage/forms/songusagedetailform.py
index f1cdb4cbc..e8f6f352a 100644
--- a/openlp/plugins/songusage/forms/songusagedetailform.py
+++ b/openlp/plugins/songusage/forms/songusagedetailform.py
@@ -59,11 +59,11 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
year = QtCore.QDate().currentDate().year()
if QtCore.QDate().currentDate().month() < 9:
year -= 1
- toDate = Settings().value(
- u'songusage/to date', QtCore.QDate(year, 8, 31)).toDate()
- fromDate = Settings().value(
- u'songusage/from date',
- QtCore.QDate(year - 1, 9, 1)).toDate()
+ # TODO: check toDate()
+ toDate = Settings().value(self.plugin.settingsSection +
+ u'/to date', QtCore.QDate(year, 8, 31)).toDate()
+ fromDate = Settings().value(self.plugin.settingsSection +
+ u'/from date', QtCore.QDate(year - 1, 9, 1)).toDate()
self.fromDate.setSelectedDate(fromDate)
self.toDate.setSelectedDate(toDate)
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
"""
log.debug(u'accept')
- path = unicode(self.fileLineEdit.text())
- if path == u'':
+ path = self.fileLineEdit.text()
+ if not path:
Receiver.send_message(u'openlp_error_message', {
u'title': translate('SongUsagePlugin.SongUsageDetailForm',
'Output Path Not Selected'),
- u'message': unicode(translate(
+ u'message': translate(
'SongUsagePlugin.SongUsageDetailForm', 'You have not set a '
'valid output location for your song usage report. Please '
- 'select an existing path on your computer.'))})
+ 'select an existing path on your computer.')})
return
check_directory_exists(path)
- filename = unicode(translate('SongUsagePlugin.SongUsageDetailForm',
- 'usage_detail_%s_%s.txt')) % (
+ filename = translate('SongUsagePlugin.SongUsageDetailForm',
+ 'usage_detail_%s_%s.txt') % (
self.fromDate.selectedDate().toString(u'ddMMyyyy'),
self.toDate.selectedDate().toString(u'ddMMyyyy'))
- Settings().setValue(u'songusage/from date',
- self.fromDate.selectedDate())
- Settings().setValue(u'songusage/to date',
- self.toDate.selectedDate())
+ Settings().setValue(self.plugin.settingsSection +
+ u'/from date', self.fromDate.selectedDate())
+ Settings().setValue(self.plugin.settingsSection +
+ u'/to date', self.toDate.selectedDate())
usage = self.plugin.manager.get_all_objects(
SongUsageItem, and_(
SongUsageItem.usagedate >= self.fromDate.selectedDate().toPyDate(),
@@ -125,9 +125,9 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
Receiver.send_message(u'openlp_information_message', {
u'title': translate('SongUsagePlugin.SongUsageDetailForm',
'Report Creation'),
- u'message': unicode(translate(
+ u'message': translate(
'SongUsagePlugin.SongUsageDetailForm', 'Report \n%s \n'
- 'has been successfully created. ')) % outname})
+ 'has been successfully created. ') % outname})
except IOError:
log.exception(u'Failed to write out song usage records')
finally:
diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py
index 48450510f..48e8ad3c4 100644
--- a/openlp/plugins/songusage/songusageplugin.py
+++ b/openlp/plugins/songusage/songusageplugin.py
@@ -112,8 +112,7 @@ class SongUsagePlugin(Plugin):
QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.songUsageStatus.setChecked)
QtCore.QObject.connect(self.songUsageActiveButton,
- QtCore.SIGNAL(u'toggled(bool)'),
- self.toggleSongUsageState)
+ QtCore.SIGNAL(u'toggled(bool)'), self.toggleSongUsageState)
self.songUsageMenu.menuAction().setVisible(False)
def initialise(self):
@@ -131,11 +130,11 @@ class SongUsagePlugin(Plugin):
self.setButtonState()
action_list = ActionList.get_instance()
action_list.add_action(self.songUsageStatus,
- unicode(translate('SongUsagePlugin', 'Song Usage')))
+ translate('SongUsagePlugin', 'Song Usage'))
action_list.add_action(self.songUsageDelete,
- unicode(translate('SongUsagePlugin', 'Song Usage')))
+ translate('SongUsagePlugin', 'Song Usage'))
action_list.add_action(self.songUsageReport,
- unicode(translate('SongUsagePlugin', 'Song Usage')))
+ translate('SongUsagePlugin', 'Song Usage'))
self.songUsageDeleteForm = SongUsageDeleteForm(self.manager,
self.formParent)
self.songUsageDetailForm = SongUsageDetailForm(self, self.formParent)
@@ -152,11 +151,11 @@ class SongUsagePlugin(Plugin):
self.songUsageMenu.menuAction().setVisible(False)
action_list = ActionList.get_instance()
action_list.remove_action(self.songUsageStatus,
- unicode(translate('SongUsagePlugin', 'Song Usage')))
+ translate('SongUsagePlugin', 'Song Usage'))
action_list.remove_action(self.songUsageDelete,
- unicode(translate('SongUsagePlugin', 'Song Usage')))
+ translate('SongUsagePlugin', 'Song Usage'))
action_list.remove_action(self.songUsageReport,
- unicode(translate('SongUsagePlugin', 'Song Usage')))
+ translate('SongUsagePlugin', 'Song Usage'))
self.songUsageActiveButton.hide()
# stop any events being processed
self.songUsageActive = False
@@ -167,8 +166,7 @@ class SongUsagePlugin(Plugin):
the UI when necessary,
"""
self.songUsageActive = not self.songUsageActive
- Settings().setValue(self.settingsSection + u'/active',
- self.songUsageActive)
+ Settings().setValue(self.settingsSection + u'/active', self.songUsageActive)
self.setButtonState()
def setButtonState(self):
@@ -198,15 +196,13 @@ class SongUsagePlugin(Plugin):
"""
Song Usage for which has been displayed
"""
- self._add_song_usage(unicode(translate('SongUsagePlugin',
- 'display')), item)
+ self._add_song_usage(translate('SongUsagePlugin', 'display'), item)
def printSongUsage(self, item):
"""
Song Usage for which has been printed
"""
- self._add_song_usage(unicode(translate('SongUsagePlugin',
- 'printed')), item)
+ self._add_song_usage(translate('SongUsagePlugin', 'printed'), item)
def _add_song_usage(self, source, item):
audit = item[0].audit