openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #18414
[Merge] lp:~googol/openlp/bug-779201-2 into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/bug-779201-2 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~googol/openlp/bug-779201-2/+merge/140886
Hello,
- fixed bug #779201: QString and QVariant auto-conversion
This needs intensive testing. Possible tests are:
a) Are you settings loaded as expected?
b) Change settings, are they restored as expected?
c) Are Lists, ints, strings, ..., saved/loaded correctly.
NOTE:
The locale aware sorting has to be tested again. Because we cannot use
QtCore.QString.localeAwareCompare(string1.lower(), string2.lower())
anyl onger. We have to check what exactly does not work with locale.strcoll()
--
https://code.launchpad.net/~googol/openlp/bug-779201-2/+merge/140886
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/bug-779201-2 into lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw 2012-06-27 21:32:43 +0000
+++ openlp.pyw 2012-12-20 12:09:36 +0000
@@ -27,7 +27,16 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
+import sip
import sys
+sip.setapi(u'QDate', 2)
+sip.setapi(u'QDateTime', 2)
+sip.setapi(u'QString', 2)
+sip.setapi(u'QTextStream', 2)
+sip.setapi(u'QTime', 2)
+sip.setapi(u'QUrl', 2)
+sip.setapi(u'QVariant', 2)
+
from openlp.core import main
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py 2012-12-07 19:43:53 +0000
+++ openlp/core/__init__.py 2012-12-20 12:09:36 +0000
@@ -43,8 +43,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Receiver, check_directory_exists
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Receiver, Settings, check_directory_exists
from openlp.core.lib.ui import UiStrings
from openlp.core.resources import qInitResources
from openlp.core.ui.mainwindow import MainWindow
@@ -119,10 +118,10 @@
# Decide how many screens we have and their size
screens = ScreenList.create(self.desktop())
# First time checks in settings
- has_run_wizard = Settings().value(u'general/has run wizard', QtCore.QVariant(False)).toBool()
+ has_run_wizard = Settings().value(u'general/has run wizard', False)
if not has_run_wizard:
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
- Settings().setValue(u'general/has run wizard', QtCore.QVariant(True))
+ Settings().setValue(u'general/has run wizard', True)
# Correct stylesheet bugs
if os.name == u'nt':
base_color = self.palette().color(QtGui.QPalette.Active, QtGui.QPalette.Base)
@@ -130,8 +129,7 @@
u'QTableWidget, QListWidget, QTreeWidget {alternate-background-color: ' + base_color.name() + ';}\n'
application_stylesheet += nt_repair_stylesheet
self.setStyleSheet(application_stylesheet)
- # show the splashscreen
- show_splash = Settings().value(u'general/show splash', QtCore.QVariant(True)).toBool()
+ show_splash = Settings().value(u'general/show splash', True)
if show_splash:
self.splash = SplashScreen()
self.splash.show()
@@ -150,7 +148,7 @@
self.processEvents()
if not has_run_wizard:
self.mainWindow.firstTime()
- update_check = Settings().value(u'general/update check', QtCore.QVariant(True)).toBool()
+ update_check = Settings().value(u'general/update check', True)
if update_check:
VersionThread(self.mainWindow).start()
Receiver.send_message(u'live_display_blank_check')
@@ -205,7 +203,7 @@
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)
@@ -297,8 +295,7 @@
if app.isAlreadyRunning():
sys.exit()
# First time checks in settings
- if not Settings().value(u'general/has run wizard',
- QtCore.QVariant(False)).toBool():
+ if not Settings().value(u'general/has run wizard', False):
if not FirstTimeLanguageForm().exec_():
# if cancel then stop processing
sys.exit()
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2012-12-03 19:19:10 +0000
+++ openlp/core/lib/__init__.py 2012-12-20 12:09:36 +0000
@@ -90,6 +90,68 @@
Next = 3
+class Settings(QtCore.QSettings):
+ """
+ Class to wrap QSettings.
+
+ * Exposes all the methods of QSettings.
+ * Adds functionality for OpenLP Portable. If the ``defaultFormat`` is set to
+ ``IniFormat``, and the path to the Ini file is set using ``setFilename``,
+ then the Settings constructor (without any arguments) will create a Settings
+ object for accessing settings stored in that Ini file.
+ """
+ __filePath__ = u''
+
+ @staticmethod
+ def setFilename(iniFile):
+ """
+ Sets the complete path to an Ini file to be used by Settings objects.
+
+ Does not affect existing Settings objects.
+ """
+ Settings.__filePath__ = iniFile
+
+ def __init__(self, *args):
+ if not args and Settings.__filePath__ and \
+ Settings.defaultFormat() == Settings.IniFormat:
+ QtCore.QSettings.__init__(self, Settings.__filePath__,
+ Settings.IniFormat)
+ else:
+ QtCore.QSettings.__init__(self, *args)
+
+ def value(self, key, defaultValue):
+ """
+ Returns the value for the given ``key``. The returned ``value`` is
+ of the same type as the ``defaultValue``.
+
+ ``key``
+ The key to return the value from.
+
+ ``defaultValue``
+ The value to be returned if the given ``key`` is not present in the
+ config. Note, the ``defaultValue``'s type defines the type the
+ returned is converted to. In other words, if the ``defaultValue`` is
+ a boolean, then the returned value will be converted to a boolean.
+
+ **Note**, this method only converts a few types and might need to be
+ extended if a certain type is missing!
+ """
+ setting = super(Settings, self).value(key, defaultValue)
+ # An empty list saved to the settings results in a None type being
+ # returned.
+ if setting is None:
+ return []
+ # Convert the setting to the correct type.
+ if isinstance(defaultValue, bool):
+ if isinstance(setting, bool):
+ return setting
+ # Sometimes setting is string instead of a boolean.
+ return setting == u'true'
+ if isinstance(defaultValue, int):
+ return int(setting)
+ return setting
+
+
def translate(context, text, comment=None,
encoding=QtCore.QCoreApplication.CodecForTr, n=-1,
translate=QtCore.QCoreApplication.translate):
@@ -369,22 +431,22 @@
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') % (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') % (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') % (stringlist[index], merged)
+ return translate('OpenLP.core.lib', '%1, %2',
+ u'Locale list separator: start') % (stringlist[0], merged)
from eventreceiver import Receiver
=== modified file 'openlp/core/lib/db.py'
--- openlp/core/lib/db.py 2012-12-01 07:57:54 +0000
+++ openlp/core/lib/db.py 2012-12-20 12:09:36 +0000
@@ -41,10 +41,9 @@
from sqlalchemy.orm import scoped_session, sessionmaker, mapper
from sqlalchemy.pool import NullPool
-from openlp.core.lib import translate
+from openlp.core.lib import translate, Settings
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.utils import AppLocation, delete_file
-from openlp.core.lib.settings import Settings
log = logging.getLogger(__name__)
@@ -191,8 +190,7 @@
self.db_url = u''
self.is_dirty = False
self.session = None
- db_type = unicode(
- settings.value(u'db type', QtCore.QVariant(u'sqlite')).toString())
+ db_type = settings.value(u'db type', u'sqlite')
if db_type == u'sqlite':
if db_file_name:
self.db_url = u'sqlite:///%s/%s' % (
@@ -203,13 +201,12 @@
AppLocation.get_section_data_path(plugin_name), plugin_name)
else:
self.db_url = u'%s://%s:%s@%s/%s' % (db_type,
- urlquote(unicode(settings.value(u'db username').toString())),
- urlquote(unicode(settings.value(u'db password').toString())),
- urlquote(unicode(settings.value(u'db hostname').toString())),
- urlquote(unicode(settings.value(u'db database').toString())))
+ urlquote(settings.value(u'db username', u'')),
+ urlquote(settings.value(u'db password', u'')),
+ urlquote(settings.value(u'db hostname', u'')),
+ urlquote(settings.value(u'db database', u'')))
if db_type == u'mysql':
- db_encoding = unicode(
- settings.value(u'db encoding', u'utf8').toString())
+ db_encoding = settings.value(u'db encoding', u'utf8')
self.db_url += u'?charset=%s' % urlquote(db_encoding)
settings.endGroup()
if upgrade_mod:
@@ -217,11 +214,11 @@
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
@@ -231,8 +228,8 @@
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):
=== modified file 'openlp/core/lib/formattingtags.py'
--- openlp/core/lib/formattingtags.py 2012-12-01 07:57:54 +0000
+++ openlp/core/lib/formattingtags.py 2012-12-20 12:09:36 +0000
@@ -33,9 +33,7 @@
from PyQt4 import QtCore
-from openlp.core.lib import translate
-from openlp.core.lib.settings import Settings
-
+from openlp.core.lib import translate, Settings
class FormattingTags(object):
"""
@@ -72,7 +70,7 @@
tag[element] = tag[element].encode('utf8')
# Formatting Tags were also known as display tags.
Settings().setValue(u'displayTags/html_tags',
- QtCore.QVariant(cPickle.dumps(tags) if tags else u''))
+ cPickle.dumps(tags) if tags else u'')
@staticmethod
def load_tags():
@@ -167,8 +165,7 @@
FormattingTags.add_html_tags(temporary_tags)
# Formatting Tags were also known as display tags.
- user_expands = Settings().value(u'displayTags/html_tags',
- QtCore.QVariant(u'')).toString()
+ user_expands = Settings().value(u'displayTags/html_tags', u'')
# cPickle only accepts str not unicode strings
user_expands_string = str(user_expands)
if user_expands_string:
=== modified file 'openlp/core/lib/listwidgetwithdnd.py'
--- openlp/core/lib/listwidgetwithdnd.py 2012-12-01 07:57:54 +0000
+++ openlp/core/lib/listwidgetwithdnd.py 2012-12-20 12:09:36 +0000
@@ -100,7 +100,7 @@
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):
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2012-12-03 19:19:10 +0000
+++ openlp/core/lib/mediamanageritem.py 2012-12-20 12:09:36 +0000
@@ -37,11 +37,10 @@
from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, \
StringContent, build_icon, translate, Receiver, ListWidgetWithDnD, \
- ServiceItemContext
+ ServiceItemContext, Settings
from openlp.core.lib.searchedit import SearchEdit
from openlp.core.lib.ui import UiStrings, create_widget_action, \
critical_error_message_box
-from openlp.core.lib.settings import Settings
log = logging.getLogger(__name__)
@@ -342,7 +341,7 @@
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)
@@ -365,9 +364,8 @@
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)
error_shown = True
else:
new_files.append(file)
@@ -385,9 +383,8 @@
names = []
full_list = []
for count in range(self.listView.count()):
- names.append(unicode(self.listView.item(count).text()))
- full_list.append(unicode(self.listView.item(count).
- data(QtCore.Qt.UserRole).toString()))
+ names.append(self.listView.item(count).text())
+ full_list.append(self.listView.item(count).data(QtCore.Qt.UserRole))
duplicates_found = False
files_added = False
for file in files:
@@ -407,8 +404,8 @@
if duplicates_found:
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)
@@ -427,7 +424,7 @@
file_list = []
while count < self.listView.count():
bitem = self.listView.item(count)
- filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
+ filename = bitem.data(QtCore.Qt.UserRole)
file_list.append(filename)
count += 1
return file_list
@@ -468,8 +465,7 @@
"""
Allows the list click action to be determined dynamically
"""
- if Settings().value(u'advanced/double click live',
- QtCore.QVariant(False)).toBool():
+ if Settings().value(u'advanced/double click live', False):
self.onLiveClick()
else:
self.onPreviewClick()
@@ -479,8 +475,9 @@
Allows the change of current item in the list to be actioned
"""
if Settings().value(u'advanced/single click preview',
- QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed and \
- self.listView.selectedIndexes() and self.autoSelectId == -1:
+ False) and self.quickPreviewAllowed \
+ and self.listView.selectedIndexes() \
+ and self.autoSelectId == -1:
self.onPreviewClick(True)
def onPreviewClick(self, keepFocus=False):
@@ -528,7 +525,7 @@
def createItemFromId(self, item_id):
item = QtGui.QListWidgetItem()
- item.setData(QtCore.Qt.UserRole, QtCore.QVariant(item_id))
+ item.setData(QtCore.Qt.UserRole, item_id)
return item
def onAddClick(self):
@@ -582,8 +579,8 @@
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,
context=ServiceItemContext.Live):
@@ -634,11 +631,11 @@
item = self.listView.currentItem()
if item is None:
return False
- item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ item_id = item.data(QtCore.Qt.UserRole)
else:
item_id = remoteItem
else:
- item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ item_id = item.data(QtCore.Qt.UserRole)
return item_id
def saveAutoSelectId(self):
@@ -649,7 +646,7 @@
if self.autoSelectId == -1:
item = self.listView.currentItem()
if item:
- self.autoSelectId = item.data(QtCore.Qt.UserRole).toInt()[0]
+ self.autoSelectId = item.data(QtCore.Qt.UserRole)
def search(self, string, showError=True):
"""
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2012-12-01 07:57:54 +0000
+++ openlp/core/lib/plugin.py 2012-12-20 12:09:36 +0000
@@ -33,8 +33,7 @@
from PyQt4 import QtCore
-from openlp.core.lib import Receiver
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Receiver, Settings
from openlp.core.lib.ui import UiStrings
from openlp.core.utils import get_application_version
@@ -194,16 +193,14 @@
Sets the status of the plugin
"""
self.status = Settings().value(
- self.settingsSection + u'/status',
- QtCore.QVariant(PluginStatus.Inactive)).toInt()[0]
+ self.settingsSection + u'/status', PluginStatus.Inactive)
def toggleStatus(self, new_status):
"""
Changes the status of the plugin and remembers it
"""
self.status = new_status
- Settings().setValue(
- self.settingsSection + u'/status', QtCore.QVariant(self.status))
+ Settings().setValue(self.settingsSection + u'/status', self.status)
if new_status == PluginStatus.Active:
self.initialise()
elif new_status == PluginStatus.Inactive:
=== modified file 'openlp/core/lib/searchedit.py'
--- openlp/core/lib/searchedit.py 2012-12-01 07:57:54 +0000
+++ openlp/core/lib/searchedit.py 2012-12-20 12:09:36 +0000
@@ -123,7 +123,7 @@
"""
menu = self.menuButton.menu()
for action in menu.actions():
- if identifier == action.data().toInt()[0]:
+ if identifier == action.data():
# setPlaceholderText has been implemented in Qt 4.7 and in at
# least PyQt 4.9 (I am not sure, if it was implemented in
# PyQt 4.8).
@@ -187,7 +187,7 @@
A :class:`~PyQt4.QtCore.QString` instance which represents the text
in the line edit.
"""
- self.clearButton.setVisible(not text.isEmpty())
+ self.clearButton.setVisible(bool(text))
def _onClearButtonClicked(self):
"""
@@ -211,7 +211,7 @@
for action in self.menuButton.menu().actions():
action.setChecked(False)
self.menuButton.setDefaultAction(sender)
- self._currentSearchType = sender.data().toInt()[0]
+ self._currentSearchType = sender.data()
# setPlaceholderText has been implemented in Qt 4.7 and in at least
# PyQt 4.9 (I am not sure, if it was implemented in PyQt 4.8).
try:
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2012-12-10 06:15:42 +0000
+++ openlp/core/lib/serviceitem.py 2012-12-20 12:09:36 +0000
@@ -570,12 +570,12 @@
start = None
end = None
if self.start_time != 0:
- start = unicode(translate('OpenLP.ServiceItem',
- '<strong>Start</strong>: %s')) % \
+ start = translate('OpenLP.ServiceItem',
+ '<strong>Start</strong>: %s') % \
unicode(datetime.timedelta(seconds=self.start_time))
if self.media_length != 0:
- end = unicode(translate('OpenLP.ServiceItem',
- '<strong>Length</strong>: %s')) % \
+ end = translate('OpenLP.ServiceItem',
+ '<strong>Length</strong>: %s') % \
unicode(datetime.timedelta(seconds=self.media_length))
if not start and not end:
return u''
=== removed file 'openlp/core/lib/settings.py'
--- openlp/core/lib/settings.py 2012-12-01 07:57:54 +0000
+++ openlp/core/lib/settings.py 1970-01-01 00:00:00 +0000
@@ -1,68 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2012 Raoul Snyman #
-# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan #
-# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
-# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
-# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
-# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
-# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
-# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-"""
-The :mod:``settings`` module provides a thin wrapper for QSettings, which OpenLP
-uses to manage settings persistence.
-"""
-
-import logging
-
-from PyQt4 import QtCore
-
-log = logging.getLogger()
-
-class Settings(QtCore.QSettings):
- """
- Class to wrap QSettings.
-
- * Exposes all the methods of QSettings.
- * Adds functionality for OpenLP Portable. If the ``defaultFormat`` is set to
- ``IniFormat``, and the path to the Ini file is set using ``setFilename``,
- then the Settings constructor (without any arguments) will create a Settings
- object for accessing settings stored in that Ini file.
- """
-
- __filePath = u''
-
- @staticmethod
- def setFilename(iniFile):
- """
- Sets the complete path to an Ini file to be used by Settings objects.
-
- Does not affect existing Settings objects.
- """
- Settings.__filePath = iniFile
-
- def __init__(self, *args):
- if not args and Settings.__filePath and (Settings.defaultFormat() ==
- Settings.IniFormat):
- QtCore.QSettings.__init__(self, Settings.__filePath,
- Settings.IniFormat)
- else:
- QtCore.QSettings.__init__(self, *args)
=== modified file 'openlp/core/lib/settingsmanager.py'
--- openlp/core/lib/settingsmanager.py 2012-12-01 07:57:54 +0000
+++ openlp/core/lib/settingsmanager.py 2012-12-20 12:09:36 +0000
@@ -36,7 +36,7 @@
from PyQt4 import QtCore
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Settings
from openlp.core.utils import AppLocation
class SettingsManager(object):
@@ -61,9 +61,7 @@
name = u'last directory %d' % num
else:
name = u'last directory'
- last_dir = unicode(Settings().value(
- section + u'/' + name, QtCore.QVariant(u'')).toString())
- return last_dir
+ return Settings().value(section + u'/' + name, u'')
@staticmethod
def set_last_dir(section, directory, num=None):
@@ -84,8 +82,7 @@
name = u'last directory %d' % num
else:
name = u'last directory'
- Settings().setValue(
- section + u'/' + name, QtCore.QVariant(directory))
+ Settings().setValue(section + u'/' + name, directory)
@staticmethod
def set_list(section, name, list):
@@ -103,13 +100,11 @@
"""
settings = Settings()
settings.beginGroup(section)
- old_count = settings.value(
- u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
+ old_count = settings.value(u'%s count' % name, 0)
new_count = len(list)
- settings.setValue(u'%s count' % name, QtCore.QVariant(new_count))
+ settings.setValue(u'%s count' % name, new_count)
for counter in range(new_count):
- settings.setValue(
- u'%s %d' % (name, counter), QtCore.QVariant(list[counter-1]))
+ settings.setValue(u'%s %d' % (name, counter), list[counter - 1])
if old_count > new_count:
# Tidy up any old list items
for counter in range(new_count, old_count):
@@ -129,13 +124,11 @@
"""
settings = Settings()
settings.beginGroup(section)
- list_count = settings.value(
- u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
+ list_count = settings.value(u'%s count' % name, 0)
list = []
if list_count:
for counter in range(list_count):
- item = unicode(
- settings.value(u'%s %d' % (name, counter)).toString())
+ item = settings.value(u'%s %d' % (name, counter), u'')
if item:
list.append(item)
settings.endGroup()
=== modified file 'openlp/core/lib/spelltextedit.py'
--- openlp/core/lib/spelltextedit.py 2012-12-01 07:57:54 +0000
+++ openlp/core/lib/spelltextedit.py 2012-12-20 12:09:36 +0000
@@ -102,7 +102,7 @@
# 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'))
@@ -202,5 +202,4 @@
def __init__(self, *args):
QtGui.QAction.__init__(self, *args)
- self.triggered.connect(lambda x: self.correct.emit(
- unicode(self.text())))
+ self.triggered.connect(lambda x: self.correct.emit(self.text()))
=== modified file 'openlp/core/lib/toolbar.py'
--- openlp/core/lib/toolbar.py 2012-12-01 07:57:54 +0000
+++ openlp/core/lib/toolbar.py 2012-12-20 12:09:36 +0000
@@ -68,7 +68,7 @@
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):
"""
=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py 2012-12-07 19:00:33 +0000
+++ openlp/core/lib/ui.py 2012-12-20 12:09:36 +0000
@@ -70,7 +70,7 @@
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.DefaultColor = translate('OpenLP.Ui', 'Default Color:')
self.Delete = translate('OpenLP.Ui', '&Delete')
self.DisplayStyle = translate('OpenLP.Ui', 'Display style:')
@@ -138,7 +138,7 @@
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',
@@ -377,7 +377,7 @@
True in case the action will be considered a separator.
``data``
- Data which is set as QVariant type.
+ The actions data.
``shortcuts``
A QList<QKeySequence> (or a list of strings) which are set as shortcuts.
@@ -411,7 +411,7 @@
if kwargs.pop(u'separator', False):
action.setSeparator(True)
if u'data' in kwargs:
- action.setData(QtCore.QVariant(kwargs.pop(u'data')))
+ action.setData(kwargs.pop(u'data'))
if kwargs.get(u'shortcuts'):
action.setShortcuts(kwargs.pop(u'shortcuts'))
if u'context' in kwargs:
=== modified file 'openlp/core/ui/aboutdialog.py'
--- openlp/core/ui/aboutdialog.py 2012-12-01 07:57:54 +0000
+++ openlp/core/ui/aboutdialog.py 2012-12-20 12:09:36 +0000
@@ -158,7 +158,7 @@
}
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'
@@ -237,7 +237,7 @@
' 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'cs']),
@@ -264,9 +264,9 @@
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, Gerald Britton, Jonathan Corwin, Samuel Findlay, '
u'Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, '
u'Armin K\xf6hler, Erik Lundin, Edwin Lunando, Joshua Miller, '
=== modified file 'openlp/core/ui/aboutform.py'
--- openlp/core/ui/aboutform.py 2012-12-01 07:57:54 +0000
+++ openlp/core/ui/aboutform.py 2012-12-20 12:09:36 +0000
@@ -49,7 +49,7 @@
about_text = about_text.replace(u'<version>',
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''
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py 2012-12-05 06:13:34 +0000
+++ openlp/core/ui/advancedtab.py 2012-12-20 12:09:36 +0000
@@ -36,8 +36,8 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab, translate, build_icon, Receiver
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import SettingsTab, translate, build_icon, Receiver, \
+ Settings
from openlp.core.lib.ui import UiStrings
from openlp.core.utils import get_images_filter, AppLocation, format_time
from openlp.core.lib import SlideLimits
@@ -59,12 +59,12 @@
# 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.dataExists = False
@@ -376,9 +376,9 @@
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:'))
@@ -448,40 +448,30 @@
# The max recent files value does not have an interface and so never
# gets actually stored in the settings therefore the default value of
# 20 will always be used.
- self.recentSpinBox.setMaximum(Settings().value(
- u'max recent files', QtCore.QVariant(20)).toInt()[0])
- self.recentSpinBox.setValue(settings.value(u'recent file count',
- QtCore.QVariant(4)).toInt()[0])
+ self.recentSpinBox.setMaximum(settings.value(u'max recent files', 20))
+ self.recentSpinBox.setValue(settings.value(u'recent file count', 4))
self.mediaPluginCheckBox.setChecked(
- settings.value(u'save current plugin',
- QtCore.QVariant(False)).toBool())
+ settings.value(u'save current plugin', False))
self.doubleClickLiveCheckBox.setChecked(
- settings.value(u'double click live',
- QtCore.QVariant(False)).toBool())
+ settings.value(u'double click live', False))
self.singleClickPreviewCheckBox.setChecked(
- settings.value(u'single click preview',
- QtCore.QVariant(False)).toBool())
+ settings.value(u'single click preview', False))
self.expandServiceItemCheckBox.setChecked(
- settings.value(u'expand service item',
- QtCore.QVariant(False)).toBool())
+ settings.value(u'expand service item', False))
self.enableAutoCloseCheckBox.setChecked(
- settings.value(u'enable exit confirmation',
- QtCore.QVariant(True)).toBool())
- self.hideMouseCheckBox.setChecked(
- settings.value(u'hide mouse', QtCore.QVariant(True)).toBool())
+ settings.value(u'enable exit confirmation', True))
+ self.hideMouseCheckBox.setChecked(settings.value(u'hide mouse', True))
self.serviceNameDay.setCurrentIndex(
- settings.value(u'default service day',
- QtCore.QVariant(self.defaultServiceDay)).toInt()[0])
+ settings.value(u'default service day', self.defaultServiceDay))
self.serviceNameTime.setTime(QtCore.QTime(
- settings.value(u'default service hour',
- self.defaultServiceHour).toInt()[0],
+ settings.value(u'default service hour', self.defaultServiceHour),
settings.value(u'default service minute',
- self.defaultServiceMinute).toInt()[0]))
+ self.defaultServiceMinute)))
self.shouldUpdateServiceNameExample = True
self.serviceNameEdit.setText(settings.value(u'default service name',
- self.defaultServiceName).toString())
- default_service_enabled = settings.value(u'default service enabled',
- QtCore.QVariant(True)).toBool()
+ self.defaultServiceName))
+ default_service_enabled = settings.value(
+ u'default service enabled', True)
self.serviceNameCheckBox.setChecked(default_service_enabled)
self.serviceNameCheckBoxToggled(default_service_enabled)
# Fix for bug #1014422.
@@ -490,14 +480,12 @@
# Default to False on Gnome.
x11_bypass_default = bool(not
os.environ.get(u'GNOME_DESKTOP_SESSION_ID'))
- self.x11BypassCheckBox.setChecked(settings.value(
- u'x11 bypass wm', QtCore.QVariant(x11_bypass_default)).toBool())
- self.defaultColor = settings.value(u'default color',
- QtCore.QVariant(u'#ffffff')).toString()
+ self.x11BypassCheckBox.setChecked(
+ settings.value(u'x11 bypass wm', x11_bypass_default))
+ self.defaultColor = settings.value(u'default color', u'#ffffff')
self.defaultFileEdit.setText(settings.value(u'default image',
- QtCore.QVariant(u':/graphics/openlp-splash-screen.png')).toString())
- self.slide_limits = settings.value(
- u'slide limits', QtCore.QVariant(SlideLimits.End)).toInt()[0]
+ u':/graphics/openlp-splash-screen.png'))
+ self.slide_limits = settings.value(u'slide limits', SlideLimits.End)
if self.slide_limits == SlideLimits.End:
self.endSlideRadioButton.setChecked(True)
elif self.slide_limits == SlideLimits.Wrap:
@@ -541,8 +529,7 @@
self.defaultColorButton.setStyleSheet(
u'background-color: %s' % self.defaultColor)
# Don't allow data directory move if running portable.
- if Settings().value(u'advanced/is portable',
- QtCore.QVariant(False)).toBool():
+ if settings.value(u'advanced/is portable', False):
self.dataDirectoryGroupBox.hide()
def save(self):
@@ -553,7 +540,7 @@
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')
@@ -566,25 +553,22 @@
self.serviceNameTime.time().hour())
settings.setValue(u'default service minute',
self.serviceNameTime.time().minute())
- settings.setValue(u'recent file count',
- QtCore.QVariant(self.recentSpinBox.value()))
+ settings.setValue(u'recent file count', self.recentSpinBox.value())
settings.setValue(u'save current plugin',
- QtCore.QVariant(self.mediaPluginCheckBox.isChecked()))
+ self.mediaPluginCheckBox.isChecked())
settings.setValue(u'double click live',
- QtCore.QVariant(self.doubleClickLiveCheckBox.isChecked()))
+ self.doubleClickLiveCheckBox.isChecked())
settings.setValue(u'single click preview',
- QtCore.QVariant(self.singleClickPreviewCheckBox.isChecked()))
+ self.singleClickPreviewCheckBox.isChecked())
settings.setValue(u'expand service item',
- QtCore.QVariant(self.expandServiceItemCheckBox.isChecked()))
+ self.expandServiceItemCheckBox.isChecked())
settings.setValue(u'enable exit confirmation',
- QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked()))
- settings.setValue(u'hide mouse',
- QtCore.QVariant(self.hideMouseCheckBox.isChecked()))
- settings.setValue(u'x11 bypass wm',
- QtCore.QVariant(self.x11BypassCheckBox.isChecked()))
+ self.enableAutoCloseCheckBox.isChecked())
+ settings.setValue(u'hide mouse', self.hideMouseCheckBox.isChecked())
+ settings.setValue(u'x11 bypass wm', self.x11BypassCheckBox.isChecked())
settings.setValue(u'default color', self.defaultColor)
settings.setValue(u'default image', self.defaultFileEdit.text())
- settings.setValue(u'slide limits', QtCore.QVariant(self.slide_limits))
+ settings.setValue(u'slide limits', self.slide_limits)
settings.endGroup()
if self.displayChanged:
Receiver.send_message(u'config_screen_changed')
=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py 2012-12-01 07:57:54 +0000
+++ openlp/core/ui/exceptionform.py 2012-12-20 12:09:36 +0000
@@ -112,10 +112,10 @@
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 + \
@@ -141,13 +141,13 @@
"""
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),
@@ -178,7 +178,7 @@
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 '
@@ -186,7 +186,7 @@
'--- 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''
@@ -211,13 +211,12 @@
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(
- self,translate('ImagePlugin.ExceptionDialog',
- 'Select Attachment'),
+ self, translate('ImagePlugin.ExceptionDialog', 'Select Attachment'),
SettingsManager.get_last_dir(u'exceptions'),
u'%s (*.*) (*)' % UiStrings().AllFiles)
log.info(u'New files(s) %s', unicode(files))
=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py 2012-12-05 06:12:07 +0000
+++ openlp/core/ui/firsttimeform.py 2012-12-20 12:09:36 +0000
@@ -40,8 +40,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, \
- check_directory_exists
-from openlp.core.lib.settings import Settings
+ check_directory_exists, Settings
from openlp.core.utils import get_web_page, AppLocation, get_filesystem_encoding
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
@@ -69,7 +68,7 @@
os.path.join(unicode(gettempdir(), get_filesystem_encoding()),
u'openlp', screenshot))
item = QtGui.QListWidgetItem(title, self.parent().themesListWidget)
- item.setData(QtCore.Qt.UserRole, QtCore.QVariant(filename))
+ item.setData(QtCore.Qt.UserRole, filename)
item.setCheckState(QtCore.Qt.Unchecked)
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
@@ -94,8 +93,8 @@
self.config.readfp(io.BytesIO(files))
self.updateScreenListCombo()
self.downloadCancelled = 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,
@@ -121,8 +120,7 @@
unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
self.noInternetFinishButton.setVisible(False)
# Check if this is a re-run of the wizard.
- self.hasRunWizard = Settings().value(
- u'general/has run wizard', QtCore.QVariant(False)).toBool()
+ self.hasRunWizard = Settings().value(u'general/has run wizard', False)
# Sort out internet access for downloads
if self.webAccess:
songs = self.config.get(u'songs', u'languages')
@@ -133,7 +131,7 @@
filename = unicode(self.config.get(
u'songs_%s' % song, u'filename'), u'utf8')
item = QtGui.QListWidgetItem(title, self.songsListWidget)
- item.setData(QtCore.Qt.UserRole, QtCore.QVariant(filename))
+ item.setData(QtCore.Qt.UserRole, filename)
item.setCheckState(QtCore.Qt.Unchecked)
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
bible_languages = self.config.get(u'bibles', u'languages')
@@ -142,7 +140,7 @@
language = unicode(self.config.get(
u'bibles_%s' % lang, u'title'), u'utf8')
langItem = QtGui.QTreeWidgetItem(
- self.biblesTreeWidget, QtCore.QStringList(language))
+ self.biblesTreeWidget, [language])
bibles = self.config.get(u'bibles_%s' % lang, u'translations')
bibles = bibles.split(u',')
for bible in bibles:
@@ -150,10 +148,8 @@
u'bible_%s' % bible, u'title'), u'utf8')
filename = unicode(self.config.get(
u'bible_%s' % bible, u'filename'))
- item = QtGui.QTreeWidgetItem(
- langItem, QtCore.QStringList(title))
- item.setData(0, QtCore.Qt.UserRole,
- QtCore.QVariant(filename))
+ item = QtGui.QTreeWidgetItem(langItem, [title])
+ item.setData(0, QtCore.Qt.UserRole, filename)
item.setCheckState(0, QtCore.Qt.Unchecked)
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
self.biblesTreeWidget.expandAll()
@@ -217,9 +213,7 @@
index = self.themeComboBox.findText(theme)
if index == -1:
self.themeComboBox.addItem(theme)
- default_theme = unicode(Settings().value(
- u'themes/global theme',
- QtCore.QVariant(u'')).toString())
+ default_theme = Settings().value(u'themes/global theme', u'')
# Pre-select the current default theme.
index = self.themeComboBox.findText(default_theme)
self.themeComboBox.setCurrentIndex(index)
@@ -271,7 +265,7 @@
self._performWizard()
Receiver.send_message(u'cursor_normal')
Receiver.send_message(u'openlp_process_events')
- Settings().setValue(u'general/has run wizard', QtCore.QVariant(True))
+ Settings().setValue(u'general/has run wizard', True)
self.close()
def urlGetFile(self, url, fpath):
@@ -308,7 +302,7 @@
screenshot = self.config.get(u'theme_%s' % theme, u'screenshot')
for index in xrange(self.themesListWidget.count()):
item = self.themesListWidget.item(index)
- if item.data(QtCore.Qt.UserRole) == QtCore.QVariant(filename):
+ if item.data(QtCore.Qt.UserRole) == filename:
break
item.setIcon(build_icon(os.path.join(unicode(gettempdir(),
get_filesystem_encoding()), u'openlp', screenshot)))
@@ -351,7 +345,7 @@
Receiver.send_message(u'openlp_process_events')
item = self.songsListWidget.item(i)
if item.checkState() == QtCore.Qt.Checked:
- filename = item.data(QtCore.Qt.UserRole).toString()
+ filename = item.data(QtCore.Qt.UserRole)
size = self._getFileSize(u'%s%s' % (self.web, filename))
self.max_progress += size
# Loop through the Bibles list and increase for each selected item
@@ -360,7 +354,7 @@
Receiver.send_message(u'openlp_process_events')
item = iterator.value()
if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
- filename = item.data(0, QtCore.Qt.UserRole).toString()
+ filename = item.data(0, QtCore.Qt.UserRole)
size = self._getFileSize(u'%s%s' % (self.web, filename))
self.max_progress += size
iterator += 1
@@ -369,7 +363,7 @@
Receiver.send_message(u'openlp_process_events')
item = self.themesListWidget.item(i)
if item.checkState() == QtCore.Qt.Checked:
- filename = item.data(QtCore.Qt.UserRole).toString()
+ filename = item.data(QtCore.Qt.UserRole)
size = self._getFileSize(u'%s%s' % (self.web, filename))
self.max_progress += size
if self.max_progress:
@@ -450,7 +444,7 @@
for i in xrange(self.songsListWidget.count()):
item = self.songsListWidget.item(i)
if item.checkState() == QtCore.Qt.Checked:
- filename = item.data(QtCore.Qt.UserRole).toString()
+ filename = item.data(QtCore.Qt.UserRole)
self._incrementProgressBar(self.downloading % filename, 0)
self.previous_size = 0
destination = os.path.join(songs_destination,
@@ -462,7 +456,7 @@
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)
self._incrementProgressBar(self.downloading % bible, 0)
self.previous_size = 0
self.urlGetFile(u'%s%s' % (self.web, bible),
@@ -472,7 +466,7 @@
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)
self._incrementProgressBar(self.downloading % theme, 0)
self.previous_size = 0
self.urlGetFile(u'%s%s' % (self.web, theme),
@@ -480,15 +474,15 @@
# Set Default Display
if self.displayComboBox.currentIndex() != -1:
Settings().setValue(u'General/monitor',
- QtCore.QVariant(self.displayComboBox.currentIndex()))
+ self.displayComboBox.currentIndex())
self.screens.set_current_display(
self.displayComboBox.currentIndex())
# Set Global Theme
if self.themeComboBox.currentIndex() != -1:
Settings().setValue(u'themes/global theme',
- QtCore.QVariant(self.themeComboBox.currentText()))
+ self.themeComboBox.currentText())
def _setPluginStatus(self, field, tag):
status = PluginStatus.Active if field.checkState() \
== QtCore.Qt.Checked else PluginStatus.Inactive
- Settings().setValue(tag, QtCore.QVariant(status))
+ Settings().setValue(tag, status)
=== modified file 'openlp/core/ui/formattingtagform.py'
--- openlp/core/ui/formattingtagform.py 2012-12-01 07:57:54 +0000
+++ openlp/core/ui/formattingtagform.py 2012-12-20 12:09:36 +0000
@@ -160,18 +160,18 @@
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.
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2012-12-01 07:57:54 +0000
+++ openlp/core/ui/generaltab.py 2012-12-20 12:09:36 +0000
@@ -30,9 +30,8 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab, Receiver, translate
+from openlp.core.lib import Receiver, Settings, SettingsTab, translate
from openlp.core.lib.ui import UiStrings
-from openlp.core.lib.settings import Settings
from openlp.core.ui import ScreenList
log = logging.getLogger(__name__)
@@ -272,49 +271,41 @@
settings.beginGroup(self.settingsSection)
self.monitorComboBox.clear()
self.monitorComboBox.addItems(self.screens.get_screen_list())
- monitorNumber = settings.value(u'monitor',
- QtCore.QVariant(self.screens.display_count - 1)).toInt()[0]
+ monitorNumber = settings.value(
+ u'monitor', self.screens.display_count - 1)
self.monitorComboBox.setCurrentIndex(monitorNumber)
- self.numberEdit.setText(unicode(settings.value(
- u'ccli number', QtCore.QVariant(u'')).toString()))
- self.usernameEdit.setText(unicode(settings.value(
- u'songselect username', QtCore.QVariant(u'')).toString()))
- self.passwordEdit.setText(unicode(settings.value(
- u'songselect password', QtCore.QVariant(u'')).toString()))
+ self.numberEdit.setText(settings.value(u'ccli number', u''))
+ self.usernameEdit.setText(settings.value(u'songselect username', u''))
+ self.passwordEdit.setText(settings.value(u'songselect password', u''))
self.saveCheckServiceCheckBox.setChecked(settings.value(u'save prompt',
- QtCore.QVariant(False)).toBool())
+ False))
self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank',
- QtCore.QVariant(False)).toBool())
+ False))
self.displayOnMonitorCheck.setChecked(self.screens.display)
- self.warningCheckBox.setChecked(settings.value(u'blank warning',
- QtCore.QVariant(False)).toBool())
- self.autoOpenCheckBox.setChecked(settings.value(u'auto open',
- QtCore.QVariant(False)).toBool())
- self.showSplashCheckBox.setChecked(settings.value(u'show splash',
- QtCore.QVariant(True)).toBool())
+ self.warningCheckBox.setChecked(settings.value(u'blank warning', False))
+ self.autoOpenCheckBox.setChecked(settings.value(u'auto open', False))
+ self.showSplashCheckBox.setChecked(settings.value(u'show splash', True))
self.checkForUpdatesCheckBox.setChecked(settings.value(u'update check',
- QtCore.QVariant(True)).toBool())
+ True))
self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview',
- QtCore.QVariant(False)).toBool())
- self.timeoutSpinBox.setValue(settings.value(u'loop delay',
- QtCore.QVariant(5)).toInt()[0])
+ False))
+ self.timeoutSpinBox.setValue(settings.value(u'loop delay', 5))
self.monitorRadioButton.setChecked(
- not settings.value(u'override position',
- QtCore.QVariant(False)).toBool())
+ not settings.value(u'override position', False))
self.overrideRadioButton.setChecked(settings.value(u'override position',
- QtCore.QVariant(False)).toBool())
+ False))
self.customXValueEdit.setValue(settings.value(u'x position',
- QtCore.QVariant(self.screens.current[u'size'].x())).toInt()[0])
+ self.screens.current[u'size'].x()))
self.customYValueEdit.setValue(settings.value(u'y position',
- QtCore.QVariant(self.screens.current[u'size'].y())).toInt()[0])
+ self.screens.current[u'size'].y()))
self.customHeightValueEdit.setValue(settings.value(u'height',
- QtCore.QVariant(self.screens.current[u'size'].height())).toInt()[0])
+ self.screens.current[u'size'].height()))
self.customWidthValueEdit.setValue(settings.value(u'width',
- QtCore.QVariant(self.screens.current[u'size'].width())).toInt()[0])
+ self.screens.current[u'size'].width()))
self.startPausedCheckBox.setChecked(settings.value(
- u'audio start paused', QtCore.QVariant(True)).toBool())
+ u'audio start paused', True))
self.repeatListCheckBox.setChecked(settings.value(
- u'audio repeat list', QtCore.QVariant(False)).toBool())
+ u'audio repeat list', False))
settings.endGroup()
self.monitorComboBox.setDisabled(self.overrideRadioButton.isChecked())
self.customXValueEdit.setEnabled(self.overrideRadioButton.isChecked())
@@ -332,46 +323,34 @@
"""
settings = Settings()
settings.beginGroup(self.settingsSection)
- settings.setValue(u'monitor',
- QtCore.QVariant(self.monitorComboBox.currentIndex()))
+ settings.setValue(u'monitor', self.monitorComboBox.currentIndex())
settings.setValue(u'display on monitor',
- QtCore.QVariant(self.displayOnMonitorCheck.isChecked()))
- settings.setValue(u'blank warning',
- QtCore.QVariant(self.warningCheckBox.isChecked()))
- settings.setValue(u'auto open',
- QtCore.QVariant(self.autoOpenCheckBox.isChecked()))
- settings.setValue(u'show splash',
- QtCore.QVariant(self.showSplashCheckBox.isChecked()))
+ self.displayOnMonitorCheck.isChecked())
+ settings.setValue(u'blank warning', self.warningCheckBox.isChecked())
+ settings.setValue(u'auto open', self.autoOpenCheckBox.isChecked())
+ settings.setValue(u'show splash', self.showSplashCheckBox.isChecked())
settings.setValue(u'update check',
- QtCore.QVariant(self.checkForUpdatesCheckBox.isChecked()))
+ self.checkForUpdatesCheckBox.isChecked())
settings.setValue(u'save prompt',
- QtCore.QVariant(self.saveCheckServiceCheckBox.isChecked()))
- settings.setValue(u'auto unblank',
- QtCore.QVariant(self.autoUnblankCheckBox.isChecked()))
- settings.setValue(u'auto preview',
- QtCore.QVariant(self.autoPreviewCheckBox.isChecked()))
- settings.setValue(u'loop delay',
- QtCore.QVariant(self.timeoutSpinBox.value()))
- settings.setValue(u'ccli number',
- QtCore.QVariant(self.numberEdit.displayText()))
+ self.saveCheckServiceCheckBox.isChecked())
+ settings.setValue(u'auto unblank', self.autoUnblankCheckBox.isChecked())
+ settings.setValue(u'auto preview', self.autoPreviewCheckBox.isChecked())
+ settings.setValue(u'loop delay', self.timeoutSpinBox.value())
+ settings.setValue(u'ccli number', self.numberEdit.displayText())
settings.setValue(u'songselect username',
- QtCore.QVariant(self.usernameEdit.displayText()))
+ self.usernameEdit.displayText())
settings.setValue(u'songselect password',
- QtCore.QVariant(self.passwordEdit.displayText()))
- settings.setValue(u'x position',
- QtCore.QVariant(self.customXValueEdit.value()))
- settings.setValue(u'y position',
- QtCore.QVariant(self.customYValueEdit.value()))
- settings.setValue(u'height',
- QtCore.QVariant(self.customHeightValueEdit.value()))
- settings.setValue(u'width',
- QtCore.QVariant(self.customWidthValueEdit.value()))
+ self.passwordEdit.displayText())
+ settings.setValue(u'x position', self.customXValueEdit.value())
+ settings.setValue(u'y position', self.customYValueEdit.value())
+ settings.setValue(u'height', self.customHeightValueEdit.value())
+ settings.setValue(u'width', self.customWidthValueEdit.value())
settings.setValue(u'override position',
- QtCore.QVariant(self.overrideRadioButton.isChecked()))
+ self.overrideRadioButton.isChecked())
settings.setValue(u'audio start paused',
- QtCore.QVariant(self.startPausedCheckBox.isChecked()))
+ self.startPausedCheckBox.isChecked())
settings.setValue(u'audio repeat list',
- QtCore.QVariant(self.repeatListCheckBox.isChecked()))
+ self.repeatListCheckBox.isChecked())
settings.endGroup()
# On save update the screens as well
self.postSetUp(True)
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2012-12-07 19:00:33 +0000
+++ openlp/core/ui/maindisplay.py 2012-12-20 12:09:36 +0000
@@ -39,9 +39,8 @@
from PyQt4.phonon import Phonon
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
- translate, PluginManager, expand_tags, ImageSource
+ translate, PluginManager, expand_tags, Settings, ImageSource
from openlp.core.lib.theme import BackgroundType
-from openlp.core.lib.settings import Settings
from openlp.core.ui import HideMode, ScreenList, AlertLocation
@@ -143,8 +142,7 @@
# Default to False on Gnome.
x11_bypass_default = bool(not
os.environ.get(u'GNOME_DESKTOP_SESSION_ID'))
- if Settings().value(u'advanced/x11 bypass wm',
- QtCore.QVariant(x11_bypass_default)).toBool():
+ if Settings().value(u'advanced/x11 bypass wm', x11_bypass_default):
windowFlags |= QtCore.Qt.X11BypassWindowManagerHint
# TODO: The following combination of windowFlags works correctly
# on Mac OS X. For next OpenLP version we should test it on other
@@ -211,13 +209,11 @@
# Build the initial frame.
background_color = QtGui.QColor()
background_color.setNamedColor(Settings().value(
- u'advanced/default color',
- QtCore.QVariant(u'#ffffff')).toString())
+ u'advanced/default color', u'#ffffff'))
if not background_color.isValid():
background_color = QtCore.Qt.white
image_file = Settings().value(u'advanced/default image',
- QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\
- .toString()
+ u':/graphics/openlp-splash-screen.png')
splash_image = QtGui.QImage(image_file)
self.initialFrame = QtGui.QImage(
self.screen[u'size'].width(),
@@ -287,7 +283,7 @@
height = self.frame.evaluateJavaScript(js)
if shrink:
if text:
- alert_height = int(height.toString())
+ alert_height = int(height)
self.resize(self.width(), alert_height)
self.setVisible(True)
if location == AlertLocation.Middle:
@@ -367,7 +363,7 @@
if self.serviceItem.themedata and \
self.serviceItem.themedata.display_slide_transition:
while self.frame.evaluateJavaScript(u'show_text_complete()') \
- .toString() == u'false':
+ == u'false':
Receiver.send_message(u'openlp_process_events')
# Wait for the webview to update before getting the preview.
# Important otherwise first preview will miss the background !
@@ -381,8 +377,7 @@
# Single screen active
if self.screens.display_count == 1:
# Only make visible if setting enabled.
- if Settings().value(u'general/display on monitor',
- QtCore.QVariant(True)).toBool():
+ if Settings().value(u'general/display on monitor', True):
self.setVisible(True)
else:
self.setVisible(True)
@@ -433,8 +428,7 @@
self.footer(serviceItem.foot_text)
# if was hidden keep it hidden
if self.hideMode and self.isLive and not serviceItem.is_media():
- if Settings().value(u'general/auto unblank',
- QtCore.QVariant(False)).toBool():
+ if Settings().value(u'general/auto unblank', False):
Receiver.send_message(u'slidecontroller_live_unblank')
else:
self.hideDisplay(self.hideMode)
@@ -457,8 +451,7 @@
log.debug(u'hideDisplay mode = %d', mode)
if self.screens.display_count == 1:
# Only make visible if setting enabled.
- if not Settings().value(u'general/display on monitor',
- QtCore.QVariant(True)).toBool():
+ if not Settings().value(u'general/display on monitor', True):
return
if mode == HideMode.Screen:
self.frame.evaluateJavaScript(u'show_blank("desktop");')
@@ -482,8 +475,7 @@
log.debug(u'showDisplay')
if self.screens.display_count == 1:
# Only make visible if setting enabled.
- if not Settings().value(u'general/display on monitor',
- QtCore.QVariant(True)).toBool():
+ if not Settings().value(u'general/display on monitor', True):
return
self.frame.evaluateJavaScript('show_blank("show");')
if self.isHidden():
@@ -497,8 +489,7 @@
"""
Hide mouse cursor when moved over display.
"""
- if Settings().value(u'advanced/hide mouse',
- QtCore.QVariant(True)).toBool():
+ if Settings().value(u'advanced/hide mouse', True):
self.setCursor(QtCore.Qt.BlankCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
else:
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2012-12-04 06:09:55 +0000
+++ openlp/core/ui/mainwindow.py 2012-12-20 12:09:36 +0000
@@ -42,8 +42,7 @@
from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \
PluginManager, Receiver, translate, ImageManager, PluginStatus
from openlp.core.lib.ui import UiStrings, create_action
-from openlp.core.lib.settings import Settings
-from openlp.core.lib import SlideLimits
+from openlp.core.lib import SlideLimits, Settings
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
ThemeManager, SlideController, PluginForm, MediaDockManager, \
ShortcutListForm, FormattingTagForm
@@ -105,13 +104,10 @@
# Create slide controllers
self.previewController = SlideController(self)
self.liveController = SlideController(self, True)
- previewVisible = Settings().value(
- u'user interface/preview panel', QtCore.QVariant(True)).toBool()
+ previewVisible = Settings().value(u'user interface/preview panel', True)
self.previewController.panel.setVisible(previewVisible)
- liveVisible = Settings().value(u'user interface/live panel',
- QtCore.QVariant(True)).toBool()
- panelLocked = Settings().value(u'user interface/lock panel',
- QtCore.QVariant(False)).toBool()
+ liveVisible = Settings().value(u'user interface/live panel', True)
+ panelLocked = Settings().value(u'user interface/lock panel', False)
self.liveController.panel.setVisible(liveVisible)
# Create menu
self.menuBar = QtGui.QMenuBar(mainWindow)
@@ -182,7 +178,7 @@
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',
@@ -213,19 +209,19 @@
category=UiStrings().File, triggers=mainWindow.close)
# Give QT Extra Hint that this is the Exit Menu Item
self.fileExitItem.setMenuRole(QtGui.QAction.QuitRole)
- 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')],
@@ -250,7 +246,7 @@
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)
@@ -263,8 +259,7 @@
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)
@@ -276,7 +271,7 @@
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',
@@ -313,8 +308,7 @@
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')],
@@ -512,8 +506,8 @@
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',
@@ -580,7 +574,7 @@
self.settingsForm = SettingsForm(self, self)
self.formattingTagForm = FormattingTagForm(self)
self.shortcutForm = ShortcutListForm(self)
- self.recentFiles = QtCore.QStringList()
+ self.recentFiles = []
# Set up the path with plugins
plugin_path = AppLocation.get_directory(AppLocation.PluginsDir)
self.pluginManager = PluginManager(plugin_path)
@@ -707,10 +701,8 @@
self.previewController.screenSizeChanged()
self.liveController.screenSizeChanged()
log.info(u'Load data from Settings')
- if Settings().value(u'advanced/save current plugin',
- QtCore.QVariant(False)).toBool():
- savedPlugin = Settings().value(
- u'advanced/current media plugin', QtCore.QVariant()).toInt()[0]
+ if Settings().value(u'advanced/save current plugin', False):
+ savedPlugin = Settings().value(u'advanced/current media plugin', -1)
if savedPlugin != -1:
self.mediaToolBox.setCurrentIndex(savedPlugin)
self.settingsForm.postSetUp()
@@ -737,10 +729,10 @@
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']))
@@ -762,11 +754,10 @@
filename = unicode(filename, sys.getfilesystemencoding())
self.serviceManagerContents.loadFile(filename)
elif Settings().value(
- self.generalSettingsSection + u'/auto open',
- QtCore.QVariant(False)).toBool():
+ self.generalSettingsSection + u'/auto open', False):
self.serviceManagerContents.loadLastFile()
- view_mode = Settings().value(u'%s/view mode' % \
- self.generalSettingsSection, u'default').toString()
+ view_mode = Settings().value(u'%s/view mode' %
+ self.generalSettingsSection, u'default')
if view_mode == u'default':
self.modeDefaultItem.setChecked(True)
elif view_mode == u'setup':
@@ -849,9 +840,9 @@
settings = Settings()
self.liveController.mainDisplaySetBackground()
if settings.value(u'%s/screen blank' % self.generalSettingsSection,
- QtCore.QVariant(False)).toBool():
+ False):
if settings.value(u'%s/blank warning' % self.generalSettingsSection,
- QtCore.QVariant(False)).toBool():
+ False):
QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow',
'OpenLP Main Display Blanked'),
@@ -960,11 +951,10 @@
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 = []
@@ -982,8 +972,7 @@
for plugin in self.pluginManager.plugins:
setting_sections.extend([plugin.name])
settings = Settings()
- import_settings = Settings(import_file_name,
- Settings.IniFormat)
+ import_settings = Settings(import_file_name, Settings.IniFormat)
import_keys = import_settings.allKeys()
for section_key in import_keys:
# We need to handle the really bad files.
@@ -1012,13 +1001,11 @@
# We have a good file, import it.
for section_key in import_keys:
value = import_settings.value(section_key)
- settings.setValue(u'%s' % (section_key),
- QtCore.QVariant(value))
+ settings.setValue(u'%s' % (section_key), value)
now = datetime.now()
settings.beginGroup(self.headerSection)
- settings.setValue(u'file_imported', QtCore.QVariant(import_file_name))
- settings.setValue(u'file_date_imported',
- now.strftime("%Y-%m-%d %H:%M"))
+ settings.setValue(u'file_imported', import_file_name)
+ settings.setValue(u'file_date_imported', now.strftime("%Y-%m-%d %H:%M"))
settings.endGroup()
settings.sync()
# We must do an immediate restart or current configuration will
@@ -1039,10 +1026,10 @@
"""
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.
@@ -1072,8 +1059,7 @@
settings.remove(self.headerSection)
# Get the settings.
keys = settings.allKeys()
- export_settings = Settings(temp_file,
- Settings.IniFormat)
+ export_settings = Settings(temp_file, Settings.IniFormat)
# Add a header section.
# This is to insure it's our conf file for import.
now = datetime.now()
@@ -1182,8 +1168,7 @@
else:
event.ignore()
else:
- if Settings().value(u'advanced/enable exit confirmation',
- QtCore.QVariant(True)).toBool():
+ if Settings().value(u'advanced/enable exit confirmation', True):
ret = QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'Close OpenLP'),
translate('OpenLP.MainWindow',
@@ -1213,10 +1198,9 @@
# Clean temporary files used by services
self.serviceManagerContents.cleanUp()
if save_settings:
- if Settings().value(u'advanced/save current plugin',
- QtCore.QVariant(False)).toBool():
+ if Settings().value(u'advanced/save current plugin', False):
Settings().setValue(u'advanced/current media plugin',
- QtCore.QVariant(self.mediaToolBox.currentIndex()))
+ self.mediaToolBox.currentIndex())
# Call the cleanup method to shutdown plugins.
log.info(u'cleanup plugins')
self.pluginManager.finalise_plugins()
@@ -1277,8 +1261,7 @@
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())
@@ -1301,8 +1284,7 @@
False - Hidden
"""
self.previewController.panel.setVisible(visible)
- Settings().setValue(u'user interface/preview panel',
- QtCore.QVariant(visible))
+ Settings().setValue(u'user interface/preview panel', visible)
self.viewPreviewPanel.setChecked(visible)
def setLockPanel(self, lock):
@@ -1333,8 +1315,7 @@
self.viewThemeManagerItem.setEnabled(True)
self.viewPreviewPanel.setEnabled(True)
self.viewLivePanel.setEnabled(True)
- Settings().setValue(u'user interface/lock panel',
- QtCore.QVariant(lock))
+ Settings().setValue(u'user interface/lock panel', lock)
def setLivePanelVisibility(self, visible):
"""
@@ -1347,8 +1328,7 @@
False - Hidden
"""
self.liveController.panel.setVisible(visible)
- Settings().setValue(u'user interface/live panel',
- QtCore.QVariant(visible))
+ Settings().setValue(u'user interface/live panel', visible)
self.viewLivePanel.setChecked(visible)
def loadSettings(self):
@@ -1360,12 +1340,12 @@
if Settings().contains(self.generalSettingsSection +
u'/enable slide loop'):
if Settings().value(self.generalSettingsSection +
- u'/enable slide loop', QtCore.QVariant(True)).toBool():
+ u'/enable slide loop', True):
Settings().setValue(self.advancedSettingsSection +
- u'/slide limits', QtCore.QVariant(SlideLimits.Wrap))
+ u'/slide limits', SlideLimits.Wrap)
else:
Settings().setValue(self.advancedSettingsSection +
- u'/slide limits', QtCore.QVariant(SlideLimits.End))
+ u'/slide limits', SlideLimits.End)
Settings().remove(self.generalSettingsSection +
u'/enable slide loop')
Receiver.send_message(u'slidecontroller_update_slide_limits')
@@ -1374,20 +1354,20 @@
settings.remove(u'custom slide')
settings.remove(u'service')
settings.beginGroup(self.generalSettingsSection)
- self.recentFiles = settings.value(u'recent files').toStringList()
+ self.recentFiles = settings.value(u'recent files', self.recentFiles)
settings.endGroup()
settings.beginGroup(self.uiSettingsSection)
- self.move(settings.value(u'main window position',
- QtCore.QVariant(QtCore.QPoint(0, 0))).toPoint())
+ self.move(settings.value(u'main window position', QtCore.QPoint(0, 0)))
self.restoreGeometry(
- settings.value(u'main window geometry').toByteArray())
- self.restoreState(settings.value(u'main window state').toByteArray())
+ settings.value(u'main window geometry', QtCore.QByteArray()))
+ self.restoreState(
+ settings.value(u'main window state', QtCore.QByteArray()))
self.liveController.splitter.restoreState(
- settings.value(u'live splitter geometry').toByteArray())
+ settings.value(u'live splitter geometry', QtCore.QByteArray()))
self.previewController.splitter.restoreState(
- settings.value(u'preview splitter geometry').toByteArray())
- self.controlSplitter.restoreState(
- settings.value(u'mainwindow splitter geometry').toByteArray())
+ settings.value(u'preview splitter geometry', QtCore.QByteArray()))
+ self.controlSplitter.restoreState(settings.value(
+ u'mainwindow splitter geometry', QtCore.QByteArray()))
settings.endGroup()
def saveSettings(self):
@@ -1400,23 +1380,18 @@
log.debug(u'Saving QSettings')
settings = Settings()
settings.beginGroup(self.generalSettingsSection)
- recentFiles = QtCore.QVariant(self.recentFiles) \
- if self.recentFiles else QtCore.QVariant()
- settings.setValue(u'recent files', recentFiles)
+ settings.setValue(u'recent files', self.recentFiles)
settings.endGroup()
settings.beginGroup(self.uiSettingsSection)
- settings.setValue(u'main window position',
- QtCore.QVariant(self.pos()))
- settings.setValue(u'main window state',
- QtCore.QVariant(self.saveState()))
- settings.setValue(u'main window geometry',
- QtCore.QVariant(self.saveGeometry()))
+ settings.setValue(u'main window position', self.pos())
+ settings.setValue(u'main window state', self.saveState())
+ settings.setValue(u'main window geometry', self.saveGeometry())
settings.setValue(u'live splitter geometry',
- QtCore.QVariant(self.liveController.splitter.saveState()))
+ self.liveController.splitter.saveState())
settings.setValue(u'preview splitter geometry',
- QtCore.QVariant(self.previewController.splitter.saveState()))
+ self.previewController.splitter.saveState())
settings.setValue(u'mainwindow splitter geometry',
- QtCore.QVariant(self.controlSplitter.saveState()))
+ self.controlSplitter.saveState())
settings.endGroup()
def updateRecentFilesMenu(self):
@@ -1424,8 +1399,7 @@
Updates the recent file menu with the latest list of service files
accessed.
"""
- recentFileCount = Settings().value(
- u'advanced/recent file count', QtCore.QVariant(4)).toInt()[0]
+ recentFileCount = Settings().value(u'advanced/recent file count', 4)
existingRecentFiles = [recentFile for recentFile in self.recentFiles
if os.path.isfile(unicode(recentFile))]
recentFilesToDisplay = existingRecentFiles[0:recentFileCount]
@@ -1442,10 +1416,10 @@
'Clear List of recent files'),
statustip=translate('OpenLP.MainWindow',
'Clear the list of recent files.'),
- enabled=not self.recentFiles.isEmpty(),
- triggers=self.recentFiles.clear)
+ enabled=bool(self.recentFiles),
+ triggers=self.clearRecentFileMenu)
add_actions(self.recentFilesMenu, (None, clearRecentFilesAction))
- clearRecentFilesAction.setEnabled(not self.recentFiles.isEmpty())
+ clearRecentFilesAction.setEnabled(bool(self.recentFiles))
def addRecentFile(self, filename):
"""
@@ -1457,8 +1431,7 @@
# The maxRecentFiles value does not have an interface and so never gets
# actually stored in the settings therefore the default value of 20 will
# always be used.
- maxRecentFiles = Settings().value(u'advanced/max recent files',
- QtCore.QVariant(20)).toInt()[0]
+ maxRecentFiles = Settings().value(u'advanced/max recent files', 20)
if filename:
# Add some cleanup to reduce duplication in the recent file list
filename = os.path.abspath(filename)
@@ -1466,13 +1439,17 @@
# in the given filename which then causes duplication.
if filename[1:3] == ':\\':
filename = filename[0].upper() + filename[1:]
- position = self.recentFiles.indexOf(filename)
- if position != -1:
- self.recentFiles.removeAt(position)
- self.recentFiles.insert(0, QtCore.QString(filename))
- while self.recentFiles.count() > maxRecentFiles:
- # Don't care what API says takeLast works, removeLast doesn't!
- self.recentFiles.takeLast()
+ if filename in self.recentFiles:
+ self.recentFiles.remove(filename)
+ self.recentFiles.insert(0, filename)
+ while len(self.recentFiles) > maxRecentFiles:
+ self.recentFiles.pop()
+
+ def clearRecentFileMenu(self):
+ """
+ Clears the recent files.
+ """
+ self.recentFiles = []
def displayProgressBar(self, size):
"""
=== modified file 'openlp/core/ui/media/__init__.py'
--- openlp/core/ui/media/__init__.py 2012-12-11 19:55:47 +0000
+++ openlp/core/ui/media/__init__.py 2012-12-20 12:09:36 +0000
@@ -28,7 +28,7 @@
###############################################################################
import logging
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Settings
from PyQt4 import QtCore
@@ -76,13 +76,10 @@
from the settings.
"""
log.debug(u'get_media_players')
- saved_players = unicode(Settings().value(u'media/players').toString())
- if not saved_players:
- # we must always have a player and Webkit is the core one.
- saved_players = u'webkit'
+ saved_players = Settings().value(u'media/players', u'webkit')
reg_ex = QtCore.QRegExp(".*\[(.*)\].*")
if Settings().value(u'media/override player',
- QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == QtCore.Qt.Checked:
+ QtCore.Qt.Unchecked)== QtCore.Qt.Checked:
if reg_ex.exactMatch(saved_players):
overridden_player = u'%s' % reg_ex.cap(1)
else:
@@ -106,10 +103,10 @@
"""
log.debug(u'set_media_players')
players = u','.join(players_list)
- if Settings().value(u'media/override player', QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == \
- QtCore.Qt.Checked and overridden_player != u'auto':
+ if Settings().value(u'media/override player', QtCore.Qt.Unchecked) == QtCore.Qt.Checked and \
+ overridden_player != u'auto':
players = players.replace(overridden_player, u'[%s]' % overridden_player)
- Settings().setValue(u'media/players', QtCore.QVariant(players))
+ Settings().setValue(u'media/players', players)
from mediacontroller import MediaController
from playertab import PlayerTab
=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py 2012-12-11 19:55:47 +0000
+++ openlp/core/ui/media/mediacontroller.py 2012-12-20 12:09:36 +0000
@@ -32,8 +32,7 @@
import sys
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import OpenLPToolbar, Receiver, translate
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import OpenLPToolbar, Receiver, translate, Settings
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui.media import MediaState, MediaInfo, MediaType, \
get_media_players, set_media_players
@@ -369,7 +368,7 @@
if not isValid:
# 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:
@@ -383,12 +382,12 @@
elif not hidden or controller.media_info.is_background or serviceItem.will_auto_start:
autoplay = True
# Unblank on load set
- elif Settings().value(u'general/auto unblank', QtCore.QVariant(False)).toBool():
+ elif Settings().value(u'general/auto unblank', False):
autoplay = True
if autoplay:
if not self.media_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.currentMediaPlayer[controller.controllerType])
@@ -412,11 +411,11 @@
if not self._check_file_type(controller, display, serviceItem):
# 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
if not self.media_play(controller):
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
- unicode(translate('MediaPlugin.MediaItem', 'Unsupported File')))
+ translate('MediaPlugin.MediaItem', 'Unsupported File'))
return False
serviceItem.set_media_length(controller.media_info.length)
self.media_stop(controller)
@@ -437,7 +436,7 @@
if serviceItem.title != UiStrings().Automatic:
usedPlayers = [serviceItem.title.lower()]
if controller.media_info.file_info.isFile():
- suffix = u'*.%s' % controller.media_info.file_info.suffix().toLower()
+ suffix = u'*.%s' % controller.media_info.file_info.suffix().lower()
for title in usedPlayers:
player = self.mediaPlayers[title]
if suffix in player.video_extensions_list:
=== modified file 'openlp/core/ui/media/phononplayer.py'
--- openlp/core/ui/media/phononplayer.py 2012-12-11 19:55:47 +0000
+++ openlp/core/ui/media/phononplayer.py 2012-12-20 12:09:36 +0000
@@ -34,8 +34,7 @@
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
-from openlp.core.lib import Receiver, translate
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Receiver, translate, Settings
from openlp.core.ui.media import MediaState
from openlp.core.ui.media.mediaplayer import MediaPlayer
@@ -223,8 +222,7 @@
"""
Add css style sheets to htmlbuilder
"""
- background = unicode(QtGui.QColor(Settings().value(u'players/background color',
- QtCore.QVariant(u'#000000'))).name())
+ background = QtGui.QColor(Settings().value(u'players/background color', u'#000000')).name()
return VIDEO_CSS % (background,background,background)
def get_info(self):
@@ -233,4 +231,4 @@
u'<br/> <strong>' + translate('Media.player', 'Audio') +
u'</strong><br/>' + unicode(self.audio_extensions_list) +
u'<br/><strong>' + translate('Media.player', 'Video') +
- u'</strong><br/>' + unicode(self.video_extensions_list) + u'<br/>')
\ No newline at end of file
+ u'</strong><br/>' + unicode(self.video_extensions_list) + u'<br/>')
=== modified file 'openlp/core/ui/media/playertab.py'
--- openlp/core/ui/media/playertab.py 2012-12-11 19:55:47 +0000
+++ openlp/core/ui/media/playertab.py 2012-12-20 12:09:36 +0000
@@ -29,9 +29,8 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab, translate, Receiver
+from openlp.core.lib import SettingsTab, translate, Receiver, Settings
from openlp.core.lib.ui import UiStrings, create_button
-from openlp.core.lib.settings import Settings
from openlp.core.ui.media import get_media_players, set_media_players
class MediaQCheckBox(QtGui.QCheckBox):
@@ -179,7 +178,7 @@
settings = Settings()
settings.beginGroup(self.settingsSection)
self.updatePlayerList()
- self.bg_color = unicode(settings.value(u'background color', QtCore.QVariant(u'#000000')).toString())
+ self.bg_color = settings.value(u'background color', u'#000000')
self.initial_color = self.bg_color
settings.endGroup()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)
@@ -188,7 +187,7 @@
player_string_changed = False
settings = Settings()
settings.beginGroup(self.settingsSection)
- settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
+ settings.setValue(u'background color', self.bg_color)
settings.endGroup()
old_players, override_player = get_media_players()
if self.usedPlayers != old_players:
@@ -233,4 +232,4 @@
if player.available:
checkbox.setText(player.display_name)
else:
- checkbox.setText(unicode(translate('OpenLP.PlayerTab', '%s (unavailable)')) % player.display_name)
\ No newline at end of file
+ checkbox.setText(translate('OpenLP.PlayerTab', '%s (unavailable)') % player.display_name)
=== modified file 'openlp/core/ui/media/vlcplayer.py'
--- openlp/core/ui/media/vlcplayer.py 2012-12-11 19:55:47 +0000
+++ openlp/core/ui/media/vlcplayer.py 2012-12-20 12:09:36 +0000
@@ -35,8 +35,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Receiver, translate
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Receiver, translate, Settings
from openlp.core.ui.media import MediaState
from openlp.core.ui.media.mediaplayer import MediaPlayer
@@ -114,7 +113,7 @@
command_line_options = u'--no-video-title-show'
if not display.hasAudio:
command_line_options += u' --no-audio --no-video-title-show'
- if Settings().value(u'advanced/hide mouse', QtCore.QVariant(True)).toBool() and display.controller.isLive:
+ if Settings().value(u'advanced/hide mouse', True) and display.controller.isLive:
command_line_options += u' --mouse-hide-timeout=0'
display.vlcInstance = vlc.Instance(command_line_options)
display.vlcInstance.set_log_verbosity(2)
@@ -147,7 +146,7 @@
log.debug(u'load vid in Vlc Controller')
controller = display.controller
volume = controller.media_info.volume
- file_path = str(controller.media_info.file_info.absoluteFilePath().toUtf8())
+ file_path = str(controller.media_info.file_info.absoluteFilePath())
path = os.path.normcase(file_path)
# create the media
display.vlcMedia = display.vlcInstance.media_new_path(path)
@@ -159,7 +158,7 @@
# We need to set media_info.length during load because we want
# to avoid start and stop the video twice. Once for real playback
# and once to just get media length.
- #
+ #
# Media plugin depends on knowing media length before playback.
controller.media_info.length = int(display.vlcMediaPlayer.get_media().get_duration() / 1000)
return True
@@ -243,4 +242,4 @@
u'<br/> <strong>' + translate('Media.player', 'Audio') +
u'</strong><br/>' + unicode(AUDIO_EXT) + u'<br/><strong>' +
translate('Media.player', 'Video') + u'</strong><br/>' +
- unicode(VIDEO_EXT) + u'<br/>')
\ No newline at end of file
+ unicode(VIDEO_EXT) + u'<br/>')
=== modified file 'openlp/core/ui/media/webkitplayer.py'
--- openlp/core/ui/media/webkitplayer.py 2012-12-11 19:55:47 +0000
+++ openlp/core/ui/media/webkitplayer.py 2012-12-20 12:09:36 +0000
@@ -31,10 +31,9 @@
import logging
-from openlp.core.lib import translate
+from openlp.core.lib import translate, Settings
from openlp.core.ui.media import MediaState
from openlp.core.ui.media.mediaplayer import MediaPlayer
-from openlp.core.lib.settings import Settings
log = logging.getLogger(__name__)
@@ -283,8 +282,7 @@
"""
Add css style sheets to htmlbuilder
"""
- background = unicode(QtGui.QColor(Settings().value(u'players/background color',
- QtCore.QVariant(u'#000000'))).name())
+ background = QtGui.QColor(Settings().value(u'players/background color', u'#000000')).name()
css = VIDEO_CSS % (background,background,background)
return css + FLASH_CSS
@@ -411,18 +409,18 @@
def update_ui(self, display):
controller = display.controller
if controller.media_info.is_flash:
- currentTime = display.frame.evaluateJavaScript(u'show_flash("currentTime");').toInt()[0]
- length = display.frame.evaluateJavaScript(u'show_flash("length");').toInt()[0]
+ currentTime = display.frame.evaluateJavaScript(u'show_flash("currentTime");')
+ length = display.frame.evaluateJavaScript(u'show_flash("length");')
else:
if display.frame.evaluateJavaScript(
- u'show_video("isEnded");').toString() == 'true':
+ u'show_video("isEnded");') == 'true':
self.stop(display)
(currentTime, ok) = display.frame.evaluateJavaScript(
- u'show_video("currentTime");').toFloat()
+ u'show_video("currentTime");')
# check if conversion was ok and value is not 'NaN'
if ok and currentTime != float('inf'):
currentTime = int(currentTime * 1000)
- (length, ok) = display.frame.evaluateJavaScript(u'show_video("length");').toFloat()
+ (length, ok) = display.frame.evaluateJavaScript(u'show_video("length");')
# check if conversion was ok and value is not 'NaN'
if ok and length != float('inf'):
length = int(length * 1000)
@@ -439,4 +437,4 @@
u'<br/> <strong>' + translate('Media.player', 'Audio') +
u'</strong><br/>' + unicode(AUDIO_EXT) + u'<br/><strong>' +
translate('Media.player', 'Video') + u'</strong><br/>' +
- unicode(VIDEO_EXT) + u'<br/>')
\ No newline at end of file
+ unicode(VIDEO_EXT) + u'<br/>')
=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py 2012-12-01 07:57:54 +0000
+++ openlp/core/ui/pluginform.py 2012-12-20 12:09:36 +0000
@@ -73,22 +73,19 @@
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)
@@ -138,16 +135,12 @@
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'])
=== modified file 'openlp/core/ui/printserviceform.py'
--- openlp/core/ui/printserviceform.py 2012-12-01 07:57:54 +0000
+++ openlp/core/ui/printserviceform.py 2012-12-20 12:09:36 +0000
@@ -33,9 +33,8 @@
from PyQt4 import QtCore, QtGui
from lxml import html
-from openlp.core.lib import translate, get_text_file_string, Receiver
+from openlp.core.lib import translate, get_text_file_string, Receiver, Settings
from openlp.core.lib.ui import UiStrings
-from openlp.core.lib.settings import Settings
from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize
from openlp.core.utils import AppLocation
@@ -126,17 +125,15 @@
settings = Settings()
settings.beginGroup(u'advanced')
self.slideTextCheckBox.setChecked(settings.value(
- u'print slide text', QtCore.QVariant(False)).toBool())
+ u'print slide text', False))
self.pageBreakAfterText.setChecked(settings.value(
- u'add page break', QtCore.QVariant(False)).toBool())
+ u'add page break', False))
if not self.slideTextCheckBox.isChecked():
self.pageBreakAfterText.setDisabled(True)
self.metaDataCheckBox.setChecked(settings.value(
- u'print file meta data', QtCore.QVariant(False)).toBool())
- self.notesCheckBox.setChecked(settings.value(
- u'print notes', QtCore.QVariant(False)).toBool())
- self.zoomComboBox.setCurrentIndex(settings.value(
- u'display size', QtCore.QVariant(0)).toInt()[0])
+ u'print file meta data', False))
+ self.notesCheckBox.setChecked(settings.value(u'print notes', False))
+ self.zoomComboBox.setCurrentIndex(settings.value(u'display size', 0))
settings.endGroup()
# Signals
QtCore.QObject.connect(self.printButton,
@@ -177,8 +174,7 @@
"""
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)
@@ -187,7 +183,7 @@
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)
@@ -246,7 +242,7 @@
translate('OpenLP.ServiceManager', 'Notes: '), p,
classId=u'itemNotesTitle')
self._addElement(u'span',
- cgi.escape(unicode(item.notes)).replace(u'\n', u'<br>'), p,
+ cgi.escape(item.notes).replace(u'\n', u'<br>'), p,
classId=u'itemNotesText')
# Add play length of media files.
if item.is_media() and self.metaDataCheckBox.isChecked():
@@ -323,7 +319,7 @@
self.previewWidget.zoomIn(0.25)
settings = Settings()
settings.beginGroup(u'advanced')
- settings.setValue(u'display size', QtCore.QVariant(display))
+ settings.setValue(u'display size', display)
settings.endGroup()
def copyText(self):
@@ -412,13 +408,12 @@
settings = Settings()
settings.beginGroup(u'advanced')
settings.setValue(u'print slide text',
- QtCore.QVariant(self.slideTextCheckBox.isChecked()))
+ self.slideTextCheckBox.isChecked())
settings.setValue(u'add page break',
- QtCore.QVariant(self.pageBreakAfterText.isChecked()))
+ self.pageBreakAfterText.isChecked())
settings.setValue(u'print file meta data',
- QtCore.QVariant(self.metaDataCheckBox.isChecked()))
- settings.setValue(u'print notes',
- QtCore.QVariant(self.notesCheckBox.isChecked()))
+ self.metaDataCheckBox.isChecked())
+ settings.setValue(u'print notes', self.notesCheckBox.isChecked())
settings.endGroup()
def update_song_usage(self):
=== modified file 'openlp/core/ui/screen.py'
--- openlp/core/ui/screen.py 2012-12-01 07:57:54 +0000
+++ openlp/core/ui/screen.py 2012-12-20 12:09:36 +0000
@@ -35,8 +35,7 @@
from PyQt4 import QtCore
-from openlp.core.lib import Receiver, translate
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Receiver, translate, Settings
log = logging.getLogger(__name__)
@@ -251,19 +250,13 @@
settings = Settings()
settings.beginGroup(u'general')
self.set_current_display(settings.value(u'monitor',
- QtCore.QVariant(self.display_count - 1)).toInt()[0])
- self.display = settings.value(
- u'display on monitor', QtCore.QVariant(True)).toBool()
- override_display = settings.value(
- u'override position', QtCore.QVariant(False)).toBool()
- x = settings.value(u'x position',
- QtCore.QVariant(self.current[u'size'].x())).toInt()[0]
- y = settings.value(u'y position',
- QtCore.QVariant(self.current[u'size'].y())).toInt()[0]
- width = settings.value(u'width',
- QtCore.QVariant(self.current[u'size'].width())).toInt()[0]
- height = settings.value(u'height',
- QtCore.QVariant(self.current[u'size'].height())).toInt()[0]
+ self.display_count - 1))
+ self.display = settings.value(u'display on monitor', True)
+ override_display = settings.value(u'override position', False)
+ x = settings.value(u'x position', self.current[u'size'].x())
+ y = settings.value(u'y position', self.current[u'size'].y())
+ width = settings.value(u'width', self.current[u'size'].width())
+ height = settings.value(u'height', self.current[u'size'].height())
self.override[u'size'] = QtCore.QRect(x, y, width, height)
self.override[u'primary'] = False
settings.endGroup()
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2012-12-10 18:04:58 +0000
+++ openlp/core/ui/servicemanager.py 2012-12-20 12:09:36 +0000
@@ -40,9 +40,8 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, ItemCapabilities, SettingsManager, \
- translate, str_to_bool, check_directory_exists
+ translate, str_to_bool, check_directory_exists, Settings
from openlp.core.lib.theme import ThemeLevel
-from openlp.core.lib.settings import Settings
from openlp.core.lib.ui import UiStrings, critical_error_message_box, create_widget_action, find_and_set_in_combo_box
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm
from openlp.core.ui.printserviceform import PrintServiceForm
@@ -166,7 +165,7 @@
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('OpenLP.ServiceManager', 'Move item to the top of the service.'),
@@ -184,9 +183,9 @@
tooltip=translate('OpenLP.ServiceManager', 'Move item to the end of the service.'),
shortcuts=[QtCore.Qt.Key_End], category=UiStrings().Service, triggers=self.onServiceEnd)
self.serviceManagerList.down = self.orderToolbar.addToolbarAction(u'down',
- text=translate('OpenLP.ServiceManager', 'Move &down'), tooltip=translate('OpenLP.ServiceManager',
- 'Moves the selection down the window.'), visible=False, shortcuts=[QtCore.Qt.Key_Down],
- triggers=self.onMoveSelectionDown)
+ text=translate('OpenLP.ServiceManager', 'Move &down'),
+ tooltip=translate('OpenLP.ServiceManager', 'Moves the selection down the window.'), visible=False,
+ shortcuts=[QtCore.Qt.Key_Down], triggers=self.onMoveSelectionDown)
action_list.add_action(self.serviceManagerList.down)
self.serviceManagerList.up = self.orderToolbar.addToolbarAction(u'up',
text=translate('OpenLP.ServiceManager', 'Move up'), tooltip=translate('OpenLP.ServiceManager',
@@ -199,12 +198,10 @@
tooltip=translate('OpenLP.ServiceManager', 'Delete the selected item from the service.'),
shortcuts=[QtCore.Qt.Key_Delete], triggers=self.onDeleteFromService)
self.orderToolbar.addSeparator()
- self.serviceManagerList.expand = self.orderToolbar.addToolbarAction(
- u'expand', text=translate('OpenLP.ServiceManager', '&Expand all'),
- icon=u':/services/service_expand_all.png', tooltip=translate(
- 'OpenLP.ServiceManager', 'Expand all the service items.'),
- shortcuts=[QtCore.Qt.Key_Plus], category=UiStrings().Service,
- triggers=self.onExpandAll)
+ self.serviceManagerList.expand = self.orderToolbar.addToolbarAction(u'expand',
+ text=translate('OpenLP.ServiceManager', '&Expand all'), icon=u':/services/service_expand_all.png',
+ tooltip=translate('OpenLP.ServiceManager', 'Expand all the service items.'),
+ shortcuts=[QtCore.Qt.Key_Plus], category=UiStrings().Service, triggers=self.onExpandAll)
self.serviceManagerList.collapse = self.orderToolbar.addToolbarAction(u'collapse',
text=translate('OpenLP.ServiceManager', '&Collapse all'), icon=u':/services/service_collapse_all.png',
tooltip=translate('OpenLP.ServiceManager', 'Collapse all the service items.'),
@@ -233,8 +230,7 @@
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.themeChange)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'service_item_update'), self.serviceItemUpdate)
# Last little bits of setting up
- self.service_theme = unicode(Settings().value(self.mainwindow.serviceManagerSettingsSection + u'/service theme',
- QtCore.QVariant(u'')).toString())
+ self.service_theme = Settings().value(self.mainwindow.serviceManagerSettingsSection + u'/service theme', u'')
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
# build the drag and drop context menu
self.dndMenu = QtGui.QMenu()
@@ -303,8 +299,8 @@
self._fileName = unicode(fileName)
self.mainwindow.setServiceModified(self.isModified(),
self.shortFileName())
- Settings().setValue(u'servicemanager/last file',QtCore.QVariant(fileName))
- self._saveLite = True if self._fileName.endswith(u'.oszl') else False
+ Settings().setValue(u'servicemanager/last file', fileName)
+ self._saveLite = self._fileName.endswith(u'.oszl')
def fileName(self):
"""
@@ -322,7 +318,7 @@
"""
Triggered when Config dialog is updated.
"""
- self.expandTabs = Settings().value(u'advanced/expand service item', QtCore.QVariant(u'False')).toBool()
+ self.expandTabs = Settings().value(u'advanced/expand service item', False)
def resetSupportedSuffixes(self):
"""
@@ -370,10 +366,10 @@
elif result == QtGui.QMessageBox.Save:
self.decideSaveMethod()
if not loadFile:
- fileName = unicode(QtGui.QFileDialog.getOpenFileName(self.mainwindow,
+ 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 *.oszl)')))
+ translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz *.oszl)'))
if not fileName:
return False
else:
@@ -390,7 +386,7 @@
def onRecentServiceClicked(self):
sender = self.sender()
- self.loadFile(sender.data().toString())
+ self.loadFile(sender.data())
def newFile(self):
"""
@@ -401,7 +397,7 @@
self.setFileName(u'')
self.serviceId += 1
self.setModified(False)
- Settings().setValue(u'servicemanager/last file',QtCore.QVariant(u''))
+ Settings().setValue(u'servicemanager/last file', u'')
Receiver.send_message(u'servicemanager_new_service')
def saveFile(self):
@@ -449,10 +445,10 @@
write_list.append(path_from)
if missing_list:
Receiver.send_message(u'cursor_normal')
- title = unicode(translate('OpenLP.ServiceManager', 'Service File(s) Missing'))
- message = unicode(translate('OpenLP.ServiceManager',
+ title = translate('OpenLP.ServiceManager', 'Service File(s) Missing')
+ message = translate('OpenLP.ServiceManager',
'The following file(s) in the service are missing:\n\t%s\n\n'
- 'These files will be removed if you continue to save.')) % "\n\t".join(missing_list)
+ 'These files will be removed if you continue to save.') % "\n\t".join(missing_list)
answer = QtGui.QMessageBox.critical(self, title, message,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel))
if answer == QtGui.QMessageBox.Cancel:
@@ -599,39 +595,39 @@
Get a file name and then call :func:`ServiceManager.saveFile` to
save the file.
"""
- default_service_enabled = Settings().value(u'advanced/default service enabled', QtCore.QVariant(True)).toBool()
+ default_service_enabled = Settings().value(u'advanced/default service enabled', True)
if default_service_enabled:
- service_day = Settings().value(u'advanced/default service day', 7).toInt()[0]
+ service_day = Settings().value(u'advanced/default service day', 7)
if service_day == 7:
local_time = datetime.now()
else:
- service_hour = Settings().value(u'advanced/default service hour', 11).toInt()[0]
- service_minute = Settings().value(u'advanced/default service minute', 0).toInt()[0]
+ service_hour = Settings().value(u'advanced/default service hour', 11)
+ service_minute = Settings().value(u'advanced/default service minute', 0)
now = datetime.now()
day_delta = service_day - now.weekday()
if day_delta < 0:
day_delta += 7
time = now + timedelta(days=day_delta)
local_time = time.replace(hour=service_hour, minute=service_minute)
- default_pattern = unicode(Settings().value(u'advanced/default service name',
+ default_pattern = Settings().value(u'advanced/default service name',
translate('OpenLP.AdvancedTab', 'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: '
'/\\?*|<>\[\]":+\nSee http://docs.python.org/library/'
- 'datetime.html#strftime-strptime-behavior for more information.')).toString())
+ 'datetime.html#strftime-strptime-behavior for more information.'))
default_filename = format_time(default_pattern, local_time)
else:
default_filename = u''
- directory = unicode(SettingsManager.get_last_dir(self.mainwindow.serviceManagerSettingsSection))
+ directory = SettingsManager.get_last_dir(self.mainwindow.serviceManagerSettingsSection)
path = os.path.join(directory, default_filename)
# SaveAs from osz to oszl is not valid as the files will be deleted
# on exit which is not sensible or usable in the long term.
if self._fileName.endswith(u'oszl') or not self._fileName:
- fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path,
+ fileName = QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager',
- 'OpenLP Service Files (*.osz);; OpenLP Service Files - lite (*.oszl)')))
+ 'OpenLP Service Files (*.osz);; OpenLP Service Files - lite (*.oszl)'))
else:
- fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path,
- translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz);;')))
+ fileName = QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path,
+ translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz);;'))
if not fileName:
return False
if os.path.splitext(fileName)[1] == u'':
@@ -710,7 +706,7 @@
delete_file(p_file)
self.mainwindow.addRecentFile(fileName)
self.setModified(False)
- Settings().setValue(u'servicemanager/last file', QtCore.QVariant(fileName))
+ Settings().setValue('servicemanager/last file', fileName)
else:
critical_error_message_box(message=translate('OpenLP.ServiceManager', 'File is not a valid service.'))
log.exception(u'File contains no service data')
@@ -745,7 +741,7 @@
service was last closed. Can be blank if there was no service
present.
"""
- fileName = Settings().value(u'servicemanager/last file',QtCore.QVariant(u'')).toString()
+ fileName = Settings().value(u'servicemanager/last file', u'')
if fileName:
self.loadFile(fileName)
@@ -753,10 +749,10 @@
item = self.serviceManagerList.itemAt(point)
if item is None:
return
- if item.parent() is None:
- pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
+ if item.parent():
+ pos = item.parent().data(0, QtCore.Qt.UserRole)
else:
- pos = item.parent().data(0, QtCore.Qt.UserRole).toInt()[0]
+ pos = item.data(0, QtCore.Qt.UserRole)
serviceItem = self.serviceItems[pos - 1]
self.editAction.setVisible(False)
self.maintainAction.setVisible(False)
@@ -873,7 +869,7 @@
while serviceIterator.value():
if serviceIterator.value() == selected:
if message == u'last slide' and prevItemLastSlide:
- pos = prevItem.data(0, QtCore.Qt.UserRole).toInt()[0]
+ pos = prevItem.data(0, QtCore.Qt.UserRole)
check_expanded = self.serviceItems[pos - 1][u'expanded']
self.serviceManagerList.setCurrentItem(prevItemLastSlide)
if not check_expanded:
@@ -940,7 +936,7 @@
Record if an item is collapsed. Used when repainting the list to get the
correct state.
"""
- pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
+ pos = item.data(0, QtCore.Qt.UserRole)
self.serviceItems[pos - 1][u'expanded'] = False
def onExpandAll(self):
@@ -956,7 +952,7 @@
Record if an item is collapsed. Used when repainting the list to get the
correct state.
"""
- pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
+ pos = item.data(0, QtCore.Qt.UserRole)
self.serviceItems[pos - 1][u'expanded'] = True
def onServiceTop(self):
@@ -1066,25 +1062,25 @@
tips = []
if serviceitem.temporary_edit:
tips.append(u'<strong>%s:</strong> <em>%s</em>' %
- (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'<strong>%s:</strong> <em>%s</em>' %
- (unicode(translate('OpenLP.ServiceManager', 'Slide theme')), serviceitem.theme))
+ (translate('OpenLP.ServiceManager', 'Slide theme'), serviceitem.theme))
if serviceitem.notes:
tips.append(u'<strong>%s: </strong> %s' %
- (unicode(translate('OpenLP.ServiceManager', 'Notes')), cgi.escape(unicode(serviceitem.notes))))
+ (translate('OpenLP.ServiceManager', 'Notes'), cgi.escape(serviceitem.notes)))
if item[u'service_item'].is_capable(ItemCapabilities.HasVariableStartTime):
tips.append(item[u'service_item'].get_media_time())
treewidgetitem.setToolTip(0, u'<br>'.join(tips))
- treewidgetitem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(item[u'order']))
+ treewidgetitem.setData(0, QtCore.Qt.UserRole, item[u'order'])
treewidgetitem.setSelected(item[u'selected'])
# Add the children to their parent treewidgetitem.
for count, frame in enumerate(serviceitem.get_frames()):
child = QtGui.QTreeWidgetItem(treewidgetitem)
text = frame[u'title'].replace(u'\n', u' ')
child.setText(0, text[:40])
- child.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(count))
+ child.setData(0, QtCore.Qt.UserRole, count)
if serviceItem == itemcount:
if item[u'expanded'] and serviceItemChild == count:
self.serviceManagerList.setCurrentItem(child)
@@ -1120,10 +1116,9 @@
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 + u'/service theme',
- QtCore.QVariant(self.service_theme))
+ Settings().setValue(self.mainwindow.serviceManagerSettingsSection + u'/service theme', self.service_theme)
self.regenerateServiceItems(True)
def themeChange(self):
@@ -1156,9 +1151,9 @@
serviceIterator += 1
if selectedItem is not None:
if selectedItem.parent() is None:
- pos = selectedItem.data(0, QtCore.Qt.UserRole).toInt()[0]
+ pos = selectedItem.data(0, QtCore.Qt.UserRole)
else:
- pos = selectedItem.parent().data(0, QtCore.Qt.UserRole).toInt()[0]
+ pos = selectedItem.parent().data(0, QtCore.Qt.UserRole)
self.serviceItems[pos - 1][u'selected'] = True
tempServiceItems = self.serviceItems
self.serviceManagerList.clear()
@@ -1296,7 +1291,7 @@
self.serviceItems[item][u'service_item'], child)
if Settings().value(
self.mainwindow.generalSettingsSection + u'/auto preview',
- QtCore.QVariant(False)).toBool():
+ False):
item += 1
if self.serviceItems and item < len(self.serviceItems) and \
self.serviceItems[item][u'service_item'].is_capable(ItemCapabilities.CanPreview):
@@ -1332,10 +1327,10 @@
for item in items:
parentitem = item.parent()
if parentitem is None:
- serviceItem = item.data(0, QtCore.Qt.UserRole).toInt()[0]
+ serviceItem = item.data(0, QtCore.Qt.UserRole)
else:
- serviceItem = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
- serviceItemChild = item.data(0, QtCore.Qt.UserRole).toInt()[0]
+ serviceItem = parentitem.data(0, QtCore.Qt.UserRole)
+ serviceItemChild = item.data(0, QtCore.Qt.UserRole)
# Adjust for zero based arrays.
serviceItem -= 1
# Only process the first item on the list for this method.
@@ -1365,14 +1360,14 @@
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 filename.endswith(u'.oszl'):
# todo correct
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':
@@ -1442,7 +1437,7 @@
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
@@ -1453,9 +1448,9 @@
def _getParentItemData(self, item):
parentitem = item.parent()
if parentitem is None:
- return item.data(0, QtCore.Qt.UserRole).toInt()[0]
+ return item.data(0, QtCore.Qt.UserRole)
else:
- return parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
+ return parentitem.data(0, QtCore.Qt.UserRole)
def printServiceOrder(self):
"""
=== modified file 'openlp/core/ui/shortcutlistform.py'
--- openlp/core/ui/shortcutlistform.py 2012-12-05 06:12:07 +0000
+++ openlp/core/ui/shortcutlistform.py 2012-12-20 12:09:36 +0000
@@ -32,8 +32,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Receiver
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Receiver, Settings
from openlp.core.utils import translate
from openlp.core.utils.actions import ActionList
from shortcutlistdialog import Ui_ShortcutListDialog
@@ -131,11 +130,10 @@
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, QtCore.QVariant(action))
+ actionItem.setData(0, QtCore.Qt.UserRole, action)
item.addChild(actionItem)
self.treeWidget.addTopLevelItem(item)
item.setExpanded(True)
@@ -352,8 +350,7 @@
map(QtGui.QKeySequence.toString, action.shortcuts()))
action.setShortcuts(self.changedActions[action])
self.action_list.update_shortcut_map(action, old_shortcuts)
- settings.setValue(
- action.objectName(), QtCore.QVariant(action.shortcuts()))
+ settings.setValue(action.objectName(), action.shortcuts())
settings.endGroup()
def onClearPrimaryButtonClicked(self, toggled):
@@ -446,9 +443,9 @@
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
@@ -471,7 +468,7 @@
item = self.treeWidget.currentItem()
if item is None:
return
- return item.data(0, QtCore.Qt.UserRole).toPyObject()
+ return item.data(0, QtCore.Qt.UserRole)
def _adjustButton(self, button, checked=None, enabled=None, text=None):
"""
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2012-12-10 18:04:58 +0000
+++ openlp/core/ui/slidecontroller.py 2012-12-20 12:09:36 +0000
@@ -35,9 +35,10 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
- translate, build_icon, build_html, PluginManager, ServiceItem, ImageSource
+ translate, build_icon, build_html, PluginManager, ServiceItem, \
+ ImageSource, SlideLimits, ServiceItemAction, Settings
+from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList
from openlp.core.lib.ui import UiStrings, create_action
-from openlp.core.lib.settings import Settings
from openlp.core.lib import SlideLimits, ServiceItemAction
from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList, \
DisplayControllerType
@@ -205,13 +206,12 @@
self.playSlidesMenu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Play Slides'), self.toolbar))
self.toolbar.addToolbarWidget(self.playSlidesMenu)
self.playSlidesLoop = create_action(self, u'playSlidesLoop', text=UiStrings().PlaySlidesInLoop,
- icon=u':/media/media_time.png', checked=False, shortcuts=[], category=self.category,
- triggers=self.onPlaySlidesLoop)
+ icon=u':/media/media_time.png', checked=False, shortcuts=[],
+ category=self.category, triggers=self.onPlaySlidesLoop)
self.playSlidesOnce = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
- icon=u':/media/media_time.png', checked=False, shortcuts=[], category=self.category,
- triggers=self.onPlaySlidesOnce)
- if Settings().value(self.parent().generalSettingsSection + u'/enable slide loop',
- QtCore.QVariant(True)).toBool():
+ icon=u':/media/media_time.png', checked=False, shortcuts=[],
+ category=self.category, triggers=self.onPlaySlidesOnce)
+ if Settings().value(self.parent().generalSettingsSection + u'/enable slide loop', True):
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
else:
self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
@@ -392,7 +392,7 @@
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:
if verse_type == u'V':
@@ -570,7 +570,7 @@
self.previewListWidget.setRowHeight(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()
@@ -585,8 +585,7 @@
"""
Updates the Slide Limits variable from the settings.
"""
- self.slide_limits = Settings().value(self.parent().advancedSettingsSection + u'/slide limits',
- QtCore.QVariant(SlideLimits.End)).toInt()[0]
+ self.slide_limits = Settings().value(self.parent().advancedSettingsSection + u'/slide limits', SlideLimits.End)
def enableToolBar(self, item):
"""
@@ -614,8 +613,7 @@
self.playSlidesLoop.setChecked(False)
self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
if item.is_text():
- if Settings().value(self.parent().songsSettingsSection + u'/display songbar',
- QtCore.QVariant(True)).toBool() and self.slideList:
+ if Settings().value(self.parent().songsSettingsSection + u'/display songbar', True) and self.slideList:
self.songMenu.show()
if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1:
self.toolbar.setWidgetVisible(self.loopList)
@@ -729,9 +727,8 @@
action.setData(counter)
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), self.onTrackTriggered)
self.display.audioPlayer.repeat = Settings().value(
- self.parent().generalSettingsSection + u'/audio repeat list', QtCore.QVariant(False)).toBool()
- if Settings().value(
- self.parent().generalSettingsSection + u'/audio start paused', QtCore.QVariant(True)).toBool():
+ self.parent().generalSettingsSection + u'/audio repeat list', False)
+ if Settings().value(self.parent().generalSettingsSection + u'/audio start paused', True):
self.audioPauseItem.setChecked(True)
self.display.audioPlayer.pause()
else:
@@ -841,7 +838,7 @@
"""
log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
display_type = Settings().value(self.parent().generalSettingsSection + u'/screen blank',
- QtCore.QVariant(u'')).toString()
+ u'')
if self.screens.which_screen(self.window()) != self.screens.which_screen(self.display):
# Order done to handle initial conversion
if display_type == u'themed':
@@ -879,7 +876,7 @@
self.themeScreen.setChecked(False)
self.desktopScreen.setChecked(False)
if checked:
- Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'blanked'))
+ Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', u'blanked')
else:
Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
self.blankPlugin()
@@ -897,7 +894,7 @@
self.themeScreen.setChecked(checked)
self.desktopScreen.setChecked(False)
if checked:
- Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'themed'))
+ Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', u'themed')
else:
Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
self.blankPlugin()
@@ -915,7 +912,7 @@
self.themeScreen.setChecked(False)
self.desktopScreen.setChecked(checked)
if checked:
- Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'hidden'))
+ Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', u'hidden')
else:
Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
self.hidePlugin(checked)
@@ -1195,7 +1192,7 @@
"""
triggered by clicking the Preview slide items
"""
- if Settings().value(u'advanced/double click live', QtCore.QVariant(False)).toBool():
+ if Settings().value(u'advanced/double click live', False):
# Live and Preview have issues if we have video or presentations
# playing in both at the same time.
if self.serviceItem.is_command():
@@ -1275,5 +1272,4 @@
def onTrackTriggered(self):
action = self.sender()
- index = action.data().toInt()[0]
- self.display.audioPlayer.goTo(index)
+ self.display.audioPlayer.goTo(action.data())
=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py 2012-12-01 07:57:54 +0000
+++ openlp/core/ui/themeform.py 2012-12-20 12:09:36 +0000
@@ -206,9 +206,8 @@
"""
Updates the lines on a page on the wizard
"""
- self.mainLineCountLabel.setText(unicode(translate(
- 'OpenLP.ThemeWizard',
- '(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):
"""
@@ -233,7 +232,7 @@
background_image = BackgroundType.to_string(BackgroundType.Image)
if self.page(self.currentId()) == self.backgroundPage and \
self.theme.background_type == background_image and \
- self.imageFileEdit.text().isEmpty():
+ not self.imageFileEdit.text():
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeWizard', 'Background Image Empty'),
translate('OpenLP.ThemeWizard', 'You have not selected a '
@@ -326,8 +325,8 @@
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)
@@ -358,37 +357,37 @@
BackgroundType.to_string(BackgroundType.Solid):
self.colorButton.setStyleSheet(u'background-color: %s' %
self.theme.background_color)
- self.setField(u'background_type', QtCore.QVariant(0))
+ self.setField(u'background_type', 0)
elif self.theme.background_type == \
BackgroundType.to_string(BackgroundType.Gradient):
self.gradientStartButton.setStyleSheet(u'background-color: %s' %
self.theme.background_start_color)
self.gradientEndButton.setStyleSheet(u'background-color: %s' %
self.theme.background_end_color)
- self.setField(u'background_type', QtCore.QVariant(1))
+ self.setField(u'background_type', 1)
elif self.theme.background_type == \
BackgroundType.to_string(BackgroundType.Image):
self.imageColorButton.setStyleSheet(u'background-color: %s' %
self.theme.background_border_color)
self.imageFileEdit.setText(self.theme.background_filename)
- self.setField(u'background_type', QtCore.QVariant(2))
+ self.setField(u'background_type', 2)
elif self.theme.background_type == \
BackgroundType.to_string(BackgroundType.Transparent):
- self.setField(u'background_type', QtCore.QVariant(3))
+ self.setField(u'background_type', 3)
if self.theme.background_direction == \
BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
- self.setField(u'gradient', QtCore.QVariant(0))
+ self.setField(u'gradient', 0)
elif self.theme.background_direction == \
BackgroundGradientType.to_string(BackgroundGradientType.Vertical):
- self.setField(u'gradient', QtCore.QVariant(1))
+ self.setField(u'gradient', 1)
elif self.theme.background_direction == \
BackgroundGradientType.to_string(BackgroundGradientType.Circular):
- self.setField(u'gradient', QtCore.QVariant(2))
+ self.setField(u'gradient', 2)
elif self.theme.background_direction == \
BackgroundGradientType.to_string(BackgroundGradientType.LeftTop):
- self.setField(u'gradient', QtCore.QVariant(3))
+ self.setField(u'gradient', 3)
else:
- self.setField(u'gradient', QtCore.QVariant(4))
+ self.setField(u'gradient', 4)
def setMainAreaPageValues(self):
"""
@@ -398,26 +397,19 @@
QtGui.QFont(self.theme.font_main_name))
self.mainColorButton.setStyleSheet(u'background-color: %s' %
self.theme.font_main_color)
- self.setField(u'mainSizeSpinBox',
- QtCore.QVariant(self.theme.font_main_size))
+ self.setField(u'mainSizeSpinBox', self.theme.font_main_size)
self.setField(u'lineSpacingSpinBox',
- QtCore.QVariant(self.theme.font_main_line_adjustment))
- self.setField(u'outlineCheckBox',
- QtCore.QVariant(self.theme.font_main_outline))
+ self.theme.font_main_line_adjustment)
+ self.setField(u'outlineCheckBox', self.theme.font_main_outline)
self.outlineColorButton.setStyleSheet(u'background-color: %s' %
self.theme.font_main_outline_color)
- self.setField(u'outlineSizeSpinBox',
- QtCore.QVariant(self.theme.font_main_outline_size))
- self.setField(u'shadowCheckBox',
- QtCore.QVariant(self.theme.font_main_shadow))
+ self.setField(u'outlineSizeSpinBox', self.theme.font_main_outline_size)
+ self.setField(u'shadowCheckBox', self.theme.font_main_shadow)
self.shadowColorButton.setStyleSheet(u'background-color: %s' %
self.theme.font_main_shadow_color)
- self.setField(u'shadowSizeSpinBox',
- QtCore.QVariant(self.theme.font_main_shadow_size))
- self.setField(u'mainBoldCheckBox',
- QtCore.QVariant(self.theme.font_main_bold))
- self.setField(u'mainItalicsCheckBox',
- QtCore.QVariant(self.theme.font_main_italics))
+ self.setField(u'shadowSizeSpinBox', self.theme.font_main_shadow_size)
+ self.setField(u'mainBoldCheckBox', self.theme.font_main_bold)
+ self.setField(u'mainItalicsCheckBox', self.theme.font_main_italics)
def setFooterAreaPageValues(self):
"""
@@ -427,8 +419,7 @@
QtGui.QFont(self.theme.font_footer_name))
self.footerColorButton.setStyleSheet(u'background-color: %s' %
self.theme.font_footer_color)
- self.setField(u'footerSizeSpinBox',
- QtCore.QVariant(self.theme.font_footer_size))
+ self.setField(u'footerSizeSpinBox', self.theme.font_footer_size)
def setPositionPageValues(self):
"""
@@ -436,40 +427,31 @@
"""
# Main Area
self.mainPositionCheckBox.setChecked(not self.theme.font_main_override)
- self.setField(u'mainPositionX', QtCore.QVariant(self.theme.font_main_x))
- self.setField(u'mainPositionY', QtCore.QVariant(self.theme.font_main_y))
- self.setField(u'mainPositionHeight',
- QtCore.QVariant(self.theme.font_main_height))
- self.setField(u'mainPositionWidth',
- QtCore.QVariant(self.theme.font_main_width))
+ self.setField(u'mainPositionX', self.theme.font_main_x)
+ self.setField(u'mainPositionY', self.theme.font_main_y)
+ self.setField(u'mainPositionHeight', self.theme.font_main_height)
+ self.setField(u'mainPositionWidth', self.theme.font_main_width)
# Footer
self.footerPositionCheckBox.setChecked(
not self.theme.font_footer_override)
- self.setField(u'footerPositionX',
- QtCore.QVariant(self.theme.font_footer_x))
- self.setField(u'footerPositionY',
- QtCore.QVariant(self.theme.font_footer_y))
- self.setField(u'footerPositionHeight',
- QtCore.QVariant(self.theme.font_footer_height))
- self.setField(u'footerPositionWidth',
- QtCore.QVariant(self.theme.font_footer_width))
+ self.setField(u'footerPositionX', self.theme.font_footer_x)
+ self.setField(u'footerPositionY', self.theme.font_footer_y)
+ self.setField(u'footerPositionHeight', self.theme.font_footer_height)
+ self.setField(u'footerPositionWidth', self.theme.font_footer_width)
def setAlignmentPageValues(self):
"""
Handle the display and state of the Alignments page.
"""
- self.setField(u'horizontal',
- QtCore.QVariant(self.theme.display_horizontal_align))
- self.setField(u'vertical',
- QtCore.QVariant(self.theme.display_vertical_align))
- self.setField(u'slideTransition',
- QtCore.QVariant(self.theme.display_slide_transition))
+ self.setField(u'horizontal', self.theme.display_horizontal_align)
+ self.setField(u'vertical', self.theme.display_vertical_align)
+ self.setField(u'slideTransition', self.theme.display_slide_transition)
def setPreviewPageValues(self):
"""
Handle the display and state of the Preview page.
"""
- self.setField(u'name', QtCore.QVariant(self.theme.theme_name))
+ self.setField(u'name', self.theme.theme_name)
def onBackgroundComboBoxCurrentIndexChanged(self, index):
"""
@@ -574,51 +556,42 @@
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_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_name = self.mainFontComboBox.currentFont().family()
+ self.theme.font_main_size = self.field(u'mainSizeSpinBox')
+ self.theme.font_main_line_adjustment = self.field(u'lineSpacingSpinBox')
+ self.theme.font_main_outline_size = self.field(u'outlineSizeSpinBox')
+ self.theme.font_main_shadow_size = self.field(u'shadowSizeSpinBox')
+ self.theme.font_main_bold = self.field(u'mainBoldCheckBox')
+ # FIXME ?
self.theme.font_main_italics = \
- self.field(u'mainItalicsCheckBox').toBool()
+ self.field(u'mainItalicsCheckBox')
# footer page
self.theme.font_footer_name = \
- unicode(self.footerFontComboBox.currentFont().family())
- self.theme.font_footer_size = \
- self.field(u'footerSizeSpinBox').toInt()[0]
+ self.footerFontComboBox.currentFont().family()
+ self.theme.font_footer_size = self.field(u'footerSizeSpinBox')
# position page
- self.theme.font_main_x = self.field(u'mainPositionX').toInt()[0]
- self.theme.font_main_y = self.field(u'mainPositionY').toInt()[0]
- self.theme.font_main_height = \
- self.field(u'mainPositionHeight').toInt()[0]
- self.theme.font_main_width = self.field(u'mainPositionWidth').toInt()[0]
- self.theme.font_footer_x = self.field(u'footerPositionX').toInt()[0]
- self.theme.font_footer_y = self.field(u'footerPositionY').toInt()[0]
- self.theme.font_footer_height = \
- self.field(u'footerPositionHeight').toInt()[0]
- self.theme.font_footer_width = \
- self.field(u'footerPositionWidth').toInt()[0]
+ self.theme.font_main_x = self.field(u'mainPositionX')
+ self.theme.font_main_y = self.field(u'mainPositionY')
+ self.theme.font_main_height = self.field(u'mainPositionHeight')
+ self.theme.font_main_width = self.field(u'mainPositionWidth')
+ #print self.field(u'footerPositionX')
+ self.theme.font_footer_x = self.field(u'footerPositionX')
+ self.theme.font_footer_y = self.field(u'footerPositionY')
+ self.theme.font_footer_height = self.field(u'footerPositionHeight')
+ self.theme.font_footer_width = self.field(u'footerPositionWidth')
# position page
self.theme.display_horizontal_align = \
self.horizontalComboBox.currentIndex()
- self.theme.display_vertical_align = \
- self.verticalComboBox.currentIndex()
- self.theme.display_slide_transition = \
- self.field(u'slideTransition').toBool()
+ self.theme.display_vertical_align = self.verticalComboBox.currentIndex()
+ # TODO Check
+ self.theme.display_slide_transition = self.field(u'slideTransition')
def accept(self):
"""
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')
if not self.theme.theme_name:
critical_error_message_box(
translate('OpenLP.ThemeWizard', 'Theme Name Missing'),
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2012-12-05 06:12:07 +0000
+++ openlp/core/ui/thememanager.py 2012-12-20 12:09:36 +0000
@@ -38,10 +38,9 @@
from openlp.core.lib import OpenLPToolbar, get_text_file_string, build_icon, \
Receiver, SettingsManager, translate, check_item_selected, \
- check_directory_exists, create_thumb, validate_thumb, ImageSource
+ check_directory_exists, create_thumb, validate_thumb, ImageSource, Settings
from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, \
BackgroundGradientType
-from openlp.core.lib.settings import Settings
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
create_widget_action
from openlp.core.theme import Theme
@@ -167,9 +166,8 @@
"""
Triggered when Config dialog is updated.
"""
- self.global_theme = unicode(Settings().value(
- self.settingsSection + u'/global theme',
- QtCore.QVariant(u'')).toString())
+ self.global_theme = Settings().value(
+ self.settingsSection + u'/global theme', u'')
def checkListState(self, item):
"""
@@ -177,8 +175,8 @@
"""
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)
+ theme_name = item.text()
# If default theme restrict actions
if real_theme_name == theme_name:
self.deleteToolbarAction.setVisible(True)
@@ -193,7 +191,7 @@
item = self.themeListWidget.itemAt(point)
if item is None:
return
- real_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString())
+ real_theme_name = item.data(QtCore.Qt.UserRole)
theme_name = unicode(item.text())
visible = real_theme_name == theme_name
self.deleteAction.setVisible(visible)
@@ -211,13 +209,13 @@
# 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)
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,19 +231,17 @@
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):
self.themeListWidget.item(count).setText(
- unicode(item.data(QtCore.Qt.UserRole).toString()))
+ item.data(QtCore.Qt.UserRole))
# 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',
- QtCore.QVariant(self.global_theme))
+ self.settingsSection + u'/global theme', self.global_theme)
Receiver.send_message(u'theme_update_global', self.global_theme)
self._pushThemes()
@@ -264,16 +260,16 @@
"""
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)
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):
@@ -292,12 +288,12 @@
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)
self.fileRenameForm.fileNameEdit.setText(
- unicode(translate('OpenLP.ThemeManager',
- 'Copy of %s', 'Copy of <theme name>')) % old_theme_name)
+ translate('OpenLP.ThemeManager',
+ 'Copy of %s', 'Copy of <theme name>') % 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)
@@ -326,8 +322,7 @@
if check_item_selected(self.themeListWidget, 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))
if theme.background_type == u'image':
self.oldBackgroundImage = theme.background_filename
self.themeForm.theme = theme
@@ -340,12 +335,12 @@
"""
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)
@@ -380,10 +375,9 @@
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)
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')
@@ -423,8 +417,8 @@
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
@@ -454,8 +448,7 @@
theme.theme_name = UiStrings().Default
self._writeTheme(theme, None, None)
Settings().setValue(
- self.settingsSection + u'/global theme',
- QtCore.QVariant(theme.theme_name))
+ self.settingsSection + u'/global theme', theme.theme_name)
self.configUpdated()
files = SettingsManager.get_files(self.settingsSection, u'.png')
# Sort the themes by its name considering language specific
@@ -468,8 +461,8 @@
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.thumbPath, u'%s.png' % text_name)
@@ -479,8 +472,7 @@
else:
icon = create_thumb(theme, thumb)
item_name.setIcon(icon)
- item_name.setData(
- QtCore.Qt.UserRole, QtCore.QVariant(text_name))
+ item_name.setData(QtCore.Qt.UserRole, text_name)
self.themeListWidget.addItem(item_name)
self.themeList.append(text_name)
self._pushThemes()
@@ -774,12 +766,11 @@
Check to see if theme has been selected and the destructive action
is allowed.
"""
- self.global_theme = unicode(Settings().value(
- self.settingsSection + u'/global theme',
- QtCore.QVariant(u'')).toString())
+ self.global_theme = Settings().value(
+ 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,
@@ -789,7 +780,7 @@
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):
critical_error_message_box(
message=translate('OpenLP.ThemeManager',
'You are unable to delete the default theme.'))
@@ -801,8 +792,8 @@
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
=== modified file 'openlp/core/ui/themestab.py'
--- openlp/core/ui/themestab.py 2012-12-01 07:57:54 +0000
+++ openlp/core/ui/themestab.py 2012-12-20 12:09:36 +0000
@@ -29,10 +29,9 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab, Receiver, translate
+from openlp.core.lib import Receiver, Settings, SettingsTab, translate
from openlp.core.lib.theme import ThemeLevel
from openlp.core.lib.ui import UiStrings, find_and_set_in_combo_box
-from openlp.core.lib.settings import Settings
class ThemesTab(SettingsTab):
"""
@@ -137,9 +136,8 @@
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
- self.theme_level = settings.value(
- u'theme level', ThemeLevel.Song).toInt()[0]
- self.global_theme = unicode(settings.value(u'global theme').toString())
+ self.theme_level = settings.value(u'theme level', ThemeLevel.Song)
+ self.global_theme = settings.value(u'global theme', u'')
settings.endGroup()
if self.theme_level == ThemeLevel.Global:
self.GlobalLevelRadioButton.setChecked(True)
@@ -151,8 +149,8 @@
def save(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
- settings.setValue(u'theme level', QtCore.QVariant(self.theme_level))
- settings.setValue(u'global theme', QtCore.QVariant(self.global_theme))
+ settings.setValue(u'theme level', self.theme_level)
+ settings.setValue(u'global theme', self.global_theme)
settings.endGroup()
self.mainwindow.renderer.set_global_theme(self.global_theme)
self.mainwindow.renderer.set_theme_level(self.theme_level)
@@ -171,9 +169,8 @@
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.mainwindow.renderer.set_theme_level(self.theme_level)
self.__previewGlobalTheme()
def updateThemeList(self, theme_list):
@@ -186,9 +183,8 @@
[u'Bible Theme', u'Song Theme']
"""
# Reload as may have been triggered by the ThemeManager.
- self.global_theme = unicode(Settings().value(
- self.settingsSection + u'/global theme',
- QtCore.QVariant(u'')).toString())
+ self.global_theme = Settings().value(
+ self.settingsSection + u'/global theme', u'')
self.DefaultComboBox.clear()
self.DefaultComboBox.addItems(theme_list)
find_and_set_in_combo_box(self.DefaultComboBox, self.global_theme)
=== modified file 'openlp/core/ui/wizard.py'
--- openlp/core/ui/wizard.py 2012-12-01 07:57:54 +0000
+++ openlp/core/ui/wizard.py 2012-12-20 12:09:36 +0000
@@ -54,25 +54,25 @@
FormatLabel = translate('OpenLP.Ui', 'Format:')
HeaderStyle = u'<span style="font-size:14pt; font-weight:600;">%s</span>'
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'))
- OpenTypeFolder = unicode(translate('OpenLP.Ui', 'Open %s Folder'))
- PercentSymbolFormat = unicode(translate('OpenLP.Ui', '%p%'))
+ OpenTypeFile = translate('OpenLP.Ui', 'Open %s File')
+ OpenTypeFolder = translate('OpenLP.Ui', 'Open %s Folder')
+ 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 one '
- '%s file to import from.', 'A file type e.g. OpenSong'))
- YouSpecifyFiles = unicode(translate('OpenLP.Ui', 'You need to specify at '
- 'least one %s file to import from.', 'A file type e.g. OpenSong'))
- YouSpecifyFolder = unicode(translate('OpenLP.Ui', 'You need to specify one '
- '%s folder to import from.', 'A song format e.g. PowerSong'))
+ YouSpecifyFile = translate('OpenLP.Ui', 'You need to specify one '
+ '%s file to import from.', 'A file type e.g. OpenSong')
+ YouSpecifyFiles = translate('OpenLP.Ui', 'You need to specify at '
+ 'least one %s file to import from.', 'A file type e.g. OpenSong')
+ YouSpecifyFolder = translate('OpenLP.Ui', 'You need to specify one '
+ '%s folder to import from.', 'A song format e.g. PowerSong')
class OpenLPWizard(QtGui.QWizard):
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py 2012-12-01 07:57:54 +0000
+++ openlp/core/utils/__init__.py 2012-12-20 12:09:36 +0000
@@ -32,13 +32,14 @@
from datetime import datetime
from distutils.version import LooseVersion
import logging
+import locale
import os
import re
from subprocess import Popen, PIPE
import sys
import urllib2
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Settings
from PyQt4 import QtGui, QtCore
@@ -91,7 +92,7 @@
VersionDir = 5
CacheDir = 6
LanguageDir = 7
-
+
# Base path where data/config/cache dir is located
BaseDir = None
@@ -132,8 +133,7 @@
"""
# Check if we have a different data location.
if Settings().contains(u'advanced/data path'):
- path = unicode(Settings().value(
- u'advanced/data path').toString())
+ path = Settings().value(u'advanced/data path')
else:
path = AppLocation.get_directory(AppLocation.DataDir)
check_directory_exists(path)
@@ -296,10 +296,9 @@
# set to prod in the distribution config file.
settings = Settings()
settings.beginGroup(u'general')
- last_test = unicode(settings.value(u'last version test',
- QtCore.QVariant(datetime.now().date())).toString())
- this_test = unicode(datetime.now().date())
- settings.setValue(u'last version test', QtCore.QVariant(this_test))
+ last_test = settings.value(u'last version test', datetime.now().date())
+ this_test = datetime.now().date()
+ settings.setValue(u'last version test', this_test)
settings.endGroup()
if last_test != this_test:
if current_version[u'build']:
@@ -497,15 +496,17 @@
or 0, depending on whether string1 collates before or after string2 or
is equal to it. Comparison is case insensitive.
"""
- # Function locale.strcol() from standard Python library does not work
+ # Function locale.strcoll() from standard Python library does not work
# properly on Windows and probably somewhere else.
- return QtCore.QString.localeAwareCompare(string1.lower(), string2.lower())
+ return locale.strcoll(string1.lower(), string2.lower())
+ # TODO: check code
+ #return QtCore.QString.localeAwareCompare(string1.lower(), string2.lower())
# For performance reasons provide direct reference to compare function
# without wrapping it in another function making te string lowercase.
# This is needed for sorting songs.
-locale_direct_compare = QtCore.QString.localeAwareCompare
+locale_direct_compare = locale.strcoll
from languagemanager import LanguageManager
=== modified file 'openlp/core/utils/actions.py'
--- openlp/core/utils/actions.py 2012-12-01 07:57:54 +0000
+++ openlp/core/utils/actions.py 2012-12-20 12:09:36 +0000
@@ -32,7 +32,8 @@
"""
from PyQt4 import QtCore, QtGui
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Settings
+
class ActionCategory(object):
"""
@@ -232,8 +233,7 @@
# Load the shortcut from the config.
settings = Settings()
settings.beginGroup(u'shortcuts')
- shortcuts = settings.value(action.objectName(),
- QtCore.QVariant(action.shortcuts())).toStringList()
+ shortcuts = settings.value(action.objectName(), action.shortcuts())
settings.endGroup()
if not shortcuts:
action.setShortcuts([])
=== modified file 'openlp/core/utils/languagemanager.py'
--- openlp/core/utils/languagemanager.py 2012-12-01 07:57:54 +0000
+++ openlp/core/utils/languagemanager.py 2012-12-20 12:09:36 +0000
@@ -31,13 +31,13 @@
language file loading for OpenLP.
"""
import logging
+import re
import sys
from PyQt4 import QtCore, QtGui
from openlp.core.utils import AppLocation
-from openlp.core.lib import translate
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import translate, Settings
log = logging.getLogger(__name__)
@@ -78,13 +78,16 @@
AppLocation.LanguageDir))
trans_dir = QtCore.QDir(AppLocation.get_directory(
AppLocation.LanguageDir))
- file_names = trans_dir.entryList(QtCore.QStringList(u'*.qm'),
- QtCore.QDir.Files, QtCore.QDir.Name)
+ file_names = trans_dir.entryList(
+ u'*.qm', QtCore.QDir.Files, QtCore.QDir.Name)
# Remove qm files from the list which start with "qt_".
- file_names = file_names.filter(QtCore.QRegExp("^(?!qt_)"))
+ file_names = filter(
+ lambda file_: not file_.startswith(u'qt_'), file_names)
+ names = []
for name in file_names:
- file_names.replaceInStrings(name, trans_dir.filePath(name))
- return file_names
+ names.append(trans_dir.filePath(name))
+ #file_names.replaceInStrings(name, trans_dir.filePath(name))
+ return names
@staticmethod
def language_name(qm_file):
@@ -104,14 +107,12 @@
"""
Retrieve a saved language to use from settings
"""
- settings = Settings()
- language = unicode(settings.value(
- u'general/language', QtCore.QVariant(u'[en]')).toString())
+ language = Settings().value(u'general/language', u'[en]')
+ language = str(language)
log.info(u'Language file: \'%s\' Loaded from conf file' % language)
- reg_ex = QtCore.QRegExp("^\[(.*)\]")
- if reg_ex.exactMatch(language):
+ if re.match(r'[[].*[]]', language):
LanguageManager.auto_language = True
- language = reg_ex.cap(1)
+ language = re.sub(r'[\[\]]', '', language)
return language
@staticmethod
@@ -136,8 +137,7 @@
language = unicode(qm_list[action_name])
if LanguageManager.auto_language:
language = u'[%s]' % language
- Settings().setValue(
- u'general/language', QtCore.QVariant(language))
+ Settings().setValue(u'general/language', language)
log.info(u'Language file: \'%s\' written to conf file' % language)
if message:
QtGui.QMessageBox.information(None,
=== modified file 'openlp/plugins/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/alerts/alertsplugin.py 2012-12-20 12:09:36 +0000
@@ -31,10 +31,10 @@
from PyQt4 import QtCore
-from openlp.core.lib import Plugin, StringContent, build_icon, translate
+from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
+ Settings
from openlp.core.lib.db import Manager
from openlp.core.lib.ui import create_action, UiStrings
-from openlp.core.lib.settings import Settings
from openlp.core.lib.theme import VerticalType
from openlp.core.utils.actions import ActionList
from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
@@ -149,7 +149,7 @@
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):
"""
@@ -165,7 +165,7 @@
def toggleAlertsState(self):
self.alertsActive = not self.alertsActive
Settings().setValue(self.settingsSection + u'/active',
- QtCore.QVariant(self.alertsActive))
+ self.alertsActive)
def onAlertsTrigger(self):
self.alertForm.loadList()
=== modified file 'openlp/plugins/alerts/forms/alertform.py'
--- openlp/plugins/alerts/forms/alertform.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/alerts/forms/alertform.py 2012-12-20 12:09:36 +0000
@@ -79,7 +79,7 @@
order_by_ref=AlertItem.text)
for alert in alerts:
item_name = QtGui.QListWidgetItem(alert.text)
- item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(alert.id))
+ item_name.setData(QtCore.Qt.UserRole, alert.id)
self.alertListWidget.addItem(item_name)
if alert.text == unicode(self.alertTextEdit.text()):
self.item_id = alert.id
@@ -87,10 +87,10 @@
self.alertListWidget.row(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):
@@ -99,7 +99,7 @@
"""
item = self.alertListWidget.currentItem()
if item:
- item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ item_id = item.data(QtCore.Qt.UserRole)
self.manager.delete_object(AlertItem, item_id)
row = self.alertListWidget.row(item)
self.alertListWidget.takeItem(row)
@@ -115,7 +115,7 @@
'clicking New.'))
else:
alert = AlertItem()
- alert.text = unicode(self.alertTextEdit.text())
+ alert.text = self.alertTextEdit.text()
self.manager.save_object(alert)
self.loadList()
@@ -125,7 +125,7 @@
"""
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()
@@ -133,7 +133,7 @@
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:
@@ -147,26 +147,26 @@
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.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
+ self.triggerAlert(bitem.text())
+ self.alertTextEdit.setText(bitem.text())
+ self.item_id = bitem.data(QtCore.Qt.UserRole)
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.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
+ self.alertTextEdit.setText(bitem.text())
+ self.item_id = bitem.data(QtCore.Qt.UserRole)
# 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)
@@ -200,7 +200,7 @@
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
=== modified file 'openlp/plugins/alerts/lib/alertstab.py'
--- openlp/plugins/alerts/lib/alertstab.py 2012-12-04 06:09:55 +0000
+++ openlp/plugins/alerts/lib/alertstab.py 2012-12-20 12:09:36 +0000
@@ -29,10 +29,9 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab, translate, Receiver
+from openlp.core.lib import SettingsTab, translate, Receiver, Settings
from openlp.core.ui import AlertLocation
from openlp.core.lib.ui import UiStrings, create_valign_selection_widgets
-from openlp.core.lib.settings import Settings
class AlertsTab(SettingsTab):
"""
@@ -157,17 +156,12 @@
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
- self.timeout = settings.value(u'timeout', QtCore.QVariant(5)).toInt()[0]
- self.font_color = unicode(settings.value(
- u'font color', QtCore.QVariant(u'#ffffff')).toString())
- self.font_size = settings.value(
- u'font size', QtCore.QVariant(40)).toInt()[0]
- self.bg_color = unicode(settings.value(
- u'background color', QtCore.QVariant(u'#660000')).toString())
- self.font_face = unicode(settings.value(
- u'font face', QtCore.QVariant(QtGui.QFont().family())).toString())
- self.location = settings.value(
- u'location', QtCore.QVariant(AlertLocation.Bottom)).toInt()[0]
+ self.timeout = settings.value(u'timeout', 5)
+ self.font_color = settings.value(u'font color', u'#ffffff')
+ self.font_size = settings.value(u'font size', 40)
+ self.bg_color = settings.value(u'background color', u'#660000')
+ self.font_face = settings.value(u'font face', QtGui.QFont().family())
+ self.location = settings.value(u'location', AlertLocation.Bottom)
settings.endGroup()
self.fontSizeSpinBox.setValue(self.font_size)
self.timeoutSpinBox.setValue(self.timeout)
@@ -186,17 +180,17 @@
settings = Settings()
settings.beginGroup(self.settingsSection)
# Check value has changed as no event handles this field
- if settings.value(u'location', QtCore.QVariant(1)).toInt()[0] != \
+ if settings.value(u'location', 1) != \
self.verticalComboBox.currentIndex():
self.changed = True
- settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
- settings.setValue(u'font color', QtCore.QVariant(self.font_color))
- settings.setValue(u'font size', QtCore.QVariant(self.font_size))
+ settings.setValue(u'background color', self.bg_color)
+ settings.setValue(u'font color', self.font_color)
+ settings.setValue(u'font size', self.font_size)
self.font_face = self.fontComboBox.currentFont().family()
- settings.setValue(u'font face', QtCore.QVariant(self.font_face))
- settings.setValue(u'timeout', QtCore.QVariant(self.timeout))
+ settings.setValue(u'font face', self.font_face)
+ settings.setValue(u'timeout', self.timeout)
self.location = self.verticalComboBox.currentIndex()
- settings.setValue(u'location', QtCore.QVariant(self.location))
+ settings.setValue(u'location', self.location)
settings.endGroup()
if self.changed:
Receiver.send_message(u'update_display_css')
=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/bibles/bibleplugin.py 2012-12-20 12:09:36 +0000
@@ -31,9 +31,9 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Plugin, StringContent, build_icon, translate
+from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
+ Settings
from openlp.core.lib.ui import create_action, UiStrings
-from openlp.core.lib.settings import Settings
from openlp.core.utils.actions import ActionList
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
from openlp.plugins.bibles.forms import BibleUpgradeForm
@@ -58,11 +58,9 @@
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)
self.toolsUpgradeItem.setVisible(bool(self.manager.old_bible_databases))
@@ -75,8 +73,7 @@
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)
@@ -97,7 +94,7 @@
settings.beginGroup(self.settingsSection)
if settings.contains(u'bookname language'):
settings.setValue(u'book name language', settings.value(
- u'bookname language', QtCore.QVariant(0)).toInt()[0])
+ u'bookname language', 0))
settings.remove(u'bookname language')
settings.endGroup()
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py 2012-12-20 12:09:36 +0000
@@ -34,10 +34,9 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Receiver, translate
+from openlp.core.lib import Receiver, translate, Settings
from openlp.core.lib.db import delete_database
from openlp.core.lib.ui import UiStrings, critical_error_message_box
-from openlp.core.lib.settings import Settings
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.core.utils import AppLocation, locale_compare
from openlp.plugins.bibles.lib.manager import BibleFormat
@@ -434,50 +433,49 @@
if self.currentPage() == self.welcomePage:
return True
elif self.currentPage() == self.selectPage:
- if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
- if not self.field(u'osis_location').toString():
+ if self.field(u'source_format') == BibleFormat.OSIS:
+ if not self.field(u'osis_location'):
critical_error_message_box(UiStrings().NFSs,
WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
self.osisFileEdit.setFocus()
return False
- elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
- if not self.field(u'csv_booksfile').toString():
+ elif self.field(u'source_format') == BibleFormat.CSV:
+ if not self.field(u'csv_booksfile'):
critical_error_message_box(UiStrings().NFSs,
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file with books of '
'the Bible to use in the import.'))
self.csvBooksEdit.setFocus()
return False
- elif not self.field(u'csv_versefile').toString():
+ elif not self.field(u'csv_versefile'):
critical_error_message_box(UiStrings().NFSs,
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file of Bible '
'verses to import.'))
self.csvVersesEdit.setFocus()
return False
- elif self.field(u'source_format').toInt()[0] == \
+ elif self.field(u'source_format') == \
BibleFormat.OpenSong:
- if not self.field(u'opensong_file').toString():
+ if not self.field(u'opensong_file'):
critical_error_message_box(UiStrings().NFSs,
WizardStrings.YouSpecifyFile % WizardStrings.OS)
self.openSongFileEdit.setFocus()
return False
- elif self.field(u'source_format').toInt()[0] == \
+ elif self.field(u'source_format') == \
BibleFormat.WebDownload:
self.versionNameEdit.setText(
self.webTranslationComboBox.currentText())
return True
- elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1:
- if not self.field(u'openlp1_location').toString():
+ elif self.field(u'source_format') == BibleFormat.OpenLP1:
+ if not self.field(u'openlp1_location'):
critical_error_message_box(UiStrings().NFSs,
WizardStrings.YouSpecifyFile % UiStrings().OLPV1)
self.openlp1FileEdit.setFocus()
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')
+ license_copyright = self.field(u'license_copyright')
path = AppLocation.get_section_data_path(u'bibles')
if not license_version:
critical_error_message_box(UiStrings().EmptyField,
@@ -597,27 +595,21 @@
self.restart()
self.finishButton.setVisible(False)
self.cancelButton.setVisible(True)
- self.setField(u'source_format', QtCore.QVariant(0))
- self.setField(u'osis_location', QtCore.QVariant(''))
- self.setField(u'csv_booksfile', QtCore.QVariant(''))
- self.setField(u'csv_versefile', QtCore.QVariant(''))
- self.setField(u'opensong_file', QtCore.QVariant(''))
- self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk))
+ self.setField(u'source_format', 0)
+ self.setField(u'osis_location', '')
+ self.setField(u'csv_booksfile', '')
+ self.setField(u'csv_versefile', '')
+ self.setField(u'opensong_file', '')
+ self.setField(u'web_location', WebDownload.Crosswalk)
self.setField(u'web_biblename',
- QtCore.QVariant(self.webTranslationComboBox.currentIndex()))
- self.setField(u'proxy_server',
- settings.value(u'proxy address', QtCore.QVariant(u'')))
- self.setField(u'proxy_username',
- settings.value(u'proxy username', QtCore.QVariant(u'')))
- self.setField(u'proxy_password',
- settings.value(u'proxy password', QtCore.QVariant(u'')))
- self.setField(u'openlp1_location', QtCore.QVariant(''))
- self.setField(u'license_version',
- QtCore.QVariant(self.versionNameEdit.text()))
- self.setField(u'license_copyright',
- QtCore.QVariant(self.copyrightEdit.text()))
- self.setField(u'license_permissions',
- QtCore.QVariant(self.permissionsEdit.text()))
+ self.webTranslationComboBox.currentIndex())
+ self.setField(u'proxy_server', settings.value(u'proxy address', u''))
+ self.setField(u'proxy_username', settings.value(u'proxy username', u''))
+ self.setField(u'proxy_password', settings.value(u'proxy password', u''))
+ self.setField(u'openlp1_location', '')
+ self.setField(u'license_version', self.versionNameEdit.text())
+ self.setField(u'license_copyright', self.copyrightEdit.text())
+ self.setField(u'license_permissions', self.permissionsEdit.text())
self.onWebSourceComboBoxIndexChanged(WebDownload.Crosswalk)
settings.endGroup()
@@ -652,7 +644,7 @@
Prepare the UI for the import.
"""
OpenLPWizard.preWizard(self)
- bible_type = self.field(u'source_format').toInt()[0]
+ bible_type = self.field(u'source_format')
if bible_type == BibleFormat.WebDownload:
self.progressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm',
@@ -665,51 +657,49 @@
"""
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())
+ bible_type = self.field(u'source_format')
+ license_version = self.field(u'license_version')
+ license_copyright = self.field(u'license_copyright')
+ license_permissions = self.field(u'license_permissions')
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')
)
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'),
+ versefile=self.field(u'csv_versefile')
)
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')
)
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())
+ download_location = self.field(u'web_location')
+ 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'),
+ proxy_username=self.field(u'proxy_username'),
+ proxy_password=self.field(u'proxy_password')
)
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')
)
if importer.do_import(license_version):
self.manager.save_meta_data(license_version, license_version,
=== modified file 'openlp/plugins/bibles/forms/bibleupgradeform.py'
--- openlp/plugins/bibles/forms/bibleupgradeform.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/bibles/forms/bibleupgradeform.py 2012-12-20 12:09:36 +0000
@@ -37,9 +37,8 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, SettingsManager, translate, \
- check_directory_exists
+ check_directory_exists, Settings
from openlp.core.lib.ui import UiStrings, critical_error_message_box
-from openlp.core.lib.settings import Settings
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, \
@@ -309,7 +308,7 @@
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',
@@ -406,9 +405,9 @@
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])
@@ -453,9 +452,9 @@
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
@@ -473,9 +472,9 @@
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
@@ -485,10 +484,10 @@
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)
@@ -530,9 +529,9 @@
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
@@ -543,10 +542,10 @@
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),
@@ -577,18 +576,18 @@
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()
@@ -612,23 +611,22 @@
# 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(
=== modified file 'openlp/plugins/bibles/forms/booknameform.py'
--- openlp/plugins/bibles/forms/booknameform.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/bibles/forms/booknameform.py 2012-12-20 12:09:36 +0000
@@ -128,7 +128,7 @@
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:
=== modified file 'openlp/plugins/bibles/forms/editbibleform.py'
--- openlp/plugins/bibles/forms/editbibleform.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/bibles/forms/editbibleform.py 2012-12-20 12:09:36 +0000
@@ -118,9 +118,9 @@
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
@@ -130,7 +130,7 @@
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
@@ -185,29 +185,29 @@
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
=== modified file 'openlp/plugins/bibles/lib/__init__.py'
--- openlp/plugins/bibles/lib/__init__.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/bibles/lib/__init__.py 2012-12-20 12:09:36 +0000
@@ -33,8 +33,7 @@
import logging
import re
-from openlp.core.lib import translate
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import translate, Settings
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
log = logging.getLogger(__name__)
@@ -182,17 +181,17 @@
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 = [
- unicode(settings.value(u'verse separator').toString()),
- unicode(settings.value(u'range separator').toString()),
- unicode(settings.value(u'list separator').toString()),
- unicode(settings.value(u'end separator').toString())]
+ settings.value(u'verse separator', u''),
+ settings.value(u'range separator', u''),
+ settings.value(u'list separator', u''),
+ settings.value(u'end separator', u'')]
settings.endGroup()
for index, role in enumerate([u'v', u'r', u'l', u'e']):
if custom_separators[index].strip(u'|') == u'':
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2012-12-05 06:12:07 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2012-12-20 12:09:36 +0000
@@ -31,9 +31,8 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Receiver, SettingsTab, translate
+from openlp.core.lib import Receiver, SettingsTab, translate, Settings
from openlp.core.lib.ui import UiStrings, find_and_set_in_combo_box
-from openlp.core.lib.settings import Settings
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
update_reference_separators, get_reference_separator, LanguageSelection
@@ -334,7 +333,7 @@
if self.verseSeparatorLineEdit.isModified():
text = self.verseSeparatorLineEdit.text()
if text == get_reference_separator(u'sep_v_default') or \
- text.remove(u'|').isEmpty():
+ not text.replace(u'|', u''):
self.verseSeparatorCheckBox.setChecked(False)
self.verseSeparatorLineEdit.setText(
get_reference_separator(u'sep_v_default'))
@@ -359,7 +358,7 @@
if self.rangeSeparatorLineEdit.isModified():
text = self.rangeSeparatorLineEdit.text()
if text == get_reference_separator(u'sep_r_default') or \
- text.remove(u'|').isEmpty():
+ not text.replace(u'|', u''):
self.rangeSeparatorCheckBox.setChecked(False)
self.rangeSeparatorLineEdit.setText(
get_reference_separator(u'sep_r_default'))
@@ -384,7 +383,7 @@
if self.listSeparatorLineEdit.isModified():
text = self.listSeparatorLineEdit.text()
if text == get_reference_separator(u'sep_l_default') or \
- text.remove(u'|').isEmpty():
+ not text.replace(u'|', u''):
self.listSeparatorCheckBox.setChecked(False)
self.listSeparatorLineEdit.setText(
get_reference_separator(u'sep_l_default'))
@@ -409,7 +408,7 @@
if self.endSeparatorLineEdit.isModified():
text = self.endSeparatorLineEdit.text()
if text == get_reference_separator(u'sep_e_default') or \
- text.remove(u'|').isEmpty():
+ not text.replace(u'|', u''):
self.endSeparatorCheckBox.setChecked(False)
self.endSeparatorLineEdit.setText(
get_reference_separator(u'sep_e_default'))
@@ -419,21 +418,16 @@
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
- self.show_new_chapters = settings.value(
- u'display new chapter', QtCore.QVariant(False)).toBool()
- self.display_style = settings.value(
- u'display brackets', QtCore.QVariant(0)).toInt()[0]
- self.layout_style = settings.value(
- u'verse layout style', QtCore.QVariant(0)).toInt()[0]
- self.bible_theme = unicode(
- settings.value(u'bible theme', QtCore.QVariant(u'')).toString())
- self.second_bibles = settings.value(
- u'second bibles', QtCore.QVariant(True)).toBool()
+ self.show_new_chapters = settings.value(u'display new chapter', False)
+ self.display_style = settings.value(u'display brackets', 0)
+ self.layout_style = settings.value(u'verse layout style', 0)
+ self.bible_theme = settings.value(u'bible theme', u'')
+ self.second_bibles = settings.value(u'second bibles', True)
self.newChaptersCheckBox.setChecked(self.show_new_chapters)
self.displayStyleComboBox.setCurrentIndex(self.display_style)
self.layoutStyleComboBox.setCurrentIndex(self.layout_style)
self.bibleSecondCheckBox.setChecked(self.second_bibles)
- verse_separator = unicode(settings.value(u'verse separator').toString())
+ verse_separator = settings.value(u'verse separator', u'')
if (verse_separator.strip(u'|') == u'') or \
(verse_separator == get_reference_separator(u'sep_v_default')):
self.verseSeparatorLineEdit.setText(
@@ -446,7 +440,7 @@
self.verseSeparatorLineEdit.setPalette(
self.getGreyTextPalette(False))
self.verseSeparatorCheckBox.setChecked(True)
- range_separator = unicode(settings.value(u'range separator').toString())
+ range_separator = settings.value(u'range separator', u'')
if (range_separator.strip(u'|') == u'') or \
(range_separator == get_reference_separator(u'sep_r_default')):
self.rangeSeparatorLineEdit.setText(
@@ -459,50 +453,42 @@
self.rangeSeparatorLineEdit.setPalette(
self.getGreyTextPalette(False))
self.rangeSeparatorCheckBox.setChecked(True)
- list_separator = unicode(settings.value(u'list separator').toString())
+ list_separator = settings.value(u'list separator', u'')
if (list_separator.strip(u'|') == u'') or \
(list_separator == get_reference_separator(u'sep_l_default')):
self.listSeparatorLineEdit.setText(
get_reference_separator(u'sep_l_default'))
- self.listSeparatorLineEdit.setPalette(
- self.getGreyTextPalette(True))
+ self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
self.listSeparatorCheckBox.setChecked(False)
else:
self.listSeparatorLineEdit.setText(list_separator)
self.listSeparatorLineEdit.setPalette(
self.getGreyTextPalette(False))
self.listSeparatorCheckBox.setChecked(True)
- end_separator = unicode(settings.value(u'end separator').toString())
+ end_separator = settings.value(u'end separator', u'')
if (end_separator.strip(u'|') == u'') or \
(end_separator == get_reference_separator(u'sep_e_default')):
self.endSeparatorLineEdit.setText(
get_reference_separator(u'sep_e_default'))
- self.endSeparatorLineEdit.setPalette(
- self.getGreyTextPalette(True))
+ self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
self.endSeparatorCheckBox.setChecked(False)
else:
self.endSeparatorLineEdit.setText(end_separator)
- self.endSeparatorLineEdit.setPalette(
- self.getGreyTextPalette(False))
+ self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
self.endSeparatorCheckBox.setChecked(True)
- self.language_selection = settings.value(
- u'book name language', QtCore.QVariant(0)).toInt()[0]
+ self.language_selection = settings.value(u'book name language', 0)
self.languageSelectionComboBox.setCurrentIndex(self.language_selection)
settings.endGroup()
def save(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
- settings.setValue(u'display new chapter',
- QtCore.QVariant(self.show_new_chapters))
- settings.setValue(u'display brackets',
- QtCore.QVariant(self.display_style))
- settings.setValue(u'verse layout style',
- QtCore.QVariant(self.layout_style))
- settings.setValue(u'book name language',
- QtCore.QVariant(self.language_selection))
- settings.setValue(u'second bibles', QtCore.QVariant(self.second_bibles))
- settings.setValue(u'bible theme', QtCore.QVariant(self.bible_theme))
+ settings.setValue(u'display new chapter', self.show_new_chapters)
+ settings.setValue(u'display brackets', self.display_style)
+ settings.setValue(u'verse layout style', self.layout_style)
+ settings.setValue(u'book name language', self.language_selection)
+ settings.setValue(u'second bibles', self.second_bibles)
+ settings.setValue(u'bible theme', self.bible_theme)
if self.verseSeparatorCheckBox.isChecked():
settings.setValue(u'verse separator',
self.verseSeparatorLineEdit.text())
=== modified file 'openlp/plugins/bibles/lib/csvbible.py'
--- openlp/plugins/bibles/lib/csvbible.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/bibles/lib/csvbible.py 2012-12-20 12:09:36 +0000
@@ -109,9 +109,9 @@
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)
@@ -153,9 +153,9 @@
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>...')) % book.name)
+ 'Importing verses from <book name>...') % book.name)
self.session.commit()
try:
verse_text = unicode(line[3], details['encoding'])
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/bibles/lib/http.py 2012-12-20 12:09:36 +0000
@@ -512,9 +512,9 @@
``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:
@@ -537,8 +537,8 @@
'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']:
@@ -553,9 +553,9 @@
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 name>...')) % book)
+ 'Importing <book name>...') % book)
book_ref_id = self.get_book_ref_id_by_name(book, len(books),
language_id)
if not book_ref_id:
=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/bibles/lib/manager.py 2012-12-20 12:09:36 +0000
@@ -32,9 +32,8 @@
from PyQt4 import QtCore
-from openlp.core.lib import Receiver, SettingsManager, translate
+from openlp.core.lib import Receiver, SettingsManager, translate, Settings
from openlp.core.utils import AppLocation, delete_file
-from openlp.core.lib.settings import Settings
from openlp.plugins.bibles.lib import parse_reference, \
get_reference_separator, LanguageSelection
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
@@ -128,9 +127,8 @@
self.web = u'Web'
self.db_cache = None
self.path = AppLocation.get_section_data_path(self.settingsSection)
- self.proxy_name = unicode(
- Settings().value(self.settingsSection + u'/proxy name',
- QtCore.QVariant(u'')).toString())
+ self.proxy_name = Settings().value(
+ self.settingsSection + u'/proxy name', u'')
self.suffix = u'.sqlite'
self.import_wizard = None
self.reload_bibles()
@@ -340,7 +338,7 @@
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 '
@@ -355,7 +353,7 @@
'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
@@ -374,8 +372,7 @@
# If None is returned, it's not the singleton object but a
# BibleMeta object with the value "None"
language_selection = Settings().value(
- self.settingsSection + u'/book name language',
- QtCore.QVariant(0)).toInt()[0]
+ self.settingsSection + u'/book name language', 0)
else:
language_selection = language_selection.value
try:
@@ -436,7 +433,7 @@
})
return None
- def save_meta_data(self, bible, version, copyright, permissions,
+ def save_meta_data(self, bible, version, copyright, permissions,
book_name_language=None):
"""
Saves the bibles meta data.
@@ -455,7 +452,7 @@
"""
log.debug(u'get_meta %s,%s', bible, key)
return self.db_cache[bible].get_object(BibleMeta, key)
-
+
def update_book(self, bible, book):
"""
Update a book of the bible.
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2012-12-04 06:09:55 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2012-12-20 12:09:36 +0000
@@ -32,9 +32,8 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
- translate, create_separated_list, ServiceItemContext
+ translate, create_separated_list, ServiceItemContext, Settings
from openlp.core.lib.searchedit import SearchEdit
-from openlp.core.lib.settings import Settings
from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, \
create_horizontal_adjusting_combo_box, critical_error_message_box, \
find_and_set_in_combo_box, build_icon
@@ -102,11 +101,7 @@
def _decodeQtObject(self, bitem, key):
reference = bitem.data(QtCore.Qt.UserRole)
- if isinstance(reference, QtCore.QVariant):
- reference = reference.toPyObject()
- obj = reference[QtCore.QString(key)]
- if isinstance(obj, QtCore.QVariant):
- obj = obj.toPyObject()
+ obj = reference[unicode(key)]
return unicode(obj).strip()
def requiredIcons(self):
@@ -297,8 +292,7 @@
def configUpdated(self):
log.debug(u'configUpdated')
- if Settings().value(self.settingsSection + u'/second bibles',
- QtCore.QVariant(True)).toBool():
+ if Settings().value(self.settingsSection + u'/second bibles', True):
self.advancedSecondLabel.setVisible(True)
self.advancedSecondComboBox.setVisible(True)
self.quickSecondLabel.setVisible(True)
@@ -367,7 +361,7 @@
])
self.quickSearchEdit.setCurrentSearchType(Settings().value(
u'%s/last search type' % self.settingsSection,
- QtCore.QVariant(BibleSearch.Reference)).toInt()[0])
+ BibleSearch.Reference))
self.configUpdated()
log.debug(u'bible manager initialise complete')
@@ -389,17 +383,15 @@
self.advancedVersionComboBox.addItems(bibles)
self.advancedSecondComboBox.addItems(bibles)
# set the default value
- bible = Settings().value(
- self.settingsSection + u'/advanced bible',
- QtCore.QVariant(u'')).toString()
+ bible = Settings().value(self.settingsSection + u'/advanced bible', u'')
if bible in bibles:
find_and_set_in_combo_box(self.advancedVersionComboBox, bible)
self.initialiseAdvancedBible(unicode(bible))
elif bibles:
self.initialiseAdvancedBible(bibles[0])
bible = Settings().value(
- self.settingsSection + u'/quick bible', QtCore.QVariant(
- self.quickVersionComboBox.currentText())).toString()
+ self.settingsSection + u'/quick bible',
+ self.quickVersionComboBox.currentText())
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
def reloadBibles(self, process=False):
@@ -427,7 +419,7 @@
"""
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 = []
@@ -456,14 +448,14 @@
book[u'book_reference_id'])
self.advancedBookComboBox.addItem(data[u'name'])
self.advancedBookComboBox.setItemData(
- row, QtCore.QVariant(book[u'book_reference_id']))
+ row, book[u'book_reference_id'])
if first:
first = False
first_book = book
initialise_chapter_verse = True
if last_book_id and last_book_id == int(book[u'book_reference_id']):
index = self.advancedBookComboBox.findData(
- QtCore.QVariant(book[u'book_reference_id']))
+ book[u'book_reference_id'])
if index == -1:
# Not Found.
index = 0
@@ -501,19 +493,18 @@
log.debug(u'updateAutoCompleter')
# Save the current search type to the configuration.
Settings().setValue(u'%s/last search type' %
- self.settingsSection,
- QtCore.QVariant(self.quickSearchEdit.currentSearchType()))
+ self.settingsSection, self.quickSearchEdit.currentSearchType())
# Save the current bible to the configuration.
Settings().setValue(self.settingsSection + u'/quick bible',
- QtCore.QVariant(self.quickVersionComboBox.currentText()))
+ self.quickVersionComboBox.currentText())
books = []
# 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 = []
@@ -552,9 +543,9 @@
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)
@@ -564,15 +555,15 @@
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',
+ translate('BiblesPlugin.MediaItem',
'Are you sure you want to completely delete "%s" Bible from '
'OpenLP?\n\nYou will need to re-import this Bible to use it '
- 'again.'))% bible,
+ 'again.') % bible,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
@@ -603,7 +594,7 @@
self.settings.layout_style)
Settings().setValue(
self.settingsSection + u'/verse layout style',
- QtCore.QVariant(self.settings.layout_style))
+ self.settings.layout_style)
def onAdvancedStyleComboBoxChanged(self):
self.settings.layout_style = self.advancedStyleComboBox.currentIndex()
@@ -612,36 +603,35 @@
self.settings.layout_style)
Settings().setValue(
self.settingsSection + u'/verse layout style',
- QtCore.QVariant(self.settings.layout_style))
+ self.settings.layout_style)
def onAdvancedVersionComboBox(self):
Settings().setValue(self.settingsSection + u'/advanced bible',
- QtCore.QVariant(self.advancedVersionComboBox.currentText()))
- self.initialiseAdvancedBible(
- unicode(self.advancedVersionComboBox.currentText()),
+ 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))
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()))
verse_from = int(self.advancedFromVerse.currentText())
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(
bible, book_ref_id, chapter_to)
@@ -649,9 +639,9 @@
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()))
chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.advancedToChapter.currentText())
verse_from = int(self.advancedFromVerse.currentText())
@@ -664,9 +654,9 @@
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()))
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,
@@ -703,7 +693,7 @@
"""
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:
@@ -716,11 +706,11 @@
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()))
chapter_from = self.advancedFromChapter.currentText()
chapter_to = self.advancedToChapter.currentText()
verse_from = self.advancedFromVerse.currentText()
@@ -755,9 +745,9 @@
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)
@@ -792,11 +782,11 @@
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 = \
@@ -861,24 +851,24 @@
verse.book.book_reference_id)
book = data[u'name']
data = {
- 'book': QtCore.QVariant(book),
- 'chapter': QtCore.QVariant(verse.chapter),
- 'verse': QtCore.QVariant(verse.verse),
- 'bible': QtCore.QVariant(bible),
- 'version': QtCore.QVariant(version),
- 'copyright': QtCore.QVariant(copyright),
- 'permissions': QtCore.QVariant(permissions),
- 'text': QtCore.QVariant(verse.text),
- 'second_bible': QtCore.QVariant(second_bible),
- 'second_version': QtCore.QVariant(second_version),
- 'second_copyright': QtCore.QVariant(second_copyright),
- 'second_permissions': QtCore.QVariant(second_permissions),
- 'second_text': QtCore.QVariant(u'')
+ 'book': book,
+ 'chapter': verse.chapter,
+ 'verse': verse.verse,
+ 'bible': bible,
+ 'version': version,
+ 'copyright': copyright,
+ 'permissions': permissions,
+ 'text': verse.text,
+ 'second_bible': second_bible,
+ 'second_version': second_version,
+ 'second_copyright': second_copyright,
+ 'second_permissions': second_permissions,
+ 'second_text': u''
}
if second_bible:
try:
- data[u'second_text'] = QtCore.QVariant(
- self.second_search_results[count].text)
+ data[u'second_text'] = \
+ self.second_search_results[count].text
except IndexError:
log.exception(u'The second_search_results does not have as '
'many verses as the search_results.')
@@ -889,7 +879,7 @@
bible_text = u'%s %d%s%d (%s)' % (book, verse.chapter,
verse_separator, verse.verse, version)
bible_verse = QtGui.QListWidgetItem(bible_text)
- bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
+ bible_verse.setData(QtCore.Qt.UserRole, data)
items.append(bible_verse)
return items
@@ -1092,7 +1082,7 @@
"""
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:
@@ -1102,7 +1092,7 @@
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
=== modified file 'openlp/plugins/bibles/lib/opensong.py'
--- openlp/plugins/bibles/lib/opensong.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/bibles/lib/opensong.py 2012-12-20 12:09:36 +0000
@@ -63,7 +63,7 @@
verse_text += self.get_text(sub_element)
if element.tail:
verse_text += element.tail
- return verse_text
+ return verse_text
def do_import(self, bible_name=None):
"""
@@ -129,11 +129,11 @@
db_book.id,
chapter_number,
verse_number,
- unicode(self.get_text(verse)))
- self.wizard.incrementProgressBar(unicode(translate(
+ self.get_text(verse))
+ self.wizard.incrementProgressBar(translate(
'BiblesPlugin.Opensong', 'Importing %s %s...',
- 'Importing <book name> <chapter>...')) %
- (db_book.name, chapter_number))
+ 'Importing <book name> <chapter>...')) % \
+ (db_book.name, chapter_number)
self.session.commit()
Receiver.send_message(u'openlp_process_events')
except etree.XMLSyntaxError as inst:
=== modified file 'openlp/plugins/bibles/lib/osis.py'
--- openlp/plugins/bibles/lib/osis.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/bibles/lib/osis.py 2012-12-20 12:09:36 +0000
@@ -103,7 +103,7 @@
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
@@ -159,9 +159,9 @@
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 <book name> <chapter>...')) %
+ 'Importing <book name> <chapter>...') %
(book_details[u'name'], chapter))
last_chapter = chapter
# All of this rigmarol below is because the mod2osis
=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py 2012-12-05 06:12:07 +0000
+++ openlp/plugins/custom/forms/editcustomform.py 2012-12-20 12:09:36 +0000
@@ -129,11 +129,11 @@
sxml.add_lyrics_to_song()
for count in range(self.slideListView.count()):
sxml.add_verse_to_lyrics(u'custom', unicode(count + 1),
- unicode(self.slideListView.item(count).text()))
- self.customSlide.title = unicode(self.titleEdit.text())
+ self.slideListView.item(count).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
=== modified file 'openlp/plugins/custom/lib/customtab.py'
--- openlp/plugins/custom/lib/customtab.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/custom/lib/customtab.py 2012-12-20 12:09:36 +0000
@@ -29,8 +29,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab, translate
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import SettingsTab, translate, Settings
class CustomTab(SettingsTab):
"""
@@ -70,10 +69,9 @@
def load(self):
self.displayFooter = Settings().value(
- self.settingsSection + u'/display footer',
- QtCore.QVariant(True)).toBool()
+ self.settingsSection + u'/display footer', True)
self.displayFooterCheckBox.setChecked(self.displayFooter)
def save(self):
Settings().setValue(self.settingsSection + u'/display footer',
- QtCore.QVariant(self.displayFooter))
+ self.displayFooter)
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2012-12-03 19:19:10 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2012-12-20 12:09:36 +0000
@@ -33,9 +33,8 @@
from sqlalchemy.sql import or_, func
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
- check_item_selected, translate, ServiceItemContext
+ check_item_selected, translate, ServiceItemContext, Settings
from openlp.core.lib.ui import UiStrings
-from openlp.core.lib.settings import Settings
from openlp.plugins.custom.forms import EditCustomForm
from openlp.plugins.custom.lib import CustomXMLParser
from openlp.plugins.custom.lib.db import CustomSlide
@@ -102,8 +101,7 @@
self.loadList(self.manager.get_all_objects(
CustomSlide, order_by_ref=CustomSlide.title))
self.searchTextEdit.setCurrentSearchType(Settings().value(
- u'%s/last search type' % self.settingsSection,
- QtCore.QVariant(CustomSearch.Titles)).toInt()[0])
+ u'%s/last search type' % self.settingsSection, CustomSearch.Titles))
def loadList(self, custom_slides):
# Sort out what custom we want to select after loading the list.
@@ -112,8 +110,7 @@
custom_slides.sort()
for custom_slide in custom_slides:
custom_name = QtGui.QListWidgetItem(custom_slide.title)
- custom_name.setData(
- QtCore.Qt.UserRole, QtCore.QVariant(custom_slide.id))
+ custom_name.setData(QtCore.Qt.UserRole, custom_slide.id)
self.listView.addItem(custom_name)
# Auto-select the custom.
if custom_slide.id == self.autoSelectId:
@@ -161,7 +158,7 @@
"""
if check_item_selected(self.listView, UiStrings().SelectEdit):
item = self.listView.currentItem()
- item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ item_id = item.data(QtCore.Qt.UserRole)
self.edit_custom_form.loadCustom(item_id, False)
self.edit_custom_form.exec_()
self.autoSelectId = -1
@@ -185,7 +182,7 @@
return
row_list = [item.row() for item in self.listView.selectedIndexes()]
row_list.sort(reverse=True)
- id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
+ id_list = [(item.data(QtCore.Qt.UserRole))
for item in self.listView.selectedIndexes()]
for id in id_list:
self.plugin.manager.delete_object(CustomSlide, id)
@@ -215,7 +212,7 @@
for slide in raw_slides:
service_item.add_from_text(slide)
if Settings().value(self.settingsSection + u'/display footer',
- QtCore.QVariant(True)).toBool() or credit:
+ True) or credit:
service_item.raw_footer.append(u' '.join([title, credit]))
else:
service_item.raw_footer.append(u'')
@@ -224,10 +221,9 @@
def onSearchTextButtonClicked(self):
# Save the current search type to the configuration.
Settings().setValue(u'%s/last search type' %
- self.settingsSection,
- QtCore.QVariant(self.searchTextEdit.currentSearchType()))
+ 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:
=== modified file 'openlp/plugins/images/imageplugin.py'
--- openlp/plugins/images/imageplugin.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/images/imageplugin.py 2012-12-20 12:09:36 +0000
@@ -32,8 +32,7 @@
import logging
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
- Receiver, ImageSource
-from openlp.core.lib.settings import Settings
+ Receiver, ImageSource, Settings
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
log = logging.getLogger(__name__)
@@ -98,6 +97,6 @@
last part of saving the config.
"""
background = QtGui.QColor(Settings().value(self.settingsSection
- + u'/background color', QtCore.QVariant(u'#000000')))
+ + u'/background color', u'#000000'))
self.liveController.imageManager.updateImagesBorder(
ImageSource.ImagePlugin, background)
=== modified file 'openlp/plugins/images/lib/imagetab.py'
--- openlp/plugins/images/lib/imagetab.py 2012-12-03 19:19:10 +0000
+++ openlp/plugins/images/lib/imagetab.py 2012-12-20 12:09:36 +0000
@@ -29,8 +29,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab, translate, Receiver
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import SettingsTab, translate, Receiver, Settings
from openlp.core.lib.ui import UiStrings
class ImageTab(SettingsTab):
@@ -86,8 +85,7 @@
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
- self.bg_color = unicode(settings.value(
- u'background color', QtCore.QVariant(u'#000000')).toString())
+ self.bg_color = settings.value(u'background color', u'#000000')
self.initial_color = self.bg_color
settings.endGroup()
self.backgroundColorButton.setStyleSheet(
@@ -96,7 +94,7 @@
def save(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
- settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
+ settings.setValue(u'background color', self.bg_color)
settings.endGroup()
if self.initial_color != self.bg_color:
Receiver.send_message(u'image_updated')
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2012-12-04 06:09:55 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2012-12-20 12:09:36 +0000
@@ -34,9 +34,8 @@
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
SettingsManager, translate, check_item_selected, check_directory_exists, \
- Receiver, create_thumb, validate_thumb, ServiceItemContext
+ Receiver, create_thumb, validate_thumb, ServiceItemContext, Settings
from openlp.core.lib.ui import UiStrings, critical_error_message_box
-from openlp.core.lib.settings import Settings
from openlp.core.utils import AppLocation, delete_file, locale_compare, \
get_images_filter
@@ -113,8 +112,7 @@
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,
@@ -144,7 +142,7 @@
item_name = QtGui.QListWidgetItem(filename)
item_name.setIcon(icon)
item_name.setToolTip(imageFile)
- item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(imageFile))
+ item_name.setData(QtCore.Qt.UserRole, imageFile)
self.listView.addItem(item_name)
if not initialLoad:
self.plugin.formParent.incrementProgressBar()
@@ -155,7 +153,7 @@
def generateSlideData(self, service_item, item=None, xmlVersion=False,
remote=False, context=ServiceItemContext.Service):
background = QtGui.QColor(Settings().value(self.settingsSection
- + u'/background color', QtCore.QVariant(u'#000000')))
+ + u'/background color', u'#000000'))
if item:
items = [item]
else:
@@ -172,7 +170,7 @@
missing_items = []
missing_items_filenames = []
for bitem in items:
- filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
+ filename = bitem.data(QtCore.Qt.UserRole)
if not os.path.exists(filename):
missing_items.append(bitem)
missing_items_filenames.append(filename)
@@ -183,22 +181,22 @@
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)
name = os.path.split(filename)[1]
service_item.add_from_image(filename, name, background)
return True
@@ -224,11 +222,10 @@
translate('ImagePlugin.MediaItem',
'You must select an image to replace the background with.')):
background = QtGui.QColor(Settings().value(
- self.settingsSection + u'/background color',
- QtCore.QVariant(u'#000000')))
+ 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)
if os.path.exists(filename):
if self.plugin.liveController.display.directImage(
filename, background):
@@ -239,9 +236,9 @@
'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')
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2012-12-10 06:15:42 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2012-12-20 12:09:36 +0000
@@ -33,8 +33,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, SettingsManager, translate, \
- check_item_selected, Receiver, MediaType, ServiceItem, build_html, ServiceItemContext
-from openlp.core.lib.settings import Settings
+ check_item_selected, Receiver, MediaType, ServiceItem, build_html, ServiceItemContext, Settings
from openlp.core.lib.ui import UiStrings, critical_error_message_box, create_horizontal_adjusting_combo_box
from openlp.core.ui import DisplayController, Display, DisplayControllerType
from openlp.core.ui.media import get_media_players, set_media_players
@@ -149,7 +148,7 @@
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)
if os.path.exists(filename):
service_item = ServiceItem()
service_item.title = u'webkit'
@@ -164,8 +163,8 @@
translate('MediaPlugin.MediaItem', 'There was no display item to amend.'))
else:
critical_error_message_box(UiStrings().LiveBGError,
- unicode(translate('MediaPlugin.MediaItem',
- 'There was a problem replacing your background, the media file "%s" no longer exists.')) % filename)
+ translate('MediaPlugin.MediaItem',
+ 'There was a problem replacing your background, the media file "%s" no longer exists.') % filename)
def generateSlideData(self, service_item, item=None, xmlVersion=False,
remote=False, context=ServiceItemContext.Live):
@@ -173,15 +172,15 @@
item = self.listView.currentItem()
if item is None:
return False
- filename = unicode(item.data(QtCore.Qt.UserRole).toString())
+ filename = item.data(QtCore.Qt.UserRole)
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
- service_item.title = unicode(self.displayTypeComboBox.currentText())
+ service_item.title = self.displayTypeComboBox.currentText()
service_item.shortname = service_item.title
(path, name) = os.path.split(filename)
service_item.add_from_command(path, name, CLAPPERBOARD)
@@ -193,8 +192,7 @@
service_item.add_capability(ItemCapabilities.CanAutoStartForLive)
service_item.add_capability(ItemCapabilities.RequiresMedia)
service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay)
- if Settings().value(self.settingsSection + u'/media auto start',
- QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == QtCore.Qt.Checked:
+ if Settings().value(self.settingsSection + u'/media auto start', QtCore.Qt.Unchecked) == QtCore.Qt.Checked:
service_item.will_auto_start = True
# force a non-existent theme
service_item.theme = -1
@@ -212,7 +210,7 @@
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.mediaController.video_extensions_list),
u' '.join(self.plugin.mediaController.audio_extensions_list), UiStrings().AllFiles)
@@ -268,7 +266,7 @@
filename = os.path.split(unicode(track))[1]
item_name = QtGui.QListWidgetItem(filename)
item_name.setIcon(ERROR)
- item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
+ item_name.setData(QtCore.Qt.UserRole, track)
elif track_info.isFile():
filename = os.path.split(unicode(track))[1]
item_name = QtGui.QListWidgetItem(filename)
@@ -276,12 +274,12 @@
item_name.setIcon(AUDIO)
else:
item_name.setIcon(VIDEO)
- item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
+ item_name.setData(QtCore.Qt.UserRole, track)
else:
filename = os.path.split(unicode(track))[1]
item_name = QtGui.QListWidgetItem(filename)
item_name.setIcon(build_icon(DVDICON))
- item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
+ item_name.setData(QtCore.Qt.UserRole, track)
item_name.setToolTip(track)
self.listView.addItem(item_name)
=== modified file 'openlp/plugins/media/lib/mediatab.py'
--- openlp/plugins/media/lib/mediatab.py 2012-12-10 06:15:42 +0000
+++ openlp/plugins/media/lib/mediatab.py 2012-12-20 12:09:36 +0000
@@ -29,9 +29,8 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab, translate, Receiver
+from openlp.core.lib import Receiver, Settings, SettingsTab, translate
from openlp.core.lib.ui import UiStrings, create_button
-from openlp.core.lib.settings import Settings
from openlp.core.ui.media import get_media_players, set_media_players
class MediaQCheckBox(QtGui.QCheckBox):
@@ -74,20 +73,20 @@
def load(self):
self.overridePlayerCheckBox.setChecked(Settings().value(self.settingsSection + u'/override player',
- QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
+ QtCore.Qt.Unchecked))
self.autoStartCheckBox.setChecked(Settings().value(self.settingsSection + u'/media auto start',
- QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
+ QtCore.Qt.Unchecked))
def save(self):
override_changed = False
setting_key = self.settingsSection + u'/override player'
- if Settings().value(setting_key).toInt()[0] != self.overridePlayerCheckBox.checkState():
- Settings().setValue(setting_key, QtCore.QVariant(self.overridePlayerCheckBox.checkState()))
+ if Settings().value(setting_key, QtCore.Qt.Unchecked) != self.overridePlayerCheckBox.checkState():
+ Settings().setValue(setting_key, self.overridePlayerCheckBox.checkState())
override_changed = True
setting_key = self.settingsSection + u'/media auto start'
- if Settings().value(setting_key).toInt()[0] != self.autoStartCheckBox.checkState():
- Settings().setValue(setting_key, QtCore.QVariant(self.autoStartCheckBox.checkState()))
+ if Settings().value(setting_key, QtCore.Qt.Unchecked) != self.autoStartCheckBox.checkState():
+ Settings().setValue(setting_key, self.autoStartCheckBox.checkState())
if override_changed:
self.parent.resetSupportedSuffixes()
Receiver.send_message(u'mediaitem_media_rebuild')
- Receiver.send_message(u'mediaitem_suffixes')
\ No newline at end of file
+ Receiver.send_message(u'mediaitem_suffixes')
=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py 2012-12-10 06:15:42 +0000
+++ openlp/plugins/media/mediaplugin.py 2012-12-20 12:09:36 +0000
@@ -31,8 +31,8 @@
from PyQt4 import QtCore
-from openlp.core.lib import Plugin, StringContent, build_icon, translate
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
+ Settings
from openlp.plugins.media.lib import MediaMediaItem, MediaTab
log = logging.getLogger(__name__)
@@ -124,14 +124,14 @@
log.info(u'Found old Phonon setting')
players = self.mediaController.mediaPlayers.keys()
has_phonon = u'phonon' in players
- if settings.value(u'use phonon').toBool() and has_phonon:
+ if settings.value(u'use phonon') and has_phonon:
log.debug(u'Converting old setting to new setting')
new_players = []
if players:
new_players = [player for player in players if player != u'phonon']
new_players.insert(0, u'phonon')
self.mediaController.mediaPlayers[u'phonon'].isActive = True
- settings.setValue(u'players', QtCore.QVariant(u','.join(new_players)))
+ settings.setValue(u'players', u','.join(new_players))
self.settingsTab.load()
settings.remove(u'use phonon')
settings.endGroup()
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2012-12-03 19:19:10 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2012-12-20 12:09:36 +0000
@@ -34,10 +34,9 @@
from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, \
translate, check_item_selected, Receiver, ItemCapabilities, create_thumb, \
- validate_thumb, ServiceItemContext
+ validate_thumb, ServiceItemContext, Settings
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
create_horizontal_adjusting_combo_box
-from openlp.core.lib.settings import Settings
from openlp.core.utils import locale_compare
from openlp.plugins.presentations.lib import MessageListener
@@ -95,8 +94,8 @@
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):
"""
@@ -150,7 +149,7 @@
self.displayTypeComboBox.insertItem(0, self.Automatic)
self.displayTypeComboBox.setCurrentIndex(0)
if Settings().value(self.settingsSection + u'/override app',
- QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
+ QtCore.Qt.Unchecked) == QtCore.Qt.Checked:
self.presentationWidget.show()
else:
self.presentationWidget.hide()
@@ -180,7 +179,7 @@
if not os.path.exists(file):
item_name = QtGui.QListWidgetItem(filename)
item_name.setIcon(build_icon(ERROR))
- item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
+ item_name.setData(QtCore.Qt.UserRole, file)
item_name.setToolTip(file)
self.listView.addItem(item_name)
else:
@@ -220,7 +219,7 @@
'This type of presentation is not supported.'))
continue
item_name = QtGui.QListWidgetItem(filename)
- item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
+ item_name.setData(QtCore.Qt.UserRole, file)
item_name.setIcon(icon)
item_name.setToolTip(file)
self.listView.addItem(item_name)
@@ -240,8 +239,7 @@
Receiver.send_message(u'cursor_busy')
self.plugin.formParent.displayProgressBar(len(row_list))
for item in items:
- filepath = unicode(item.data(
- QtCore.Qt.UserRole).toString())
+ filepath = unicode(item.data(QtCore.Qt.UserRole))
for cidx in self.controllers:
doc = self.controllers[cidx].add_document(filepath)
doc.presentation_deleted()
@@ -267,15 +265,15 @@
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)
if os.path.exists(filename):
if shortname == self.Automatic:
service_item.shortname = self.findControllerByType(filename)
@@ -301,10 +299,9 @@
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
@@ -312,8 +309,8 @@
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):
=== modified file 'openlp/plugins/presentations/lib/presentationcontroller.py'
--- openlp/plugins/presentations/lib/presentationcontroller.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/presentations/lib/presentationcontroller.py 2012-12-20 12:09:36 +0000
@@ -34,8 +34,7 @@
from PyQt4 import QtCore
from openlp.core.lib import Receiver, check_directory_exists, create_thumb, \
- validate_thumb
-from openlp.core.lib.settings import Settings
+ validate_thumb, Settings
from openlp.core.utils import AppLocation
log = logging.getLogger(__name__)
@@ -393,10 +392,8 @@
"""
Return whether the controller is currently enabled
"""
- if Settings().value(
- self.settings_section + u'/' + self.name,
- QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0] == \
- QtCore.Qt.Checked:
+ if Settings().value(self.settings_section + u'/' + self.name,
+ QtCore.Qt.Checked) == QtCore.Qt.Checked:
return self.is_available()
else:
return False
=== modified file 'openlp/plugins/presentations/lib/presentationtab.py'
--- openlp/plugins/presentations/lib/presentationtab.py 2012-12-03 19:19:10 +0000
+++ openlp/plugins/presentations/lib/presentationtab.py 2012-12-20 12:09:36 +0000
@@ -29,9 +29,8 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Receiver, SettingsTab, translate
+from openlp.core.lib import Receiver, Settings, SettingsTab, translate
from openlp.core.lib.ui import UiStrings
-from openlp.core.lib.settings import Settings
class PresentationTab(SettingsTab):
"""
@@ -96,8 +95,8 @@
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):
"""
@@ -108,10 +107,9 @@
checkbox = self.PresenterCheckboxes[controller.name]
checkbox.setChecked(Settings().value(
self.settingsSection + u'/' + controller.name,
- QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0])
+ QtCore.Qt.Checked))
self.OverrideAppCheckBox.setChecked(Settings().value(
- self.settingsSection + u'/override app',
- QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
+ self.settingsSection + u'/override app', QtCore.Qt.Unchecked))
def save(self):
"""
@@ -130,8 +128,7 @@
if Settings().value(setting_key) != \
checkbox.checkState():
changed = True
- Settings().setValue(setting_key,
- QtCore.QVariant(checkbox.checkState()))
+ Settings().setValue(setting_key, checkbox.checkState())
if checkbox.isChecked():
controller.start_process()
else:
@@ -140,7 +137,7 @@
if Settings().value(setting_key) != \
self.OverrideAppCheckBox.checkState():
Settings().setValue(setting_key,
- QtCore.QVariant(self.OverrideAppCheckBox.checkState()))
+ self.OverrideAppCheckBox.checkState())
changed = True
if changed:
self.parent.resetSupportedSuffixes()
=== modified file 'openlp/plugins/remotes/lib/httpserver.py'
--- openlp/plugins/remotes/lib/httpserver.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/remotes/lib/httpserver.py 2012-12-20 12:09:36 +0000
@@ -123,8 +123,7 @@
from PyQt4 import QtCore, QtNetwork
from mako.template import Template
-from openlp.core.lib import Receiver, PluginStatus, StringContent
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Receiver, Settings, PluginStatus, StringContent
from openlp.core.utils import AppLocation, translate
log = logging.getLogger(__name__)
@@ -173,11 +172,9 @@
"""
log.debug(u'Start TCP server')
port = Settings().value(
- self.plugin.settingsSection + u'/port',
- QtCore.QVariant(4316)).toInt()[0]
+ self.plugin.settingsSection + u'/port', 4316)
address = Settings().value(
- self.plugin.settingsSection + u'/ip address',
- QtCore.QVariant(u'0.0.0.0')).toString()
+ self.plugin.settingsSection + u'/ip address', u'0.0.0.0')
self.server = QtNetwork.QTcpServer()
self.server.listen(QtNetwork.QHostAddress(address), port)
QtCore.QObject.connect(Receiver.get_receiver(),
@@ -238,7 +235,7 @@
Initialise the http connection. Listen out for socket signals.
"""
log.debug(u'Initialise HttpConnection: %s' %
- socket.peerAddress().toString())
+ socket.peerAddress())
self.socket = socket
self.parent = parent
self.routes = [
@@ -409,14 +406,11 @@
u'slide': self.parent.current_slide or 0,
u'item': self.parent.current_item._uuid \
if self.parent.current_item else u'',
- u'twelve':Settings().value(
- u'remotes/twelve hour', QtCore.QVariant(True)).toBool(),
- u'blank': self.parent.plugin.liveController.blankScreen.\
- isChecked(),
- u'theme': self.parent.plugin.liveController.themeScreen.\
- isChecked(),
- u'display': self.parent.plugin.liveController.desktopScreen.\
- isChecked()
+ u'twelve':Settings().value(u'remotes/twelve hour', True),
+ u'blank': self.parent.plugin.liveController.blankScreen.isChecked(),
+ u'theme': self.parent.plugin.liveController.themeScreen.isChecked(),
+ u'display': \
+ self.parent.plugin.liveController.desktopScreen.isChecked()
}
return HttpResponse(json.dumps({u'results': result}),
{u'Content-Type': u'application/json'})
=== modified file 'openlp/plugins/remotes/lib/remotetab.py'
--- openlp/plugins/remotes/lib/remotetab.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/remotes/lib/remotetab.py 2012-12-20 12:09:36 +0000
@@ -29,8 +29,7 @@
from PyQt4 import QtCore, QtGui, QtNetwork
-from openlp.core.lib import SettingsTab, translate, Receiver
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Settings, SettingsTab, translate, Receiver
ZERO_URL = u'0.0.0.0'
@@ -141,7 +140,7 @@
ip = addr.ip()
if ip.protocol() == 0 and \
ip != QtNetwork.QHostAddress.LocalHost:
- ipAddress = ip.toString()
+ ipAddress = ip
break
else:
ipAddress = self.addressEdit.text()
@@ -152,30 +151,26 @@
def load(self):
self.portSpinBox.setValue(
- Settings().value(self.settingsSection + u'/port',
- QtCore.QVariant(4316)).toInt()[0])
+ Settings().value(self.settingsSection + u'/port', 4316))
self.addressEdit.setText(
- Settings().value(self.settingsSection + u'/ip address',
- QtCore.QVariant(ZERO_URL)).toString())
+ Settings().value(self.settingsSection + u'/ip address', ZERO_URL))
self.twelveHour = Settings().value(
- self.settingsSection + u'/twelve hour',
- QtCore.QVariant(True)).toBool()
+ self.settingsSection + u'/twelve hour', True)
self.twelveHourCheckBox.setChecked(self.twelveHour)
self.setUrls()
def save(self):
changed = False
- if Settings().value(self.settingsSection + u'/ip address',
- QtCore.QVariant(ZERO_URL).toString() != self.addressEdit.text() or
- Settings().value(self.settingsSection + u'/port',
- QtCore.QVariant(4316).toInt()[0]) != self.portSpinBox.value()):
+ if Settings().value(self.settingsSection + u'/ip address', ZERO_URL !=
+ self.addressEdit.text() or Settings().value(self.settingsSection +
+ u'/port', 4316) != self.portSpinBox.value()):
changed = True
Settings().setValue(self.settingsSection + u'/port',
- QtCore.QVariant(self.portSpinBox.value()))
+ self.portSpinBox.value())
Settings().setValue(self.settingsSection + u'/ip address',
- QtCore.QVariant(self.addressEdit.text()))
+ self.addressEdit.text())
Settings().setValue(self.settingsSection + u'/twelve hour',
- QtCore.QVariant(self.twelveHour))
+ self.twelveHour)
if changed:
Receiver.send_message(u'remotes_config_updated')
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2012-12-07 19:00:33 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2012-12-20 12:09:36 +0000
@@ -147,8 +147,7 @@
for author in authors:
row = self.authorsComboBox.count()
self.authorsComboBox.addItem(author.display_name)
- self.authorsComboBox.setItemData(
- row, QtCore.QVariant(author.id))
+ self.authorsComboBox.setItemData(row, author.id)
self.authors.append(author.display_name)
set_case_insensitive_completer(self.authors, self.authorsComboBox)
@@ -168,7 +167,7 @@
row = combo.count()
combo.addItem(object.name)
cache.append(object.name)
- combo.setItemData(row, QtCore.QVariant(object.id))
+ combo.setItemData(row, object.id)
set_case_insensitive_completer(cache, combo)
def loadThemes(self, theme_list):
@@ -278,7 +277,7 @@
verse[0][u'label'] = u'1'
verse_def = u'%s%s' % (verse[0][u'type'], verse[0][u'label'])
item = QtGui.QTableWidgetItem(verse[1])
- item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))
+ item.setData(QtCore.Qt.UserRole, verse_def)
self.verseListWidget.setItem(count, 0, item)
else:
verses = self.song.lyrics.split(u'\n\n')
@@ -288,7 +287,7 @@
item = QtGui.QTableWidgetItem(verse)
verse_def = u'%s%s' % \
(VerseType.Tags[VerseType.Verse], unicode(count + 1))
- item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))
+ item.setData(QtCore.Qt.UserRole, verse_def)
self.verseListWidget.setItem(count, 0, item)
if self.song.verse_order:
# we translate verse order
@@ -310,20 +309,19 @@
self.authorsListView.clear()
for author in self.song.authors:
author_name = QtGui.QListWidgetItem(unicode(author.display_name))
- author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
+ author_name.setData(QtCore.Qt.UserRole, author.id)
self.authorsListView.addItem(author_name)
# clear the results
self.topicsListView.clear()
for topic in self.song.topics:
topic_name = QtGui.QListWidgetItem(unicode(topic.name))
- topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
+ topic_name.setData(QtCore.Qt.UserRole, topic.id)
self.topicsListView.addItem(topic_name)
self.audioListWidget.clear()
for media in self.song.media_files:
media_file = QtGui.QListWidgetItem(
os.path.split(media.file_name)[1])
- media_file.setData(QtCore.Qt.UserRole,
- QtCore.QVariant(media.file_name))
+ media_file.setData(QtCore.Qt.UserRole, media.file_name)
self.audioListWidget.addItem(media_file)
self.titleEdit.setFocus()
# Hide or show the preview button.
@@ -336,7 +334,7 @@
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)
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 +344,7 @@
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:
@@ -372,7 +370,7 @@
else:
return
elif item > 0:
- item_id = (self.authorsComboBox.itemData(item)).toInt()[0]
+ item_id = (self.authorsComboBox.itemData(item))
author = self.manager.get_object(Author, item_id)
if self.authorsListView.findItems(unicode(author.display_name),
QtCore.Qt.MatchExactly):
@@ -394,7 +392,7 @@
Add an author to the author list.
"""
author_item = QtGui.QListWidgetItem(unicode(author.display_name))
- author_item.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
+ author_item.setData(QtCore.Qt.UserRole, author.id)
self.authorsListView.addItem(author_item)
def onAuthorsListViewClicked(self):
@@ -409,7 +407,7 @@
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'),
@@ -420,15 +418,14 @@
topic = Topic.populate(name=text)
self.manager.save_object(topic)
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
- topic_item.setData(QtCore.Qt.UserRole,
- QtCore.QVariant(topic.id))
+ topic_item.setData(QtCore.Qt.UserRole, topic.id)
self.topicsListView.addItem(topic_item)
self.loadTopics()
self.topicsComboBox.setCurrentIndex(0)
else:
return
elif item > 0:
- item_id = (self.topicsComboBox.itemData(item)).toInt()[0]
+ item_id = (self.topicsComboBox.itemData(item))
topic = self.manager.get_object(Topic, item_id)
if self.topicsListView.findItems(unicode(topic.name),
QtCore.Qt.MatchExactly):
@@ -437,8 +434,7 @@
'This topic is already in the list.'))
else:
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
- topic_item.setData(QtCore.Qt.UserRole,
- QtCore.QVariant(topic.id))
+ topic_item.setData(QtCore.Qt.UserRole, topic.id)
self.topicsListView.addItem(topic_item)
self.topicsComboBox.setCurrentIndex(0)
else:
@@ -467,7 +463,7 @@
after_text, verse_tag, verse_num = self.verseForm.getVerse()
verse_def = u'%s%s' % (verse_tag, verse_num)
item = QtGui.QTableWidgetItem(after_text)
- item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))
+ item.setData(QtCore.Qt.UserRole, verse_def)
item.setText(after_text)
self.verseListWidget.setRowCount(
self.verseListWidget.rowCount() + 1)
@@ -481,12 +477,12 @@
item = self.verseListWidget.currentItem()
if item:
temp_text = item.text()
- verse_id = unicode(item.data(QtCore.Qt.UserRole).toString())
+ verse_id = item.data(QtCore.Qt.UserRole)
self.verseForm.setVerse(temp_text, True, verse_id)
if self.verseForm.exec_():
after_text, verse_tag, verse_num = self.verseForm.getVerse()
verse_def = u'%s%s' % (verse_tag, verse_num)
- item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))
+ item.setData(QtCore.Qt.UserRole, verse_def)
item.setText(after_text)
# number of lines has changed, repaint the list moving the data
if len(temp_text.split(u'\n')) != len(after_text.split(u'\n')):
@@ -510,7 +506,7 @@
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)
verse_tag = VerseType.translated_name(field[0])
verse_num = field[1:]
verse_list += u'---[%s:%s]---\n' % (verse_tag, verse_num)
@@ -554,8 +550,7 @@
if parts.endswith(u'\n'):
parts = parts.rstrip(u'\n')
item = QtGui.QTableWidgetItem(parts)
- item.setData(QtCore.Qt.UserRole,
- QtCore.QVariant(verse_def))
+ item.setData(QtCore.Qt.UserRole, verse_def)
self.verseListWidget.setRowCount(
self.verseListWidget.rowCount() + 1)
self.verseListWidget.setItem(
@@ -578,7 +573,7 @@
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)
if verse not in verse_names:
verses.append(verse)
verse_names.append(u'%s%s' % (
@@ -619,7 +614,7 @@
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)
if verse not in verse_names:
verses.append(verse)
verse_names.append(u'%s%s' % (
@@ -630,15 +625,15 @@
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):
@@ -675,7 +670,7 @@
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'),
@@ -701,7 +696,7 @@
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_(True)
@@ -720,7 +715,7 @@
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')
@@ -730,8 +725,7 @@
"""
filters = u'%s (*)' % UiStrings().AllFiles
filenames = QtGui.QFileDialog.getOpenFileNames(self,
- translate('SongsPlugin.EditSongForm', 'Open File(s)'),
- QtCore.QString(), filters)
+ translate('SongsPlugin.EditSongForm', 'Open File(s)'), u'', filters)
for filename in filenames:
item = QtGui.QListWidgetItem(os.path.split(unicode(filename))[1])
item.setData(QtCore.Qt.UserRole, filename)
@@ -829,30 +823,30 @@
# 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:
@@ -861,14 +855,14 @@
self.song.authors = []
for row in xrange(self.authorsListView.count()):
item = self.authorsListView.item(row)
- authorId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ authorId = (item.data(QtCore.Qt.UserRole))
author = self.manager.get_object(Author, authorId)
if author is not None:
self.song.authors.append(author)
self.song.topics = []
for row in xrange(self.topicsListView.count()):
item = self.topicsListView.item(row)
- topicId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ topicId = (item.data(QtCore.Qt.UserRole))
topic = self.manager.get_object(Topic, topicId)
if topic is not None:
self.song.topics.append(topic)
@@ -885,7 +879,7 @@
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)
if not filename.startswith(save_path):
oldfile, filename = filename, os.path.join(save_path,
os.path.split(filename)[1])
@@ -922,11 +916,10 @@
multiple = []
for i in range(self.verseListWidget.rowCount()):
item = self.verseListWidget.item(i, 0)
- verse_id = unicode(item.data(QtCore.Qt.UserRole).toString())
+ verse_id = item.data(QtCore.Qt.UserRole)
verse_tag = verse_id[0]
verse_num = verse_id[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')
=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py 2012-12-05 06:12:07 +0000
+++ openlp/plugins/songs/forms/editverseform.py 2012-12-20 12:09:36 +0000
@@ -98,7 +98,7 @@
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:
@@ -128,7 +128,7 @@
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 \
@@ -182,7 +182,8 @@
def getVerseAll(self):
text = self.verseTextEdit.toPlainText()
- if not text.startsWith(u'---['):
+ if not text.startswith(u'---['):
text = u'---[%s:1]---\n%s' % \
(VerseType.TranslatedNames[VerseType.Verse], text)
return text
+
=== modified file 'openlp/plugins/songs/forms/mediafilesform.py'
--- openlp/plugins/songs/forms/mediafilesform.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songs/forms/mediafilesform.py 2012-12-20 12:09:36 +0000
@@ -54,6 +54,6 @@
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),
self.fileListWidget.selectedItems())
=== modified file 'openlp/plugins/songs/forms/songexportform.py'
--- openlp/plugins/songs/forms/songexportform.py 2012-12-13 18:42:06 +0000
+++ openlp/plugins/songs/forms/songexportform.py 2012-12-20 12:09:36 +0000
@@ -220,8 +220,7 @@
# Add the songs to the list of selected songs.
for item in items:
song = QtGui.QListWidgetItem(item.text())
- song.setData(QtCore.Qt.UserRole,
- QtCore.QVariant(item.data(QtCore.Qt.UserRole).toPyObject()))
+ song.setData(QtCore.Qt.UserRole, item.data(QtCore.Qt.UserRole))
song.setFlags(QtCore.Qt.ItemIsEnabled)
self.selectedListWidget.addItem(song)
return True
@@ -262,7 +261,7 @@
for author in song.authors])
title = u'%s (%s)' % (unicode(song.title), authors)
item = QtGui.QListWidgetItem(title)
- item.setData(QtCore.Qt.UserRole, QtCore.QVariant(song))
+ item.setData(QtCore.Qt.UserRole, song)
item.setFlags(QtCore.Qt.ItemIsSelectable|
QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
item.setCheckState(QtCore.Qt.Unchecked)
@@ -284,11 +283,10 @@
and calls the *do_export* method.
"""
songs = [
- song.data(QtCore.Qt.UserRole).toPyObject()
+ song.data(QtCore.Qt.UserRole)
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 '
@@ -310,8 +308,8 @@
``text``
The text to search for. (unicode string)
"""
- return [item for item in listWidget.findItems(
- QtCore.QString(unicode(text)), QtCore.Qt.MatchContains)
+ return [
+ item for item in listWidget.findItems(text, QtCore.Qt.MatchContains)
]
def onItemActivated(self, item):
@@ -333,11 +331,11 @@
will be hidden, but not unchecked!
``text``
- The text of the *searchLineEdit*. (QString)
+ The text of the *searchLineEdit*.
"""
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)
=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songs/forms/songimportform.py 2012-12-20 12:09:36 +0000
@@ -35,9 +35,8 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Receiver, SettingsManager, translate
+from openlp.core.lib import Receiver, Settings, SettingsManager, translate
from openlp.core.lib.ui import UiStrings, critical_error_message_box
-from openlp.core.lib.settings import Settings
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.plugins.songs.lib.importer import SongFormat, SongFormatSelect
@@ -239,8 +238,7 @@
return True
elif self.currentPage() == self.sourcePage:
format = self.currentFormat
- Settings().setValue(u'songs/last import type',
- format)
+ Settings().setValue(u'songs/last import type', format)
select_mode, class_, error_msg = SongFormat.get(format,
u'selectMode', u'class', u'invalidSourceMsg')
if select_mode == SongFormatSelect.MultipleFiles:
@@ -293,7 +291,7 @@
"""
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):
"""
@@ -346,7 +344,7 @@
self.finishButton.setVisible(False)
self.cancelButton.setVisible(True)
last_import_type = Settings().value(
- u'songs/last import type').toInt()[0]
+ u'songs/last import type')
if last_import_type < 0 or \
last_import_type >= self.formatComboBox.count():
last_import_type = 0
@@ -379,11 +377,11 @@
source_format = self.currentFormat
select_mode = SongFormat.get(source_format, u'selectMode')
if select_mode == SongFormatSelect.SingleFile:
- importer = self.plugin.importSongs(source_format, filename=unicode(
- self.formatWidgets[source_format][u'filepathEdit'].text()))
+ importer = self.plugin.importSongs(source_format, filename=
+ self.formatWidgets[source_format][u'filepathEdit'].text())
elif select_mode == SongFormatSelect.SingleFolder:
- importer = self.plugin.importSongs(source_format, folder=unicode(
- self.formatWidgets[source_format][u'filepathEdit'].text()))
+ importer = self.plugin.importSongs(source_format, folder=
+ self.formatWidgets[source_format][u'filepathEdit'].text())
else:
importer = self.plugin.importSongs(source_format,
filenames=self.getListOfFiles(
=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py 2012-12-20 12:09:36 +0000
@@ -108,7 +108,7 @@
def _getCurrentItemId(self, listWidget):
item = listWidget.currentItem()
if item:
- item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ item_id = (item.data(QtCore.Qt.UserRole))
return item_id
else:
return -1
@@ -141,7 +141,7 @@
else:
author_name = QtGui.QListWidgetItem(
u' '.join([author.first_name, author.last_name]))
- author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
+ author_name.setData(QtCore.Qt.UserRole, author.id)
self.authorsListWidget.addItem(author_name)
def resetTopics(self):
@@ -152,7 +152,7 @@
topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name)
for topic in topics:
topic_name = QtGui.QListWidgetItem(topic.name)
- topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
+ topic_name.setData(QtCore.Qt.UserRole, topic.id)
self.topicsListWidget.addItem(topic_name)
def resetBooks(self):
@@ -164,7 +164,7 @@
for book in books:
book_name = QtGui.QListWidgetItem(u'%s (%s)' % (book.name,
book.publisher))
- book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id))
+ book_name.setData(QtCore.Qt.UserRole, book.id)
self.booksListWidget.addItem(book_name)
def checkAuthor(self, newAuthor, edit=False):
@@ -218,9 +218,9 @@
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()
@@ -235,7 +235,7 @@
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()
@@ -250,8 +250,8 @@
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()
@@ -279,9 +279,9 @@
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()
@@ -291,10 +291,10 @@
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,
@@ -319,7 +319,7 @@
# 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()
@@ -328,9 +328,9 @@
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)
@@ -356,8 +356,8 @@
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()
@@ -366,9 +366,9 @@
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)
=== modified file 'openlp/plugins/songs/lib/__init__.py'
--- openlp/plugins/songs/lib/__init__.py 2012-12-13 18:42:06 +0000
+++ openlp/plugins/songs/lib/__init__.py 2012-12-20 12:09:36 +0000
@@ -160,13 +160,13 @@
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
=== modified file 'openlp/plugins/songs/lib/db.py'
--- openlp/plugins/songs/lib/db.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songs/lib/db.py 2012-12-20 12:09:36 +0000
@@ -72,14 +72,18 @@
self.sort_key = ()
def _try_int(self, s):
- "Convert to integer if possible."
+ """
+ Convert to integer if possible.
+ """
try:
return int(s)
except:
- return QtCore.QString(s.lower())
+ return s.lower()
def _natsort_key(self, s):
- "Used internally to get a tuple by which s is sorted."
+ """
+ Used internally to get a tuple by which s is sorted.
+ """
return map(self._try_int, re.findall(r'(\d+|\D+)', s))
# This decorator tells sqlalchemy to call this method everytime
=== modified file 'openlp/plugins/songs/lib/ewimport.py'
--- openlp/plugins/songs/lib/ewimport.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songs/lib/ewimport.py 2012-12-20 12:09:36 +0000
@@ -165,8 +165,8 @@
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:
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2012-12-13 18:42:06 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2012-12-20 12:09:36 +0000
@@ -37,10 +37,14 @@
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
translate, check_item_selected, PluginStatus, create_separated_list, \
- check_directory_exists, ServiceItemContext
+ check_directory_exists, ServiceItemContext, Settings
from openlp.core.lib.ui import UiStrings, create_widget_action
+<<<<<<< TREE
from openlp.core.lib.settings import Settings
from openlp.core.utils import AppLocation
+=======
+from openlp.core.utils import AppLocation, locale_direct_compare
+>>>>>>> MERGE-SOURCE
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
SongImportForm, SongExportForm
from openlp.plugins.songs.lib import OpenLyrics, SongXML, VerseType, \
@@ -51,6 +55,46 @@
log = logging.getLogger(__name__)
+<<<<<<< TREE
+=======
+def natcmp(a, b):
+ """
+ Natural string comparison which mimics the behaviour of Python's internal
+ cmp function.
+ """
+ log.debug('a: %s; b: %s', a, b)
+ if len(a) <= len(b):
+ for i, key in enumerate(a):
+ if isinstance(key, int) and isinstance(b[i], int):
+ result = cmp(key, b[i])
+ elif isinstance(key, int) and not isinstance(b[i], int):
+ result = locale_direct_compare(str(key), b[i])
+ elif not isinstance(key, int) and isinstance(b[i], int):
+ result = locale_direct_compare(key, str(b[i]))
+ else:
+ result = locale_direct_compare(key, b[i])
+ if result != 0:
+ return result
+ if len(a) == len(b):
+ return 0
+ else:
+ return -1
+ else:
+ for i, key in enumerate(b):
+ if isinstance(a[i], int) and isinstance(key, int):
+ result = cmp(a[i], key)
+ elif isinstance(a[i], int) and not isinstance(key, int):
+ result = locale_direct_compare(str(a[i]), key)
+ elif not isinstance(a[i], int) and isinstance(key, int):
+ result = locale_direct_compare(a[i], str(key))
+ else:
+ result = locale_direct_compare(a[i], key)
+ if result != 0:
+ return result
+ return 1
+
+
+>>>>>>> MERGE-SOURCE
class SongSearch(object):
"""
An enumeration for song search methods.
@@ -135,14 +179,11 @@
def configUpdated(self):
self.searchAsYouType = Settings().value(
- self.settingsSection + u'/search as type',
- QtCore.QVariant(u'False')).toBool()
+ self.settingsSection + u'/search as type', False)
self.updateServiceOnEdit = Settings().value(
- self.settingsSection + u'/update service on edit',
- QtCore.QVariant(u'False')).toBool()
+ self.settingsSection + u'/update service on edit', False)
self.addSongFromService = Settings().value(
- self.settingsSection + u'/add song from service',
- QtCore.QVariant(u'True')).toBool()
+ self.settingsSection + u'/add song from service', True)
def retranslateUi(self):
self.searchTextLabel.setText(u'%s:' % UiStrings().Search)
@@ -172,15 +213,13 @@
UiStrings().Themes, UiStrings().SearchThemes)
])
self.searchTextEdit.setCurrentSearchType(Settings().value(
- u'%s/last search type' % self.settingsSection,
- QtCore.QVariant(SongSearch.Entire)).toInt()[0])
+ u'%s/last search type' % self.settingsSection, SongSearch.Entire))
self.configUpdated()
def onSearchTextButtonClicked(self):
# Save the current search type to the configuration.
Settings().setValue(u'%s/last search type' %
- self.settingsSection,
- QtCore.QVariant(self.searchTextEdit.currentSearchType()))
+ self.settingsSection, self.searchTextEdit.currentSearchType())
# Reload the list considering the new search type.
search_keywords = unicode(self.searchTextEdit.displayText())
search_results = []
@@ -271,7 +310,7 @@
song_detail = u'%s (%s)' % (song_title,
create_separated_list(author_list))
song_name = QtGui.QListWidgetItem(song_detail)
- song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
+ song_name.setData(QtCore.Qt.UserRole, song.id)
self.listView.addItem(song_name)
# Auto-select the item if name has been set
if song.id == self.autoSelectId:
@@ -288,7 +327,7 @@
continue
song_detail = u'%s (%s)' % (author.display_name, song.title)
song_name = QtGui.QListWidgetItem(song_detail)
- song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
+ song_name.setData(QtCore.Qt.UserRole, song.id)
self.listView.addItem(song_name)
def displayResultsBook(self, searchresults, song_number=False):
@@ -306,7 +345,7 @@
song_detail = u'%s - %s (%s)' % (book.name, song.song_number,
song.title)
song_name = QtGui.QListWidgetItem(song_detail)
- song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
+ song_name.setData(QtCore.Qt.UserRole, song.id)
self.listView.addItem(song_name)
def onClearTextButtonClick(self):
@@ -386,7 +425,7 @@
log.debug(u'onEditClick')
if check_item_selected(self.listView, UiStrings().SelectEdit):
self.editItem = self.listView.currentItem()
- item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0]
+ item_id = self.editItem.data(QtCore.Qt.UserRole)
self.editSongForm.loadSong(item_id, False)
self.editSongForm.exec_()
self.autoSelectId = -1
@@ -411,7 +450,7 @@
Receiver.send_message(u'cursor_busy')
self.plugin.formParent.displayProgressBar(len(items))
for item in items:
- item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ item_id = item.data(QtCore.Qt.UserRole)
media_files = self.plugin.manager.get_all_objects(MediaFile,
MediaFile.song_id == item_id)
for media_file in media_files:
@@ -440,7 +479,7 @@
log.debug(u'onCloneClick')
if check_item_selected(self.listView, UiStrings().SelectEdit):
self.editItem = self.listView.currentItem()
- item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0]
+ item_id = self.editItem.data(QtCore.Qt.UserRole)
old_song = self.plugin.manager.get_object(Song, item_id)
song_xml = self.openLyrics.song_to_xml(old_song)
new_song = self.openLyrics.xml_to_song(song_xml)
@@ -515,12 +554,10 @@
service_item.raw_footer.append(song.title)
service_item.raw_footer.append(create_separated_list(author_list))
service_item.raw_footer.append(song.copyright)
- if Settings().value(u'general/ccli number',
- QtCore.QVariant(u'')).toString():
- service_item.raw_footer.append(unicode(
+ if Settings().value(u'general/ccli number', u''):
+ service_item.raw_footer.append(
translate('SongsPlugin.MediaItem', 'CCLI License: ') +
- Settings().value(u'general/ccli number',
- QtCore.QVariant(u'')).toString()))
+ Settings().value(u'general/ccli number', u''))
service_item.audit = [
song.title, author_list, song.copyright, unicode(song.ccli_number)
]
=== modified file 'openlp/plugins/songs/lib/openlyricsexport.py'
--- openlp/plugins/songs/lib/openlyricsexport.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songs/lib/openlyricsexport.py 2012-12-20 12:09:36 +0000
@@ -67,9 +67,8 @@
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,
=== modified file 'openlp/plugins/songs/lib/powersongimport.py'
--- openlp/plugins/songs/lib/powersongimport.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songs/lib/powersongimport.py 2012-12-20 12:09:36 +0000
@@ -101,10 +101,10 @@
else:
self.importSource = u''
if not self.importSource or not isinstance(self.importSource, list):
- self.logError(unicode(translate('SongsPlugin.PowerSongImport',
- 'No songs to import.')),
- unicode(translate('SongsPlugin.PowerSongImport',
- 'No %s files found.')) % PS_string)
+ self.logError(translate('SongsPlugin.PowerSongImport',
+ 'No songs to import.'),
+ translate('SongsPlugin.PowerSongImport',
+ 'No %s files found.') % PS_string)
return
self.importWizard.progressBar.setMaximum(len(self.importSource))
for file in self.importSource:
=== modified file 'openlp/plugins/songs/lib/songimport.py'
--- openlp/plugins/songs/lib/songimport.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songs/lib/songimport.py 2012-12-20 12:09:36 +0000
@@ -109,8 +109,7 @@
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):
"""
=== modified file 'openlp/plugins/songs/lib/songstab.py'
--- openlp/plugins/songs/lib/songstab.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songs/lib/songstab.py 2012-12-20 12:09:36 +0000
@@ -29,8 +29,8 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab, translate
-from openlp.core.lib.settings import Settings
+from openlp.core.lib import Settings, SettingsTab, translate
+
class SongsTab(SettingsTab):
"""
@@ -115,14 +115,10 @@
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
- self.song_search = settings.value(
- u'search as type', QtCore.QVariant(False)).toBool()
- self.tool_bar = settings.value(
- u'display songbar', QtCore.QVariant(True)).toBool()
- self.update_edit = settings.value(
- u'update service on edit', QtCore.QVariant(False)).toBool()
- self.update_load = settings.value(
- u'add song from service', QtCore.QVariant(True)).toBool()
+ self.song_search = settings.value(u'search as type', False)
+ self.tool_bar = settings.value(u'display songbar', True)
+ self.update_edit = settings.value(u'update service on edit', False)
+ self.update_load = settings.value(u'add song from service', True)
self.searchAsTypeCheckBox.setChecked(self.song_search)
self.toolBarActiveCheckBox.setChecked(self.tool_bar)
self.updateOnEditCheckBox.setChecked(self.update_edit)
@@ -132,10 +128,8 @@
def save(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
- settings.setValue(u'search as type', QtCore.QVariant(self.song_search))
- settings.setValue(u'display songbar', QtCore.QVariant(self.tool_bar))
- settings.setValue(u'update service on edit',
- QtCore.QVariant(self.update_edit))
- settings.setValue(u'add song from service',
- QtCore.QVariant(self.update_load))
+ settings.setValue(u'search as type', self.song_search)
+ settings.setValue(u'display songbar', self.tool_bar)
+ settings.setValue(u'update service on edit', self.update_edit)
+ settings.setValue(u'add song from service', self.update_load)
settings.endGroup()
=== modified file 'openlp/plugins/songs/lib/xml.py'
--- openlp/plugins/songs/lib/xml.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songs/lib/xml.py 2012-12-20 12:09:36 +0000
@@ -732,15 +732,15 @@
except AttributeError:
raise OpenLyricsError(OpenLyricsError.LyricsError,
'<lyrics> tag is missing.',
- unicode(translate('OpenLP.OpenLyricsImportError',
- '<lyrics> tag is missing.')))
+ translate('OpenLP.OpenLyricsImportError',
+ '<lyrics> tag is missing.'))
try:
verse_list = lyrics.verse
except AttributeError:
raise OpenLyricsError(OpenLyricsError.VerseError,
'<verse> tag is missing.',
- unicode(translate('OpenLP.OpenLyricsImportError',
- '<verse> tag is missing.')))
+ translate('OpenLP.OpenLyricsImportError',
+ '<verse> tag is missing.'))
# Loop over the "verse" elements.
for verse in verse_list:
text = u''
=== modified file 'openlp/plugins/songs/lib/zionworximport.py'
--- openlp/plugins/songs/lib/zionworximport.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songs/lib/zionworximport.py 2012-12-20 12:09:36 +0000
@@ -89,10 +89,10 @@
try:
records = list(songs_reader)
except csv.Error, e:
- self.logError(unicode(translate('SongsPlugin.ZionWorxImport',
- 'Error reading CSV file.')),
- unicode(translate('SongsPlugin.ZionWorxImport',
- 'Line %d: %s')) % (songs_reader.line_num, e))
+ self.logError(translate('SongsPlugin.ZionWorxImport',
+ 'Error reading CSV file.'),
+ translate('SongsPlugin.ZionWorxImport',
+ 'Line %d: %s') % (songs_reader.line_num, e))
return
num_records = len(records)
log.info(u'%s records found in CSV file' % num_records)
@@ -109,15 +109,15 @@
self.addCopyright(self._decode(record[u'Copyright']))
lyrics = self._decode(record[u'Lyrics'])
except UnicodeDecodeError, e:
- self.logError(unicode(translate(
- 'SongsPlugin.ZionWorxImport', 'Record %d' % index)),
- unicode(translate('SongsPlugin.ZionWorxImport',
- 'Decoding error: %s')) % e)
+ self.logError(translate(
+ 'SongsPlugin.ZionWorxImport', 'Record %d' % index),
+ translate('SongsPlugin.ZionWorxImport',
+ 'Decoding error: %s') % e)
continue
except TypeError, e:
- self.logError(unicode(translate(
+ self.logError(translate(
'SongsPlugin.ZionWorxImport', 'File not valid ZionWorx '
- 'CSV format.')), u'TypeError: %s' % e)
+ 'CSV format.'), u'TypeError: %s' % e)
return
verse = u''
for line in lyrics.splitlines():
@@ -130,8 +130,7 @@
self.addVerse(verse)
title = self.title
if not self.finish():
- self.logError(unicode(translate(
- 'SongsPlugin.ZionWorxImport', 'Record %d')) % index
+ self.logError(translate('SongsPlugin.ZionWorxImport', 'Record %d') % index
+ (u': "' + title + u'"' if title else u''))
def _decode(self, str):
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songs/songsplugin.py 2012-12-20 12:09:36 +0000
@@ -78,10 +78,9 @@
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)
@@ -282,12 +281,9 @@
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):
=== modified file 'openlp/plugins/songusage/forms/songusagedetailform.py'
--- openlp/plugins/songusage/forms/songusagedetailform.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songusage/forms/songusagedetailform.py 2012-12-20 12:09:36 +0000
@@ -33,9 +33,8 @@
from PyQt4 import QtCore, QtGui
from sqlalchemy.sql import and_
-from openlp.core.lib import SettingsManager, translate, Receiver, \
+from openlp.core.lib import Receiver, Settings, SettingsManager, translate, \
check_directory_exists
-from openlp.core.lib.settings import Settings
from openlp.plugins.songusage.lib.db import SongUsageItem
from songusagedetaildialog import Ui_SongUsageDetailDialog
@@ -62,12 +61,10 @@
year = QtCore.QDate().currentDate().year()
if QtCore.QDate().currentDate().month() < 9:
year -= 1
- toDate = Settings().value(
- u'songusage/to date',
- QtCore.QVariant(QtCore.QDate(year, 8, 31))).toDate()
- fromDate = Settings().value(
- u'songusage/from date',
- QtCore.QVariant(QtCore.QDate(year - 1, 9, 1))).toDate()
+ toDate = Settings().value(self.plugin.settingsSection +
+ u'/to date', QtCore.QDate(year, 8, 31))
+ fromDate = Settings().value(self.plugin.settingsSection +
+ u'/from date', QtCore.QDate(year - 1, 9, 1))
self.fromDate.setSelectedDate(fromDate)
self.toDate.setSelectedDate(toDate)
self.fileLineEdit.setText(
@@ -91,25 +88,24 @@
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',
- QtCore.QVariant(self.fromDate.selectedDate()))
- Settings().setValue(u'songusage/to date',
- QtCore.QVariant(self.toDate.selectedDate()))
+ self.fromDate.selectedDate())
+ Settings().setValue(u'songusage/to date', self.toDate.selectedDate())
usage = self.plugin.manager.get_all_objects(
SongUsageItem, and_(
SongUsageItem.usagedate >= self.fromDate.selectedDate().toPyDate(),
@@ -129,9 +125,9 @@
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:
=== modified file 'openlp/plugins/songusage/songusageplugin.py'
--- openlp/plugins/songusage/songusageplugin.py 2012-12-01 07:57:54 +0000
+++ openlp/plugins/songusage/songusageplugin.py 2012-12-20 12:09:36 +0000
@@ -32,11 +32,10 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Plugin, StringContent, Receiver, build_icon, \
- translate
+from openlp.core.lib import build_icon, Plugin, Receiver, Settings, \
+ StringContent, translate
from openlp.core.lib.db import Manager
from openlp.core.lib.ui import create_action
-from openlp.core.lib.settings import Settings
from openlp.core.utils.actions import ActionList
from openlp.plugins.songusage.forms import SongUsageDetailForm, \
SongUsageDeleteForm
@@ -115,8 +114,7 @@
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):
@@ -129,17 +127,16 @@
QtCore.SIGNAL(u'print_service_started'),
self.printSongUsage)
self.songUsageActive = Settings().value(
- self.settingsSection + u'/active',
- QtCore.QVariant(False)).toBool()
+ self.settingsSection + u'/active', False)
# Set the button and checkbox state
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)
@@ -156,11 +153,11 @@
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
@@ -172,7 +169,7 @@
"""
self.songUsageActive = not self.songUsageActive
Settings().setValue(self.settingsSection + u'/active',
- QtCore.QVariant(self.songUsageActive))
+ self.songUsageActive)
self.setButtonState()
def setButtonState(self):
@@ -202,15 +199,13 @@
"""
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
Follow ups