openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #15932
[Merge] lp:~smpettit/openlp/portable into lp:openlp
Stevan Pettit has proposed merging lp:~smpettit/openlp/portable into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #781839 in OpenLP: "make openlp portable"
https://bugs.launchpad.net/openlp/+bug/781839
For more details, see:
https://code.launchpad.net/~smpettit/openlp/portable/+merge/109497
Added code to allow OpenLP to run as a portable app.
MrGamgee developed settings.py which subclasses QtCore.QSettings. This was required because QtCore.QSettings has no method to set a default INI file. The portable app requires the ability to save settings on the removable drive.
As a result of the subclassing, all references to QtCore.QSettings() were changed to Settings() and Import statements were changed accordingly.
The only exception to the above was in the Export/Import settings routines.
This change also requires that any future code accessing settings use Settings()
The portable app conforms to the guidelines set by PortableApps.com and has been reviewed by them.
The portable app makes no changes to the settings of a locally installed copy of OpenLP. No entries are made to the Windows registry.
OpenLP itself is launched using the PortableApp Launcher which is built during the build process and creates OpenLPPortable.exe
If the removable drive contains a portable copy of VLC, it will be accessed by OpenLP (if needed). This is accomplished by the portable app launcher (OpenLPPortable.exe) adding the VLC directory to the PATH.
The portable app launcher takes care of the changing removable drive letters.
Any references to data locations in OpenLP will have to remain "relative".
The portable app is built by adding the -p {portable build directory} parm the the windows build script.
The ability to move the data directory location is disabled if running portable.
Impress does NOT work if installed as a portable app on the removable drive. (This may be a restriction).
--
https://code.launchpad.net/~smpettit/openlp/portable/+merge/109497
Your team OpenLP Core is requested to review the proposed merge of lp:~smpettit/openlp/portable into lp:openlp.
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py 2012-05-23 16:53:04 +0000
+++ openlp/core/__init__.py 2012-06-10 02:02:21 +0000
@@ -41,6 +41,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.ui import UiStrings
from openlp.core.resources import qInitResources
from openlp.core.ui.mainwindow import MainWindow
@@ -113,15 +114,15 @@
# Decide how many screens we have and their size
screens = ScreenList.create(self.desktop())
# First time checks in settings
- has_run_wizard = QtCore.QSettings().value(
+ has_run_wizard = Settings().value(
u'general/has run wizard', QtCore.QVariant(False)).toBool()
if not has_run_wizard:
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
- QtCore.QSettings().setValue(u'general/has run wizard',
+ Settings().setValue(u'general/has run wizard',
QtCore.QVariant(True))
if os.name == u'nt':
self.setStyleSheet(application_stylesheet)
- show_splash = QtCore.QSettings().value(
+ show_splash = Settings().value(
u'general/show splash', QtCore.QVariant(True)).toBool()
if show_splash:
self.splash = SplashScreen()
@@ -141,7 +142,7 @@
self.processEvents()
if not has_run_wizard:
self.mainWindow.firstTime()
- update_check = QtCore.QSettings().value(
+ update_check = Settings().value(
u'general/update check', QtCore.QVariant(True)).toBool()
if update_check:
VersionThread(self.mainWindow).start()
@@ -258,7 +259,28 @@
app = OpenLP(qt_args)
app.setOrganizationName(u'OpenLP')
app.setOrganizationDomain(u'openlp.org')
- app.setApplicationName(u'OpenLP')
+ if options.portable:
+ log.info(u'Running portable')
+ app.setApplicationName(u'OpenLPPortable')
+ Settings.setDefaultFormat(Settings.IniFormat)
+ # Get location OpenLPPortable.ini
+ app_path = AppLocation.get_directory(AppLocation.AppDir)
+ portable_settings_file = os.path.abspath(os.path.join(app_path, u'..',
+ u'..', u'Data', u'OpenLP.ini'))
+ # Make this our settings file
+ log.info(u'INI file: %s' % portable_settings_file)
+ Settings.setFilename(portable_settings_file)
+ portable_settings = Settings()
+ # Set our data path
+ data_path = os.path.abspath(os.path.join(app_path,
+ u'..', u'..', u'Data',))
+ log.info(u'Data path: %s' % data_path)
+ # Point to our data path
+ portable_settings.setValue(u'advanced/data path',data_path)
+ portable_settings.setValue(u'advanced/is portable',True)
+ portable_settings.sync()
+ else:
+ app.setApplicationName(u'OpenLP')
app.setApplicationVersion(get_application_version()[u'version'])
# Instance check
if not options.testing:
@@ -266,7 +288,7 @@
if app.isAlreadyRunning():
sys.exit()
# First time checks in settings
- if not QtCore.QSettings().value(u'general/has run wizard',
+ if not Settings().value(u'general/has run wizard',
QtCore.QVariant(False)).toBool():
if not FirstTimeLanguageForm().exec_():
# if cancel then stop processing
=== modified file 'openlp/core/lib/db.py'
--- openlp/core/lib/db.py 2012-03-12 19:35:29 +0000
+++ openlp/core/lib/db.py 2012-06-10 02:02:21 +0000
@@ -41,6 +41,7 @@
from openlp.core.lib import translate
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__)
@@ -179,7 +180,7 @@
The file name to use for this database. Defaults to None resulting
in the plugin_name being used.
"""
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(plugin_name)
self.db_url = u''
self.is_dirty = False
=== modified file 'openlp/core/lib/formattingtags.py'
--- openlp/core/lib/formattingtags.py 2012-05-05 16:03:40 +0000
+++ openlp/core/lib/formattingtags.py 2012-06-10 02:02:21 +0000
@@ -32,6 +32,7 @@
from PyQt4 import QtCore
from openlp.core.lib import translate
+from openlp.core.lib.settings import Settings
class FormattingTags(object):
@@ -68,7 +69,7 @@
if isinstance(tag[element], unicode):
tag[element] = tag[element].encode('utf8')
# Formatting Tags were also known as display tags.
- QtCore.QSettings().setValue(u'displayTags/html_tags',
+ Settings().setValue(u'displayTags/html_tags',
QtCore.QVariant(cPickle.dumps(tags) if tags else u''))
@staticmethod
@@ -164,7 +165,7 @@
FormattingTags.add_html_tags(temporary_tags)
# Formatting Tags were also known as display tags.
- user_expands = QtCore.QSettings().value(u'displayTags/html_tags',
+ user_expands = Settings().value(u'displayTags/html_tags',
QtCore.QVariant(u'')).toString()
# cPickle only accepts str not unicode strings
user_expands_string = str(user_expands)
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2012-05-01 11:00:02 +0000
+++ openlp/core/lib/mediamanageritem.py 2012-06-10 02:02:21 +0000
@@ -38,6 +38,7 @@
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__)
@@ -462,7 +463,7 @@
"""
Allows the list click action to be determined dynamically
"""
- if QtCore.QSettings().value(u'advanced/double click live',
+ if Settings().value(u'advanced/double click live',
QtCore.QVariant(False)).toBool():
self.onLiveClick()
else:
@@ -472,7 +473,7 @@
"""
Allows the change of current item in the list to be actioned
"""
- if QtCore.QSettings().value(u'advanced/single click preview',
+ if Settings().value(u'advanced/single click preview',
QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed \
and self.listView.selectedIndexes() \
and self.autoSelectId == -1:
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2012-04-22 19:37:11 +0000
+++ openlp/core/lib/plugin.py 2012-06-10 02:02:21 +0000
@@ -32,6 +32,7 @@
from PyQt4 import QtCore
from openlp.core.lib import Receiver
+from openlp.core.lib.settings import Settings
from openlp.core.lib.ui import UiStrings
from openlp.core.utils import get_application_version
@@ -190,7 +191,7 @@
"""
Sets the status of the plugin
"""
- self.status = QtCore.QSettings().value(
+ self.status = Settings().value(
self.settingsSection + u'/status',
QtCore.QVariant(PluginStatus.Inactive)).toInt()[0]
@@ -199,7 +200,7 @@
Changes the status of the plugin and remembers it
"""
self.status = new_status
- QtCore.QSettings().setValue(
+ Settings().setValue(
self.settingsSection + u'/status', QtCore.QVariant(self.status))
if new_status == PluginStatus.Active:
self.initialise()
=== added file 'openlp/core/lib/settings.py'
--- openlp/core/lib/settings.py 1970-01-01 00:00:00 +0000
+++ openlp/core/lib/settings.py 2012-06-10 02:02:21 +0000
@@ -0,0 +1,66 @@
+# -*- 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, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, #
+# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias #
+# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# 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-04-16 07:02:24 +0000
+++ openlp/core/lib/settingsmanager.py 2012-06-10 02:02:21 +0000
@@ -34,6 +34,7 @@
from PyQt4 import QtCore
+from openlp.core.lib.settings import Settings
from openlp.core.utils import AppLocation
class SettingsManager(object):
@@ -58,7 +59,7 @@
name = u'last directory %d' % num
else:
name = u'last directory'
- last_dir = unicode(QtCore.QSettings().value(
+ last_dir = unicode(Settings().value(
section + u'/' + name, QtCore.QVariant(u'')).toString())
return last_dir
@@ -81,7 +82,7 @@
name = u'last directory %d' % num
else:
name = u'last directory'
- QtCore.QSettings().setValue(
+ Settings().setValue(
section + u'/' + name, QtCore.QVariant(directory))
@staticmethod
@@ -98,7 +99,7 @@
``list``
The list of values to save.
"""
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(section)
old_count = settings.value(
u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
@@ -124,7 +125,7 @@
``name``
The name of the list.
"""
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(section)
list_count = settings.value(
u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
=== modified file 'openlp/core/ui/aboutdialog.py'
--- openlp/core/ui/aboutdialog.py 2012-04-02 00:19:16 +0000
+++ openlp/core/ui/aboutdialog.py 2012-06-10 02:02:21 +0000
@@ -25,7 +25,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import UiStrings, create_button, create_button_box
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py 2012-06-09 12:03:47 +0000
+++ openlp/core/ui/advancedtab.py 2012-06-10 02:02:21 +0000
@@ -35,6 +35,7 @@
import os
import sys
from openlp.core.lib import SettingsTab, translate, build_icon, Receiver
+from openlp.core.lib.settings import Settings
from openlp.core.lib.ui import UiStrings
from openlp.core.utils import get_images_filter, AppLocation
from openlp.core.lib import SlideLimits
@@ -450,12 +451,12 @@
"""
Load settings from disk.
"""
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
# 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(QtCore.QSettings().value(
+ 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])
@@ -548,7 +549,7 @@
"""
Save settings to disk.
"""
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
settings.setValue(u'default service enabled',
self.serviceNameCheckBox.isChecked())
=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py 2012-05-26 16:52:34 +0000
+++ openlp/core/ui/firsttimeform.py 2012-06-10 02:02:21 +0000
@@ -39,6 +39,7 @@
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, \
check_directory_exists
+from openlp.core.lib.settings import Settings
from openlp.core.utils import get_web_page, AppLocation
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
@@ -116,7 +117,7 @@
check_directory_exists(os.path.join(gettempdir(), u'openlp'))
self.noInternetFinishButton.setVisible(False)
# Check if this is a re-run of the wizard.
- self.hasRunWizard = QtCore.QSettings().value(
+ self.hasRunWizard = Settings().value(
u'general/has run wizard', QtCore.QVariant(False)).toBool()
# Sort out internet access for downloads
if self.webAccess:
@@ -209,7 +210,7 @@
index = self.themeComboBox.findText(theme)
if index == -1:
self.themeComboBox.addItem(theme)
- default_theme = unicode(QtCore.QSettings().value(
+ default_theme = unicode(Settings().value(
u'themes/global theme',
QtCore.QVariant(u'')).toString())
# Pre-select the current default theme.
@@ -261,7 +262,7 @@
self._performWizard()
Receiver.send_message(u'openlp_process_events')
Receiver.send_message(u'cursor_normal')
- QtCore.QSettings().setValue(u'general/has run wizard',
+ Settings().setValue(u'general/has run wizard',
QtCore.QVariant(True))
self.close()
@@ -460,16 +461,16 @@
os.path.join(themes_destination, theme))
# Set Default Display
if self.displayComboBox.currentIndex() != -1:
- QtCore.QSettings().setValue(u'General/monitor',
+ Settings().setValue(u'General/monitor',
QtCore.QVariant(self.displayComboBox.currentIndex()))
self.screens.set_current_display(
self.displayComboBox.currentIndex())
# Set Global Theme
if self.themeComboBox.currentIndex() != -1:
- QtCore.QSettings().setValue(u'themes/global theme',
+ Settings().setValue(u'themes/global theme',
QtCore.QVariant(self.themeComboBox.currentText()))
def _setPluginStatus(self, field, tag):
status = PluginStatus.Active if field.checkState() \
== QtCore.Qt.Checked else PluginStatus.Inactive
- QtCore.QSettings().setValue(tag, QtCore.QVariant(status))
+ Settings().setValue(tag, QtCore.QVariant(status))
=== modified file 'openlp/core/ui/firsttimelanguagedialog.py'
--- openlp/core/ui/firsttimelanguagedialog.py 2012-04-01 22:44:09 +0000
+++ openlp/core/ui/firsttimelanguagedialog.py 2012-06-10 02:02:21 +0000
@@ -25,7 +25,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import translate
from openlp.core.lib.ui import create_button_box
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2012-05-20 20:56:11 +0000
+++ openlp/core/ui/generaltab.py 2012-06-10 02:02:21 +0000
@@ -30,6 +30,7 @@
from openlp.core.lib import SettingsTab, Receiver, 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__)
@@ -265,7 +266,7 @@
"""
Load the settings to populate the form
"""
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
self.monitorComboBox.clear()
self.monitorComboBox.addItems(self.screens.get_screen_list())
@@ -327,7 +328,7 @@
"""
Save the settings from the form
"""
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
settings.setValue(u'monitor',
QtCore.QVariant(self.monitorComboBox.currentIndex()))
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2012-06-09 15:46:01 +0000
+++ openlp/core/ui/maindisplay.py 2012-06-10 02:02:21 +0000
@@ -38,6 +38,7 @@
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
translate, PluginManager, expand_tags
from openlp.core.lib.theme import BackgroundType
+from openlp.core.lib.settings import Settings
from openlp.core.ui import HideMode, ScreenList, AlertLocation
@@ -132,7 +133,7 @@
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | \
QtCore.Qt.WindowStaysOnTopHint
- if QtCore.QSettings().value(u'advanced/x11 bypass wm',
+ if Settings().value(u'advanced/x11 bypass wm',
QtCore.QVariant(True)).toBool():
windowFlags |= QtCore.Qt.X11BypassWindowManagerHint
# FIXME: QtCore.Qt.SplashScreen is workaround to make display screen
@@ -193,11 +194,11 @@
Display.setup(self)
if self.isLive:
# Build the initial frame.
- image_file = QtCore.QSettings().value(u'advanced/default image',
+ image_file = Settings().value(u'advanced/default image',
QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\
.toString()
background_color = QtGui.QColor()
- background_color.setNamedColor(QtCore.QSettings().value(
+ background_color.setNamedColor(Settings().value(
u'advanced/default color',
QtCore.QVariant(u'#ffffff')).toString())
if not background_color.isValid():
@@ -350,7 +351,7 @@
# Single screen active
if self.screens.display_count == 1:
# Only make visible if setting enabled.
- if QtCore.QSettings().value(u'general/display on monitor',
+ if Settings().value(u'general/display on monitor',
QtCore.QVariant(True)).toBool():
self.setVisible(True)
else:
@@ -399,7 +400,7 @@
self.footer(serviceItem.foot_text)
# if was hidden keep it hidden
if self.hideMode and self.isLive and not serviceItem.is_media():
- if QtCore.QSettings().value(u'general/auto unblank',
+ if Settings().value(u'general/auto unblank',
QtCore.QVariant(False)).toBool():
Receiver.send_message(u'slidecontroller_live_unblank')
else:
@@ -423,7 +424,7 @@
log.debug(u'hideDisplay mode = %d', mode)
if self.screens.display_count == 1:
# Only make visible if setting enabled.
- if not QtCore.QSettings().value(u'general/display on monitor',
+ if not Settings().value(u'general/display on monitor',
QtCore.QVariant(True)).toBool():
return
if mode == HideMode.Screen:
@@ -448,7 +449,7 @@
log.debug(u'showDisplay')
if self.screens.display_count == 1:
# Only make visible if setting enabled.
- if not QtCore.QSettings().value(u'general/display on monitor',
+ if not Settings().value(u'general/display on monitor',
QtCore.QVariant(True)).toBool():
return
self.frame.evaluateJavaScript('show_blank("show");')
@@ -463,7 +464,7 @@
"""
Hide mouse cursor when moved over display.
"""
- if QtCore.QSettings().value(u'advanced/hide mouse',
+ if Settings().value(u'advanced/hide mouse',
QtCore.QVariant(False)).toBool():
self.setCursor(QtCore.Qt.BlankCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2012-06-08 23:19:03 +0000
+++ openlp/core/ui/mainwindow.py 2012-06-10 02:02:21 +0000
@@ -40,6 +40,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.ui import AboutForm, SettingsForm, ServiceManager, \
ThemeManager, SlideController, PluginForm, MediaDockManager, \
@@ -102,12 +103,12 @@
# Create slide controllers
self.previewController = SlideController(self)
self.liveController = SlideController(self, True)
- previewVisible = QtCore.QSettings().value(
+ previewVisible = Settings().value(
u'user interface/preview panel', QtCore.QVariant(True)).toBool()
self.previewController.panel.setVisible(previewVisible)
- liveVisible = QtCore.QSettings().value(u'user interface/live panel',
+ liveVisible = Settings().value(u'user interface/live panel',
QtCore.QVariant(True)).toBool()
- panelLocked = QtCore.QSettings().value(u'user interface/lock panel',
+ panelLocked = Settings().value(u'user interface/lock panel',
QtCore.QVariant(False)).toBool()
self.liveController.panel.setVisible(liveVisible)
# Create menu
@@ -696,9 +697,9 @@
self.previewController.screenSizeChanged()
self.liveController.screenSizeChanged()
log.info(u'Load data from Settings')
- if QtCore.QSettings().value(u'advanced/save current plugin',
+ if Settings().value(u'advanced/save current plugin',
QtCore.QVariant(False)).toBool():
- savedPlugin = QtCore.QSettings().value(
+ savedPlugin = Settings().value(
u'advanced/current media plugin', QtCore.QVariant()).toInt()[0]
if savedPlugin != -1:
self.mediaToolBox.setCurrentIndex(savedPlugin)
@@ -750,11 +751,11 @@
if not isinstance(filename, unicode):
filename = unicode(filename, sys.getfilesystemencoding())
self.serviceManagerContents.loadFile(filename)
- elif QtCore.QSettings().value(
+ elif Settings().value(
self.generalSettingsSection + u'/auto open',
QtCore.QVariant(False)).toBool():
self.serviceManagerContents.loadLastFile()
- view_mode = QtCore.QSettings().value(u'%s/view mode' % \
+ view_mode = Settings().value(u'%s/view mode' % \
self.generalSettingsSection, u'default').toString()
if view_mode == u'default':
self.modeDefaultItem.setChecked(True)
@@ -832,7 +833,7 @@
"""
Check and display message if screen blank on setup.
"""
- settings = QtCore.QSettings()
+ settings = Settings()
self.liveController.mainDisplaySetBackground()
if settings.value(u'%s/screen blank' % self.generalSettingsSection,
QtCore.QVariant(False)).toBool():
@@ -966,9 +967,9 @@
# Add plugin sections.
for plugin in self.pluginManager.plugins:
setting_sections.extend([plugin.name])
- settings = QtCore.QSettings()
- import_settings = QtCore.QSettings(import_file_name,
- QtCore.QSettings.IniFormat)
+ settings = Settings()
+ 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.
@@ -1030,7 +1031,7 @@
'OpenLP Export Settings File (*.conf)')))
if not export_file_name:
return
- # Make sure it's a .conf file.
+ # Make sure it's a .conf file.
if not export_file_name.endswith(u'conf'):
export_file_name = export_file_name + u'.conf'
temp_file = os.path.join(unicode(gettempdir()),
@@ -1053,12 +1054,12 @@
os.remove(temp_file)
if os.path.exists(export_file_name):
os.remove(export_file_name)
- settings = QtCore.QSettings()
+ settings = Settings()
settings.remove(self.headerSection)
# Get the settings.
keys = settings.allKeys()
- export_settings = QtCore.QSettings(temp_file,
- QtCore.QSettings.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()
@@ -1116,7 +1117,7 @@
Set OpenLP to a different view mode.
"""
if mode:
- settings = QtCore.QSettings()
+ settings = Settings()
settings.setValue(u'%s/view mode' % self.generalSettingsSection,
mode)
self.mediaManagerDock.setVisible(media)
@@ -1167,7 +1168,7 @@
else:
event.ignore()
else:
- if QtCore.QSettings().value(u'advanced/enable exit confirmation',
+ if Settings().value(u'advanced/enable exit confirmation',
QtCore.QVariant(True)).toBool():
ret = QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'Close OpenLP'),
@@ -1198,9 +1199,9 @@
# Clean temporary files used by services
self.serviceManagerContents.cleanUp()
if save_settings:
- if QtCore.QSettings().value(u'advanced/save current plugin',
+ if Settings().value(u'advanced/save current plugin',
QtCore.QVariant(False)).toBool():
- QtCore.QSettings().setValue(u'advanced/current media plugin',
+ Settings().setValue(u'advanced/current media plugin',
QtCore.QVariant(self.mediaToolBox.currentIndex()))
# Call the cleanup method to shutdown plugins.
log.info(u'cleanup plugins')
@@ -1284,7 +1285,7 @@
False - Hidden
"""
self.previewController.panel.setVisible(visible)
- QtCore.QSettings().setValue(u'user interface/preview panel',
+ Settings().setValue(u'user interface/preview panel',
QtCore.QVariant(visible))
self.viewPreviewPanel.setChecked(visible)
@@ -1316,7 +1317,7 @@
self.viewThemeManagerItem.setEnabled(True)
self.viewPreviewPanel.setEnabled(True)
self.viewLivePanel.setEnabled(True)
- QtCore.QSettings().setValue(u'user interface/lock panel',
+ Settings().setValue(u'user interface/lock panel',
QtCore.QVariant(lock))
def setLivePanelVisibility(self, visible):
@@ -1330,7 +1331,7 @@
False - Hidden
"""
self.liveController.panel.setVisible(visible)
- QtCore.QSettings().setValue(u'user interface/live panel',
+ Settings().setValue(u'user interface/live panel',
QtCore.QVariant(visible))
self.viewLivePanel.setChecked(visible)
@@ -1340,19 +1341,19 @@
"""
log.debug(u'Loading QSettings')
# Migrate Wrap Settings to Slide Limits Settings
- if QtCore.QSettings().contains(self.generalSettingsSection +
+ if Settings().contains(self.generalSettingsSection +
u'/enable slide loop'):
- if QtCore.QSettings().value(self.generalSettingsSection +
+ if Settings().value(self.generalSettingsSection +
u'/enable slide loop', QtCore.QVariant(True)).toBool():
- QtCore.QSettings().setValue(self.advancedSettingsSection +
+ Settings().setValue(self.advancedSettingsSection +
u'/slide limits', QtCore.QVariant(SlideLimits.Wrap))
else:
- QtCore.QSettings().setValue(self.advancedSettingsSection +
+ Settings().setValue(self.advancedSettingsSection +
u'/slide limits', QtCore.QVariant(SlideLimits.End))
- QtCore.QSettings().remove(self.generalSettingsSection +
+ Settings().remove(self.generalSettingsSection +
u'/enable slide loop')
Receiver.send_message(u'slidecontroller_update_slide_limits')
- settings = QtCore.QSettings()
+ settings = Settings()
# Remove obsolete entries.
settings.remove(u'custom slide')
settings.remove(u'service')
@@ -1381,7 +1382,7 @@
if self.settingsImported:
return
log.debug(u'Saving QSettings')
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.generalSettingsSection)
recentFiles = QtCore.QVariant(self.recentFiles) \
if self.recentFiles else QtCore.QVariant()
@@ -1407,7 +1408,7 @@
Updates the recent file menu with the latest list of service files
accessed.
"""
- recentFileCount = QtCore.QSettings().value(
+ recentFileCount = Settings().value(
u'advanced/recent file count', QtCore.QVariant(4)).toInt()[0]
existingRecentFiles = [recentFile for recentFile in self.recentFiles
if os.path.isfile(unicode(recentFile))]
@@ -1440,7 +1441,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 = QtCore.QSettings().value(u'advanced/max recent files',
+ maxRecentFiles = Settings().value(u'advanced/max recent files',
QtCore.QVariant(20)).toInt()[0]
if filename:
# Add some cleanup to reduce duplication in the recent file list
=== modified file 'openlp/core/ui/media/__init__.py'
--- openlp/core/ui/media/__init__.py 2012-04-28 11:31:42 +0000
+++ openlp/core/ui/media/__init__.py 2012-06-10 02:02:21 +0000
@@ -26,6 +26,8 @@
###############################################################################
import logging
+from openlp.core.lib.settings import Settings
+
from PyQt4 import QtCore
log = logging.getLogger(__name__)
@@ -78,11 +80,11 @@
Here an special media player is chosen for all media actions.
"""
log.debug(u'get_media_players')
- players = unicode(QtCore.QSettings().value(u'media/players').toString())
+ players = unicode(Settings().value(u'media/players').toString())
if not players:
players = u'webkit'
reg_ex = QtCore.QRegExp(".*\[(.*)\].*")
- if QtCore.QSettings().value(u'media/override player',
+ if Settings().value(u'media/override player',
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == QtCore.Qt.Checked:
if reg_ex.exactMatch(players):
overridden_player = u'%s' % reg_ex.cap(1)
@@ -107,10 +109,10 @@
"""
log.debug(u'set_media_players')
players = u','.join(players_list)
- if QtCore.QSettings().value(u'media/override player',
+ if Settings().value(u'media/override player',
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == \
QtCore.Qt.Checked and overridden_player != u'auto':
players = players.replace(overridden_player, u'[%s]' % overridden_player)
- QtCore.QSettings().setValue(u'media/players', QtCore.QVariant(players))
+ Settings().setValue(u'media/players', QtCore.QVariant(players))
from mediacontroller import MediaController
=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py 2012-06-09 15:46:01 +0000
+++ openlp/core/ui/media/mediacontroller.py 2012-06-10 02:02:21 +0000
@@ -30,6 +30,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, Receiver, translate
+from openlp.core.lib.settings import Settings
from openlp.core.lib.mediaplayer import MediaPlayer
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.media import MediaState, MediaInfo, MediaType, \
@@ -333,7 +334,7 @@
"setBackBoard", null, null, null,"visible");')
# now start playing
if controller.isLive and \
- (QtCore.QSettings().value(u'general/auto unblank',
+ (Settings().value(u'general/auto unblank',
QtCore.QVariant(False)).toBool() or \
controller.media_info.is_background) or not controller.isLive:
if not self.video_play([controller]):
=== modified file 'openlp/core/ui/media/vlcplayer.py'
--- openlp/core/ui/media/vlcplayer.py 2012-06-09 15:46:01 +0000
+++ openlp/core/ui/media/vlcplayer.py 2012-06-10 02:02:21 +0000
@@ -34,6 +34,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver
+from openlp.core.lib.settings import Settings
from openlp.core.lib.mediaplayer import MediaPlayer
from openlp.core.ui.media import MediaState
@@ -114,7 +115,7 @@
command_line_options = u'--no-video-title-show'
if not display.hasAudio:
command_line_options += u' --no-audio --no-video-title-show'
- if QtCore.QSettings().value(u'advanced/hide mouse',
+ if Settings().value(u'advanced/hide mouse',
QtCore.QVariant(False)).toBool() and \
display.controller.isLive:
command_line_options += u' --mouse-hide-timeout=0'
=== modified file 'openlp/core/ui/printserviceform.py'
--- openlp/core/ui/printserviceform.py 2012-03-12 22:12:16 +0000
+++ openlp/core/ui/printserviceform.py 2012-06-10 02:02:21 +0000
@@ -33,6 +33,7 @@
from openlp.core.lib import translate, get_text_file_string, Receiver
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
@@ -120,7 +121,7 @@
self.zoom = 0
self.setupUi(self)
# Load the settings for the dialog.
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(u'advanced')
self.slideTextCheckBox.setChecked(settings.value(
u'print slide text', QtCore.QVariant(False)).toBool())
@@ -318,7 +319,7 @@
elif display == ZoomSize.TwentyFive:
self.previewWidget.fitToWidth()
self.previewWidget.zoomIn(0.25)
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(u'advanced')
settings.setValue(u'display size', QtCore.QVariant(display))
settings.endGroup()
@@ -389,7 +390,7 @@
Save the settings and close the dialog.
"""
# Save the settings for this dialog.
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(u'advanced')
settings.setValue(u'print slide text',
QtCore.QVariant(self.slideTextCheckBox.isChecked()))
=== modified file 'openlp/core/ui/screen.py'
--- openlp/core/ui/screen.py 2012-05-20 20:56:11 +0000
+++ openlp/core/ui/screen.py 2012-06-10 02:02:21 +0000
@@ -34,6 +34,7 @@
from PyQt4 import QtCore
from openlp.core.lib import Receiver, translate
+from openlp.core.lib.settings import Settings
log = logging.getLogger(__name__)
@@ -245,7 +246,7 @@
"""
Loads the screen size and the monitor number from the settings.
"""
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(u'general')
self.set_current_display(settings.value(u'monitor',
QtCore.QVariant(self.display_count - 1)).toInt()[0])
=== modified file 'openlp/core/ui/serviceitemeditdialog.py'
--- openlp/core/ui/serviceitemeditdialog.py 2012-04-03 17:58:42 +0000
+++ openlp/core/ui/serviceitemeditdialog.py 2012-06-10 02:02:21 +0000
@@ -25,7 +25,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import translate
from openlp.core.lib.ui import create_button_box, create_button
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2012-06-09 15:46:01 +0000
+++ openlp/core/ui/servicemanager.py 2012-06-10 02:02:21 +0000
@@ -40,6 +40,7 @@
from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \
ItemCapabilities, SettingsManager, translate, str_to_bool
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
@@ -274,7 +275,7 @@
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'service_item_update'), self.serviceItemUpdate)
# Last little bits of setting up
- self.service_theme = unicode(QtCore.QSettings().value(
+ self.service_theme = unicode(Settings().value(
self.mainwindow.serviceManagerSettingsSection + u'/service theme',
QtCore.QVariant(u'')).toString())
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
@@ -352,7 +353,7 @@
self._fileName = unicode(fileName)
self.mainwindow.setServiceModified(self.isModified(),
self.shortFileName())
- QtCore.QSettings(). \
+ Settings(). \
setValue(u'servicemanager/last file',QtCore.QVariant(fileName))
def fileName(self):
@@ -371,7 +372,7 @@
"""
Triggered when Config dialog is updated.
"""
- self.expandTabs = QtCore.QSettings().value(
+ self.expandTabs = Settings().value(
u'advanced/expand service item',
QtCore.QVariant(u'False')).toBool()
@@ -444,7 +445,7 @@
self.setFileName(u'')
self.serviceId += 1
self.setModified(False)
- QtCore.QSettings(). \
+ Settings(). \
setValue(u'servicemanager/last file',QtCore.QVariant(u''))
Receiver.send_message(u'servicemanager_new_service')
@@ -588,17 +589,17 @@
Get a file name and then call :func:`ServiceManager.saveFile` to
save the file.
"""
- default_service_enabled = QtCore.QSettings().value(
+ default_service_enabled = Settings().value(
u'advanced/default service enabled', QtCore.QVariant(True)).toBool()
if default_service_enabled:
- service_day = QtCore.QSettings().value(
+ service_day = Settings().value(
u'advanced/default service day', 7).toInt()[0]
if service_day == 7:
time = datetime.now()
else:
- service_hour = QtCore.QSettings().value(
+ service_hour = Settings().value(
u'advanced/default service hour', 11).toInt()[0]
- service_minute = QtCore.QSettings().value(
+ service_minute = Settings().value(
u'advanced/default service minute', 0).toInt()[0]
now = datetime.now()
day_delta = service_day - now.weekday()
@@ -606,7 +607,7 @@
day_delta += 7
time = now + timedelta(days=day_delta)
time = time.replace(hour=service_hour, minute=service_minute)
- default_pattern = unicode(QtCore.QSettings().value(
+ default_pattern = unicode(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: '
@@ -687,7 +688,7 @@
self.setFileName(fileName)
self.mainwindow.addRecentFile(fileName)
self.setModified(False)
- QtCore.QSettings().setValue(
+ Settings().setValue(
'servicemanager/last file', QtCore.QVariant(fileName))
else:
critical_error_message_box(
@@ -729,7 +730,7 @@
service was last closed. Can be blank if there was no service
present.
"""
- fileName = QtCore.QSettings(). \
+ fileName = Settings(). \
value(u'servicemanager/last file',QtCore.QVariant(u'')).toString()
if fileName:
self.loadFile(fileName)
@@ -1101,7 +1102,7 @@
log.debug(u'onThemeComboBoxSelected')
self.service_theme = unicode(self.themeComboBox.currentText())
self.mainwindow.renderer.set_service_theme(self.service_theme)
- QtCore.QSettings().setValue(
+ Settings().setValue(
self.mainwindow.serviceManagerSettingsSection +
u'/service theme',
QtCore.QVariant(self.service_theme))
@@ -1282,7 +1283,7 @@
if self.serviceItems[item][u'service_item'].is_valid:
self.mainwindow.liveController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], child)
- if QtCore.QSettings().value(
+ if Settings().value(
self.mainwindow.generalSettingsSection + u'/auto preview',
QtCore.QVariant(False)).toBool():
item += 1
=== modified file 'openlp/core/ui/servicenoteform.py'
--- openlp/core/ui/servicenoteform.py 2012-04-01 22:44:09 +0000
+++ openlp/core/ui/servicenoteform.py 2012-06-10 02:02:21 +0000
@@ -25,7 +25,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import translate, SpellTextEdit
from openlp.core.lib.ui import create_button_box
=== modified file 'openlp/core/ui/shortcutlistform.py'
--- openlp/core/ui/shortcutlistform.py 2012-04-29 15:31:56 +0000
+++ openlp/core/ui/shortcutlistform.py 2012-06-10 02:02:21 +0000
@@ -31,6 +31,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver
+from openlp.core.lib.settings import Settings
from openlp.core.utils import translate
from openlp.core.utils.actions import ActionList
from shortcutlistdialog import Ui_ShortcutListDialog
@@ -337,7 +338,7 @@
Save the shortcuts. **Note**, that we do not have to load the shortcuts,
as they are loaded in :class:`~openlp.core.utils.ActionList`.
"""
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(u'shortcuts')
for category in self.action_list.categories:
# Check if the category is for internal use only.
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2012-06-04 10:47:36 +0000
+++ openlp/core/ui/slidecontroller.py 2012-06-10 02:02:21 +0000
@@ -35,6 +35,7 @@
from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
translate, build_icon, build_html, PluginManager, ServiceItem
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
from openlp.core.utils.actions import ActionList, CategoryOrder
@@ -237,7 +238,7 @@
text=UiStrings().PlaySlidesToEnd,
icon=u':/media/media_time.png', checked=False, shortcuts=[],
category=self.category, triggers=self.onPlaySlidesOnce)
- if QtCore.QSettings().value(self.parent().generalSettingsSection +
+ if Settings().value(self.parent().generalSettingsSection +
u'/enable slide loop', QtCore.QVariant(True)).toBool():
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
else:
@@ -662,7 +663,7 @@
"""
Updates the Slide Limits variable from the settings.
"""
- self.slide_limits = QtCore.QSettings().value(
+ self.slide_limits = Settings().value(
self.parent().advancedSettingsSection + u'/slide limits',
QtCore.QVariant(SlideLimits.End)).toInt()[0]
@@ -692,7 +693,7 @@
self.playSlidesLoop.setChecked(False)
self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
if item.is_text():
- if QtCore.QSettings().value(
+ if Settings().value(
self.parent().songsSettingsSection + u'/display songbar',
QtCore.QVariant(True)).toBool() and self.slideList:
self.songMenu.show()
@@ -813,11 +814,11 @@
QtCore.QObject.connect(action,
QtCore.SIGNAL(u'triggered(bool)'),
self.onTrackTriggered)
- self.display.audioPlayer.repeat = QtCore.QSettings().value(
+ self.display.audioPlayer.repeat = Settings().value(
self.parent().generalSettingsSection + \
u'/audio repeat list',
QtCore.QVariant(False)).toBool()
- if QtCore.QSettings().value(
+ if Settings().value(
self.parent().generalSettingsSection + \
u'/audio start paused',
QtCore.QVariant(True)).toBool():
@@ -930,7 +931,7 @@
Allow the main display to blank the main display at startup time
"""
log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
- display_type = QtCore.QSettings().value(
+ display_type = Settings().value(
self.parent().generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'')).toString()
if self.screens.which_screen(self.window()) != \
@@ -971,11 +972,11 @@
self.themeScreen.setChecked(False)
self.desktopScreen.setChecked(False)
if checked:
- QtCore.QSettings().setValue(
+ Settings().setValue(
self.parent().generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'blanked'))
else:
- QtCore.QSettings().remove(
+ Settings().remove(
self.parent().generalSettingsSection + u'/screen blank')
self.blankPlugin()
self.updatePreview()
@@ -992,11 +993,11 @@
self.themeScreen.setChecked(checked)
self.desktopScreen.setChecked(False)
if checked:
- QtCore.QSettings().setValue(
+ Settings().setValue(
self.parent().generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'themed'))
else:
- QtCore.QSettings().remove(
+ Settings().remove(
self.parent().generalSettingsSection + u'/screen blank')
self.blankPlugin()
self.updatePreview()
@@ -1013,11 +1014,11 @@
self.themeScreen.setChecked(False)
self.desktopScreen.setChecked(checked)
if checked:
- QtCore.QSettings().setValue(
+ Settings().setValue(
self.parent().generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'hidden'))
else:
- QtCore.QSettings().remove(
+ Settings().remove(
self.parent().generalSettingsSection + u'/screen blank')
self.hidePlugin(checked)
self.updatePreview()
@@ -1311,7 +1312,7 @@
"""
triggered by clicking the Preview slide items
"""
- if QtCore.QSettings().value(u'advanced/double click live',
+ if Settings().value(u'advanced/double click live',
QtCore.QVariant(False)).toBool():
# Live and Preview have issues if we have video or presentations
# playing in both at the same time.
=== modified file 'openlp/core/ui/themelayoutdialog.py'
--- openlp/core/ui/themelayoutdialog.py 2012-04-01 22:44:09 +0000
+++ openlp/core/ui/themelayoutdialog.py 2012-06-10 02:02:21 +0000
@@ -25,7 +25,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import translate
from openlp.core.lib.ui import create_button_box
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2012-06-04 10:47:36 +0000
+++ openlp/core/ui/thememanager.py 2012-06-10 02:02:21 +0000
@@ -40,6 +40,7 @@
check_directory_exists, create_thumb, validate_thumb
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
@@ -164,7 +165,7 @@
"""
Triggered when Config dialog is updated.
"""
- self.global_theme = unicode(QtCore.QSettings().value(
+ self.global_theme = unicode(Settings().value(
self.settingsSection + u'/global theme',
QtCore.QVariant(u'')).toString())
@@ -244,7 +245,7 @@
name = unicode(translate('OpenLP.ThemeManager',
'%s (default)')) % self.global_theme
self.themeListWidget.item(count).setText(name)
- QtCore.QSettings().setValue(
+ Settings().setValue(
self.settingsSection + u'/global theme',
QtCore.QVariant(self.global_theme))
Receiver.send_message(u'theme_update_global', self.global_theme)
@@ -451,7 +452,7 @@
theme = ThemeXML()
theme.theme_name = UiStrings().Default
self._writeTheme(theme, None, None)
- QtCore.QSettings().setValue(
+ Settings().setValue(
self.settingsSection + u'/global theme',
QtCore.QVariant(theme.theme_name))
self.configUpdated()
@@ -770,7 +771,7 @@
Check to see if theme has been selected and the destructive action
is allowed.
"""
- self.global_theme = unicode(QtCore.QSettings().value(
+ self.global_theme = unicode(Settings().value(
self.settingsSection + u'/global theme',
QtCore.QVariant(u'')).toString())
if check_item_selected(self.themeListWidget, select_text):
=== modified file 'openlp/core/ui/themestab.py'
--- openlp/core/ui/themestab.py 2012-05-20 18:26:24 +0000
+++ openlp/core/ui/themestab.py 2012-06-10 02:02:21 +0000
@@ -30,6 +30,7 @@
from openlp.core.lib import SettingsTab, Receiver, 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):
"""
@@ -132,7 +133,7 @@
'any themes associated with either the service or the songs.'))
def load(self):
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
self.theme_level = settings.value(
u'theme level', ThemeLevel.Song).toInt()[0]
@@ -146,7 +147,7 @@
self.SongLevelRadioButton.setChecked(True)
def save(self):
- settings = QtCore.QSettings()
+ 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))
@@ -183,7 +184,7 @@
[u'Bible Theme', u'Song Theme']
"""
# Reload as may have been triggered by the ThemeManager.
- self.global_theme = unicode(QtCore.QSettings().value(
+ self.global_theme = unicode(Settings().value(
self.settingsSection + u'/global theme',
QtCore.QVariant(u'')).toString())
self.DefaultComboBox.clear()
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py 2012-06-08 23:19:03 +0000
+++ openlp/core/utils/__init__.py 2012-06-10 02:02:21 +0000
@@ -36,6 +36,8 @@
import sys
import urllib2
+from openlp.core.lib.settings import Settings
+
from PyQt4 import QtGui, QtCore
if sys.platform != u'win32' and sys.platform != u'darwin':
@@ -127,8 +129,8 @@
Return the path OpenLP stores all its data under.
"""
# Check if we have a different data location.
- if QtCore.QSettings().contains(u'advanced/data path'):
- path = unicode(QtCore.QSettings().value(
+ if Settings().contains(u'advanced/data path'):
+ path = unicode(Settings().value(
u'advanced/data path').toString())
else:
path = AppLocation.get_directory(AppLocation.DataDir)
@@ -285,7 +287,7 @@
"""
version_string = current_version[u'full']
# set to prod in the distribution config file.
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(u'general')
last_test = unicode(settings.value(u'last version test',
QtCore.QVariant(datetime.now().date())).toString())
=== modified file 'openlp/core/utils/actions.py'
--- openlp/core/utils/actions.py 2012-04-29 15:31:56 +0000
+++ openlp/core/utils/actions.py 2012-06-10 02:02:21 +0000
@@ -30,6 +30,8 @@
"""
from PyQt4 import QtCore, QtGui
+from openlp.core.lib.settings import Settings
+
class ActionCategory(object):
"""
The :class:`~openlp.core.utils.ActionCategory` class encapsulates a
@@ -226,7 +228,7 @@
else:
self.categories[category].actions.add(action, weight)
# Load the shortcut from the config.
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(u'shortcuts')
shortcuts = settings.value(action.objectName(),
QtCore.QVariant(action.shortcuts())).toStringList()
=== modified file 'openlp/core/utils/languagemanager.py'
--- openlp/core/utils/languagemanager.py 2011-12-27 10:33:55 +0000
+++ openlp/core/utils/languagemanager.py 2012-06-10 02:02:21 +0000
@@ -35,6 +35,7 @@
from openlp.core.utils import AppLocation
from openlp.core.lib import translate
+from openlp.core.lib.settings import Settings
log = logging.getLogger(__name__)
@@ -101,7 +102,7 @@
"""
Retrieve a saved language to use from settings
"""
- settings = QtCore.QSettings()
+ settings = Settings()
language = unicode(settings.value(
u'general/language', QtCore.QVariant(u'[en]')).toString())
log.info(u'Language file: \'%s\' Loaded from conf file' % language)
@@ -133,7 +134,7 @@
language = unicode(qm_list[action_name])
if LanguageManager.auto_language:
language = u'[%s]' % language
- QtCore.QSettings().setValue(
+ Settings().setValue(
u'general/language', QtCore.QVariant(language))
log.info(u'Language file: \'%s\' written to conf file' % language)
if message:
=== modified file 'openlp/plugins/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py 2012-04-22 19:37:11 +0000
+++ openlp/plugins/alerts/alertsplugin.py 2012-06-10 02:02:21 +0000
@@ -32,6 +32,7 @@
from openlp.core.lib import Plugin, StringContent, build_icon, translate
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
@@ -160,7 +161,7 @@
def toggleAlertsState(self):
self.alertsActive = not self.alertsActive
- QtCore.QSettings().setValue(self.settingsSection + u'/active',
+ Settings().setValue(self.settingsSection + u'/active',
QtCore.QVariant(self.alertsActive))
def onAlertsTrigger(self):
=== modified file 'openlp/plugins/alerts/forms/alertdialog.py'
--- openlp/plugins/alerts/forms/alertdialog.py 2012-04-02 00:19:16 +0000
+++ openlp/plugins/alerts/forms/alertdialog.py 2012-06-10 02:02:21 +0000
@@ -25,7 +25,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import create_button, create_button_box
=== modified file 'openlp/plugins/alerts/lib/alertstab.py'
--- openlp/plugins/alerts/lib/alertstab.py 2012-04-02 00:19:16 +0000
+++ openlp/plugins/alerts/lib/alertstab.py 2012-06-10 02:02:21 +0000
@@ -30,6 +30,7 @@
from openlp.core.lib import SettingsTab, translate, Receiver
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):
"""
@@ -152,7 +153,7 @@
self.updateDisplay()
def load(self):
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
self.timeout = settings.value(u'timeout', QtCore.QVariant(5)).toInt()[0]
self.font_color = unicode(settings.value(
@@ -180,7 +181,7 @@
self.changed = False
def save(self):
- settings = QtCore.QSettings()
+ 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] != \
=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py 2012-04-29 15:31:56 +0000
+++ openlp/plugins/bibles/bibleplugin.py 2012-06-10 02:02:21 +0000
@@ -31,6 +31,7 @@
from openlp.core.lib import Plugin, StringContent, build_icon, translate
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
@@ -91,7 +92,7 @@
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No)) == QtGui.QMessageBox.Yes:
self.onToolsUpgradeItemTriggered()
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
if settings.contains(u'bookname language'):
settings.setValue(u'book name language', settings.value(
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py 2012-04-12 14:16:12 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py 2012-06-10 02:02:21 +0000
@@ -36,6 +36,7 @@
from openlp.core.lib import Receiver, translate
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
from openlp.plugins.bibles.lib.manager import BibleFormat
@@ -590,7 +591,7 @@
"""
Set default values for the wizard pages.
"""
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.plugin.settingsSection)
self.restart()
self.finishButton.setVisible(False)
=== modified file 'openlp/plugins/bibles/forms/bibleupgradeform.py'
--- openlp/plugins/bibles/forms/bibleupgradeform.py 2012-04-29 15:31:56 +0000
+++ openlp/plugins/bibles/forms/bibleupgradeform.py 2012-06-10 02:02:21 +0000
@@ -36,6 +36,7 @@
from openlp.core.lib import Receiver, SettingsManager, translate, \
check_directory_exists
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
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, \
@@ -341,7 +342,7 @@
Set default values for the wizard pages.
"""
log.debug(u'BibleUpgrade setDefaults')
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.plugin.settingsSection)
self.stop_import_flag = False
self.success.clear()
=== modified file 'openlp/plugins/bibles/forms/languagedialog.py'
--- openlp/plugins/bibles/forms/languagedialog.py 2012-04-04 07:26:51 +0000
+++ openlp/plugins/bibles/forms/languagedialog.py 2012-06-10 02:02:21 +0000
@@ -24,7 +24,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import translate
from openlp.core.lib.ui import create_button_box
=== modified file 'openlp/plugins/bibles/lib/__init__.py'
--- openlp/plugins/bibles/lib/__init__.py 2012-04-29 15:31:56 +0000
+++ openlp/plugins/bibles/lib/__init__.py 2012-06-10 02:02:21 +0000
@@ -31,9 +31,8 @@
import logging
import re
-from PyQt4 import QtCore
-
from openlp.core.lib import translate
+from openlp.core.lib.settings import Settings
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
log = logging.getLogger(__name__)
@@ -185,7 +184,7 @@
':|v|V|verse|verses;;-|to;;,|and;;end',
'Double-semicolon delimited separators for parsing references. '
'Consult the developers for further information.')).split(u';;')
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(u'bibles')
custom_separators = [
unicode(settings.value(u'verse separator').toString()),
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2012-04-21 22:29:08 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2012-06-10 02:02:21 +0000
@@ -31,6 +31,7 @@
from openlp.core.lib import Receiver, SettingsTab, translate
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
@@ -414,7 +415,7 @@
self.getGreyTextPalette(True))
def load(self):
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
self.show_new_chapters = settings.value(
u'display new chapter', QtCore.QVariant(False)).toBool()
@@ -488,7 +489,7 @@
settings.endGroup()
def save(self):
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
settings.setValue(u'display new chapter',
QtCore.QVariant(self.show_new_chapters))
=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py 2012-05-15 21:06:09 +0000
+++ openlp/plugins/bibles/lib/manager.py 2012-06-10 02:02:21 +0000
@@ -32,6 +32,7 @@
from openlp.core.lib import Receiver, SettingsManager, translate
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
@@ -126,7 +127,7 @@
self.db_cache = None
self.path = AppLocation.get_section_data_path(self.settingsSection)
self.proxy_name = unicode(
- QtCore.QSettings().value(self.settingsSection + u'/proxy name',
+ Settings().value(self.settingsSection + u'/proxy name',
QtCore.QVariant(u'')).toString())
self.suffix = u'.sqlite'
self.import_wizard = None
@@ -378,7 +379,7 @@
except (ValueError, TypeError):
language_selection = LanguageSelection.Application
if language_selection is None or language_selection == -1:
- language_selection = QtCore.QSettings().value(
+ language_selection = Settings().value(
self.settingsSection + u'/bookname language',
QtCore.QVariant(0)).toInt()[0]
return language_selection
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2012-05-16 16:42:33 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2012-06-10 02:02:21 +0000
@@ -33,6 +33,7 @@
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
translate, create_separated_list
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
@@ -294,7 +295,7 @@
def configUpdated(self):
log.debug(u'configUpdated')
- if QtCore.QSettings().value(self.settingsSection + u'/second bibles',
+ if Settings().value(self.settingsSection + u'/second bibles',
QtCore.QVariant(True)).toBool():
self.advancedSecondLabel.setVisible(True)
self.advancedSecondComboBox.setVisible(True)
@@ -362,7 +363,7 @@
translate('BiblesPlugin.MediaItem', 'Text Search'),
translate('BiblesPlugin.MediaItem', 'Search Text...'))
])
- self.quickSearchEdit.setCurrentSearchType(QtCore.QSettings().value(
+ self.quickSearchEdit.setCurrentSearchType(Settings().value(
u'%s/last search type' % self.settingsSection,
QtCore.QVariant(BibleSearch.Reference)).toInt()[0])
self.configUpdated()
@@ -386,7 +387,7 @@
self.advancedVersionComboBox.addItems(bibles)
self.advancedSecondComboBox.addItems(bibles)
# set the default value
- bible = QtCore.QSettings().value(
+ bible = Settings().value(
self.settingsSection + u'/advanced bible',
QtCore.QVariant(u'')).toString()
if bible in bibles:
@@ -394,7 +395,7 @@
self.initialiseAdvancedBible(unicode(bible))
elif bibles:
self.initialiseAdvancedBible(bibles[0])
- bible = QtCore.QSettings().value(
+ bible = Settings().value(
self.settingsSection + u'/quick bible', QtCore.QVariant(
self.quickVersionComboBox.currentText())).toString()
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
@@ -497,11 +498,11 @@
"""
log.debug(u'updateAutoCompleter')
# Save the current search type to the configuration.
- QtCore.QSettings().setValue(u'%s/last search type' %
+ Settings().setValue(u'%s/last search type' %
self.settingsSection,
QtCore.QVariant(self.quickSearchEdit.currentSearchType()))
# Save the current bible to the configuration.
- QtCore.QSettings().setValue(self.settingsSection + u'/quick bible',
+ Settings().setValue(self.settingsSection + u'/quick bible',
QtCore.QVariant(self.quickVersionComboBox.currentText()))
books = []
# We have to do a 'Reference Search'.
@@ -596,7 +597,7 @@
self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style)
self.settings.layoutStyleComboBox.setCurrentIndex(
self.settings.layout_style)
- QtCore.QSettings().setValue(
+ Settings().setValue(
self.settingsSection + u'/verse layout style',
QtCore.QVariant(self.settings.layout_style))
@@ -605,12 +606,12 @@
self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style)
self.settings.layoutStyleComboBox.setCurrentIndex(
self.settings.layout_style)
- QtCore.QSettings().setValue(
+ Settings().setValue(
self.settingsSection + u'/verse layout style',
QtCore.QVariant(self.settings.layout_style))
def onAdvancedVersionComboBox(self):
- QtCore.QSettings().setValue(self.settingsSection + u'/advanced bible',
+ Settings().setValue(self.settingsSection + u'/advanced bible',
QtCore.QVariant(self.advancedVersionComboBox.currentText()))
self.initialiseAdvancedBible(
unicode(self.advancedVersionComboBox.currentText()),
=== modified file 'openlp/plugins/custom/forms/editcustomdialog.py'
--- openlp/plugins/custom/forms/editcustomdialog.py 2012-04-01 22:44:09 +0000
+++ openlp/plugins/custom/forms/editcustomdialog.py 2012-06-10 02:02:21 +0000
@@ -25,7 +25,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import UiStrings, create_button_box, create_button
=== modified file 'openlp/plugins/custom/forms/editcustomslidedialog.py'
--- openlp/plugins/custom/forms/editcustomslidedialog.py 2012-04-02 00:19:16 +0000
+++ openlp/plugins/custom/forms/editcustomslidedialog.py 2012-06-10 02:02:21 +0000
@@ -25,7 +25,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import translate, SpellTextEdit, build_icon
from openlp.core.lib.ui import UiStrings, create_button, create_button_box
=== modified file 'openlp/plugins/custom/lib/customtab.py'
--- openlp/plugins/custom/lib/customtab.py 2011-12-27 10:33:55 +0000
+++ openlp/plugins/custom/lib/customtab.py 2012-06-10 02:02:21 +0000
@@ -28,6 +28,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate
+from openlp.core.lib.settings import Settings
class CustomTab(SettingsTab):
"""
@@ -66,11 +67,11 @@
self.displayFooter = True
def load(self):
- self.displayFooter = QtCore.QSettings().value(
+ self.displayFooter = Settings().value(
self.settingsSection + u'/display footer',
QtCore.QVariant(True)).toBool()
self.displayFooterCheckBox.setChecked(self.displayFooter)
def save(self):
- QtCore.QSettings().setValue(self.settingsSection + u'/display footer',
+ Settings().setValue(self.settingsSection + u'/display footer',
QtCore.QVariant(self.displayFooter))
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2012-06-08 13:27:40 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2012-06-10 02:02:21 +0000
@@ -34,6 +34,7 @@
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
check_item_selected, translate
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
@@ -99,7 +100,7 @@
])
self.loadList(self.manager.get_all_objects(
CustomSlide, order_by_ref=CustomSlide.title))
- self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value(
+ self.searchTextEdit.setCurrentSearchType(Settings().value(
u'%s/last search type' % self.settingsSection,
QtCore.QVariant(CustomSearch.Titles)).toInt()[0])
@@ -215,7 +216,7 @@
service_item.title = title
for slide in raw_slides:
service_item.add_from_text(slide[:30], slide)
- if QtCore.QSettings().value(self.settingsSection + u'/display footer',
+ if Settings().value(self.settingsSection + u'/display footer',
QtCore.QVariant(True)).toBool() or credit:
service_item.raw_footer.append(u' '.join([title, credit]))
else:
@@ -224,7 +225,7 @@
def onSearchTextButtonClicked(self):
# Save the current search type to the configuration.
- QtCore.QSettings().setValue(u'%s/last search type' %
+ Settings().setValue(u'%s/last search type' %
self.settingsSection,
QtCore.QVariant(self.searchTextEdit.currentSearchType()))
# Reload the list considering the new search type.
=== modified file 'openlp/plugins/images/imageplugin.py'
--- openlp/plugins/images/imageplugin.py 2012-06-04 10:22:47 +0000
+++ openlp/plugins/images/imageplugin.py 2012-06-10 02:02:21 +0000
@@ -31,6 +31,7 @@
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
Receiver
+from openlp.core.lib.settings import Settings
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
log = logging.getLogger(__name__)
@@ -94,6 +95,6 @@
image manager to require updates. Actual update is triggered by the
last part of saving the config.
"""
- background = QtGui.QColor(QtCore.QSettings().value(self.settingsSection
+ background = QtGui.QColor(Settings().value(self.settingsSection
+ u'/background color', QtCore.QVariant(u'#000000')))
self.liveController.imageManager.updateImages(u'image', background)
=== modified file 'openlp/plugins/images/lib/imagetab.py'
--- openlp/plugins/images/lib/imagetab.py 2012-04-03 17:59:34 +0000
+++ openlp/plugins/images/lib/imagetab.py 2012-06-10 02:02:21 +0000
@@ -28,6 +28,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate, Receiver
+from openlp.core.lib.settings import Settings
class ImageTab(SettingsTab):
"""
@@ -82,7 +83,7 @@
u'background-color: %s' % self.bg_color)
def load(self):
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
self.bg_color = unicode(settings.value(
u'background color', QtCore.QVariant(u'#000000')).toString())
@@ -92,7 +93,7 @@
u'background-color: %s' % self.bg_color)
def save(self):
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
settings.endGroup()
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2012-04-21 22:29:08 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2012-06-10 02:02:21 +0000
@@ -35,6 +35,7 @@
SettingsManager, translate, check_item_selected, check_directory_exists, \
Receiver, create_thumb, validate_thumb
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, get_images_filter
log = logging.getLogger(__name__)
@@ -151,7 +152,7 @@
def generateSlideData(self, service_item, item=None, xmlVersion=False,
remote=False):
- background = QtGui.QColor(QtCore.QSettings().value(self.settingsSection
+ background = QtGui.QColor(Settings().value(self.settingsSection
+ u'/background color', QtCore.QVariant(u'#000000')))
if item:
items = [item]
@@ -220,7 +221,7 @@
if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem',
'You must select an image to replace the background with.')):
- background = QtGui.QColor(QtCore.QSettings().value(
+ background = QtGui.QColor(Settings().value(
self.settingsSection + u'/background color',
QtCore.QVariant(u'#000000')))
item = self.listView.selectedIndexes()[0]
=== modified file 'openlp/plugins/media/lib/mediatab.py'
--- openlp/plugins/media/lib/mediatab.py 2012-04-01 21:19:56 +0000
+++ openlp/plugins/media/lib/mediatab.py 2012-06-10 02:02:21 +0000
@@ -29,6 +29,7 @@
from openlp.core.lib import SettingsTab, translate, Receiver
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):
"""
@@ -186,7 +187,7 @@
else:
checkbox.setChecked(False)
self.updatePlayerList()
- self.overridePlayerCheckBox.setChecked(QtCore.QSettings().value(
+ self.overridePlayerCheckBox.setChecked(Settings().value(
self.settingsSection + u'/override player',
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
@@ -200,9 +201,9 @@
player_string_changed = True
override_changed = True
setting_key = self.settingsSection + u'/override player'
- if QtCore.QSettings().value(setting_key).toInt()[0] != \
+ if Settings().value(setting_key).toInt()[0] != \
self.overridePlayerCheckBox.checkState():
- QtCore.QSettings().setValue(setting_key,
+ Settings().setValue(setting_key,
QtCore.QVariant(self.overridePlayerCheckBox.checkState()))
override_changed = True
if override_changed:
=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py 2012-04-22 19:37:11 +0000
+++ openlp/plugins/media/mediaplugin.py 2012-06-10 02:02:21 +0000
@@ -30,6 +30,7 @@
from PyQt4 import QtCore
from openlp.core.lib import Plugin, StringContent, build_icon, translate
+from openlp.core.lib.settings import Settings
from openlp.plugins.media.lib import MediaMediaItem, MediaTab
log = logging.getLogger(__name__)
@@ -126,7 +127,7 @@
we want to check if we have the old "Use Phonon" setting, and convert
it to "enable Phonon" and "make it the first one in the list".
"""
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
if settings.contains(u'use phonon'):
log.info(u'Found old Phonon setting')
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2012-04-22 19:37:11 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2012-06-10 02:02:21 +0000
@@ -36,6 +36,7 @@
validate_thumb
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.plugins.presentations.lib import MessageListener
log = logging.getLogger(__name__)
@@ -149,7 +150,7 @@
if self.displayTypeComboBox.count() > 1:
self.displayTypeComboBox.insertItem(0, self.Automatic)
self.displayTypeComboBox.setCurrentIndex(0)
- if QtCore.QSettings().value(self.settingsSection + u'/override app',
+ if Settings().value(self.settingsSection + u'/override app',
QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
self.presentationWidget.show()
else:
=== modified file 'openlp/plugins/presentations/lib/presentationcontroller.py'
--- openlp/plugins/presentations/lib/presentationcontroller.py 2011-12-27 10:33:55 +0000
+++ openlp/plugins/presentations/lib/presentationcontroller.py 2012-06-10 02:02:21 +0000
@@ -33,6 +33,7 @@
from openlp.core.lib import Receiver, check_directory_exists, create_thumb, \
validate_thumb
+from openlp.core.lib.settings import Settings
from openlp.core.utils import AppLocation
log = logging.getLogger(__name__)
@@ -392,7 +393,7 @@
"""
Return whether the controller is currently enabled
"""
- if QtCore.QSettings().value(
+ if Settings().value(
self.settings_section + u'/' + self.name,
QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0] == \
QtCore.Qt.Checked:
=== modified file 'openlp/plugins/presentations/lib/presentationtab.py'
--- openlp/plugins/presentations/lib/presentationtab.py 2012-03-10 18:36:59 +0000
+++ openlp/plugins/presentations/lib/presentationtab.py 2012-06-10 02:02:21 +0000
@@ -29,6 +29,7 @@
from openlp.core.lib import Receiver, SettingsTab, translate
from openlp.core.lib.ui import UiStrings
+from openlp.core.lib.settings import Settings
class PresentationTab(SettingsTab):
"""
@@ -102,10 +103,10 @@
for key in self.controllers:
controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name]
- checkbox.setChecked(QtCore.QSettings().value(
+ checkbox.setChecked(Settings().value(
self.settingsSection + u'/' + controller.name,
QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0])
- self.OverrideAppCheckBox.setChecked(QtCore.QSettings().value(
+ self.OverrideAppCheckBox.setChecked(Settings().value(
self.settingsSection + u'/override app',
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
@@ -123,19 +124,19 @@
if controller.is_available():
checkbox = self.PresenterCheckboxes[controller.name]
setting_key = self.settingsSection + u'/' + controller.name
- if QtCore.QSettings().value(setting_key) != \
+ if Settings().value(setting_key) != \
checkbox.checkState():
changed = True
- QtCore.QSettings().setValue(setting_key,
+ Settings().setValue(setting_key,
QtCore.QVariant(checkbox.checkState()))
if checkbox.isChecked():
controller.start_process()
else:
controller.kill()
setting_key = self.settingsSection + u'/override app'
- if QtCore.QSettings().value(setting_key) != \
+ if Settings().value(setting_key) != \
self.OverrideAppCheckBox.checkState():
- QtCore.QSettings().setValue(setting_key,
+ Settings().setValue(setting_key,
QtCore.QVariant(self.OverrideAppCheckBox.checkState()))
changed = True
if changed:
=== modified file 'openlp/plugins/remotes/lib/httpserver.py'
--- openlp/plugins/remotes/lib/httpserver.py 2012-04-20 19:36:10 +0000
+++ openlp/plugins/remotes/lib/httpserver.py 2012-06-10 02:02:21 +0000
@@ -122,6 +122,7 @@
from mako.template import Template
from openlp.core.lib import Receiver, PluginStatus, StringContent
+from openlp.core.lib.settings import Settings
from openlp.core.utils import AppLocation, translate
log = logging.getLogger(__name__)
@@ -169,10 +170,10 @@
clients. Listen out for socket connections.
"""
log.debug(u'Start TCP server')
- port = QtCore.QSettings().value(
+ port = Settings().value(
self.plugin.settingsSection + u'/port',
QtCore.QVariant(4316)).toInt()[0]
- address = QtCore.QSettings().value(
+ address = Settings().value(
self.plugin.settingsSection + u'/ip address',
QtCore.QVariant(u'0.0.0.0')).toString()
self.server = QtNetwork.QTcpServer()
@@ -404,7 +405,7 @@
u'slide': self.parent.current_slide or 0,
u'item': self.parent.current_item._uuid \
if self.parent.current_item else u'',
- u'twelve':QtCore.QSettings().value(
+ u'twelve':Settings().value(
u'remotes/twelve hour', QtCore.QVariant(True)).toBool(),
u'blank': self.parent.plugin.liveController.blankScreen.\
isChecked(),
=== modified file 'openlp/plugins/remotes/lib/remotetab.py'
--- openlp/plugins/remotes/lib/remotetab.py 2012-03-18 09:33:05 +0000
+++ openlp/plugins/remotes/lib/remotetab.py 2012-06-10 02:02:21 +0000
@@ -28,6 +28,7 @@
from PyQt4 import QtCore, QtGui, QtNetwork
from openlp.core.lib import SettingsTab, translate, Receiver
+from openlp.core.lib.settings import Settings
ZERO_URL = u'0.0.0.0'
@@ -149,12 +150,12 @@
def load(self):
self.portSpinBox.setValue(
- QtCore.QSettings().value(self.settingsSection + u'/port',
+ Settings().value(self.settingsSection + u'/port',
QtCore.QVariant(4316)).toInt()[0])
self.addressEdit.setText(
- QtCore.QSettings().value(self.settingsSection + u'/ip address',
+ Settings().value(self.settingsSection + u'/ip address',
QtCore.QVariant(ZERO_URL)).toString())
- self.twelveHour = QtCore.QSettings().value(
+ self.twelveHour = Settings().value(
self.settingsSection + u'/twelve hour',
QtCore.QVariant(True)).toBool()
self.twelveHourCheckBox.setChecked(self.twelveHour)
@@ -162,16 +163,16 @@
def save(self):
changed = False
- if QtCore.QSettings().value(self.settingsSection + u'/ip address',
+ if Settings().value(self.settingsSection + u'/ip address',
QtCore.QVariant(ZERO_URL).toString() != self.addressEdit.text() or
- QtCore.QSettings().value(self.settingsSection + u'/port',
+ Settings().value(self.settingsSection + u'/port',
QtCore.QVariant(4316).toInt()[0]) != self.portSpinBox.value()):
changed = True
- QtCore.QSettings().setValue(self.settingsSection + u'/port',
+ Settings().setValue(self.settingsSection + u'/port',
QtCore.QVariant(self.portSpinBox.value()))
- QtCore.QSettings().setValue(self.settingsSection + u'/ip address',
+ Settings().setValue(self.settingsSection + u'/ip address',
QtCore.QVariant(self.addressEdit.text()))
- QtCore.QSettings().setValue(self.settingsSection + u'/twelve hour',
+ Settings().setValue(self.settingsSection + u'/twelve hour',
QtCore.QVariant(self.twelveHour))
if changed:
Receiver.send_message(u'remotes_config_updated')
=== modified file 'openlp/plugins/songs/forms/authorsdialog.py'
--- openlp/plugins/songs/forms/authorsdialog.py 2012-04-01 22:44:09 +0000
+++ openlp/plugins/songs/forms/authorsdialog.py 2012-06-10 02:02:21 +0000
@@ -25,7 +25,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import translate
from openlp.core.lib.ui import create_button_box
=== modified file 'openlp/plugins/songs/forms/songbookdialog.py'
--- openlp/plugins/songs/forms/songbookdialog.py 2012-04-01 22:44:09 +0000
+++ openlp/plugins/songs/forms/songbookdialog.py 2012-06-10 02:02:21 +0000
@@ -25,7 +25,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import translate
from openlp.core.lib.ui import create_button_box
=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py 2012-06-08 21:03:18 +0000
+++ openlp/plugins/songs/forms/songimportform.py 2012-06-10 02:02:21 +0000
@@ -35,6 +35,7 @@
from openlp.core.lib import Receiver, 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
@@ -236,7 +237,7 @@
return True
elif self.currentPage() == self.sourcePage:
format = self.currentFormat
- QtCore.QSettings().setValue(u'songs/last import type',
+ Settings().setValue(u'songs/last import type',
format)
select_mode, class_, error_msg = SongFormat.get(format,
u'selectMode', u'class', u'invalidSourceMsg')
@@ -342,7 +343,7 @@
self.restart()
self.finishButton.setVisible(False)
self.cancelButton.setVisible(True)
- last_import_type = QtCore.QSettings().value(
+ last_import_type = Settings().value(
u'songs/last import type').toInt()[0]
if last_import_type < 0 or \
last_import_type >= self.formatComboBox.count():
=== modified file 'openlp/plugins/songs/forms/topicsdialog.py'
--- openlp/plugins/songs/forms/topicsdialog.py 2012-04-01 22:44:09 +0000
+++ openlp/plugins/songs/forms/topicsdialog.py 2012-06-10 02:02:21 +0000
@@ -25,7 +25,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import translate
from openlp.core.lib.ui import create_button_box
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2012-04-29 15:31:56 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2012-06-10 02:02:21 +0000
@@ -37,6 +37,7 @@
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
translate, check_item_selected, PluginStatus, create_separated_list
from openlp.core.lib.ui import UiStrings, create_widget_action
+from openlp.core.lib.settings import Settings
from openlp.core.utils import AppLocation
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
SongImportForm, SongExportForm
@@ -131,13 +132,13 @@
self.searchTextEdit.setFocus()
def configUpdated(self):
- self.searchAsYouType = QtCore.QSettings().value(
+ self.searchAsYouType = Settings().value(
self.settingsSection + u'/search as type',
QtCore.QVariant(u'False')).toBool()
- self.updateServiceOnEdit = QtCore.QSettings().value(
+ self.updateServiceOnEdit = Settings().value(
self.settingsSection + u'/update service on edit',
QtCore.QVariant(u'False')).toBool()
- self.addSongFromService = QtCore.QSettings().value(
+ self.addSongFromService = Settings().value(
self.settingsSection + u'/add song from service',
QtCore.QVariant(u'True')).toBool()
@@ -168,14 +169,14 @@
(SongSearch.Themes, u':/slides/slide_theme.png',
UiStrings().Themes, UiStrings().SearchThemes)
])
- self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value(
+ self.searchTextEdit.setCurrentSearchType(Settings().value(
u'%s/last search type' % self.settingsSection,
QtCore.QVariant(SongSearch.Entire)).toInt()[0])
self.configUpdated()
def onSearchTextButtonClicked(self):
# Save the current search type to the configuration.
- QtCore.QSettings().setValue(u'%s/last search type' %
+ Settings().setValue(u'%s/last search type' %
self.settingsSection,
QtCore.QVariant(self.searchTextEdit.currentSearchType()))
# Reload the list considering the new search type.
@@ -516,11 +517,11 @@
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 QtCore.QSettings().value(u'general/ccli number',
+ if Settings().value(u'general/ccli number',
QtCore.QVariant(u'')).toString():
service_item.raw_footer.append(unicode(
translate('SongsPlugin.MediaItem', 'CCLI License: ') +
- QtCore.QSettings().value(u'general/ccli number',
+ Settings().value(u'general/ccli number',
QtCore.QVariant(u'')).toString()))
service_item.audit = [
song.title, author_list, song.copyright, unicode(song.ccli_number)
=== modified file 'openlp/plugins/songs/lib/songstab.py'
--- openlp/plugins/songs/lib/songstab.py 2012-04-02 19:52:47 +0000
+++ openlp/plugins/songs/lib/songstab.py 2012-06-10 02:02:21 +0000
@@ -28,6 +28,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate
+from openlp.core.lib.settings import Settings
class SongsTab(SettingsTab):
"""
@@ -110,7 +111,7 @@
self.update_load = True
def load(self):
- settings = QtCore.QSettings()
+ settings = Settings()
settings.beginGroup(self.settingsSection)
self.song_search = settings.value(
u'search as type', QtCore.QVariant(False)).toBool()
@@ -127,7 +128,7 @@
settings.endGroup()
def save(self):
- settings = QtCore.QSettings()
+ 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))
=== modified file 'openlp/plugins/songusage/forms/songusagedetailform.py'
--- openlp/plugins/songusage/forms/songusagedetailform.py 2012-04-03 17:58:42 +0000
+++ openlp/plugins/songusage/forms/songusagedetailform.py 2012-06-10 02:02:21 +0000
@@ -33,6 +33,7 @@
from openlp.core.lib import SettingsManager, translate, Receiver, \
check_directory_exists
+from openlp.core.lib.settings import Settings
from openlp.plugins.songusage.lib.db import SongUsageItem
from songusagedetaildialog import Ui_SongUsageDetailDialog
@@ -59,10 +60,10 @@
year = QtCore.QDate().currentDate().year()
if QtCore.QDate().currentDate().month() < 9:
year -= 1
- toDate = QtCore.QSettings().value(
+ toDate = Settings().value(
u'songusage/to date',
QtCore.QVariant(QtCore.QDate(year, 8, 31))).toDate()
- fromDate = QtCore.QSettings().value(
+ fromDate = Settings().value(
u'songusage/from date',
QtCore.QVariant(QtCore.QDate(year - 1, 9, 1))).toDate()
self.fromDate.setSelectedDate(fromDate)
@@ -103,9 +104,9 @@
'usage_detail_%s_%s.txt')) % (
self.fromDate.selectedDate().toString(u'ddMMyyyy'),
self.toDate.selectedDate().toString(u'ddMMyyyy'))
- QtCore.QSettings().setValue(u'songusage/from date',
+ Settings().setValue(u'songusage/from date',
QtCore.QVariant(self.fromDate.selectedDate()))
- QtCore.QSettings().setValue(u'songusage/to date',
+ Settings().setValue(u'songusage/to date',
QtCore.QVariant(self.toDate.selectedDate()))
usage = self.plugin.manager.get_all_objects(
SongUsageItem, and_(
=== modified file 'openlp/plugins/songusage/songusageplugin.py'
--- openlp/plugins/songusage/songusageplugin.py 2012-04-21 22:29:08 +0000
+++ openlp/plugins/songusage/songusageplugin.py 2012-06-10 02:02:21 +0000
@@ -34,6 +34,7 @@
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
@@ -125,7 +126,7 @@
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'print_service_started'),
self.printSongUsage)
- self.songUsageActive = QtCore.QSettings().value(
+ self.songUsageActive = Settings().value(
self.settingsSection + u'/active',
QtCore.QVariant(False)).toBool()
# Set the button and checkbox state
@@ -168,7 +169,7 @@
the UI when necessary,
"""
self.songUsageActive = not self.songUsageActive
- QtCore.QSettings().setValue(self.settingsSection + u'/active',
+ Settings().setValue(self.settingsSection + u'/active',
QtCore.QVariant(self.songUsageActive))
self.setButtonState()
Follow ups