Added code to allow OpenLP to run portable

This commit is contained in:
Stevan Pettit 2012-05-11 08:22:34 -04:00
parent cf0e8c184e
commit f1586052a6
51 changed files with 344 additions and 199 deletions

View File

@ -41,6 +41,7 @@ from traceback import format_exception
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
@ -48,7 +49,7 @@ from openlp.core.ui.firsttimelanguageform import FirstTimeLanguageForm
from openlp.core.ui.firsttimeform import FirstTimeForm
from openlp.core.ui.exceptionform import ExceptionForm
from openlp.core.ui import SplashScreen, ScreenList
from openlp.core.utils import AppLocation, LanguageManager, VersionThread, \
from openlp.core.utils import AppLocation, LanguageManager, VersionThread,\
get_application_version
@ -111,15 +112,15 @@ class OpenLP(QtGui.QApplication):
# Decide how many screens we have and their size
screens = ScreenList(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()
@ -139,7 +140,7 @@ class OpenLP(QtGui.QApplication):
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()
@ -256,7 +257,26 @@ def main(args=None):
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')
QtCore.QSettings.setDefaultFormat(QtCore.QSettings.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'Data', u'Settings', u'OpenLPPortable.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'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.sync()
else:
app.setApplicationName(u'OpenLP')
app.setApplicationVersion(get_application_version()[u'version'])
# Instance check
if not options.testing:
@ -264,7 +284,7 @@ def main(args=None):
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

View File

@ -41,6 +41,7 @@ from sqlalchemy.pool import NullPool
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 @@ class Manager(object):
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

View File

@ -32,6 +32,7 @@ import cPickle
from PyQt4 import QtCore
from openlp.core.lib import translate
from openlp.core.lib.settings import Settings
class FormattingTags(object):
@ -160,7 +161,7 @@ class FormattingTags(object):
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
@ -173,7 +174,7 @@ class FormattingTags(object):
# Initial Load of the Tags
FormattingTags.reset_html_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)

View File

@ -38,6 +38,7 @@ from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, \
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 @@ class MediaManagerItem(QtGui.QWidget):
"""
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 @@ class MediaManagerItem(QtGui.QWidget):
"""
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:

View File

@ -32,6 +32,7 @@ import logging
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 @@ class Plugin(QtCore.QObject):
"""
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 @@ class Plugin(QtCore.QObject):
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()

View File

@ -0,0 +1,67 @@
# -*- 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 will create a Settings object for accessing
settings stored in that Ini file.
"""
FilePath = u''
@staticmethod
def setFilename(filepath):
"""
Sets the complete path to an Ini file to be used by Settings objects.
Does not affect existing Settings objects.
"""
Settings.FilePath = filepath
log.info(u'Set Settings file: %s' % filepath)
def __init__(self, *args):
if Settings.FilePath and (Settings.defaultFormat() ==
Settings.IniFormat):
QtCore.QSettings.__init__(self, Settings.FilePath,
Settings.IniFormat)
else:
QtCore.QSettings.__init__(self, *args)

View File

@ -34,6 +34,7 @@ import os
from PyQt4 import QtCore
from openlp.core.lib.settings import Settings
from openlp.core.utils import AppLocation
class SettingsManager(object):
@ -58,7 +59,7 @@ class SettingsManager(object):
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 @@ class SettingsManager(object):
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 @@ class SettingsManager(object):
``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 @@ class SettingsManager(object):
``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]

View File

@ -36,6 +36,7 @@ import os
import sys
from openlp.core.lib import SettingsTab, translate, build_icon, Receiver
from openlp.core.lib.ui import UiStrings
from openlp.core.lib.settings import Settings
from openlp.core.utils import get_images_filter, AppLocation
from openlp.core.lib import SlideLimits
@ -449,12 +450,12 @@ class AdvancedTab(SettingsTab):
"""
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])
@ -547,7 +548,7 @@ class AdvancedTab(SettingsTab):
"""
Save settings to disk.
"""
settings = QtCore.QSettings()
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.setValue(u'default service enabled',
self.serviceNameCheckBox.isChecked())

View File

@ -39,6 +39,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
from openlp.core.utils import get_web_page, AppLocation
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
@ -113,7 +114,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
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:
@ -206,7 +207,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
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.
@ -257,7 +258,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
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()
@ -456,16 +457,16 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
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))

View File

@ -30,6 +30,7 @@ from PyQt4 import QtCore, QtGui
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 @@ class GeneralTab(SettingsTab):
"""
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 @@ class GeneralTab(SettingsTab):
"""
Save the settings from the form
"""
settings = QtCore.QSettings()
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.setValue(u'monitor',
QtCore.QVariant(self.monitorComboBox.currentIndex()))

View File

@ -38,6 +38,7 @@ from PyQt4.phonon import Phonon
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
@ -134,7 +135,7 @@ class MainDisplay(Display):
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
@ -195,11 +196,11 @@ class MainDisplay(Display):
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():
@ -352,7 +353,7 @@ class MainDisplay(Display):
# 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:
@ -401,7 +402,7 @@ class MainDisplay(Display):
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:
@ -425,7 +426,7 @@ class MainDisplay(Display):
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:
@ -450,7 +451,7 @@ class MainDisplay(Display):
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");')
@ -465,7 +466,7 @@ class MainDisplay(Display):
"""
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"')

View File

@ -39,6 +39,7 @@ from PyQt4 import QtCore, QtGui
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, \
@ -101,12 +102,12 @@ class Ui_MainWindow(object):
# 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
@ -694,9 +695,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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)
@ -748,11 +749,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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)
@ -830,7 +831,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
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():
@ -964,9 +965,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# 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.
@ -1018,19 +1019,24 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.cleanUp()
QtCore.QCoreApplication.exit()
def onSettingsExportItemClicked(self):
def onSettingsExportItemClicked(self, export_file = None):
"""
Export settings to a .conf file in INI format
Export settings to a .conf file in INI format. If no filename is,
get one from the user. A filename is passed from self.cleanup if
OpenLP is running as a portable app.
"""
export_file_name = unicode(QtGui.QFileDialog.getSaveFileName(self,
translate('OpenLP.MainWindow', 'Export Settings File'), '',
translate('OpenLP.MainWindow',
'OpenLP Export Settings File (*.conf)')))
if not export_file_name:
return
# Make sure it's a .conf file.
if not export_file_name.endswith(u'conf'):
export_file_name = export_file_name + u'.conf'
if not export_file:
export_file_name = unicode(QtGui.QFileDialog.getSaveFileName(self,
translate('OpenLP.MainWindow', 'Export Settings File'), '',
translate('OpenLP.MainWindow',
'OpenLP Export Settings File (*.conf)')))
if not export_file_name:
return
# Make sure it's a .conf file.
if not export_file_name.endswith(u'conf'):
export_file_name = export_file_name + u'.conf'
else:
export_file_name = unicode(export_file)
temp_file = os.path.join(unicode(gettempdir()),
u'openlp', u'exportConf.tmp')
self.saveSettings()
@ -1051,12 +1057,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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)
Settings.IniFormat)
# Add a header section.
# This is to insure it's our conf file for import.
now = datetime.now()
@ -1114,7 +1120,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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)
@ -1159,7 +1165,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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'),
@ -1184,9 +1190,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
# Clean temporary files used by services
self.serviceManagerContents.cleanUp()
if QtCore.QSettings().value(u'advanced/save current plugin',
settings = Settings()
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')
@ -1267,7 +1274,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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)
@ -1299,7 +1306,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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):
@ -1313,7 +1320,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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)
@ -1323,19 +1330,19 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
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')
@ -1364,7 +1371,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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()
@ -1390,7 +1397,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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))]
@ -1423,7 +1430,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# 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
@ -1507,7 +1514,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
else:
log.info(u'No data copy requested')
# Change the location of data directory in config file.
settings = QtCore.QSettings()
settings = Settings()
settings.setValue(u'advanced/data path', self.newDataPath)
# Check if the new data path is our default.
if self.newDataPath == AppLocation.get_directory(AppLocation.DataDir):

View File

@ -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 @@ def get_media_players():
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 @@ def set_media_players(players_list, overridden_player=u'auto'):
"""
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

View File

@ -30,6 +30,7 @@ import os
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 @@ class MediaController(object):
"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 == True) or \
controller.isLive == False:

View File

@ -34,6 +34,7 @@ import sys
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 @@ class VlcPlayer(MediaPlayer):
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'

View File

@ -33,6 +33,7 @@ from lxml import html
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 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
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 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
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 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
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()))

View File

@ -34,6 +34,7 @@ import copy
from PyQt4 import QtCore
from openlp.core.lib import Receiver, translate
from openlp.core.lib.settings import Settings
log = logging.getLogger(__name__)
@ -241,7 +242,7 @@ class ScreenList(object):
"""
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])

View File

@ -40,6 +40,7 @@ from PyQt4 import QtCore, QtGui
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
@ -271,7 +272,7 @@ class ServiceManager(QtGui.QWidget):
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 @@ class ServiceManager(QtGui.QWidget):
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 @@ class ServiceManager(QtGui.QWidget):
"""
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 @@ class ServiceManager(QtGui.QWidget):
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')
@ -593,17 +594,17 @@ class ServiceManager(QtGui.QWidget):
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()
@ -611,7 +612,7 @@ class ServiceManager(QtGui.QWidget):
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: '
@ -692,7 +693,7 @@ class ServiceManager(QtGui.QWidget):
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(
@ -734,7 +735,7 @@ class ServiceManager(QtGui.QWidget):
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)
@ -1106,7 +1107,7 @@ class ServiceManager(QtGui.QWidget):
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))
@ -1287,7 +1288,7 @@ class ServiceManager(QtGui.QWidget):
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

View File

@ -31,6 +31,7 @@ import re
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 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
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.

View File

@ -35,6 +35,7 @@ from PyQt4 import QtCore, QtGui
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
@ -236,7 +237,7 @@ class SlideController(Controller):
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 @@ class SlideController(Controller):
"""
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 @@ class SlideController(Controller):
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 @@ class SlideController(Controller):
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 @@ class SlideController(Controller):
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 @@ class SlideController(Controller):
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 @@ class SlideController(Controller):
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 @@ class SlideController(Controller):
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 @@ class SlideController(Controller):
"""
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.

View File

@ -40,6 +40,7 @@ from openlp.core.lib import OpenLPToolbar, get_text_file_string, build_icon, \
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 @@ class ThemeManager(QtGui.QWidget):
"""
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 @@ class ThemeManager(QtGui.QWidget):
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',
@ -448,7 +449,7 @@ class ThemeManager(QtGui.QWidget):
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()
@ -767,7 +768,7 @@ class ThemeManager(QtGui.QWidget):
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):

View File

@ -30,6 +30,7 @@ from PyQt4 import QtCore, QtGui
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 @@ class ThemesTab(SettingsTab):
'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 @@ class ThemesTab(SettingsTab):
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 @@ class ThemesTab(SettingsTab):
[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()

View File

@ -37,6 +37,8 @@ import sys
import time
import urllib2
from openlp.core.lib.settings import Settings
from PyQt4 import QtGui, QtCore
if sys.platform != u'win32' and sys.platform != u'darwin':
@ -128,8 +130,8 @@ class AppLocation(object):
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)
@ -286,7 +288,7 @@ def check_latest_version(current_version):
"""
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())

View File

@ -30,6 +30,8 @@ by the shortcuts system.
"""
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 @@ class ActionList(object):
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()

View File

@ -35,6 +35,7 @@ from PyQt4 import QtCore, QtGui
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 @@ class LanguageManager(object):
"""
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 @@ class LanguageManager(object):
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:

View File

@ -32,6 +32,7 @@ from PyQt4 import QtCore
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 @@ class AlertsPlugin(Plugin):
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):

View File

@ -30,6 +30,7 @@ from PyQt4 import QtCore, QtGui
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 @@ class AlertsTab(SettingsTab):
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 @@ class AlertsTab(SettingsTab):
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] != \

View File

@ -31,6 +31,7 @@ from PyQt4 import QtCore, QtGui
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 @@ class BiblePlugin(Plugin):
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(

View File

@ -36,6 +36,7 @@ from PyQt4 import QtCore, QtGui
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 @@ class BibleImportForm(OpenLPWizard):
"""
Set default values for the wizard pages.
"""
settings = QtCore.QSettings()
settings = Settings()
settings.beginGroup(self.plugin.settingsSection)
self.restart()
self.finishButton.setVisible(False)

View File

@ -36,6 +36,7 @@ from PyQt4 import QtCore, QtGui
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 @@ class BibleUpgradeForm(OpenLPWizard):
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()

View File

@ -34,6 +34,7 @@ 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 +186,7 @@ def update_reference_separators():
':|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()),

View File

@ -31,6 +31,7 @@ from PyQt4 import QtCore, QtGui
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 @@ class BiblesTab(SettingsTab):
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 @@ class BiblesTab(SettingsTab):
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))

View File

@ -32,6 +32,7 @@ from PyQt4 import QtCore
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 @@ class BibleManager(object):
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
@ -334,7 +335,7 @@ class BibleManager(object):
if language_selection:
language_selection = int(language_selection.value)
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]
reflist = parse_reference(versetext, self.db_cache[bible],
@ -381,7 +382,7 @@ class BibleManager(object):
if language_selection and language_selection.value != u'None':
return int(language_selection.value)
if language_selection is None or language_selection.value == u'None':
return QtCore.QSettings().value(
return Settings().value(
self.settingsSection + u'/bookname language',
QtCore.QVariant(0)).toInt()[0]

View File

@ -33,6 +33,7 @@ from PyQt4 import QtCore, QtGui
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 @@ class BibleMediaItem(MediaManagerItem):
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 @@ class BibleMediaItem(MediaManagerItem):
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 @@ class BibleMediaItem(MediaManagerItem):
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 @@ class BibleMediaItem(MediaManagerItem):
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 @@ class BibleMediaItem(MediaManagerItem):
"""
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 @@ class BibleMediaItem(MediaManagerItem):
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 @@ class BibleMediaItem(MediaManagerItem):
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()),

View File

@ -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 @@ class CustomTab(SettingsTab):
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))

View File

@ -34,6 +34,7 @@ from sqlalchemy.sql import or_, func
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 @@ class CustomMediaItem(MediaManagerItem):
])
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])
@ -218,7 +219,7 @@ class CustomMediaItem(MediaManagerItem):
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:
raw_footer.append(title + u' ' + credit)
else:
@ -228,7 +229,7 @@ class CustomMediaItem(MediaManagerItem):
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.

View File

@ -31,6 +31,7 @@ import logging
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 @@ class ImagePlugin(Plugin):
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.update_images(u'image', background)

View File

@ -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 @@ class ImageTab(SettingsTab):
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 @@ class ImageTab(SettingsTab):
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()

View File

@ -35,6 +35,7 @@ from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
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 @@ class ImageMediaItem(MediaManagerItem):
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 @@ class ImageMediaItem(MediaManagerItem):
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]

View File

@ -29,6 +29,7 @@ from PyQt4 import QtCore, QtGui
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 @@ class MediaTab(SettingsTab):
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 @@ class MediaTab(SettingsTab):
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:

View File

@ -30,6 +30,7 @@ import logging
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 @@ class MediaPlugin(Plugin):
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')

View File

@ -36,6 +36,7 @@ from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, \
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 @@ class PresentationMediaItem(MediaManagerItem):
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:

View File

@ -33,6 +33,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
from openlp.core.utils import AppLocation
log = logging.getLogger(__name__)
@ -392,7 +393,7 @@ class PresentationController(object):
"""
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:

View File

@ -29,6 +29,7 @@ from PyQt4 import QtCore, QtGui
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 @@ class PresentationTab(SettingsTab):
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 @@ class PresentationTab(SettingsTab):
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:

View File

@ -122,6 +122,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.utils import AppLocation, translate
log = logging.getLogger(__name__)
@ -169,10 +170,10 @@ class HttpServer(object):
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 @@ class HttpConnection(object):
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(),

View File

@ -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 @@ class RemoteTab(SettingsTab):
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 @@ class RemoteTab(SettingsTab):
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')

View File

@ -35,6 +35,7 @@ from PyQt4 import QtCore, QtGui
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
@ -373,7 +374,7 @@ class SongImportForm(OpenLPWizard):
return True
elif self.currentPage() == self.sourcePage:
source_format = self.formatComboBox.currentIndex()
QtCore.QSettings().setValue(u'songs/last import type',
Settings().setValue(u'songs/last import type',
source_format)
if source_format == SongFormat.OpenLP2:
if self.openLP2FilenameEdit.text().isEmpty():
@ -704,7 +705,7 @@ class SongImportForm(OpenLPWizard):
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():

View File

@ -37,6 +37,7 @@ from sqlalchemy.sql import or_
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 @@ class SongMediaItem(MediaManagerItem):
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 @@ class SongMediaItem(MediaManagerItem):
(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 @@ class SongMediaItem(MediaManagerItem):
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)

View File

@ -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 @@ class SongsTab(SettingsTab):
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 @@ class SongsTab(SettingsTab):
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))

View File

@ -33,6 +33,7 @@ from sqlalchemy.sql import and_
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 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
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 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
'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_(

View File

@ -34,6 +34,7 @@ from openlp.core.lib import Plugin, StringContent, Receiver, build_icon, \
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 @@ class SongUsagePlugin(Plugin):
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 @@ class SongUsagePlugin(Plugin):
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()