removed value parameter (still needs work)

This commit is contained in:
Andreas Preikschat 2013-01-11 00:07:48 +01:00
parent 6faf76ed5c
commit 2616f63007
62 changed files with 332 additions and 345 deletions

View File

@ -43,14 +43,14 @@ from traceback import format_exception
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, Settings, check_directory_exists
from openlp.core.lib import Receiver, Settings, check_directory_exists, ScreenList
from openlp.core.lib.ui import UiStrings
from openlp.core.resources import qInitResources
from openlp.core.ui.mainwindow import MainWindow
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.ui import SplashScreen
from openlp.core.utils import AppLocation, LanguageManager, VersionThread, \
get_application_version
@ -118,7 +118,7 @@ class OpenLP(QtGui.QApplication):
# Decide how many screens we have and their size
screens = ScreenList.create(self.desktop())
# First time checks in settings
has_run_wizard = Settings().value(u'general/has run wizard', False)
has_run_wizard = Settings().value(u'general/has run wizard')
if not has_run_wizard:
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
Settings().setValue(u'general/has run wizard', True)
@ -129,7 +129,7 @@ class OpenLP(QtGui.QApplication):
u'QTableWidget, QListWidget, QTreeWidget {alternate-background-color: ' + base_color.name() + ';}\n'
application_stylesheet += nt_repair_stylesheet
self.setStyleSheet(application_stylesheet)
show_splash = Settings().value(u'general/show splash', True)
show_splash = Settings().value(u'general/show splash')
if show_splash:
self.splash = SplashScreen()
self.splash.show()
@ -148,7 +148,7 @@ class OpenLP(QtGui.QApplication):
self.processEvents()
if not has_run_wizard:
self.mainWindow.firstTime()
update_check = Settings().value(u'general/update check', True)
update_check = Settings().value(u'general/update check')
if update_check:
VersionThread(self.mainWindow).start()
Receiver.send_message(u'live_display_blank_check')
@ -174,6 +174,7 @@ class OpenLP(QtGui.QApplication):
return False
def hookException(self, exctype, value, traceback):
print ''.join(format_exception(exctype, value, traceback))
if not hasattr(self, u'mainWindow'):
log.exception(''.join(format_exception(exctype, value, traceback)))
return
@ -295,7 +296,7 @@ def main(args=None):
if app.isAlreadyRunning():
sys.exit()
# First time checks in settings
if not Settings().value(u'general/has run wizard', False):
if not Settings().value(u'general/has run wizard'):
if not FirstTimeLanguageForm().exec_():
# if cancel then stop processing
sys.exit()

View File

@ -382,8 +382,9 @@ def create_separated_list(stringlist):
u'Locale list separator: start') % (stringlist[0], merged)
from settings import Settings
from eventreceiver import Receiver
from screen import ScreenList
from settings import Settings
from listwidgetwithdnd import ListWidgetWithDnD
from formattingtags import FormattingTags
from spelltextedit import SpellTextEdit
@ -392,8 +393,7 @@ from plugin import PluginStatus, StringContent, Plugin
from pluginmanager import PluginManager
from settingstab import SettingsTab
from serviceitem import ServiceItem, ServiceItemType, ItemCapabilities
from htmlbuilder import build_html, build_lyrics_format_css, \
build_lyrics_outline_css
from htmlbuilder import build_html, build_lyrics_format_css, build_lyrics_outline_css
from toolbar import OpenLPToolbar
from dockwidget import OpenLPDockWidget
from imagemanager import ImageManager

View File

@ -119,8 +119,7 @@ def upgrade_db(url, upgrade):
session.commit()
version += 1
else:
version_meta = Metadata.populate(key=u'version',
value=int(upgrade.__version__))
version_meta = Metadata.populate(key=u'version', value=int(upgrade.__version__))
session.commit()
return int(version_meta.value), upgrade.__version__
@ -186,7 +185,7 @@ class Manager(object):
self.db_url = u''
self.is_dirty = False
self.session = None
db_type = settings.value(u'db type', u'sqlite')
db_type = settings.value(u'db type')
if db_type == u'sqlite':
if db_file_name:
self.db_url = u'sqlite:///%s/%s' % (AppLocation.get_section_data_path(plugin_name), db_file_name)
@ -194,12 +193,12 @@ class Manager(object):
self.db_url = u'sqlite:///%s/%s.sqlite' % (AppLocation.get_section_data_path(plugin_name), plugin_name)
else:
self.db_url = u'%s://%s:%s@%s/%s' % (db_type,
urlquote(settings.value(u'db username', u'')),
urlquote(settings.value(u'db password', u'')),
urlquote(settings.value(u'db hostname', u'')),
urlquote(settings.value(u'db database', u'')))
urlquote(settings.value(u'db username')),
urlquote(settings.value(u'db password')),
urlquote(settings.value(u'db hostname')),
urlquote(settings.value(u'db database')))
if db_type == u'mysql':
db_encoding = settings.value(u'db encoding', u'utf8')
db_encoding = settings.value(u'db encoding')
self.db_url += u'?charset=%s' % urlquote(db_encoding)
settings.endGroup()
if upgrade_mod:

View File

@ -35,8 +35,7 @@ import logging
from PyQt4 import QtGui
from openlp.core.lib import build_icon
from openlp.core.ui import ScreenList
from openlp.core.lib import build_icon, ScreenList
log = logging.getLogger(__name__)

View File

@ -164,7 +164,7 @@ class FormattingTags(object):
FormattingTags.add_html_tags(temporary_tags)
# Formatting Tags were also known as display tags.
user_expands = Settings().value(u'displayTags/html_tags', u'')
user_expands = Settings().value(u'displayTags/html_tags')
# cPickle only accepts str not unicode strings
user_expands_string = str(user_expands)
if user_expands_string:

View File

@ -39,8 +39,7 @@ import Queue
from PyQt4 import QtCore
from openlp.core.lib import resize_image, image_to_byte, Receiver
from openlp.core.ui import ScreenList
from openlp.core.lib import resize_image, image_to_byte, Receiver, ScreenList
log = logging.getLogger(__name__)

View File

@ -444,7 +444,7 @@ class MediaManagerItem(QtGui.QWidget):
"""
Allows the list click action to be determined dynamically
"""
if Settings().value(u'advanced/double click live', False):
if Settings().value(u'advanced/double click live'):
self.onLiveClick()
else:
self.onPreviewClick()
@ -453,7 +453,7 @@ class MediaManagerItem(QtGui.QWidget):
"""
Allows the change of current item in the list to be actioned
"""
if Settings().value(u'advanced/single click preview', False) and self.quickPreviewAllowed \
if Settings().value(u'advanced/single click preview') and self.quickPreviewAllowed \
and self.listView.selectedIndexes() and self.autoSelectId == -1:
self.onPreviewClick(True)

View File

@ -195,7 +195,7 @@ class Plugin(QtCore.QObject):
"""
Sets the status of the plugin
"""
self.status = Settings().value(self.settingsSection + u'/status', PluginStatus.Inactive)
self.status = Settings().value(self.settingsSection + u'/status')
def toggleStatus(self, new_status):
"""

View File

@ -32,9 +32,9 @@ import logging
from PyQt4 import QtGui, QtCore, QtWebKit
from openlp.core.lib import ServiceItem, expand_tags, build_lyrics_format_css, build_lyrics_outline_css, Receiver, \
ItemCapabilities, FormattingTags, ImageSource
ItemCapabilities, FormattingTags, ImageSource, ScreenList
from openlp.core.lib.theme import ThemeLevel
from openlp.core.ui import MainDisplay, ScreenList
from openlp.core.ui import MainDisplay
log = logging.getLogger(__name__)

View File

@ -35,7 +35,7 @@ import copy
from PyQt4 import QtCore
from openlp.core.lib import Receiver, translate, Settings
from openlp.core.lib import Receiver, translate
log = logging.getLogger(__name__)
@ -241,15 +241,16 @@ class ScreenList(object):
"""
Loads the screen size and the monitor number from the settings.
"""
from openlp.core.lib import Settings
settings = Settings()
settings.beginGroup(u'general')
self.set_current_display(settings.value(u'monitor', self.display_count - 1))
self.display = settings.value(u'display on monitor', True)
override_display = settings.value(u'override position', False)
x = settings.value(u'x position', self.current[u'size'].x())
y = settings.value(u'y position', self.current[u'size'].y())
width = settings.value(u'width', self.current[u'size'].width())
height = settings.value(u'height', self.current[u'size'].height())
self.set_current_display(settings.value(u'monitor'))
self.display = settings.value(u'display on monitor')
override_display = settings.value(u'override position')
x = settings.value(u'x position')
y = settings.value(u'y position')
width = settings.value(u'width')
height = settings.value(u'height')
self.override[u'size'] = QtCore.QRect(x, y, width, height)
self.override[u'primary'] = False
settings.endGroup()

View File

@ -32,11 +32,13 @@ This class contains the core default settings.
import datetime
import logging
import os
import sys
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, SlideLimits
from openlp.core.lib import SlideLimits, ScreenList
from openlp.core.lib.theme import ThemeLevel
from openlp.core.lib.ui import UiStrings
log = logging.getLogger(__name__)
@ -51,12 +53,23 @@ class Settings(QtCore.QSettings):
object for accessing settings stored in that Ini file.
"""
__filePath__ = u''
# Fix for bug #1014422.
x11_bypass_default = True
if sys.platform.startswith(u'linux'):
# Default to False on Gnome.
x11_bypass_default = bool(not os.environ.get(u'GNOME_DESKTOP_SESSION_ID'))
# Default to False on XFce
if os.environ.get(u'DESKTOP_SESSION') == u'xfce':
x11_bypass_default = False
__default_settings__ = {
u'advanced/x11 bypass wm': True,
u'advanced/x11 bypass wm': x11_bypass_default,
u'advanced/default service enabled': True,
u'advanced/enable exit confirmation': True,
u'advanced/save current plugin': False,
u'advanced/single click preview': False,
# 7 stands for now, 0 to 6 is Monday to Sunday.
u'advanced/default service day': 7,
u'advanced/max recent files': 20,
u'advanced/is portable': False,
@ -69,14 +82,16 @@ class Settings(QtCore.QSettings):
u'advanced/expand service item': False,
u'advanced/recent file count': 4,
# TODO: Check if translate already works at this stage. If not move the string to Ui String class.
u'advanced/default service name': translate('OpenLP.AdvancedTab', 'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: /\\?*|<>\[\]":+\nSee http://docs.python.org/library/'
'datetime.html#strftime-strptime-behavior for more information.'),
u'advanced/default service name': UiStrings().DefaultServiceName,
u'advanced/default service minute': 0,
u'advanced/slide limits': SlideLimits.End,
u'advanced/print slide text': False,
u'advanced/add page break': False,
u'advanced/print file meta data': False,
u'advanced/print notes': False,
u'advanced/display size': 0,
u'displayTags/html_tags': u'',
u'general/ccli number': u'',
u'general/y position': 0,
u'general/has run wizard': False,
u'general/update check': True,
u'general/language': u'[en]',
@ -90,15 +105,16 @@ class Settings(QtCore.QSettings):
u'general/enable slide loop': True,
u'general/show splash': True,
u'general/screen blank': False,
u'general/x position': 0,
u'general/x position': 0, #ScreenList().current[u'size'].x()
u'general/y position': 0, # ScreenList().current[u'size'].y()
u'general/monitor': 0, # ScreenList().display_count - 1
u'general/height': 1024, # ScreenList().current[u'size'].height()
u'general/width': 1280, # ScreenList().current[u'size'].width()
u'general/loop delay': 5,
u'general/height': 1024,
u'general/monitor': 0,
u'general/songselect username': u'',
u'general/audio repeat list': False,
u'general/auto unblank': False,
u'general/display on monitor': True,
u'general/width': 1280,
u'general/audio start paused': True,
u'general/last version test': datetime.datetime.now().date(),
u'general/blank warning': False,
@ -167,8 +183,9 @@ class Settings(QtCore.QSettings):
u'shortcuts/previousService': [QtCore.Qt.Key_Left],
u'shortcuts/importThemeItem': [],
u'shortcuts/down': [QtCore.Qt.Key_Down],
u'themes/theme level': ThemeLevel.Global,
u'themes/theme level': ThemeLevel.Song,
u'themes/global theme': u'',
u'themes/last directory': u'',
u'user interface/main window position': QtCore.QPoint(),
u'user interface/preview panel': True,
u'user interface/live panel': True,
@ -179,12 +196,19 @@ class Settings(QtCore.QSettings):
u'user interface/live splitter geometry': QtCore.QByteArray(),
u'user interface/main window state': QtCore.QByteArray(),
u'servicemanager/service theme': u'',
u'players/background color': u'#000000',
u'servicemanager/service theme': u''
# HAS TO BE HERE. Should be FIXED.
u'media/players': u'webkit',
u'media/override player': QtCore.Qt.Unchecked
}
@staticmethod
def extendDefaultSettings(defaultValues):
"""
"""
Settings.__default_settings__ = dict(defaultValues.items() + Settings.__default_settings__.items())
@staticmethod
@ -203,7 +227,7 @@ class Settings(QtCore.QSettings):
else:
QtCore.QSettings.__init__(self, *args)
def value(self, key, defaultValue):
def value(self, key, defaultValue=0):
"""
Returns the value for the given ``key``. The returned ``value`` is
of the same type as the ``defaultValue``.
@ -220,11 +244,22 @@ class Settings(QtCore.QSettings):
**Note**, this method only converts a few types and might need to be
extended if a certain type is missing!
"""
if defaultValue:
raise Exception(u'Should not happen')
if u'/' not in key:
key = u'/'.join((self.group(), key))
# Check for none as u'' is passed as default and is valid! This is
# needed because the settings export does not know the default values,
# thus just passes None.
if defaultValue is None and not super(Settings, self).contains(key):
return None
defaultValue = Settings.__default_settings__[key]
# try:
# defaultValue = Settings.__default_settings__[key]
# except KeyError:
# return None
#if defaultValue is None and not super(Settings, self).contains(key):
#return None
setting = super(Settings, self).value(key, defaultValue)
# On OS X (and probably on other platforms too) empty value from QSettings
# is represented as type PyQt4.QtCore.QPyNullVariant. This type has to be

View File

@ -61,7 +61,7 @@ class SettingsManager(object):
name = u'last directory %d' % num
else:
name = u'last directory'
return Settings().value(section + u'/' + name, u'')
return Settings().value(section + u'/' + name)
@staticmethod
def set_last_dir(section, directory, num=None):
@ -100,7 +100,7 @@ class SettingsManager(object):
"""
settings = Settings()
settings.beginGroup(section)
old_count = settings.value(u'%s count' % name, 0)
old_count = settings.value(u'%s count' % name)
new_count = len(list)
settings.setValue(u'%s count' % name, new_count)
for counter in range(new_count):
@ -124,11 +124,11 @@ class SettingsManager(object):
"""
settings = Settings()
settings.beginGroup(section)
list_count = settings.value(u'%s count' % name, 0)
list_count = settings.value(u'%s count' % name)
list = []
if list_count:
for counter in range(list_count):
item = settings.value(u'%s %d' % (name, counter), u'')
item = settings.value(u'%s %d' % (name, counter))
if item:
list.append(item)
settings.endGroup()

View File

@ -451,7 +451,8 @@ class ThemeXML(object):
Set the header and footer size into the current primary screen.
10 px on each side is removed to allow for a border.
"""
from openlp.core.ui import ScreenList
#FIXME
from openlp.core.lib import ScreenList
current_screen = ScreenList().current
self.font_main_y = 0
self.font_main_width = current_screen[u'size'].width() - 20

View File

@ -33,8 +33,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, Receiver, translate
from openlp.core.utils.actions import ActionList
from openlp.core.lib import build_icon, translate, Receiver
log = logging.getLogger(__name__)
@ -72,6 +71,9 @@ class UiStrings(object):
self.Continuous = translate('OpenLP.Ui', 'Continuous')
self.Default = translate('OpenLP.Ui', 'Default')
self.DefaultColor = translate('OpenLP.Ui', 'Default Color:')
self.DefaultServiceName = translate('OpenLP.AdvancedTab', 'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: /\\?*|<>\[\]":+\n'
'See http://docs.python.org/library/datetime.html#strftime-strptime-behavior for more information.')
self.Delete = translate('OpenLP.Ui', '&Delete')
self.DisplayStyle = translate('OpenLP.Ui', 'Display style:')
self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error')
@ -286,6 +288,7 @@ def create_button(parent, name, **kwargs):
``enabled``
False in case the button should be disabled.
"""
from openlp.core.utils.actions import ActionList
if u'role' in kwargs:
role = kwargs.pop(u'role')
if role == u'delete':
@ -371,6 +374,7 @@ def create_action(parent, name, **kwargs):
``triggers``
A slot which is connected to the actions ``triggered()`` slot.
"""
from openlp.core.utils.actions import ActionList
action = QtGui.QAction(parent)
action.setObjectName(name)
if kwargs.get(u'text'):

View File

@ -33,6 +33,7 @@ from PyQt4 import QtGui
from openlp.core.lib import translate
class HideMode(object):
"""
This is an enumeration class which specifies the different modes of hiding
@ -54,6 +55,7 @@ class HideMode(object):
Theme = 2
Screen = 3
class AlertLocation(object):
"""
This is an enumeration class which controls where Alerts are placed on the
@ -72,6 +74,7 @@ class AlertLocation(object):
Middle = 1
Bottom = 2
class DisplayControllerType(object):
"""
This is an enumeration class which says where a display controller
@ -88,7 +91,7 @@ from themelayoutform import ThemeLayoutForm
from themeform import ThemeForm
from filerenameform import FileRenameForm
from starttimeform import StartTimeForm
from screen import ScreenList
#from screen import ScreenList
from maindisplay import MainDisplay, Display
from servicenoteform import ServiceNoteForm
from serviceitemeditform import ServiceItemEditForm

View File

@ -54,17 +54,6 @@ class AdvancedTab(SettingsTab):
Initialise the settings tab
"""
self.displayChanged = False
# 7 stands for now, 0 to 6 is Monday to Sunday.
self.defaultServiceDay = 7
# 11 o'clock is the most popular time for morning service.
self.defaultServiceHour = 11
self.defaultServiceMinute = 0
self.defaultServiceName = translate('OpenLP.AdvancedTab',
'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: '
'/\\?*|<>\[\]":+\n'
'See http://docs.python.org/library/datetime.html'
'#strftime-strptime-behavior for more information.')
self.defaultImage = u':/graphics/openlp-splash-screen.png'
self.defaultColor = u'#ffffff'
self.dataExists = False
@ -311,7 +300,7 @@ class AdvancedTab(SettingsTab):
self.serviceNameLabel.setText(translate('OpenLP.AdvancedTab', 'Name:'))
self.serviceNameEdit.setToolTip(translate('OpenLP.AdvancedTab', 'Consult the OpenLP manual for usage.'))
self.serviceNameRevertButton.setToolTip(
translate('OpenLP.AdvancedTab', 'Revert to the default service name "%s".') % self.defaultServiceName)
translate('OpenLP.AdvancedTab', 'Revert to the default service name "%s".') % UiStrings().DefaultServiceName)
self.serviceNameExampleLabel.setText(translate('OpenLP.AdvancedTab', 'Example:'))
self.hideMouseGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Mouse Cursor'))
self.hideMouseCheckBox.setText(translate('OpenLP.AdvancedTab', 'Hide mouse cursor when over display window'))
@ -353,36 +342,26 @@ class AdvancedTab(SettingsTab):
# The max recent files value does not have an interface and so never
# gets actually stored in the settings therefore the default value of
# 20 will always be used.
self.recentSpinBox.setMaximum(settings.value(u'max recent files', 20))
self.recentSpinBox.setValue(settings.value(u'recent file count', 4))
self.mediaPluginCheckBox.setChecked(settings.value(u'save current plugin', False))
self.doubleClickLiveCheckBox.setChecked(settings.value(u'double click live', False))
self.singleClickPreviewCheckBox.setChecked(settings.value(u'single click preview', False))
self.expandServiceItemCheckBox.setChecked(settings.value(u'expand service item', False))
self.enableAutoCloseCheckBox.setChecked(settings.value(u'enable exit confirmation', True))
self.hideMouseCheckBox.setChecked(settings.value(u'hide mouse', True))
self.serviceNameDay.setCurrentIndex(settings.value(u'default service day', self.defaultServiceDay))
self.serviceNameTime.setTime(QtCore.QTime(settings.value(u'default service hour', self.defaultServiceHour),
settings.value(u'default service minute',self.defaultServiceMinute)))
self.recentSpinBox.setMaximum(settings.value(u'max recent files'))
self.recentSpinBox.setValue(settings.value(u'recent file count'))
self.mediaPluginCheckBox.setChecked(settings.value(u'save current plugin'))
self.doubleClickLiveCheckBox.setChecked(settings.value(u'double click live'))
self.singleClickPreviewCheckBox.setChecked(settings.value(u'single click preview'))
self.expandServiceItemCheckBox.setChecked(settings.value(u'expand service item'))
self.enableAutoCloseCheckBox.setChecked(settings.value(u'enable exit confirmation'))
self.hideMouseCheckBox.setChecked(settings.value(u'hide mouse'))
self.serviceNameDay.setCurrentIndex(settings.value(u'default service day'))
self.serviceNameTime.setTime(QtCore.QTime(settings.value(u'default service hour'),
settings.value(u'default service minute')))
self.shouldUpdateServiceNameExample = True
self.serviceNameEdit.setText(settings.value(u'default service name',
self.defaultServiceName))
default_service_enabled = settings.value(u'default service enabled', True)
self.serviceNameEdit.setText(settings.value(u'default service name'))
default_service_enabled = settings.value(u'default service enabled')
self.serviceNameCheckBox.setChecked(default_service_enabled)
self.serviceNameCheckBoxToggled(default_service_enabled)
# Fix for bug #1014422.
x11_bypass_default = True
if sys.platform.startswith(u'linux'):
# Default to False on Gnome.
x11_bypass_default = bool(not
os.environ.get(u'GNOME_DESKTOP_SESSION_ID'))
# Default to False on XFce
if os.environ.get(u'DESKTOP_SESSION') == u'xfce':
x11_bypass_default = False
self.x11BypassCheckBox.setChecked(settings.value(u'x11 bypass wm', x11_bypass_default))
self.defaultColor = settings.value(u'default color', u'#ffffff')
self.defaultFileEdit.setText(settings.value(u'default image', u':/graphics/openlp-splash-screen.png'))
self.slide_limits = settings.value(u'slide limits', SlideLimits.End)
self.x11BypassCheckBox.setChecked(settings.value(u'x11 bypass wm'))
self.defaultColor = settings.value(u'default color')
self.defaultFileEdit.setText(settings.value(u'default image'))
self.slide_limits = settings.value(u'slide limits')
if self.slide_limits == SlideLimits.End:
self.endSlideRadioButton.setChecked(True)
elif self.slide_limits == SlideLimits.Wrap:
@ -424,7 +403,7 @@ class AdvancedTab(SettingsTab):
self.dataDirectoryLabel.setText(os.path.abspath(self.currentDataPath))
self.defaultColorButton.setStyleSheet(u'background-color: %s' % self.defaultColor)
# Don't allow data directory move if running portable.
if settings.value(u'advanced/is portable', False):
if settings.value(u'advanced/is portable'):
self.dataDirectoryGroupBox.hide()
def save(self):
@ -433,11 +412,10 @@ class AdvancedTab(SettingsTab):
"""
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.setValue(u'default service enabled',
self.serviceNameCheckBox.isChecked())
settings.setValue(u'default service enabled', self.serviceNameCheckBox.isChecked())
service_name = self.serviceNameEdit.text()
preset_is_valid = self.generateServiceNameExample()[0]
if service_name == self.defaultServiceName or not preset_is_valid:
if service_name == UiStrings().DefaultServiceName or not preset_is_valid:
settings.remove(u'default service name')
self.serviceNameEdit.setText(service_name)
else:
@ -504,7 +482,7 @@ class AdvancedTab(SettingsTab):
self.updateServiceNameExample(None)
def onServiceNameRevertButtonClicked(self):
self.serviceNameEdit.setText(self.defaultServiceName)
self.serviceNameEdit.setText(UiStrings().DefaultServiceName)
self.serviceNameEdit.setFocus()
def onDefaultColorButtonClicked(self):

View File

@ -116,7 +116,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
self.noInternetFinishButton.setVisible(False)
# Check if this is a re-run of the wizard.
self.hasRunWizard = Settings().value(u'general/has run wizard', False)
self.hasRunWizard = Settings().value(u'general/has run wizard')
# Sort out internet access for downloads
if self.webAccess:
songs = self.config.get(u'songs', u'languages')
@ -202,7 +202,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
index = self.themeComboBox.findText(theme)
if index == -1:
self.themeComboBox.addItem(theme)
default_theme = Settings().value(u'themes/global theme', u'')
default_theme = Settings().value(u'themes/global theme')
# Pre-select the current default theme.
index = self.themeComboBox.findText(default_theme)
self.themeComboBox.setCurrentIndex(index)

View File

@ -30,9 +30,8 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, Settings, SettingsTab, translate
from openlp.core.lib import Receiver, Settings, SettingsTab, translate, ScreenList
from openlp.core.lib.ui import UiStrings
from openlp.core.ui import ScreenList
log = logging.getLogger(__name__)
@ -247,28 +246,28 @@ class GeneralTab(SettingsTab):
settings.beginGroup(self.settingsSection)
self.monitorComboBox.clear()
self.monitorComboBox.addItems(self.screens.get_screen_list())
monitorNumber = settings.value(u'monitor', self.screens.display_count - 1)
monitorNumber = settings.value(u'monitor')
self.monitorComboBox.setCurrentIndex(monitorNumber)
self.numberEdit.setText(settings.value(u'ccli number', u''))
self.usernameEdit.setText(settings.value(u'songselect username', u''))
self.passwordEdit.setText(settings.value(u'songselect password', u''))
self.saveCheckServiceCheckBox.setChecked(settings.value(u'save prompt', False))
self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank', False))
self.numberEdit.setText(settings.value(u'ccli number'))
self.usernameEdit.setText(settings.value(u'songselect username'))
self.passwordEdit.setText(settings.value(u'songselect password'))
self.saveCheckServiceCheckBox.setChecked(settings.value(u'save prompt'))
self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank'))
self.displayOnMonitorCheck.setChecked(self.screens.display)
self.warningCheckBox.setChecked(settings.value(u'blank warning', False))
self.autoOpenCheckBox.setChecked(settings.value(u'auto open', False))
self.showSplashCheckBox.setChecked(settings.value(u'show splash', True))
self.checkForUpdatesCheckBox.setChecked(settings.value(u'update check', True))
self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview', False))
self.timeoutSpinBox.setValue(settings.value(u'loop delay', 5))
self.monitorRadioButton.setChecked(not settings.value(u'override position', False))
self.overrideRadioButton.setChecked(settings.value(u'override position', False))
self.customXValueEdit.setValue(settings.value(u'x position', self.screens.current[u'size'].x()))
self.customYValueEdit.setValue(settings.value(u'y position', self.screens.current[u'size'].y()))
self.customHeightValueEdit.setValue(settings.value(u'height', self.screens.current[u'size'].height()))
self.customWidthValueEdit.setValue(settings.value(u'width', self.screens.current[u'size'].width()))
self.startPausedCheckBox.setChecked(settings.value(u'audio start paused', True))
self.repeatListCheckBox.setChecked(settings.value(u'audio repeat list', False))
self.warningCheckBox.setChecked(settings.value(u'blank warning'))
self.autoOpenCheckBox.setChecked(settings.value(u'auto open'))
self.showSplashCheckBox.setChecked(settings.value(u'show splash'))
self.checkForUpdatesCheckBox.setChecked(settings.value(u'update check'))
self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview'))
self.timeoutSpinBox.setValue(settings.value(u'loop delay'))
self.monitorRadioButton.setChecked(not settings.value(u'override position',))
self.overrideRadioButton.setChecked(settings.value(u'override position'))
self.customXValueEdit.setValue(settings.value(u'x position'))
self.customYValueEdit.setValue(settings.value(u'y position'))
self.customHeightValueEdit.setValue(settings.value(u'height'))
self.customWidthValueEdit.setValue(settings.value(u'width'))
self.startPausedCheckBox.setChecked(settings.value(u'audio start paused'))
self.repeatListCheckBox.setChecked(settings.value(u'audio repeat list'))
settings.endGroup()
self.monitorComboBox.setDisabled(self.overrideRadioButton.isChecked())
self.customXValueEdit.setEnabled(self.overrideRadioButton.isChecked())

View File

@ -42,7 +42,8 @@ from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, tr
Settings, ImageSource
from openlp.core.lib.theme import BackgroundType
from openlp.core.ui import HideMode, ScreenList, AlertLocation
from openlp.core.lib import ScreenList
from openlp.core.ui import HideMode, AlertLocation
log = logging.getLogger(__name__)
@ -131,18 +132,8 @@ class MainDisplay(Display):
self.firstTime = True
self.webLoaded = True
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | \
QtCore.Qt.WindowStaysOnTopHint
# Fix for bug #1014422.
x11_bypass_default = True
if sys.platform.startswith(u'linux'):
# Default to False on Gnome.
x11_bypass_default = bool(not
os.environ.get(u'GNOME_DESKTOP_SESSION_ID'))
# Default to False on XFce
if os.environ.get(u'DESKTOP_SESSION') == u'xfce':
x11_bypass_default = False
if Settings().value(u'advanced/x11 bypass wm', x11_bypass_default):
windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint
if Settings().value(u'advanced/x11 bypass wm'):
windowFlags |= QtCore.Qt.X11BypassWindowManagerHint
# TODO: The following combination of windowFlags works correctly
# on Mac OS X. For next OpenLP version we should test it on other
@ -204,10 +195,10 @@ class MainDisplay(Display):
if self.isLive:
# Build the initial frame.
background_color = QtGui.QColor()
background_color.setNamedColor(Settings().value(u'advanced/default color', u'#ffffff'))
background_color.setNamedColor(Settings().value(u'advanced/default color'))
if not background_color.isValid():
background_color = QtCore.Qt.white
image_file = Settings().value(u'advanced/default image', u':/graphics/openlp-splash-screen.png')
image_file = Settings().value(u'advanced/default image')
splash_image = QtGui.QImage(image_file)
self.initialFrame = QtGui.QImage(
self.screen[u'size'].width(),
@ -364,7 +355,7 @@ class MainDisplay(Display):
# Single screen active
if self.screens.display_count == 1:
# Only make visible if setting enabled.
if Settings().value(u'general/display on monitor', True):
if Settings().value(u'general/display on monitor'):
self.setVisible(True)
else:
self.setVisible(True)
@ -410,7 +401,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 Settings().value(u'general/auto unblank', False):
if Settings().value(u'general/auto unblank'):
Receiver.send_message(u'slidecontroller_live_unblank')
else:
self.hideDisplay(self.hideMode)
@ -432,7 +423,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 Settings().value(u'general/display on monitor', True):
if not Settings().value(u'general/display on monitor'):
return
if mode == HideMode.Screen:
self.frame.evaluateJavaScript(u'show_blank("desktop");')
@ -456,7 +447,7 @@ class MainDisplay(Display):
log.debug(u'showDisplay')
if self.screens.display_count == 1:
# Only make visible if setting enabled.
if not Settings().value(u'general/display on monitor', True):
if not Settings().value(u'general/display on monitor'):
return
self.frame.evaluateJavaScript('show_blank("show");')
if self.isHidden():
@ -470,7 +461,7 @@ class MainDisplay(Display):
"""
Hide mouse cursor when moved over display.
"""
if Settings().value(u'advanced/hide mouse', True):
if Settings().value(u'advanced/hide mouse'):
self.setCursor(QtCore.Qt.BlankCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
else:

View File

@ -40,7 +40,7 @@ from datetime import datetime
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, PluginManager, Receiver, translate, ImageManager, \
PluginStatus
PluginStatus, ScreenList
from openlp.core.lib.ui import UiStrings, create_action
from openlp.core.lib import SlideLimits, Settings
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \
@ -50,7 +50,6 @@ from openlp.core.utils import AppLocation, add_actions, LanguageManager, get_app
get_filesystem_encoding
from openlp.core.utils.actions import ActionList, CategoryOrder
from openlp.core.ui.firsttimeform import FirstTimeForm
from openlp.core.ui import ScreenList
log = logging.getLogger(__name__)
@ -104,10 +103,10 @@ class Ui_MainWindow(object):
# Create slide controllers
self.previewController = SlideController(self)
self.liveController = SlideController(self, True)
previewVisible = Settings().value(u'user interface/preview panel', True)
previewVisible = Settings().value(u'user interface/preview panel')
self.previewController.panel.setVisible(previewVisible)
liveVisible = Settings().value(u'user interface/live panel', True)
panelLocked = Settings().value(u'user interface/lock panel', False)
liveVisible = Settings().value(u'user interface/live panel')
panelLocked = Settings().value(u'user interface/lock panel')
self.liveController.panel.setVisible(liveVisible)
# Create menu
self.menuBar = QtGui.QMenuBar(mainWindow)
@ -580,8 +579,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.previewController.screenSizeChanged()
self.liveController.screenSizeChanged()
log.info(u'Load data from Settings')
if Settings().value(u'advanced/save current plugin', False):
savedPlugin = Settings().value(u'advanced/current media plugin', -1)
if Settings().value(u'advanced/save current plugin'):
savedPlugin = Settings().value(u'advanced/current media plugin')
if savedPlugin != -1:
self.mediaToolBox.setCurrentIndex(savedPlugin)
self.settingsForm.postSetUp()
@ -630,10 +629,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if not isinstance(filename, unicode):
filename = unicode(filename, sys.getfilesystemencoding())
self.serviceManagerContents.loadFile(filename)
elif Settings().value(
self.generalSettingsSection + u'/auto open', False):
elif Settings().value(self.generalSettingsSection + u'/auto open'):
self.serviceManagerContents.loadLastFile()
view_mode = Settings().value(u'%s/view mode' % self.generalSettingsSection, u'default')
view_mode = Settings().value(u'%s/view mode' % self.generalSettingsSection)
if view_mode == u'default':
self.modeDefaultItem.setChecked(True)
elif view_mode == u'setup':
@ -711,10 +709,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
settings = Settings()
self.liveController.mainDisplaySetBackground()
if settings.value(u'%s/screen blank' % self.generalSettingsSection,
False):
if settings.value(u'%s/blank warning' % self.generalSettingsSection,
False):
if settings.value(u'%s/screen blank' % self.generalSettingsSection):
if settings.value(u'%s/blank warning' % self.generalSettingsSection):
QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'OpenLP Main Display Blanked'),
translate('OpenLP.MainWindow', 'The Main Display has been blanked out'))
@ -838,7 +834,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# Lets do a basic sanity check. If it contains this string we can
# assume it was created by OpenLP and so we'll load what we can
# from it, and just silently ignore anything we don't recognise
if import_settings.value(u'SettingsImport/type', u'') != u'OpenLP_settings_export':
if import_settings.value(u'SettingsImport/type') != u'OpenLP_settings_export':
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'Import settings'),
translate('OpenLP.MainWindow', 'The file you have selected does not appear to be a valid OpenLP '
'settings file.\n\nProcessing has terminated and no changes have been made.'),
@ -861,7 +857,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
continue
# We have a good file, import it.
for section_key in import_keys:
value = import_settings.value(section_key, None)
value = import_settings.value(section_key)
if value is not None:
settings.setValue(u'%s' % (section_key), value)
now = datetime.now()
@ -933,7 +929,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
export_settings.endGroup()
# Write all the sections and keys.
for section_key in keys:
key_value = settings.value(section_key, None)
key_value = settings.value(section_key)
if key_value is not None:
export_settings.setValue(section_key, key_value)
export_settings.sync()
@ -1026,7 +1022,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
else:
event.ignore()
else:
if Settings().value(u'advanced/enable exit confirmation', True):
if Settings().value(u'advanced/enable exit confirmation'):
ret = QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'Close OpenLP'),
translate('OpenLP.MainWindow', 'Are you sure you want to close OpenLP?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
@ -1053,7 +1049,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# Clean temporary files used by services
self.serviceManagerContents.cleanUp()
if save_settings:
if Settings().value(u'advanced/save current plugin', False):
if Settings().value(u'advanced/save current plugin'):
Settings().setValue(u'advanced/current media plugin', self.mediaToolBox.currentIndex())
# Call the cleanup method to shutdown plugins.
log.info(u'cleanup plugins')
@ -1184,7 +1180,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
log.debug(u'Loading QSettings')
# Migrate Wrap Settings to Slide Limits Settings
if Settings().contains(self.generalSettingsSection + u'/enable slide loop'):
if Settings().value(self.generalSettingsSection + u'/enable slide loop', True):
if Settings().value(self.generalSettingsSection + u'/enable slide loop'):
Settings().setValue(self.advancedSettingsSection + u'/slide limits', SlideLimits.Wrap)
else:
Settings().setValue(self.advancedSettingsSection + u'/slide limits', SlideLimits.End)
@ -1195,15 +1191,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
settings.remove(u'custom slide')
settings.remove(u'service')
settings.beginGroup(self.generalSettingsSection)
self.recentFiles = settings.value(u'recent files', self.recentFiles)
self.recentFiles = settings.value(u'recent files')
settings.endGroup()
settings.beginGroup(self.uiSettingsSection)
self.move(settings.value(u'main window position', QtCore.QPoint(0, 0)))
self.restoreGeometry(settings.value(u'main window geometry', QtCore.QByteArray()))
self.restoreState(settings.value(u'main window state', QtCore.QByteArray()))
self.liveController.splitter.restoreState(settings.value(u'live splitter geometry', QtCore.QByteArray()))
self.previewController.splitter.restoreState(settings.value(u'preview splitter geometry', QtCore.QByteArray()))
self.controlSplitter.restoreState(settings.value(u'mainwindow splitter geometry', QtCore.QByteArray()))
self.move(settings.value(u'main window position'))
self.restoreGeometry(settings.value(u'main window geometry'))
self.restoreState(settings.value(u'main window state'))
self.liveController.splitter.restoreState(settings.value(u'live splitter geometry'))
self.previewController.splitter.restoreState(settings.value(u'preview splitter geometry'))
self.controlSplitter.restoreState(settings.value(u'mainwindow splitter geometry'))
settings.endGroup()
def saveSettings(self):
@ -1232,7 +1228,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Updates the recent file menu with the latest list of service files
accessed.
"""
recentFileCount = Settings().value(u'advanced/recent file count', 4)
recentFileCount = Settings().value(u'advanced/recent file count')
existingRecentFiles = [recentFile for recentFile in self.recentFiles
if os.path.isfile(unicode(recentFile))]
recentFilesToDisplay = existingRecentFiles[0:recentFileCount]
@ -1262,7 +1258,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 = Settings().value(u'advanced/max recent files', 20)
maxRecentFiles = Settings().value(u'advanced/max recent files')
if filename:
# Add some cleanup to reduce duplication in the recent file list
filename = os.path.abspath(filename)

View File

@ -76,10 +76,9 @@ def get_media_players():
from the settings.
"""
log.debug(u'get_media_players')
saved_players = Settings().value(u'media/players', u'webkit')
saved_players = Settings().value(u'media/players')
reg_ex = QtCore.QRegExp(".*\[(.*)\].*")
if Settings().value(u'media/override player',
QtCore.Qt.Unchecked)== QtCore.Qt.Checked:
if Settings().value(u'media/override player') == QtCore.Qt.Checked:
if reg_ex.exactMatch(saved_players):
overridden_player = u'%s' % reg_ex.cap(1)
else:

View File

@ -382,7 +382,7 @@ class MediaController(object):
elif not hidden or controller.media_info.is_background or serviceItem.will_auto_start:
autoplay = True
# Unblank on load set
elif Settings().value(u'general/auto unblank', False):
elif Settings().value(u'general/auto unblank'):
autoplay = True
if autoplay:
if not self.media_play(controller):

View File

@ -222,7 +222,7 @@ class PhononPlayer(MediaPlayer):
"""
Add css style sheets to htmlbuilder
"""
background = QtGui.QColor(Settings().value(u'players/background color', u'#000000')).name()
background = QtGui.QColor(Settings().value(u'players/background color')).name()
return VIDEO_CSS % (background,background,background)
def get_info(self):

View File

@ -177,7 +177,7 @@ class PlayerTab(SettingsTab):
settings = Settings()
settings.beginGroup(self.settingsSection)
self.updatePlayerList()
self.bg_color = settings.value(u'background color', u'#000000')
self.bg_color = settings.value(u'background color')
self.initial_color = self.bg_color
settings.endGroup()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)

View File

@ -113,7 +113,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 Settings().value(u'advanced/hide mouse', True) and display.controller.isLive:
if Settings().value(u'advanced/hide mouse') and display.controller.isLive:
command_line_options += u' --mouse-hide-timeout=0'
display.vlcInstance = vlc.Instance(command_line_options)
display.vlcInstance.set_log_verbosity(2)

View File

@ -282,7 +282,7 @@ class WebkitPlayer(MediaPlayer):
"""
Add css style sheets to htmlbuilder
"""
background = QtGui.QColor(Settings().value(u'players/background color', u'#000000')).name()
background = QtGui.QColor(Settings().value(u'players/background color')).name()
css = VIDEO_CSS % (background,background,background)
return css + FLASH_CSS

View File

@ -124,13 +124,13 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
# Load the settings for the dialog.
settings = Settings()
settings.beginGroup(u'advanced')
self.slideTextCheckBox.setChecked(settings.value(u'print slide text', False))
self.pageBreakAfterText.setChecked(settings.value(u'add page break', False))
self.slideTextCheckBox.setChecked(settings.value(u'print slide text'))
self.pageBreakAfterText.setChecked(settings.value(u'add page break'))
if not self.slideTextCheckBox.isChecked():
self.pageBreakAfterText.setDisabled(True)
self.metaDataCheckBox.setChecked(settings.value(u'print file meta data', False))
self.notesCheckBox.setChecked(settings.value(u'print notes', False))
self.zoomComboBox.setCurrentIndex(settings.value(u'display size', 0))
self.metaDataCheckBox.setChecked(settings.value(u'print file meta data'))
self.notesCheckBox.setChecked(settings.value(u'print notes'))
self.zoomComboBox.setCurrentIndex(settings.value(u'display size'))
settings.endGroup()
# Signals
QtCore.QObject.connect(self.printButton, QtCore.SIGNAL(u'triggered()'), self.printServiceOrder)

View File

@ -230,7 +230,7 @@ class ServiceManager(QtGui.QWidget):
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.themeChange)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'service_item_update'), self.serviceItemUpdate)
# Last little bits of setting up
self.service_theme = Settings().value(self.mainwindow.serviceManagerSettingsSection + u'/service theme', u'')
self.service_theme = Settings().value(self.mainwindow.serviceManagerSettingsSection + u'/service theme')
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
# build the drag and drop context menu
self.dndMenu = QtGui.QMenu()
@ -319,7 +319,7 @@ class ServiceManager(QtGui.QWidget):
"""
Triggered when Config dialog is updated.
"""
self.expandTabs = Settings().value(u'advanced/expand service item', False)
self.expandTabs = Settings().value(u'advanced/expand service item')
def resetSupportedSuffixes(self):
"""
@ -594,25 +594,21 @@ class ServiceManager(QtGui.QWidget):
Get a file name and then call :func:`ServiceManager.saveFile` to
save the file.
"""
default_service_enabled = Settings().value(u'advanced/default service enabled', True)
default_service_enabled = Settings().value(u'advanced/default service enabled')
if default_service_enabled:
service_day = Settings().value(u'advanced/default service day', 7)
service_day = Settings().value(u'advanced/default service day')
if service_day == 7:
local_time = datetime.now()
else:
service_hour = Settings().value(u'advanced/default service hour', 11)
service_minute = Settings().value(u'advanced/default service minute', 0)
service_hour = Settings().value(u'advanced/default service hour')
service_minute = Settings().value(u'advanced/default service minute')
now = datetime.now()
day_delta = service_day - now.weekday()
if day_delta < 0:
day_delta += 7
time = now + timedelta(days=day_delta)
local_time = time.replace(hour=service_hour, minute=service_minute)
default_pattern = Settings().value(u'advanced/default service name',
translate('OpenLP.AdvancedTab', 'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: '
'/\\?*|<>\[\]":+\nSee http://docs.python.org/library/'
'datetime.html#strftime-strptime-behavior for more information.'))
default_pattern = Settings().value(u'advanced/default service name')
default_filename = format_time(default_pattern, local_time)
else:
default_filename = u''
@ -740,7 +736,7 @@ class ServiceManager(QtGui.QWidget):
service was last closed. Can be blank if there was no service
present.
"""
fileName = Settings().value(u'servicemanager/last file', u'')
fileName = Settings().value(u'servicemanager/last file')
if fileName:
self.loadFile(fileName)
@ -1294,7 +1290,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 Settings().value(self.mainwindow.generalSettingsSection + u'/auto preview', False):
if Settings().value(self.mainwindow.generalSettingsSection + u'/auto preview'):
item += 1
if self.serviceItems and item < len(self.serviceItems) and \
self.serviceItems[item][u'service_item'].is_capable(ItemCapabilities.CanPreview):

View File

@ -34,14 +34,11 @@ from collections import deque
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
translate, build_icon, build_html, PluginManager, ServiceItem, \
ImageSource, SlideLimits, ServiceItemAction, Settings
from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList
from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, translate, build_icon, build_html, \
PluginManager, ServiceItem, ImageSource, SlideLimits, ServiceItemAction, Settings, ScreenList
from openlp.core.lib.ui import UiStrings, create_action
from openlp.core.lib import SlideLimits, ServiceItemAction
from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList, \
DisplayControllerType
from openlp.core.ui import HideMode, MainDisplay, Display, DisplayControllerType
from openlp.core.utils.actions import ActionList, CategoryOrder
log = logging.getLogger(__name__)
@ -211,7 +208,7 @@ class SlideController(DisplayController):
self.playSlidesOnce = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
icon=u':/media/media_time.png', checked=False, shortcuts=[],
category=self.category, triggers=self.onPlaySlidesOnce)
if Settings().value(self.parent().generalSettingsSection + u'/enable slide loop', True):
if Settings().value(self.parent().generalSettingsSection + u'/enable slide loop'):
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
else:
self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
@ -585,7 +582,7 @@ class SlideController(DisplayController):
"""
Updates the Slide Limits variable from the settings.
"""
self.slide_limits = Settings().value(self.parent().advancedSettingsSection + u'/slide limits', SlideLimits.End)
self.slide_limits = Settings().value(self.parent().advancedSettingsSection + u'/slide limits')
def enableToolBar(self, item):
"""
@ -613,7 +610,7 @@ class SlideController(DisplayController):
self.playSlidesLoop.setChecked(False)
self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
if item.is_text():
if Settings().value(self.parent().songsSettingsSection + u'/display songbar', True) and self.slideList:
if Settings().value(self.parent().songsSettingsSection + u'/display songbar') and self.slideList:
self.songMenu.show()
if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1:
self.toolbar.setWidgetVisible(self.loopList)
@ -727,8 +724,8 @@ class SlideController(DisplayController):
action.setData(counter)
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), self.onTrackTriggered)
self.display.audioPlayer.repeat = Settings().value(
self.parent().generalSettingsSection + u'/audio repeat list', False)
if Settings().value(self.parent().generalSettingsSection + u'/audio start paused', True):
self.parent().generalSettingsSection + u'/audio repeat list')
if Settings().value(self.parent().generalSettingsSection + u'/audio start paused'):
self.audioPauseItem.setChecked(True)
self.display.audioPlayer.pause()
else:
@ -837,8 +834,7 @@ class SlideController(DisplayController):
Allow the main display to blank the main display at startup time
"""
log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
display_type = Settings().value(self.parent().generalSettingsSection + u'/screen blank',
u'')
display_type = Settings().value(self.parent().generalSettingsSection + u'/screen blank')
if self.screens.which_screen(self.window()) != self.screens.which_screen(self.display):
# Order done to handle initial conversion
if display_type == u'themed':
@ -1192,7 +1188,7 @@ class SlideController(DisplayController):
"""
triggered by clicking the Preview slide items
"""
if Settings().value(u'advanced/double click live', False):
if Settings().value(u'advanced/double click live'):
# Live and Preview have issues if we have video or presentations
# playing in both at the same time.
if self.serviceItem.is_command():

View File

@ -158,7 +158,7 @@ class ThemeManager(QtGui.QWidget):
"""
Triggered when Config dialog is updated.
"""
self.global_theme = Settings().value(self.settingsSection + u'/global theme', u'')
self.global_theme = Settings().value(self.settingsSection + u'/global theme')
def checkListState(self, item):
"""
@ -429,7 +429,7 @@ class ThemeManager(QtGui.QWidget):
Settings().setValue(self.settingsSection + u'/global theme', theme.theme_name)
self.configUpdated()
files = SettingsManager.get_files(self.settingsSection, u'.png')
# Sort the themes by its name considering language specific
# Sort the themes by its name considering language specific
files.sort(key=lambda file_name: unicode(file_name),
cmp=locale_compare)
# now process the file list of png files
@ -729,8 +729,7 @@ class ThemeManager(QtGui.QWidget):
Check to see if theme has been selected and the destructive action
is allowed.
"""
self.global_theme = Settings().value(
self.settingsSection + u'/global theme', u'')
self.global_theme = Settings().value(self.settingsSection + u'/global theme')
if check_item_selected(self.themeListWidget, select_text):
item = self.themeListWidget.currentItem()
theme = item.text()

View File

@ -119,8 +119,8 @@ class ThemesTab(SettingsTab):
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
self.theme_level = settings.value(u'theme level', ThemeLevel.Song)
self.global_theme = settings.value(u'global theme', u'')
self.theme_level = settings.value(u'theme level')
self.global_theme = settings.value(u'global theme')
settings.endGroup()
if self.theme_level == ThemeLevel.Global:
self.GlobalLevelRadioButton.setChecked(True)
@ -166,7 +166,7 @@ class ThemesTab(SettingsTab):
[u'Bible Theme', u'Song Theme']
"""
# Reload as may have been triggered by the ThemeManager.
self.global_theme = Settings().value(self.settingsSection + u'/global theme', u'')
self.global_theme = Settings().value(self.settingsSection + u'/global theme')
self.DefaultComboBox.clear()
self.DefaultComboBox.addItems(theme_list)
find_and_set_in_combo_box(self.DefaultComboBox, self.global_theme)

View File

@ -127,7 +127,7 @@ class AppLocation(object):
"""
# Check if we have a different data location.
if Settings().contains(u'advanced/data path'):
path = Settings().value(u'advanced/data path', u'')
path = Settings().value(u'advanced/data path')
else:
path = AppLocation.get_directory(AppLocation.DataDir)
check_directory_exists(path)
@ -282,7 +282,7 @@ def check_latest_version(current_version):
# set to prod in the distribution config file.
settings = Settings()
settings.beginGroup(u'general')
last_test = settings.value(u'last version test', datetime.now().date())
last_test = settings.value(u'last version test')
this_test = datetime.now().date()
settings.setValue(u'last version test', this_test)
settings.endGroup()

View File

@ -233,7 +233,7 @@ class ActionList(object):
# Load the shortcut from the config.
settings = Settings()
settings.beginGroup(u'shortcuts')
shortcuts = settings.value(action.objectName(), action.shortcuts())
shortcuts = settings.value(action.objectName())
settings.endGroup()
if not shortcuts:
action.setShortcuts([])

View File

@ -98,7 +98,7 @@ class LanguageManager(object):
"""
Retrieve a saved language to use from settings
"""
language = Settings().value(u'general/language', u'[en]')
language = Settings().value(u'general/language')
language = str(language)
log.info(u'Language file: \'%s\' Loaded from conf file' % language)
if re.match(r'[[].*[]]', language):

View File

@ -29,12 +29,13 @@
import logging
from PyQt4 import QtCore
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings, PluginStatus
from openlp.core.lib.db import Manager
from openlp.core.lib.ui import create_action, UiStrings
from openlp.core.lib.theme import VerticalType
from openlp.core.ui import AlertLocation
from openlp.core.utils.actions import ActionList
from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
from openlp.plugins.alerts.lib.db import init_schema
@ -114,11 +115,11 @@ HTML = """
"""
__default_settings__ = {
u'alerts/font face': u'Sans',
u'alerts/font face': QtGui.QFont().family(),
u'alerts/font size': 40,
u'alerts/status': PluginStatus.Inactive,
u'alerts/db type': u'sqlite',
u'alerts/location': 2,
u'alerts/location': AlertLocation.Bottom,
u'alerts/background color': u'#660000',
u'alerts/font color': u'#ffffff',
u'alerts/timeout': 5

View File

@ -141,12 +141,12 @@ class AlertsTab(SettingsTab):
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
self.timeout = settings.value(u'timeout', 5)
self.font_color = settings.value(u'font color', u'#ffffff')
self.font_size = settings.value(u'font size', 40)
self.bg_color = settings.value(u'background color', u'#660000')
self.font_face = settings.value(u'font face', QtGui.QFont().family())
self.location = settings.value(u'location', AlertLocation.Bottom)
self.timeout = settings.value(u'timeout')
self.font_color = settings.value(u'font color')
self.font_size = settings.value(u'font size')
self.bg_color = settings.value(u'background color')
self.font_face = settings.value(u'font face')
self.location = settings.value(u'location')
settings.endGroup()
self.fontSizeSpinBox.setValue(self.font_size)
self.timeoutSpinBox.setValue(self.timeout)
@ -163,7 +163,7 @@ class AlertsTab(SettingsTab):
settings = Settings()
settings.beginGroup(self.settingsSection)
# Check value has changed as no event handles this field
if settings.value(u'location', 1) != self.verticalComboBox.currentIndex():
if settings.value(u'location') != self.verticalComboBox.currentIndex():
self.changed = True
settings.setValue(u'background color', self.bg_color)
settings.setValue(u'font color', self.font_color)

View File

@ -42,22 +42,25 @@ from openlp.plugins.bibles.forms import BibleUpgradeForm
log = logging.getLogger(__name__)
__default_settings__ = {
u'bibles/book name language': LanguageSelection.Bible,
u'bibles/verse separator': u'',
u'bibles/advanced bible': u'',
u'bibles/proxy name': u'',
u'bibles/db type': u'sqlite',
u'bibles/status': PluginStatus.Inactive,
u'bibles/bible theme': u'',
u'bibles/range separator': u'',
u'bibles/display new chapter': False,
u'bibles/last search type': BibleSearch.Reference,
u'bibles/verse layout style': LayoutStyle.VersePerSlide,
u'bibles/book name language': LanguageSelection.Bible,
u'bibles/display brackets': DisplayStyle.NoBrackets,
u'bibles/list separator': u'',
u'bibles/display new chapter': False,
u'bibles/second bibles': True,
u'bibles/quick bible': u'Afrikaans Bybel',
u'bibles/end separator': u'',
u'bibles/last search type': BibleSearch.Reference
u'bibles/advanced bible': u'', # FIXME: check
u'bibles/quick bible': u'', # FIXME: check
u'bibles/proxy name': u'',
u'bibles/proxy address': u'',
u'bibles/proxy username': u'',
u'bibles/proxy password': u'',
u'bibles/bible theme': u'',
u'bibles/verse separator': u'',
u'bibles/range separator': u'',
u'bibles/list separator': u'',
u'bibles/end separator': u''
}
@ -113,7 +116,8 @@ class BiblePlugin(Plugin):
settings = Settings()
settings.beginGroup(self.settingsSection)
if settings.contains(u'bookname language'):
settings.setValue(u'book name language', settings.value(u'bookname language', 0))
# FIXME: Will that cause crashes?
settings.setValue(u'book name language', settings.value(u'bookname language'))
settings.remove(u'bookname language')
settings.endGroup()

View File

@ -533,9 +533,9 @@ class BibleImportForm(OpenLPWizard):
self.setField(u'opensong_file', '')
self.setField(u'web_location', WebDownload.Crosswalk)
self.setField(u'web_biblename', self.webTranslationComboBox.currentIndex())
self.setField(u'proxy_server', settings.value(u'proxy address', u''))
self.setField(u'proxy_username', settings.value(u'proxy username', u''))
self.setField(u'proxy_password', settings.value(u'proxy password', u''))
self.setField(u'proxy_server', settings.value(u'proxy address'))
self.setField(u'proxy_username', settings.value(u'proxy username'))
self.setField(u'proxy_password', settings.value(u'proxy password'))
self.setField(u'openlp1_location', '')
self.setField(u'license_version', self.versionNameEdit.text())
self.setField(u'license_copyright', self.copyrightEdit.text())

View File

@ -187,10 +187,10 @@ def update_reference_separators():
settings = Settings()
settings.beginGroup(u'bibles')
custom_separators = [
settings.value(u'verse separator', u''),
settings.value(u'range separator', u''),
settings.value(u'list separator', u''),
settings.value(u'end separator', u'')]
settings.value(u'verse separator'),
settings.value(u'range separator'),
settings.value(u'list separator'),
settings.value(u'end separator')]
settings.endGroup()
for index, role in enumerate([u'v', u'r', u'l', u'e']):
if custom_separators[index].strip(u'|') == u'':

View File

@ -331,16 +331,16 @@ class BiblesTab(SettingsTab):
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
self.show_new_chapters = settings.value(u'display new chapter', False)
self.display_style = settings.value(u'display brackets', 0)
self.layout_style = settings.value(u'verse layout style', 0)
self.bible_theme = settings.value(u'bible theme', u'')
self.second_bibles = settings.value(u'second bibles', True)
self.show_new_chapters = settings.value(u'display new chapter')
self.display_style = settings.value(u'display brackets')
self.layout_style = settings.value(u'verse layout style')
self.bible_theme = settings.value(u'bible theme')
self.second_bibles = settings.value(u'second bibles')
self.newChaptersCheckBox.setChecked(self.show_new_chapters)
self.displayStyleComboBox.setCurrentIndex(self.display_style)
self.layoutStyleComboBox.setCurrentIndex(self.layout_style)
self.bibleSecondCheckBox.setChecked(self.second_bibles)
verse_separator = settings.value(u'verse separator', u'')
verse_separator = settings.value(u'verse separator')
if (verse_separator.strip(u'|') == u'') or (verse_separator == get_reference_separator(u'sep_v_default')):
self.verseSeparatorLineEdit.setText(get_reference_separator(u'sep_v_default'))
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
@ -349,7 +349,7 @@ class BiblesTab(SettingsTab):
self.verseSeparatorLineEdit.setText(verse_separator)
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
self.verseSeparatorCheckBox.setChecked(True)
range_separator = settings.value(u'range separator', u'')
range_separator = settings.value(u'range separator')
if (range_separator.strip(u'|') == u'') or (range_separator == get_reference_separator(u'sep_r_default')):
self.rangeSeparatorLineEdit.setText(get_reference_separator(u'sep_r_default'))
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
@ -358,7 +358,7 @@ class BiblesTab(SettingsTab):
self.rangeSeparatorLineEdit.setText(range_separator)
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
self.rangeSeparatorCheckBox.setChecked(True)
list_separator = settings.value(u'list separator', u'')
list_separator = settings.value(u'list separator')
if (list_separator.strip(u'|') == u'') or (list_separator == get_reference_separator(u'sep_l_default')):
self.listSeparatorLineEdit.setText(get_reference_separator(u'sep_l_default'))
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
@ -367,7 +367,7 @@ class BiblesTab(SettingsTab):
self.listSeparatorLineEdit.setText(list_separator)
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
self.listSeparatorCheckBox.setChecked(True)
end_separator = settings.value(u'end separator', u'')
end_separator = settings.value(u'end separator')
if (end_separator.strip(u'|') == u'') or (end_separator == get_reference_separator(u'sep_e_default')):
self.endSeparatorLineEdit.setText(get_reference_separator(u'sep_e_default'))
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
@ -376,7 +376,7 @@ class BiblesTab(SettingsTab):
self.endSeparatorLineEdit.setText(end_separator)
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
self.endSeparatorCheckBox.setChecked(True)
self.language_selection = settings.value(u'book name language', 0)
self.language_selection = settings.value(u'book name language')
self.languageSelectionComboBox.setCurrentIndex(self.language_selection)
settings.endGroup()

View File

@ -126,7 +126,7 @@ class BibleManager(object):
self.web = u'Web'
self.db_cache = None
self.path = AppLocation.get_section_data_path(self.settingsSection)
self.proxy_name = Settings().value(self.settingsSection + u'/proxy name', u'')
self.proxy_name = Settings().value(self.settingsSection + u'/proxy name')
self.suffix = u'.sqlite'
self.import_wizard = None
self.reload_bibles()
@ -358,7 +358,7 @@ class BibleManager(object):
if not language_selection or language_selection.value == "None" or language_selection.value == "-1":
# If None is returned, it's not the singleton object but a
# BibleMeta object with the value "None"
language_selection = Settings().value(self.settingsSection + u'/book name language', 0)
language_selection = Settings().value(self.settingsSection + u'/book name language')
else:
language_selection = language_selection.value
try:

View File

@ -260,7 +260,7 @@ class BibleMediaItem(MediaManagerItem):
def configUpdated(self):
log.debug(u'configUpdated')
if Settings().value(self.settingsSection + u'/second bibles', True):
if Settings().value(self.settingsSection + u'/second bibles'):
self.advancedSecondLabel.setVisible(True)
self.advancedSecondComboBox.setVisible(True)
self.quickSecondLabel.setVisible(True)
@ -312,8 +312,7 @@ class BibleMediaItem(MediaManagerItem):
translate('BiblesPlugin.MediaItem', 'Text Search'),
translate('BiblesPlugin.MediaItem', 'Search Text...'))
])
self.quickSearchEdit.setCurrentSearchType(Settings().value(u'%s/last search type' % self.settingsSection,
BibleSearch.Reference))
self.quickSearchEdit.setCurrentSearchType(Settings().value(u'%s/last search type' % self.settingsSection))
self.configUpdated()
log.debug(u'bible manager initialise complete')
@ -335,13 +334,14 @@ class BibleMediaItem(MediaManagerItem):
self.advancedVersionComboBox.addItems(bibles)
self.advancedSecondComboBox.addItems(bibles)
# set the default value
bible = Settings().value(self.settingsSection + u'/advanced bible', u'')
bible = Settings().value(self.settingsSection + u'/advanced bible')
if bible in bibles:
find_and_set_in_combo_box(self.advancedVersionComboBox, bible)
self.initialiseAdvancedBible(unicode(bible))
elif bibles:
self.initialiseAdvancedBible(bibles[0])
bible = Settings().value(self.settingsSection + u'/quick bible', self.quickVersionComboBox.currentText())
# Check: causes crashes?
bible = Settings().value(self.settingsSection + u'/quick bible')
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
def reloadBibles(self, process=False):

View File

@ -39,9 +39,10 @@ log = logging.getLogger(__name__)
__default_settings__ = {
u'custom/db type': u'sqlite',
u'custom/display footer': True,
u'custom/status': PluginStatus.Inactive,
u'custom/last search type': CustomSearch.Titles,
u'custom/status': PluginStatus.Inactive
u'custom/display footer': True,
u'custom/add custom from service': True
}

View File

@ -77,8 +77,8 @@ class CustomTab(SettingsTab):
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
self.displayFooter = settings.value(u'display footer', True)
self.update_load = settings.value(u'add custom from service', True)
self.displayFooter = settings.value(u'display footer')
self.update_load = settings.value(u'add custom from service')
self.displayFooterCheckBox.setChecked(self.displayFooter)
self.add_from_service_checkbox.setChecked(self.update_load)
settings.endGroup()

View File

@ -83,7 +83,7 @@ class CustomMediaItem(MediaManagerItem):
self.create_from_service_item)
def config_updated(self):
self.add_custom_from_service = Settings().value(self.settingsSection + u'/add custom from service', True)
self.add_custom_from_service = Settings().value(self.settingsSection + u'/add custom from service')
def retranslateUi(self):
self.searchTextLabel.setText(u'%s:' % UiStrings().Search)
@ -97,8 +97,7 @@ class CustomMediaItem(MediaManagerItem):
(CustomSearch.Themes, u':/slides/slide_theme.png', UiStrings().Themes, UiStrings().SearchThemes)
])
self.loadList(self.manager.get_all_objects(CustomSlide, order_by_ref=CustomSlide.title))
self.searchTextEdit.setCurrentSearchType(Settings().value( u'%s/last search type' % self.settingsSection,
CustomSearch.Titles))
self.searchTextEdit.setCurrentSearchType(Settings().value( u'%s/last search type' % self.settingsSection))
self.config_updated()
def loadList(self, custom_slides):
@ -208,7 +207,7 @@ class CustomMediaItem(MediaManagerItem):
service_item.title = title
for slide in raw_slides:
service_item.add_from_text(slide)
if Settings().value(self.settingsSection + u'/display footer', True) or credit:
if Settings().value(self.settingsSection + u'/display footer') or credit:
service_item.raw_footer.append(u' '.join([title, credit]))
else:
service_item.raw_footer.append(u'')

View File

@ -98,5 +98,5 @@ class ImagePlugin(Plugin):
image manager to require updates. Actual update is triggered by the
last part of saving the config.
"""
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color', u'#000000'))
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color'))
self.liveController.imageManager.updateImagesBorder(ImageSource.ImagePlugin, background)

View File

@ -81,7 +81,7 @@ class ImageTab(SettingsTab):
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
self.bg_color = settings.value(u'background color', u'#000000')
self.bg_color = settings.value(u'background color')
self.initial_color = self.bg_color
settings.endGroup()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)

View File

@ -141,7 +141,7 @@ class ImageMediaItem(MediaManagerItem):
def generateSlideData(self, service_item, item=None, xmlVersion=False,
remote=False, context=ServiceItemContext.Service):
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color', u'#000000'))
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color'))
if item:
items = [item]
else:
@ -205,7 +205,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(Settings().value(self.settingsSection + u'/background color', u'#000000'))
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color'))
item = self.listView.selectedIndexes()[0]
bitem = self.listView.item(item.row())
filename = bitem.data(QtCore.Qt.UserRole)

View File

@ -192,7 +192,7 @@ class MediaMediaItem(MediaManagerItem):
service_item.add_capability(ItemCapabilities.CanAutoStartForLive)
service_item.add_capability(ItemCapabilities.RequiresMedia)
service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay)
if Settings().value(self.settingsSection + u'/media auto start', QtCore.Qt.Unchecked) == QtCore.Qt.Checked:
if Settings().value(self.settingsSection + u'/media auto start') == QtCore.Qt.Checked:
service_item.will_auto_start = True
# force a non-existent theme
service_item.theme = -1

View File

@ -72,19 +72,17 @@ class MediaTab(SettingsTab):
self.autoStartCheckBox.setText(translate('MediaPlugin.MediaTab', 'Start Live items automatically'))
def load(self):
self.overridePlayerCheckBox.setChecked(Settings().value(self.settingsSection + u'/override player',
QtCore.Qt.Unchecked))
self.autoStartCheckBox.setChecked(Settings().value(self.settingsSection + u'/media auto start',
QtCore.Qt.Unchecked))
self.overridePlayerCheckBox.setChecked(Settings().value(self.settingsSection + u'/override player'))
self.autoStartCheckBox.setChecked(Settings().value(self.settingsSection + u'/media auto start'))
def save(self):
override_changed = False
setting_key = self.settingsSection + u'/override player'
if Settings().value(setting_key, QtCore.Qt.Unchecked) != self.overridePlayerCheckBox.checkState():
if Settings().value(setting_key) != self.overridePlayerCheckBox.checkState():
Settings().setValue(setting_key, self.overridePlayerCheckBox.checkState())
override_changed = True
setting_key = self.settingsSection + u'/media auto start'
if Settings().value(setting_key, QtCore.Qt.Unchecked) != self.autoStartCheckBox.checkState():
if Settings().value(setting_key) != self.autoStartCheckBox.checkState():
Settings().setValue(setting_key, self.autoStartCheckBox.checkState())
if override_changed:
self.parent.resetSupportedSuffixes()

View File

@ -37,11 +37,9 @@ from openlp.plugins.media.lib import MediaMediaItem, MediaTab
log = logging.getLogger(__name__)
__default_settings__ = {
u'media/override player': QtCore.Qt.Unchecked,
u'media/media count': 0,
u'media/media auto start': QtCore.Qt.Unchecked,
u'media/status': PluginStatus.Inactive,
u'media/players': u'webkit'
u'media/status': PluginStatus.Inactive
}

View File

@ -137,8 +137,7 @@ class PresentationMediaItem(MediaManagerItem):
if self.displayTypeComboBox.count() > 1:
self.displayTypeComboBox.insertItem(0, self.Automatic)
self.displayTypeComboBox.setCurrentIndex(0)
if Settings().value(self.settingsSection + u'/override app',
QtCore.Qt.Unchecked) == QtCore.Qt.Checked:
if Settings().value(self.settingsSection + u'/override app') == QtCore.Qt.Checked:
self.presentationWidget.show()
else:
self.presentationWidget.hide()

View File

@ -387,7 +387,7 @@ class PresentationController(object):
"""
Return whether the controller is currently enabled
"""
if Settings().value(self.settings_section + u'/' + self.name, QtCore.Qt.Checked) == QtCore.Qt.Checked:
if Settings().value(self.settings_section + u'/' + self.name) == QtCore.Qt.Checked:
return self.is_available()
else:
return False

View File

@ -101,9 +101,8 @@ class PresentationTab(SettingsTab):
for key in self.controllers:
controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name]
checkbox.setChecked(Settings().value(self.settingsSection + u'/' + controller.name, QtCore.Qt.Checked))
self.OverrideAppCheckBox.setChecked(Settings().value(self.settingsSection + u'/override app',
QtCore.Qt.Unchecked))
checkbox.setChecked(Settings().value(self.settingsSection + u'/' + controller.name))
self.OverrideAppCheckBox.setChecked(Settings().value(self.settingsSection + u'/override app'))
def save(self):
"""
@ -119,7 +118,7 @@ class PresentationTab(SettingsTab):
if controller.is_available():
checkbox = self.PresenterCheckboxes[controller.name]
setting_key = self.settingsSection + u'/' + controller.name
if Settings().value(setting_key, QtCore.Qt.Checked) != checkbox.checkState():
if Settings().value(setting_key) != checkbox.checkState():
changed = True
Settings().setValue(setting_key, checkbox.checkState())
if checkbox.isChecked():
@ -127,7 +126,7 @@ class PresentationTab(SettingsTab):
else:
controller.kill()
setting_key = self.settingsSection + u'/override app'
if Settings().value(setting_key, QtCore.Qt.Checked) != self.OverrideAppCheckBox.checkState():
if Settings().value(setting_key) != self.OverrideAppCheckBox.checkState():
Settings().setValue(setting_key, self.OverrideAppCheckBox.checkState())
changed = True
if changed:

View File

@ -169,8 +169,8 @@ class HttpServer(object):
clients. Listen out for socket connections.
"""
log.debug(u'Start TCP server')
port = Settings().value(self.plugin.settingsSection + u'/port', 4316)
address = Settings().value(self.plugin.settingsSection + u'/ip address', u'0.0.0.0')
port = Settings().value(self.plugin.settingsSection + u'/port')
address = Settings().value(self.plugin.settingsSection + u'/ip address')
self.server = QtNetwork.QTcpServer()
self.server.listen(QtNetwork.QHostAddress(address), port)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_live_changed'),
@ -389,7 +389,7 @@ class HttpConnection(object):
u'service': self.parent.plugin.serviceManager.serviceId,
u'slide': self.parent.current_slide or 0,
u'item': self.parent.current_item._uuid if self.parent.current_item else u'',
u'twelve':Settings().value(u'remotes/twelve hour', True),
u'twelve':Settings().value(u'remotes/twelve hour'),
u'blank': self.parent.plugin.liveController.blankScreen.isChecked(),
u'theme': self.parent.plugin.liveController.themeScreen.isChecked(),
u'display': self.parent.plugin.liveController.desktopScreen.isChecked()

View File

@ -135,14 +135,16 @@ class RemoteTab(SettingsTab):
self.stageUrl.setText(u'<a href="%s">%s</a>' % (url, url))
def load(self):
self.portSpinBox.setValue(Settings().value(self.settingsSection + u'/port', 4316))
self.addressEdit.setText(Settings().value(self.settingsSection + u'/ip address', ZERO_URL))
self.twelveHour = Settings().value(self.settingsSection + u'/twelve hour', True)
self.portSpinBox.setValue(Settings().value(self.settingsSection + u'/port'))
# Check constant: ZERO_URL
self.addressEdit.setText(Settings().value(self.settingsSection + u'/ip address'))
self.twelveHour = Settings().value(self.settingsSection + u'/twelve hour')
self.twelveHourCheckBox.setChecked(self.twelveHour)
self.setUrls()
def save(self):
changed = False
# FIXME: What's going on here?
if Settings().value(self.settingsSection + u'/ip address', ZERO_URL != self.addressEdit.text() or
Settings().value(self.settingsSection + u'/port', 4316) != self.portSpinBox.value()):
changed = True

View File

@ -306,7 +306,7 @@ class SongImportForm(OpenLPWizard):
self.restart()
self.finishButton.setVisible(False)
self.cancelButton.setVisible(True)
last_import_type = Settings().value(u'songs/last import type', SongFormat.OpenLyrics)
last_import_type = Settings().value(u'songs/last import type')
if last_import_type < 0 or last_import_type >= self.formatComboBox.count():
last_import_type = 0
self.formatComboBox.setCurrentIndex(last_import_type)

View File

@ -122,9 +122,9 @@ class SongMediaItem(MediaManagerItem):
self.searchTextEdit.setFocus()
def configUpdated(self):
self.searchAsYouType = Settings().value(self.settingsSection + u'/search as type', False)
self.updateServiceOnEdit = Settings().value(self.settingsSection + u'/update service on edit', False)
self.addSongFromService = Settings().value(self.settingsSection + u'/add song from service', True)
self.searchAsYouType = Settings().value(self.settingsSection + u'/search as type')
self.updateServiceOnEdit = Settings().value(self.settingsSection + u'/update service on edit')
self.addSongFromService = Settings().value(self.settingsSection + u'/add song from service',)
def retranslateUi(self):
self.searchTextLabel.setText(u'%s:' % UiStrings().Search)
@ -151,8 +151,7 @@ class SongMediaItem(MediaManagerItem):
(SongSearch.Themes, u':/slides/slide_theme.png',
UiStrings().Themes, UiStrings().SearchThemes)
])
self.searchTextEdit.setCurrentSearchType(Settings().value(
u'%s/last search type' % self.settingsSection, SongSearch.Entire))
self.searchTextEdit.setCurrentSearchType(Settings().value(u'%s/last search type' % self.settingsSection))
self.configUpdated()
def onSearchTextButtonClicked(self):
@ -470,9 +469,9 @@ 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 Settings().value(u'general/ccli number', u''):
if Settings().value(u'general/ccli number'):
service_item.raw_footer.append(translate('SongsPlugin.MediaItem', 'CCLI License: ') +
Settings().value(u'general/ccli number', u''))
Settings().value(u'general/ccli number'))
service_item.audit = [
song.title, author_list, song.copyright, unicode(song.ccli_number)
]

View File

@ -80,36 +80,24 @@ class SongsTab(SettingsTab):
'Import missing songs from service files'))
def onSearchAsTypeCheckBoxChanged(self, check_state):
self.song_search = False
# we have a set value convert to True/False
if check_state == QtCore.Qt.Checked:
self.song_search = True
self.song_search = (check_state == QtCore.Qt.Checked)
def onToolBarActiveCheckBoxChanged(self, check_state):
self.tool_bar = False
# we have a set value convert to True/False
if check_state == QtCore.Qt.Checked:
self.tool_bar = True
self.tool_bar = (check_state == QtCore.Qt.Checked)
def onUpdateOnEditCheckBoxChanged(self, check_state):
self.update_edit = False
# we have a set value convert to True/False
if check_state == QtCore.Qt.Checked:
self.update_edit = True
self.update_edit = (check_state == QtCore.Qt.Checked)
def onAddFromServiceCheckBoxChanged(self, check_state):
self.update_load = False
# we have a set value convert to True/False
if check_state == QtCore.Qt.Checked:
self.update_load = True
self.update_load = (check_state == QtCore.Qt.Checked)
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
self.song_search = settings.value(u'search as type', False)
self.tool_bar = settings.value(u'display songbar', True)
self.update_edit = settings.value(u'update service on edit', False)
self.update_load = settings.value(u'add song from service', True)
self.song_search = settings.value(u'search as type')
self.tool_bar = settings.value(u'display songbar')
self.update_edit = settings.value(u'update service on edit')
self.update_load = settings.value(u'add song from service')
self.searchAsTypeCheckBox.setChecked(self.song_search)
self.toolBarActiveCheckBox.setChecked(self.tool_bar)
self.updateOnEditCheckBox.setChecked(self.update_edit)

View File

@ -34,7 +34,7 @@ import sqlite3
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Receiver
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Receiver, PluginStatus
from openlp.core.lib.db import Manager
from openlp.core.lib.ui import UiStrings, create_action
from openlp.core.utils import get_filesystem_encoding
@ -47,11 +47,14 @@ from openlp.plugins.songs.lib.olpimport import OpenLPSongImport
log = logging.getLogger(__name__)
__default_settings__ = {
u'songs/db type': u'sqlite',
u'songs/status': PluginStatus.Inactive,
u'songs/last search type': SongSearch.Entire,
u'songs/last import type': SongFormat.OpenLyrics,
u'songs/update service on edit': False,
u'songs/search as type': False,
u'songs/add song from service': True,
u'songs/display songbar': True,
u'songs/last search type': SongSearch.Entire
u'songs/display songbar': True
}
class SongsPlugin(Plugin):

View File

@ -58,11 +58,8 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
"""
We need to set up the screen
"""
year = QtCore.QDate().currentDate().year()
if QtCore.QDate().currentDate().month() < 9:
year -= 1
toDate = Settings().value(self.plugin.settingsSection + u'/to date', QtCore.QDate(year, 8, 31))
fromDate = Settings().value(self.plugin.settingsSection + u'/from date', QtCore.QDate(year - 1, 9, 1))
toDate = Settings().value(self.plugin.settingsSection + u'/to date')
fromDate = Settings().value(self.plugin.settingsSection + u'/from date')
self.fromDate.setSelectedDate(fromDate)
self.toDate.setSelectedDate(toDate)
self.fileLineEdit.setText(SettingsManager.get_last_dir(self.plugin.settingsSection, 1))

View File

@ -46,8 +46,11 @@ __default_settings__ = {
u'songusage/db type': u'sqlite',
u'songusage/status': PluginStatus.Inactive,
u'songusage/active': False,
u'songusage/to date': QtCore.QDate.currentDate(),
u'songusage/from date': QtCore.QDate.currentDate().addYears(-1)
}
class SongUsagePlugin(Plugin):
log.info(u'SongUsage Plugin loaded')
@ -118,7 +121,7 @@ class SongUsagePlugin(Plugin):
self.displaySongUsage)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'print_service_started'),
self.printSongUsage)
self.songUsageActive = Settings().value(self.settingsSection + u'/active', False)
self.songUsageActive = Settings().value(self.settingsSection + u'/active')
# Set the button and checkbox state
self.setButtonState()
action_list = ActionList.get_instance()