forked from openlp/openlp
started to use QString v2 api
This commit is contained in:
parent
01ed8e4ed8
commit
2d99f59c84
@ -26,6 +26,8 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
import sip
|
||||
sip.setapi(u'QString', 2)
|
||||
# Import uuid now, to avoid the rare bug described in the support system:
|
||||
# http://support.openlp.org/issues/102
|
||||
# If https://bugs.gentoo.org/show_bug.cgi?id=317557 is fixed, the import can be
|
||||
|
@ -40,7 +40,7 @@ from traceback import format_exception
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver, check_directory_exists
|
||||
from openlp.core.lib import Receiver, Settings, check_directory_exists, Settings
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.core.resources import qInitResources
|
||||
from openlp.core.ui.mainwindow import MainWindow
|
||||
@ -78,7 +78,6 @@ QToolBar
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
class OpenLP(QtGui.QApplication):
|
||||
"""
|
||||
The core application class. This class inherits from Qt's QApplication
|
||||
@ -98,6 +97,7 @@ class OpenLP(QtGui.QApplication):
|
||||
"""
|
||||
Run the OpenLP application.
|
||||
"""
|
||||
|
||||
# On Windows, the args passed into the constructor are
|
||||
# ignored. Not very handy, so set the ones we want to use.
|
||||
self.args.extend(args)
|
||||
@ -111,16 +111,14 @@ 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(
|
||||
u'general/has run wizard', QtCore.QVariant(False)).toBool()
|
||||
has_run_wizard = Settings().value(
|
||||
u'general/has run wizard', False)
|
||||
if not has_run_wizard:
|
||||
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
|
||||
QtCore.QSettings().setValue(u'general/has run wizard',
|
||||
QtCore.QVariant(True))
|
||||
Settings().setValue(u'general/has run wizard', True)
|
||||
if os.name == u'nt':
|
||||
self.setStyleSheet(application_stylesheet)
|
||||
show_splash = QtCore.QSettings().value(
|
||||
u'general/show splash', QtCore.QVariant(True)).toBool()
|
||||
show_splash = Settings().value(u'general/show splash', True)
|
||||
if show_splash:
|
||||
self.splash = SplashScreen()
|
||||
self.splash.show()
|
||||
@ -139,8 +137,7 @@ class OpenLP(QtGui.QApplication):
|
||||
self.processEvents()
|
||||
if not has_run_wizard:
|
||||
self.mainWindow.firstTime()
|
||||
update_check = QtCore.QSettings().value(
|
||||
u'general/update check', QtCore.QVariant(True)).toBool()
|
||||
update_check = Settings().value(u'general/update check', True)
|
||||
if update_check:
|
||||
VersionThread(self.mainWindow).start()
|
||||
Receiver.send_message(u'live_display_blank_check')
|
||||
@ -264,8 +261,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',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
if not Settings().value(u'general/has run wizard', False):
|
||||
if not FirstTimeLanguageForm().exec_():
|
||||
# if cancel then stop processing
|
||||
sys.exit()
|
||||
|
@ -63,6 +63,22 @@ class ServiceItemAction(object):
|
||||
Next = 3
|
||||
|
||||
|
||||
class Settings(QtCore.QSettings):
|
||||
def __init__(self, *args):
|
||||
QtCore.QSettings.__init__(self, *args)
|
||||
import copy
|
||||
self.value_ = copy.deepcopy(self.value)
|
||||
self.value = copy.deepcopy(self.value2)
|
||||
|
||||
def value2(self, key, defaultValue):
|
||||
setting = self.value_(key, defaultValue)
|
||||
if isinstance(defaultValue, int):
|
||||
return setting.toInt()[0]
|
||||
if isinstance(defaultValue, basestring):
|
||||
return setting.toString()
|
||||
if isinstance(defaultValue, bool):
|
||||
return setting.toBool()
|
||||
|
||||
def translate(context, text, comment=None,
|
||||
encoding=QtCore.QCoreApplication.CodecForTr, n=-1,
|
||||
translate=QtCore.QCoreApplication.translate):
|
||||
|
@ -38,7 +38,7 @@ from sqlalchemy.exc import SQLAlchemyError, InvalidRequestError, DBAPIError, \
|
||||
from sqlalchemy.orm import scoped_session, sessionmaker, mapper
|
||||
from sqlalchemy.pool import NullPool
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import translate, Settings
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.core.utils import AppLocation, delete_file
|
||||
|
||||
@ -179,13 +179,12 @@ 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
|
||||
self.session = None
|
||||
db_type = unicode(
|
||||
settings.value(u'db type', QtCore.QVariant(u'sqlite')).toString())
|
||||
db_type = unicode(settings.value(u'db type', u'sqlite'))
|
||||
if db_type == u'sqlite':
|
||||
if db_file_name:
|
||||
self.db_url = u'sqlite:///%s/%s' % (
|
||||
@ -196,13 +195,12 @@ class Manager(object):
|
||||
AppLocation.get_section_data_path(plugin_name), plugin_name)
|
||||
else:
|
||||
self.db_url = u'%s://%s:%s@%s/%s' % (db_type,
|
||||
urlquote(unicode(settings.value(u'db username').toString())),
|
||||
urlquote(unicode(settings.value(u'db password').toString())),
|
||||
urlquote(unicode(settings.value(u'db hostname').toString())),
|
||||
urlquote(unicode(settings.value(u'db database').toString())))
|
||||
urlquote(unicode(settings.value(u'db username'))),
|
||||
urlquote(unicode(settings.value(u'db password'))),
|
||||
urlquote(unicode(settings.value(u'db hostname'))),
|
||||
urlquote(unicode(settings.value(u'db database'))))
|
||||
if db_type == u'mysql':
|
||||
db_encoding = unicode(
|
||||
settings.value(u'db encoding', u'utf8').toString())
|
||||
db_encoding = unicode(settings.value(u'db encoding', u'utf8'))
|
||||
self.db_url += u'?charset=%s' % urlquote(db_encoding)
|
||||
settings.endGroup()
|
||||
if upgrade_mod:
|
||||
|
@ -31,7 +31,7 @@ import cPickle
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import translate, Settings
|
||||
|
||||
|
||||
class FormattingTags(object):
|
||||
@ -68,8 +68,8 @@ 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',
|
||||
QtCore.QVariant(cPickle.dumps(tags) if tags else u''))
|
||||
Settings().setValue(u'displayTags/html_tags',
|
||||
cPickle.dumps(tags) if tags else u'')
|
||||
|
||||
@staticmethod
|
||||
def load_tags():
|
||||
@ -164,8 +164,7 @@ class FormattingTags(object):
|
||||
FormattingTags.add_html_tags(temporary_tags)
|
||||
|
||||
# Formatting Tags were also known as display tags.
|
||||
user_expands = QtCore.QSettings().value(u'displayTags/html_tags',
|
||||
QtCore.QVariant(u'')).toString()
|
||||
user_expands = Settings().value(u'displayTags/html_tags', u'')
|
||||
# cPickle only accepts str not unicode strings
|
||||
user_expands_string = str(user_expands)
|
||||
if user_expands_string:
|
||||
|
@ -34,7 +34,7 @@ import re
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, \
|
||||
StringContent, build_icon, translate, Receiver, ListWidgetWithDnD
|
||||
StringContent, build_icon, translate, Receiver, ListWidgetWithDnD, Settings
|
||||
from openlp.core.lib.searchedit import SearchEdit
|
||||
from openlp.core.lib.ui import UiStrings, create_widget_action, \
|
||||
critical_error_message_box
|
||||
@ -462,8 +462,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
"""
|
||||
Allows the list click action to be determined dynamically
|
||||
"""
|
||||
if QtCore.QSettings().value(u'advanced/double click live',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
if Settings().value(u'advanced/double click live', False):
|
||||
self.onLiveClick()
|
||||
else:
|
||||
self.onPreviewClick()
|
||||
@ -472,8 +471,8 @@ 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',
|
||||
QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed \
|
||||
if Settings().value(u'advanced/single click preview',
|
||||
False) and self.quickPreviewAllowed \
|
||||
and self.listView.selectedIndexes() \
|
||||
and self.autoSelectId == -1:
|
||||
self.onPreviewClick(True)
|
||||
@ -521,7 +520,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
|
||||
def createItemFromId(self, item_id):
|
||||
item = QtGui.QListWidgetItem()
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(item_id))
|
||||
item.setData(QtCore.Qt.UserRole, item_id)
|
||||
return item
|
||||
|
||||
def onAddClick(self):
|
||||
|
@ -31,7 +31,7 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Receiver
|
||||
from openlp.core.lib import Receiver, Settings
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.core.utils import get_application_version
|
||||
|
||||
@ -190,17 +190,17 @@ class Plugin(QtCore.QObject):
|
||||
"""
|
||||
Sets the status of the plugin
|
||||
"""
|
||||
self.status = QtCore.QSettings().value(
|
||||
self.settingsSection + u'/status',
|
||||
QtCore.QVariant(PluginStatus.Inactive)).toInt()[0]
|
||||
#TODO: check if [0] is needed.
|
||||
self.status = Settings().value(
|
||||
self.settingsSection + u'/status', PluginStatus.Inactive)
|
||||
|
||||
def toggleStatus(self, new_status):
|
||||
"""
|
||||
Changes the status of the plugin and remembers it
|
||||
"""
|
||||
self.status = new_status
|
||||
QtCore.QSettings().setValue(
|
||||
self.settingsSection + u'/status', QtCore.QVariant(self.status))
|
||||
Settings().setValue(
|
||||
self.settingsSection + u'/status', self.status)
|
||||
if new_status == PluginStatus.Active:
|
||||
self.initialise()
|
||||
elif new_status == PluginStatus.Inactive:
|
||||
|
@ -34,6 +34,7 @@ import os
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Settings
|
||||
from openlp.core.utils import AppLocation
|
||||
|
||||
class SettingsManager(object):
|
||||
@ -58,9 +59,7 @@ class SettingsManager(object):
|
||||
name = u'last directory %d' % num
|
||||
else:
|
||||
name = u'last directory'
|
||||
last_dir = unicode(QtCore.QSettings().value(
|
||||
section + u'/' + name, QtCore.QVariant(u'')).toString())
|
||||
return last_dir
|
||||
return unicode(Settings().value(section + u'/' + name, u''))
|
||||
|
||||
@staticmethod
|
||||
def set_last_dir(section, directory, num=None):
|
||||
@ -81,8 +80,7 @@ class SettingsManager(object):
|
||||
name = u'last directory %d' % num
|
||||
else:
|
||||
name = u'last directory'
|
||||
QtCore.QSettings().setValue(
|
||||
section + u'/' + name, QtCore.QVariant(directory))
|
||||
Settings().setValue(section + u'/' + name, directory)
|
||||
|
||||
@staticmethod
|
||||
def set_list(section, name, list):
|
||||
@ -98,15 +96,14 @@ 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]
|
||||
#TODO: check if [0] is needed.
|
||||
old_count = settings.value(u'%s count' % name, 0)
|
||||
new_count = len(list)
|
||||
settings.setValue(u'%s count' % name, QtCore.QVariant(new_count))
|
||||
settings.setValue(u'%s count' % name, new_count)
|
||||
for counter in range(new_count):
|
||||
settings.setValue(
|
||||
u'%s %d' % (name, counter), QtCore.QVariant(list[counter-1]))
|
||||
settings.setValue(u'%s %d' % (name, counter), list[counter - 1])
|
||||
if old_count > new_count:
|
||||
# Tidy up any old list items
|
||||
for counter in range(new_count, old_count):
|
||||
@ -124,15 +121,13 @@ 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]
|
||||
list_count = settings.value(u'%s count' % name, 0)
|
||||
list = []
|
||||
if list_count:
|
||||
for counter in range(list_count):
|
||||
item = unicode(
|
||||
settings.value(u'%s %d' % (name, counter)).toString())
|
||||
item = unicode(settings.value(u'%s %d' % (name, counter)))
|
||||
if item:
|
||||
list.append(item)
|
||||
settings.endGroup()
|
||||
|
@ -365,6 +365,7 @@ def create_action(parent, name, **kwargs):
|
||||
``separator``
|
||||
True in case the action will be considered a separator.
|
||||
|
||||
#FIXME: check
|
||||
``data``
|
||||
Data which is set as QVariant type.
|
||||
|
||||
@ -400,7 +401,7 @@ def create_action(parent, name, **kwargs):
|
||||
if kwargs.pop(u'separator', False):
|
||||
action.setSeparator(True)
|
||||
if u'data' in kwargs:
|
||||
action.setData(QtCore.QVariant(kwargs.pop(u'data')))
|
||||
action.setData(kwargs.pop(u'data'))
|
||||
if kwargs.get(u'shortcuts'):
|
||||
action.setShortcuts(kwargs.pop(u'shortcuts'))
|
||||
if u'context' in kwargs:
|
||||
|
@ -31,7 +31,8 @@ from datetime import datetime, timedelta
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, build_icon, Receiver
|
||||
from openlp.core.lib import Receiver, Settings, SettingsTab, translate, \
|
||||
build_icon
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.core.lib import SlideLimits
|
||||
from openlp.core.utils import get_images_filter
|
||||
@ -340,56 +341,52 @@ 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(
|
||||
u'max recent files', QtCore.QVariant(20)).toInt()[0])
|
||||
self.recentSpinBox.setMaximum(Settings().value(
|
||||
u'max recent files', 20))
|
||||
self.recentSpinBox.setValue(settings.value(u'recent file count',
|
||||
QtCore.QVariant(4)).toInt()[0])
|
||||
4))
|
||||
self.mediaPluginCheckBox.setChecked(
|
||||
settings.value(u'save current plugin',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
False))
|
||||
self.doubleClickLiveCheckBox.setChecked(
|
||||
settings.value(u'double click live',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
False))
|
||||
self.singleClickPreviewCheckBox.setChecked(
|
||||
settings.value(u'single click preview',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
False))
|
||||
self.expandServiceItemCheckBox.setChecked(
|
||||
settings.value(u'expand service item',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
False))
|
||||
self.enableAutoCloseCheckBox.setChecked(
|
||||
settings.value(u'enable exit confirmation',
|
||||
QtCore.QVariant(True)).toBool())
|
||||
True))
|
||||
self.hideMouseCheckBox.setChecked(
|
||||
settings.value(u'hide mouse', QtCore.QVariant(False)).toBool())
|
||||
settings.value(u'hide mouse', False))
|
||||
self.serviceNameDay.setCurrentIndex(
|
||||
settings.value(u'default service day',
|
||||
QtCore.QVariant(self.defaultServiceDay)).toInt()[0])
|
||||
self.defaultServiceDay))
|
||||
self.serviceNameTime.setTime(QtCore.QTime(
|
||||
settings.value(u'default service hour',
|
||||
self.defaultServiceHour).toInt()[0],
|
||||
settings.value(u'default service hour', self.defaultServiceHour),
|
||||
settings.value(u'default service minute',
|
||||
self.defaultServiceMinute).toInt()[0]))
|
||||
self.defaultServiceMinute)))
|
||||
self.shouldUpdateServiceNameExample = True
|
||||
self.serviceNameEdit.setText(settings.value(u'default service name',
|
||||
self.defaultServiceName).toString())
|
||||
default_service_enabled = settings.value(u'default service enabled',
|
||||
QtCore.QVariant(True)).toBool()
|
||||
self.defaultServiceName))
|
||||
default_service_enabled = settings.value(
|
||||
u'default service enabled', True)
|
||||
self.serviceNameCheckBox.setChecked(default_service_enabled)
|
||||
self.serviceNameCheckBoxToggled(default_service_enabled)
|
||||
self.x11BypassCheckBox.setChecked(
|
||||
settings.value(u'x11 bypass wm', QtCore.QVariant(True)).toBool())
|
||||
self.defaultColor = settings.value(u'default color',
|
||||
QtCore.QVariant(u'#ffffff')).toString()
|
||||
settings.value(u'x11 bypass wm', True))
|
||||
self.defaultColor = settings.value(u'default color', u'#ffffff')
|
||||
self.defaultFileEdit.setText(settings.value(u'default image',
|
||||
QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\
|
||||
.toString())
|
||||
self.slide_limits = settings.value(
|
||||
u'slide limits', QtCore.QVariant(SlideLimits.End)).toInt()[0]
|
||||
u':/graphics/openlp-splash-screen.png'))
|
||||
self.slide_limits = settings.value(u'slide limits', SlideLimits.End)
|
||||
if self.slide_limits == SlideLimits.End:
|
||||
self.endSlideRadioButton.setChecked(True)
|
||||
elif self.slide_limits == SlideLimits.Wrap:
|
||||
@ -404,7 +401,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())
|
||||
@ -421,25 +418,22 @@ class AdvancedTab(SettingsTab):
|
||||
self.serviceNameTime.time().hour())
|
||||
settings.setValue(u'default service minute',
|
||||
self.serviceNameTime.time().minute())
|
||||
settings.setValue(u'recent file count',
|
||||
QtCore.QVariant(self.recentSpinBox.value()))
|
||||
settings.setValue(u'recent file count', self.recentSpinBox.value())
|
||||
settings.setValue(u'save current plugin',
|
||||
QtCore.QVariant(self.mediaPluginCheckBox.isChecked()))
|
||||
self.mediaPluginCheckBox.isChecked())
|
||||
settings.setValue(u'double click live',
|
||||
QtCore.QVariant(self.doubleClickLiveCheckBox.isChecked()))
|
||||
self.doubleClickLiveCheckBox.isChecked())
|
||||
settings.setValue(u'single click preview',
|
||||
QtCore.QVariant(self.singleClickPreviewCheckBox.isChecked()))
|
||||
self.singleClickPreviewCheckBox.isChecked())
|
||||
settings.setValue(u'expand service item',
|
||||
QtCore.QVariant(self.expandServiceItemCheckBox.isChecked()))
|
||||
self.expandServiceItemCheckBox.isChecked())
|
||||
settings.setValue(u'enable exit confirmation',
|
||||
QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked()))
|
||||
settings.setValue(u'hide mouse',
|
||||
QtCore.QVariant(self.hideMouseCheckBox.isChecked()))
|
||||
settings.setValue(u'x11 bypass wm',
|
||||
QtCore.QVariant(self.x11BypassCheckBox.isChecked()))
|
||||
self.enableAutoCloseCheckBox.isChecked())
|
||||
settings.setValue(u'hide mouse', self.hideMouseCheckBox.isChecked())
|
||||
settings.setValue(u'x11 bypass wm', self.x11BypassCheckBox.isChecked())
|
||||
settings.setValue(u'default color', self.defaultColor)
|
||||
settings.setValue(u'default image', self.defaultFileEdit.text())
|
||||
settings.setValue(u'slide limits', QtCore.QVariant(self.slide_limits))
|
||||
settings.setValue(u'slide limits', self.slide_limits)
|
||||
settings.endGroup()
|
||||
if self.displayChanged:
|
||||
Receiver.send_message(u'config_screen_changed')
|
||||
|
@ -38,7 +38,7 @@ from ConfigParser import SafeConfigParser
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, \
|
||||
check_directory_exists
|
||||
check_directory_exists, Settings
|
||||
from openlp.core.utils import get_web_page, AppLocation
|
||||
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
|
||||
|
||||
@ -62,7 +62,7 @@ class ThemeScreenshotThread(QtCore.QThread):
|
||||
urllib.urlretrieve(u'%s%s' % (self.parent().web, screenshot),
|
||||
os.path.join(gettempdir(), u'openlp', screenshot))
|
||||
item = QtGui.QListWidgetItem(title, self.parent().themesListWidget)
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(filename))
|
||||
item.setData(QtCore.Qt.UserRole, filename)
|
||||
item.setCheckState(QtCore.Qt.Unchecked)
|
||||
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
|
||||
|
||||
@ -113,8 +113,8 @@ 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(
|
||||
u'general/has run wizard', QtCore.QVariant(False)).toBool()
|
||||
self.hasRunWizard = Settings().value(
|
||||
u'general/has run wizard', False)
|
||||
# Sort out internet access for downloads
|
||||
if self.webAccess:
|
||||
songs = self.config.get(u'songs', u'languages')
|
||||
@ -125,7 +125,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
filename = unicode(self.config.get(
|
||||
u'songs_%s' % song, u'filename'), u'utf8')
|
||||
item = QtGui.QListWidgetItem(title, self.songsListWidget)
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(filename))
|
||||
item.setData(QtCore.Qt.UserRole, filename)
|
||||
item.setCheckState(QtCore.Qt.Unchecked)
|
||||
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
|
||||
bible_languages = self.config.get(u'bibles', u'languages')
|
||||
@ -133,8 +133,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
for lang in bible_languages:
|
||||
language = unicode(self.config.get(
|
||||
u'bibles_%s' % lang, u'title'), u'utf8')
|
||||
# FIXME
|
||||
langItem = QtGui.QTreeWidgetItem(
|
||||
self.biblesTreeWidget, QtCore.QStringList(language))
|
||||
self.biblesTreeWidget, language)
|
||||
bibles = self.config.get(u'bibles_%s' % lang, u'translations')
|
||||
bibles = bibles.split(u',')
|
||||
for bible in bibles:
|
||||
@ -142,10 +143,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
u'bible_%s' % bible, u'title'), u'utf8')
|
||||
filename = unicode(self.config.get(
|
||||
u'bible_%s' % bible, u'filename'))
|
||||
item = QtGui.QTreeWidgetItem(
|
||||
langItem, QtCore.QStringList(title))
|
||||
item.setData(0, QtCore.Qt.UserRole,
|
||||
QtCore.QVariant(filename))
|
||||
# FIXME
|
||||
item = QtGui.QTreeWidgetItem(langItem, title)
|
||||
item.setData(0, QtCore.Qt.UserRole, filename)
|
||||
item.setCheckState(0, QtCore.Qt.Unchecked)
|
||||
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
|
||||
self.biblesTreeWidget.expandAll()
|
||||
@ -206,9 +206,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
index = self.themeComboBox.findText(theme)
|
||||
if index == -1:
|
||||
self.themeComboBox.addItem(theme)
|
||||
default_theme = unicode(QtCore.QSettings().value(
|
||||
u'themes/global theme',
|
||||
QtCore.QVariant(u'')).toString())
|
||||
default_theme = unicode(Settings().value(
|
||||
u'themes/global theme', u''))
|
||||
# Pre-select the current default theme.
|
||||
index = self.themeComboBox.findText(default_theme)
|
||||
self.themeComboBox.setCurrentIndex(index)
|
||||
@ -257,8 +256,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',
|
||||
QtCore.QVariant(True))
|
||||
Settings().setValue(u'general/has run wizard', True)
|
||||
self.close()
|
||||
|
||||
def urlGetFile(self, url, fpath):
|
||||
@ -296,7 +294,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
screenshot = self.config.get(u'theme_%s' % theme, u'screenshot')
|
||||
for index in xrange(self.themesListWidget.count()):
|
||||
item = self.themesListWidget.item(index)
|
||||
if item.data(QtCore.Qt.UserRole) == QtCore.QVariant(filename):
|
||||
if item.data(QtCore.Qt.UserRole) == filename:
|
||||
break
|
||||
item.setIcon(build_icon(
|
||||
os.path.join(gettempdir(), u'openlp', screenshot)))
|
||||
@ -456,16 +454,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',
|
||||
QtCore.QVariant(self.displayComboBox.currentIndex()))
|
||||
Settings().setValue(u'General/monitor',
|
||||
self.displayComboBox.currentIndex())
|
||||
self.screens.set_current_display(
|
||||
self.displayComboBox.currentIndex())
|
||||
self.displayComboBox.currentIndex())
|
||||
# Set Global Theme
|
||||
if self.themeComboBox.currentIndex() != -1:
|
||||
QtCore.QSettings().setValue(u'themes/global theme',
|
||||
QtCore.QVariant(self.themeComboBox.currentText()))
|
||||
Settings().setValue(u'themes/global theme',
|
||||
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))
|
||||
status = PluginStatus.Active if field.checkState() == QtCore.Qt.Checked\
|
||||
else PluginStatus.Inactive
|
||||
Settings().setValue(tag, status)
|
||||
|
@ -28,7 +28,7 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, Receiver, translate
|
||||
from openlp.core.lib import Receiver, Settings, SettingsTab, translate
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.core.ui import ScreenList
|
||||
|
||||
@ -265,53 +265,50 @@ 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())
|
||||
monitorNumber = settings.value(u'monitor',
|
||||
QtCore.QVariant(self.screens.display_count - 1)).toInt()[0]
|
||||
monitorNumber = settings.value(
|
||||
u'monitor', self.screens.display_count - 1)
|
||||
self.monitorComboBox.setCurrentIndex(monitorNumber)
|
||||
self.numberEdit.setText(unicode(settings.value(
|
||||
u'ccli number', QtCore.QVariant(u'')).toString()))
|
||||
self.usernameEdit.setText(unicode(settings.value(
|
||||
u'songselect username', QtCore.QVariant(u'')).toString()))
|
||||
self.passwordEdit.setText(unicode(settings.value(
|
||||
u'songselect password', QtCore.QVariant(u'')).toString()))
|
||||
self.numberEdit.setText(settings.value(u'ccli number', u''))
|
||||
self.usernameEdit.setText(settings.value(u'songselect username', u''))
|
||||
self.passwordEdit.setText(settings.value(u'songselect password', u''))
|
||||
self.saveCheckServiceCheckBox.setChecked(settings.value(u'save prompt',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
False))
|
||||
self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
False))
|
||||
self.displayOnMonitorCheck.setChecked(self.screens.display)
|
||||
self.warningCheckBox.setChecked(settings.value(u'blank warning',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
False))
|
||||
self.autoOpenCheckBox.setChecked(settings.value(u'auto open',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
False))
|
||||
self.showSplashCheckBox.setChecked(settings.value(u'show splash',
|
||||
QtCore.QVariant(True)).toBool())
|
||||
True))
|
||||
self.checkForUpdatesCheckBox.setChecked(settings.value(u'update check',
|
||||
QtCore.QVariant(True)).toBool())
|
||||
True))
|
||||
self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
False))
|
||||
self.timeoutSpinBox.setValue(settings.value(u'loop delay',
|
||||
QtCore.QVariant(5)).toInt()[0])
|
||||
5))
|
||||
self.monitorRadioButton.setChecked(
|
||||
not settings.value(u'override position',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
False))
|
||||
self.overrideRadioButton.setChecked(settings.value(u'override position',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
False))
|
||||
self.customXValueEdit.setValue(settings.value(u'x position',
|
||||
QtCore.QVariant(self.screens.current[u'size'].x())).toInt()[0])
|
||||
self.screens.current[u'size'].x()))
|
||||
self.customYValueEdit.setValue(settings.value(u'y position',
|
||||
QtCore.QVariant(self.screens.current[u'size'].y())).toInt()[0])
|
||||
self.screens.current[u'size'].y()))
|
||||
self.customHeightValueEdit.setValue(settings.value(u'height',
|
||||
QtCore.QVariant(self.screens.current[u'size'].height())).toInt()[0])
|
||||
self.screens.current[u'size'].height()))
|
||||
self.customWidthValueEdit.setValue(settings.value(u'width',
|
||||
QtCore.QVariant(self.screens.current[u'size'].width())).toInt()[0])
|
||||
self.screens.current[u'size'].width()))
|
||||
self.startPausedCheckBox.setChecked(settings.value(
|
||||
u'audio start paused', QtCore.QVariant(True)).toBool())
|
||||
u'audio start paused', True))
|
||||
self.repeatListCheckBox.setChecked(settings.value(
|
||||
u'audio repeat list', QtCore.QVariant(False)).toBool())
|
||||
u'audio repeat list', False))
|
||||
settings.endGroup()
|
||||
self.monitorComboBox.setDisabled(self.overrideRadioButton.isChecked())
|
||||
self.customXValueEdit.setEnabled(self.overrideRadioButton.isChecked())
|
||||
@ -327,48 +324,36 @@ 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()))
|
||||
settings.setValue(u'monitor', self.monitorComboBox.currentIndex())
|
||||
settings.setValue(u'display on monitor',
|
||||
QtCore.QVariant(self.displayOnMonitorCheck.isChecked()))
|
||||
settings.setValue(u'blank warning',
|
||||
QtCore.QVariant(self.warningCheckBox.isChecked()))
|
||||
settings.setValue(u'auto open',
|
||||
QtCore.QVariant(self.autoOpenCheckBox.isChecked()))
|
||||
settings.setValue(u'show splash',
|
||||
QtCore.QVariant(self.showSplashCheckBox.isChecked()))
|
||||
self.displayOnMonitorCheck.isChecked())
|
||||
settings.setValue(u'blank warning', self.warningCheckBox.isChecked())
|
||||
settings.setValue(u'auto open', self.autoOpenCheckBox.isChecked())
|
||||
settings.setValue(u'show splash', self.showSplashCheckBox.isChecked())
|
||||
settings.setValue(u'update check',
|
||||
QtCore.QVariant(self.checkForUpdatesCheckBox.isChecked()))
|
||||
self.checkForUpdatesCheckBox.isChecked())
|
||||
settings.setValue(u'save prompt',
|
||||
QtCore.QVariant(self.saveCheckServiceCheckBox.isChecked()))
|
||||
settings.setValue(u'auto unblank',
|
||||
QtCore.QVariant(self.autoUnblankCheckBox.isChecked()))
|
||||
settings.setValue(u'auto preview',
|
||||
QtCore.QVariant(self.autoPreviewCheckBox.isChecked()))
|
||||
settings.setValue(u'loop delay',
|
||||
QtCore.QVariant(self.timeoutSpinBox.value()))
|
||||
settings.setValue(u'ccli number',
|
||||
QtCore.QVariant(self.numberEdit.displayText()))
|
||||
self.saveCheckServiceCheckBox.isChecked())
|
||||
settings.setValue(u'auto unblank', self.autoUnblankCheckBox.isChecked())
|
||||
settings.setValue(u'auto preview', self.autoPreviewCheckBox.isChecked())
|
||||
settings.setValue(u'loop delay', self.timeoutSpinBox.value())
|
||||
settings.setValue(u'ccli number', self.numberEdit.displayText())
|
||||
settings.setValue(u'songselect username',
|
||||
QtCore.QVariant(self.usernameEdit.displayText()))
|
||||
self.usernameEdit.displayText())
|
||||
settings.setValue(u'songselect password',
|
||||
QtCore.QVariant(self.passwordEdit.displayText()))
|
||||
settings.setValue(u'x position',
|
||||
QtCore.QVariant(self.customXValueEdit.value()))
|
||||
settings.setValue(u'y position',
|
||||
QtCore.QVariant(self.customYValueEdit.value()))
|
||||
settings.setValue(u'height',
|
||||
QtCore.QVariant(self.customHeightValueEdit.value()))
|
||||
settings.setValue(u'width',
|
||||
QtCore.QVariant(self.customWidthValueEdit.value()))
|
||||
self.passwordEdit.displayText())
|
||||
settings.setValue(u'x position', self.customXValueEdit.value())
|
||||
settings.setValue(u'y position', self.customYValueEdit.value())
|
||||
settings.setValue(u'height', self.customHeightValueEdit.value())
|
||||
settings.setValue(u'width', self.customWidthValueEdit.value())
|
||||
settings.setValue(u'override position',
|
||||
QtCore.QVariant(self.overrideRadioButton.isChecked()))
|
||||
self.overrideRadioButton.isChecked())
|
||||
settings.setValue(u'audio start paused',
|
||||
QtCore.QVariant(self.startPausedCheckBox.isChecked()))
|
||||
self.startPausedCheckBox.isChecked())
|
||||
settings.setValue(u'audio repeat list',
|
||||
QtCore.QVariant(self.repeatListCheckBox.isChecked()))
|
||||
self.repeatListCheckBox.isChecked())
|
||||
settings.endGroup()
|
||||
# On save update the screens as well
|
||||
self.postSetUp(True)
|
||||
|
@ -36,7 +36,7 @@ from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
|
||||
translate, PluginManager, expand_tags
|
||||
translate, PluginManager, expand_tags, Settings
|
||||
from openlp.core.lib.theme import BackgroundType
|
||||
|
||||
from openlp.core.ui import HideMode, ScreenList, AlertLocation
|
||||
@ -134,8 +134,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',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
if Settings().value(u'advanced/x11 bypass wm', True):
|
||||
windowFlags |= QtCore.Qt.X11BypassWindowManagerHint
|
||||
# FIXME: QtCore.Qt.SplashScreen is workaround to make display screen
|
||||
# stay always on top on Mac OS X. For details see bug 906926.
|
||||
@ -195,13 +194,12 @@ class MainDisplay(Display):
|
||||
Display.setup(self)
|
||||
if self.isLive:
|
||||
# Build the initial frame.
|
||||
image_file = QtCore.QSettings().value(u'advanced/default image',
|
||||
QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\
|
||||
.toString()
|
||||
image_file = Settings().value(u'advanced/default image',
|
||||
u':/graphics/openlp-splash-screen.png')
|
||||
background_color = QtGui.QColor()
|
||||
background_color.setNamedColor(QtCore.QSettings().value(
|
||||
background_color.setNamedColor(Settings().value(
|
||||
u'advanced/default color',
|
||||
QtCore.QVariant(u'#ffffff')).toString())
|
||||
u'#ffffff'))
|
||||
if not background_color.isValid():
|
||||
background_color = QtCore.Qt.white
|
||||
splash_image = QtGui.QImage(image_file)
|
||||
@ -260,7 +258,7 @@ class MainDisplay(Display):
|
||||
height = self.frame.evaluateJavaScript(js)
|
||||
if shrink:
|
||||
if text:
|
||||
alert_height = int(height.toString())
|
||||
alert_height = int(height)
|
||||
self.resize(self.width(), alert_height)
|
||||
self.setVisible(True)
|
||||
if location == AlertLocation.Middle:
|
||||
@ -352,8 +350,8 @@ 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',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
if Settings().value(
|
||||
u'general/display on monitor', True):
|
||||
self.setVisible(True)
|
||||
else:
|
||||
self.setVisible(True)
|
||||
@ -401,8 +399,8 @@ 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',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
if Settings().value(u'general/auto unblank',
|
||||
False):
|
||||
Receiver.send_message(u'slidecontroller_live_unblank')
|
||||
else:
|
||||
self.hideDisplay(self.hideMode)
|
||||
@ -425,8 +423,8 @@ 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',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
if not Settings().value(u'general/display on monitor',
|
||||
True):
|
||||
return
|
||||
if mode == HideMode.Screen:
|
||||
self.frame.evaluateJavaScript(u'show_blank("desktop");')
|
||||
@ -450,8 +448,8 @@ 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',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
if not Settings().value(u'general/display on monitor',
|
||||
True):
|
||||
return
|
||||
self.frame.evaluateJavaScript('show_blank("show");')
|
||||
if self.isHidden():
|
||||
@ -465,8 +463,8 @@ class MainDisplay(Display):
|
||||
"""
|
||||
Hide mouse cursor when moved over display.
|
||||
"""
|
||||
if QtCore.QSettings().value(u'advanced/hide mouse',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
if Settings().value(u'advanced/hide mouse',
|
||||
False):
|
||||
self.setCursor(QtCore.Qt.BlankCursor)
|
||||
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
|
||||
else:
|
||||
|
@ -37,7 +37,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 import SlideLimits
|
||||
from openlp.core.lib import SlideLimits, Settings
|
||||
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
|
||||
ThemeManager, SlideController, PluginForm, MediaDockManager, \
|
||||
ShortcutListForm, FormattingTagForm
|
||||
@ -99,13 +99,13 @@ class Ui_MainWindow(object):
|
||||
# Create slide controllers
|
||||
self.previewController = SlideController(self)
|
||||
self.liveController = SlideController(self, True)
|
||||
previewVisible = QtCore.QSettings().value(
|
||||
u'user interface/preview panel', QtCore.QVariant(True)).toBool()
|
||||
previewVisible = Settings().value(
|
||||
u'user interface/preview panel', True)
|
||||
self.previewController.panel.setVisible(previewVisible)
|
||||
liveVisible = QtCore.QSettings().value(u'user interface/live panel',
|
||||
QtCore.QVariant(True)).toBool()
|
||||
panelLocked = QtCore.QSettings().value(u'user interface/lock panel',
|
||||
QtCore.QVariant(False)).toBool()
|
||||
liveVisible = Settings().value(u'user interface/live panel',
|
||||
True)
|
||||
panelLocked = Settings().value(u'user interface/lock panel',
|
||||
False)
|
||||
self.liveController.panel.setVisible(liveVisible)
|
||||
# Create menu
|
||||
self.menuBar = QtGui.QMenuBar(mainWindow)
|
||||
@ -684,10 +684,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',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
savedPlugin = QtCore.QSettings().value(
|
||||
u'advanced/current media plugin', QtCore.QVariant()).toInt()[0]
|
||||
if Settings().value(u'advanced/save current plugin', False):
|
||||
savedPlugin = Settings().value(
|
||||
u'advanced/current media plugin', )
|
||||
if savedPlugin != -1:
|
||||
self.mediaToolBox.setCurrentIndex(savedPlugin)
|
||||
self.settingsForm.postSetUp()
|
||||
@ -738,12 +737,12 @@ 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():
|
||||
False):
|
||||
self.serviceManagerContents.loadLastFile()
|
||||
view_mode = QtCore.QSettings().value(u'%s/view mode' % \
|
||||
self.generalSettingsSection, u'default').toString()
|
||||
view_mode = Settings().value(u'%s/view mode' % \
|
||||
self.generalSettingsSection, u'default')
|
||||
if view_mode == u'default':
|
||||
self.modeDefaultItem.setChecked(True)
|
||||
elif view_mode == u'setup':
|
||||
@ -820,12 +819,12 @@ 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():
|
||||
False):
|
||||
if settings.value(u'%s/blank warning' % self.generalSettingsSection,
|
||||
QtCore.QVariant(False)).toBool():
|
||||
False):
|
||||
QtGui.QMessageBox.question(self,
|
||||
translate('OpenLP.MainWindow',
|
||||
'OpenLP Main Display Blanked'),
|
||||
@ -954,8 +953,8 @@ 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,
|
||||
settings = Settings()
|
||||
import_settings = Settings(import_file_name,
|
||||
QtCore.QSettings.IniFormat)
|
||||
import_keys = import_settings.allKeys()
|
||||
for section_key in import_keys:
|
||||
@ -985,11 +984,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
# We have a good file, import it.
|
||||
for section_key in import_keys:
|
||||
value = import_settings.value(section_key)
|
||||
settings.setValue(u'%s' % (section_key),
|
||||
QtCore.QVariant(value))
|
||||
settings.setValue(u'%s' % (section_key), value)
|
||||
now = datetime.now()
|
||||
settings.beginGroup(self.headerSection)
|
||||
settings.setValue(u'file_imported', QtCore.QVariant(import_file_name))
|
||||
settings.setValue(u'file_imported', import_file_name)
|
||||
settings.setValue(u'file_date_imported',
|
||||
now.strftime("%Y-%m-%d %H:%M"))
|
||||
settings.endGroup()
|
||||
@ -1041,11 +1039,11 @@ 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,
|
||||
export_settings = Settings(temp_file,
|
||||
QtCore.QSettings.IniFormat)
|
||||
# Add a header section.
|
||||
# This is to insure it's our conf file for import.
|
||||
@ -1104,7 +1102,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)
|
||||
@ -1149,8 +1147,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
else:
|
||||
event.ignore()
|
||||
else:
|
||||
if QtCore.QSettings().value(u'advanced/enable exit confirmation',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
if Settings().value(u'advanced/enable exit confirmation',
|
||||
True):
|
||||
ret = QtGui.QMessageBox.question(self,
|
||||
translate('OpenLP.MainWindow', 'Close OpenLP'),
|
||||
translate('OpenLP.MainWindow',
|
||||
@ -1174,10 +1172,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',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
QtCore.QSettings().setValue(u'advanced/current media plugin',
|
||||
QtCore.QVariant(self.mediaToolBox.currentIndex()))
|
||||
if Settings().value(u'advanced/save current plugin',
|
||||
False):
|
||||
Settings().setValue(u'advanced/current media plugin',
|
||||
self.mediaToolBox.currentIndex())
|
||||
# Call the cleanup method to shutdown plugins.
|
||||
log.info(u'cleanup plugins')
|
||||
self.pluginManager.finalise_plugins()
|
||||
@ -1254,8 +1252,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
False - Hidden
|
||||
"""
|
||||
self.previewController.panel.setVisible(visible)
|
||||
QtCore.QSettings().setValue(u'user interface/preview panel',
|
||||
QtCore.QVariant(visible))
|
||||
Settings().setValue(u'user interface/preview panel', visible)
|
||||
self.viewPreviewPanel.setChecked(visible)
|
||||
|
||||
def setLockPanel(self, lock):
|
||||
@ -1286,8 +1283,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',
|
||||
QtCore.QVariant(lock))
|
||||
Settings().setValue(u'user interface/lock panel', lock)
|
||||
|
||||
def setLivePanelVisibility(self, visible):
|
||||
"""
|
||||
@ -1300,8 +1296,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
False - Hidden
|
||||
"""
|
||||
self.liveController.panel.setVisible(visible)
|
||||
QtCore.QSettings().setValue(u'user interface/live panel',
|
||||
QtCore.QVariant(visible))
|
||||
Settings().setValue(u'user interface/live panel', visible)
|
||||
self.viewLivePanel.setChecked(visible)
|
||||
|
||||
def loadSettings(self):
|
||||
@ -1310,19 +1305,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 +
|
||||
u'/enable slide loop', QtCore.QVariant(True)).toBool():
|
||||
QtCore.QSettings().setValue(self.advancedSettingsSection +
|
||||
u'/slide limits', QtCore.QVariant(SlideLimits.Wrap))
|
||||
if Settings().value(self.generalSettingsSection +
|
||||
u'/enable slide loop', True):
|
||||
Settings().setValue(self.advancedSettingsSection +
|
||||
u'/slide limits', SlideLimits.Wrap)
|
||||
else:
|
||||
QtCore.QSettings().setValue(self.advancedSettingsSection +
|
||||
u'/slide limits', QtCore.QVariant(SlideLimits.End))
|
||||
QtCore.QSettings().remove(self.generalSettingsSection +
|
||||
Settings().setValue(self.advancedSettingsSection +
|
||||
u'/slide limits', SlideLimits.End)
|
||||
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')
|
||||
@ -1331,7 +1326,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
settings.endGroup()
|
||||
settings.beginGroup(self.uiSettingsSection)
|
||||
self.move(settings.value(u'main window position',
|
||||
QtCore.QVariant(QtCore.QPoint(0, 0))).toPoint())
|
||||
QtCore.QPoint(0, 0))).toPoint()
|
||||
self.restoreGeometry(
|
||||
settings.value(u'main window geometry').toByteArray())
|
||||
self.restoreState(settings.value(u'main window state').toByteArray())
|
||||
@ -1351,25 +1346,21 @@ 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()
|
||||
recentFiles = self.recentFiles if self.recentFiles else u''
|
||||
settings.setValue(u'recent files', recentFiles)
|
||||
settings.endGroup()
|
||||
settings.beginGroup(self.uiSettingsSection)
|
||||
settings.setValue(u'main window position',
|
||||
QtCore.QVariant(self.pos()))
|
||||
settings.setValue(u'main window state',
|
||||
QtCore.QVariant(self.saveState()))
|
||||
settings.setValue(u'main window geometry',
|
||||
QtCore.QVariant(self.saveGeometry()))
|
||||
settings.setValue(u'main window position', self.pos())
|
||||
settings.setValue(u'main window state', self.saveState())
|
||||
settings.setValue(u'main window geometry', self.saveGeometry())
|
||||
settings.setValue(u'live splitter geometry',
|
||||
QtCore.QVariant(self.liveController.splitter.saveState()))
|
||||
self.liveController.splitter.saveState())
|
||||
settings.setValue(u'preview splitter geometry',
|
||||
QtCore.QVariant(self.previewController.splitter.saveState()))
|
||||
self.previewController.splitter.saveState())
|
||||
settings.setValue(u'mainwindow splitter geometry',
|
||||
QtCore.QVariant(self.controlSplitter.saveState()))
|
||||
self.controlSplitter.saveState())
|
||||
settings.endGroup()
|
||||
|
||||
def updateRecentFilesMenu(self):
|
||||
@ -1377,8 +1368,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
Updates the recent file menu with the latest list of service files
|
||||
accessed.
|
||||
"""
|
||||
recentFileCount = QtCore.QSettings().value(
|
||||
u'advanced/recent file count', QtCore.QVariant(4)).toInt()[0]
|
||||
recentFileCount = Settings().value(
|
||||
u'advanced/recent file count', 4)
|
||||
existingRecentFiles = [recentFile for recentFile in self.recentFiles
|
||||
if os.path.isfile(unicode(recentFile))]
|
||||
recentFilesToDisplay = existingRecentFiles[0:recentFileCount]
|
||||
@ -1410,8 +1401,8 @@ 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',
|
||||
QtCore.QVariant(20)).toInt()[0]
|
||||
maxRecentFiles = Settings().value(
|
||||
u'advanced/max recent files', 20)
|
||||
if filename:
|
||||
# Add some cleanup to reduce duplication in the recent file list
|
||||
filename = os.path.abspath(filename)
|
||||
@ -1422,7 +1413,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
position = self.recentFiles.indexOf(filename)
|
||||
if position != -1:
|
||||
self.recentFiles.removeAt(position)
|
||||
self.recentFiles.insert(0, QtCore.QString(filename))
|
||||
self.recentFiles.insert(0, filename)
|
||||
while self.recentFiles.count() > maxRecentFiles:
|
||||
# Don't care what API says takeLast works, removeLast doesn't!
|
||||
self.recentFiles.takeLast()
|
||||
|
@ -26,6 +26,8 @@
|
||||
###############################################################################
|
||||
import logging
|
||||
|
||||
from openlp.core.lib import Settings
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -78,12 +80,12 @@ 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 = Settings().value(u'media/players')
|
||||
if not players:
|
||||
players = u'webkit'
|
||||
reg_ex = QtCore.QRegExp(".*\[(.*)\].*")
|
||||
if QtCore.QSettings().value(u'media/override player',
|
||||
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == QtCore.Qt.Checked:
|
||||
if Settings().value(u'media/override player',
|
||||
QtCore.Qt.Unchecked) == QtCore.Qt.Checked:
|
||||
if reg_ex.exactMatch(players):
|
||||
overridden_player = u'%s' % reg_ex.cap(1)
|
||||
else:
|
||||
@ -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',
|
||||
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == \
|
||||
QtCore.Qt.Checked and overridden_player != u'auto':
|
||||
if Settings().value(u'media/override player',
|
||||
QtCore.Qt.Unchecked) == QtCore.Qt.Checked and \
|
||||
overridden_player != u'auto':
|
||||
players = players.replace(overridden_player, u'[%s]' % overridden_player)
|
||||
QtCore.QSettings().setValue(u'media/players', QtCore.QVariant(players))
|
||||
Settings().setValue(u'media/players', players)
|
||||
|
||||
from mediacontroller import MediaController
|
||||
|
@ -332,9 +332,8 @@ class MediaController(object):
|
||||
display.frame.evaluateJavaScript(u'show_video( \
|
||||
"setBackBoard", null, null, null,"visible");')
|
||||
# now start playing
|
||||
if controller.isLive and \
|
||||
(QtCore.QSettings().value(u'general/auto unblank',
|
||||
QtCore.QVariant(False)).toBool() or \
|
||||
if controller.isLive and (Settings().value(
|
||||
u'general/auto unblank', False) or
|
||||
controller.media_info.is_background == True) or \
|
||||
controller.isLive == False:
|
||||
if not self.video_play([controller]):
|
||||
|
@ -33,7 +33,7 @@ import sys
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver
|
||||
from openlp.core.lib import Receiver, Settings
|
||||
from openlp.core.lib.mediaplayer import MediaPlayer
|
||||
from openlp.core.ui.media import MediaState
|
||||
|
||||
@ -114,8 +114,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',
|
||||
QtCore.QVariant(False)).toBool() and \
|
||||
if Settings().value(u'advanced/hide mouse', False) and \
|
||||
display.controller.isLive:
|
||||
command_line_options += u' --mouse-hide-timeout=0'
|
||||
display.vlcInstance = vlc.Instance(command_line_options)
|
||||
|
@ -31,7 +31,7 @@ import os
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from lxml import html
|
||||
|
||||
from openlp.core.lib import translate, get_text_file_string, Receiver
|
||||
from openlp.core.lib import translate, get_text_file_string, Receiver, Settings
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize
|
||||
from openlp.core.utils import AppLocation
|
||||
@ -120,20 +120,18 @@ 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())
|
||||
u'print slide text', False))
|
||||
self.pageBreakAfterText.setChecked(settings.value(
|
||||
u'add page break', QtCore.QVariant(False)).toBool())
|
||||
u'add page break', False))
|
||||
if not self.slideTextCheckBox.isChecked():
|
||||
self.pageBreakAfterText.setDisabled(True)
|
||||
self.metaDataCheckBox.setChecked(settings.value(
|
||||
u'print file meta data', QtCore.QVariant(False)).toBool())
|
||||
self.notesCheckBox.setChecked(settings.value(
|
||||
u'print notes', QtCore.QVariant(False)).toBool())
|
||||
self.zoomComboBox.setCurrentIndex(settings.value(
|
||||
u'display size', QtCore.QVariant(0)).toInt()[0])
|
||||
u'print file meta data', False))
|
||||
self.notesCheckBox.setChecked(settings.value(u'print notes', False))
|
||||
self.zoomComboBox.setCurrentIndex(settings.value(u'display size', 0))
|
||||
settings.endGroup()
|
||||
# Signals
|
||||
QtCore.QObject.connect(self.printButton,
|
||||
@ -318,9 +316,9 @@ 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.setValue(u'display size', display)
|
||||
settings.endGroup()
|
||||
|
||||
def copyText(self):
|
||||
@ -389,16 +387,15 @@ 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()))
|
||||
self.slideTextCheckBox.isChecked())
|
||||
settings.setValue(u'add page break',
|
||||
QtCore.QVariant(self.pageBreakAfterText.isChecked()))
|
||||
self.pageBreakAfterText.isChecked())
|
||||
settings.setValue(u'print file meta data',
|
||||
QtCore.QVariant(self.metaDataCheckBox.isChecked()))
|
||||
settings.setValue(u'print notes',
|
||||
QtCore.QVariant(self.notesCheckBox.isChecked()))
|
||||
self.metaDataCheckBox.isChecked())
|
||||
settings.setValue(u'print notes', self.notesCheckBox.isChecked())
|
||||
settings.endGroup()
|
||||
|
||||
def update_song_usage(self):
|
||||
|
@ -33,7 +33,7 @@ import copy
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Receiver, translate
|
||||
from openlp.core.lib import Receiver, translate, Settings
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -241,22 +241,16 @@ 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])
|
||||
self.display = settings.value(
|
||||
u'display on monitor', QtCore.QVariant(True)).toBool()
|
||||
override_display = settings.value(
|
||||
u'override position', QtCore.QVariant(False)).toBool()
|
||||
x = settings.value(u'x position',
|
||||
QtCore.QVariant(self.current[u'size'].x())).toInt()[0]
|
||||
y = settings.value(u'y position',
|
||||
QtCore.QVariant(self.current[u'size'].y())).toInt()[0]
|
||||
width = settings.value(u'width',
|
||||
QtCore.QVariant(self.current[u'size'].width())).toInt()[0]
|
||||
height = settings.value(u'height',
|
||||
QtCore.QVariant(self.current[u'size'].height())).toInt()[0]
|
||||
self.display_count - 1))
|
||||
self.display = settings.value(u'display on monitor', True)
|
||||
override_display = settings.value(u'override position', False)
|
||||
x = settings.value(u'x position', self.current[u'size'].x())
|
||||
y = settings.value(u'y position', self.current[u'size'].y())
|
||||
width = settings.value(u'width', self.current[u'size'].width())
|
||||
height = settings.value(u'height', self.current[u'size'].height())
|
||||
self.override[u'size'] = QtCore.QRect(x, y, width, height)
|
||||
self.override[u'primary'] = False
|
||||
settings.endGroup()
|
||||
|
@ -38,7 +38,7 @@ log = logging.getLogger(__name__)
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \
|
||||
ItemCapabilities, SettingsManager, translate, str_to_bool
|
||||
ItemCapabilities, SettingsManager, translate, str_to_bool, Settings
|
||||
from openlp.core.lib.theme import ThemeLevel
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
|
||||
create_widget_action, find_and_set_in_combo_box
|
||||
@ -274,9 +274,9 @@ 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())
|
||||
u''))
|
||||
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
|
||||
# build the drag and drop context menu
|
||||
self.dndMenu = QtGui.QMenu()
|
||||
@ -350,10 +350,9 @@ class ServiceManager(QtGui.QWidget):
|
||||
Setter for service file.
|
||||
"""
|
||||
self._fileName = unicode(fileName)
|
||||
self.mainwindow.setServiceModified(self.isModified(),
|
||||
self.shortFileName())
|
||||
QtCore.QSettings(). \
|
||||
setValue(u'servicemanager/last file',QtCore.QVariant(fileName))
|
||||
self.mainwindow.setServiceModified(
|
||||
self.isModified(), self.shortFileName())
|
||||
Settings().setValue(u'servicemanager/last file', fileName)
|
||||
|
||||
def fileName(self):
|
||||
"""
|
||||
@ -371,9 +370,8 @@ class ServiceManager(QtGui.QWidget):
|
||||
"""
|
||||
Triggered when Config dialog is updated.
|
||||
"""
|
||||
self.expandTabs = QtCore.QSettings().value(
|
||||
u'advanced/expand service item',
|
||||
QtCore.QVariant(u'False')).toBool()
|
||||
self.expandTabs = Settings().value(
|
||||
u'advanced/expand service item', False)
|
||||
|
||||
def supportedSuffixes(self, suffix):
|
||||
self.suffixes.append(suffix)
|
||||
@ -433,7 +431,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
|
||||
def onRecentServiceClicked(self):
|
||||
sender = self.sender()
|
||||
self.loadFile(sender.data().toString())
|
||||
self.loadFile(sender.data())
|
||||
|
||||
def newFile(self):
|
||||
"""
|
||||
@ -444,8 +442,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
self.setFileName(u'')
|
||||
self.serviceId += 1
|
||||
self.setModified(False)
|
||||
QtCore.QSettings(). \
|
||||
setValue(u'servicemanager/last file',QtCore.QVariant(u''))
|
||||
Settings().setValue(u'servicemanager/last file', u'')
|
||||
Receiver.send_message(u'servicemanager_new_service')
|
||||
|
||||
def saveFile(self):
|
||||
@ -593,17 +590,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(
|
||||
u'advanced/default service enabled', QtCore.QVariant(True)).toBool()
|
||||
default_service_enabled = Settings().value(
|
||||
u'advanced/default service enabled', True)
|
||||
if default_service_enabled:
|
||||
service_day = 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,13 +608,13 @@ 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: '
|
||||
'/\\?*|<>\[\]":+\nSee http://docs.python.org/library/'
|
||||
'datetime.html#strftime-strptime-behavior for more '
|
||||
'information.')).toString())
|
||||
'information.')))
|
||||
default_filename = time.strftime(default_pattern)
|
||||
else:
|
||||
default_filename = u''
|
||||
@ -692,8 +689,8 @@ class ServiceManager(QtGui.QWidget):
|
||||
self.setFileName(fileName)
|
||||
self.mainwindow.addRecentFile(fileName)
|
||||
self.setModified(False)
|
||||
QtCore.QSettings().setValue(
|
||||
'servicemanager/last file', QtCore.QVariant(fileName))
|
||||
Settings().setValue(
|
||||
'servicemanager/last file', fileName)
|
||||
else:
|
||||
critical_error_message_box(
|
||||
message=translate('OpenLP.ServiceManager',
|
||||
@ -734,8 +731,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
service was last closed. Can be blank if there was no service
|
||||
present.
|
||||
"""
|
||||
fileName = QtCore.QSettings(). \
|
||||
value(u'servicemanager/last file',QtCore.QVariant(u'')).toString()
|
||||
fileName = Settings().value(u'servicemanager/last file', u'')
|
||||
if fileName:
|
||||
self.loadFile(fileName)
|
||||
|
||||
@ -1062,15 +1058,14 @@ class ServiceManager(QtGui.QWidget):
|
||||
.is_capable(ItemCapabilities.HasVariableStartTime):
|
||||
tips.append(item[u'service_item'].get_media_time())
|
||||
treewidgetitem.setToolTip(0, u'<br>'.join(tips))
|
||||
treewidgetitem.setData(0, QtCore.Qt.UserRole,
|
||||
QtCore.QVariant(item[u'order']))
|
||||
treewidgetitem.setData(0, QtCore.Qt.UserRole, item[u'order'])
|
||||
treewidgetitem.setSelected(item[u'selected'])
|
||||
# Add the children to their parent treewidgetitem.
|
||||
for count, frame in enumerate(serviceitem.get_frames()):
|
||||
child = QtGui.QTreeWidgetItem(treewidgetitem)
|
||||
text = frame[u'title'].replace(u'\n', u' ')
|
||||
child.setText(0, text[:40])
|
||||
child.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(count))
|
||||
child.setData(0, QtCore.Qt.UserRole, count)
|
||||
if serviceItem == itemcount:
|
||||
if item[u'expanded'] and serviceItemChild == count:
|
||||
self.serviceManagerList.setCurrentItem(child)
|
||||
@ -1106,10 +1101,9 @@ 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))
|
||||
u'/service theme', self.service_theme)
|
||||
self.regenerateServiceItems(True)
|
||||
|
||||
def themeChange(self):
|
||||
@ -1287,9 +1281,9 @@ 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():
|
||||
False):
|
||||
item += 1
|
||||
if self.serviceItems and item < len(self.serviceItems) and \
|
||||
self.serviceItems[item][u'service_item'].is_capable(
|
||||
|
@ -30,7 +30,7 @@ import re
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver
|
||||
from openlp.core.lib import Receiver, Settings
|
||||
from openlp.core.utils import translate
|
||||
from openlp.core.utils.actions import ActionList
|
||||
from shortcutlistdialog import Ui_ShortcutListDialog
|
||||
@ -131,8 +131,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
actionText = REMOVE_AMPERSAND.sub('', unicode(action.text()))
|
||||
actionItem = QtGui.QTreeWidgetItem([actionText])
|
||||
actionItem.setIcon(0, action.icon())
|
||||
actionItem.setData(0,
|
||||
QtCore.Qt.UserRole, QtCore.QVariant(action))
|
||||
actionItem.setData(0, QtCore.Qt.UserRole, action)
|
||||
item.addChild(actionItem)
|
||||
self.treeWidget.addTopLevelItem(item)
|
||||
item.setExpanded(True)
|
||||
@ -337,7 +336,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.
|
||||
@ -349,8 +348,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
map(QtGui.QKeySequence.toString, action.shortcuts()))
|
||||
action.setShortcuts(self.changedActions[action])
|
||||
self.action_list.update_shortcut_map(action, old_shortcuts)
|
||||
settings.setValue(
|
||||
action.objectName(), QtCore.QVariant(action.shortcuts()))
|
||||
settings.setValue(action.objectName(), action.shortcuts())
|
||||
settings.endGroup()
|
||||
|
||||
def onClearPrimaryButtonClicked(self, toggled):
|
||||
|
@ -35,7 +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 import SlideLimits, ServiceItemAction
|
||||
from openlp.core.lib import SlideLimits, ServiceItemAction, Settings
|
||||
from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList
|
||||
from openlp.core.utils.actions import ActionList, CategoryOrder
|
||||
|
||||
@ -236,8 +236,8 @@ 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 +
|
||||
u'/enable slide loop', QtCore.QVariant(True)).toBool():
|
||||
if Settings().value(self.parent().generalSettingsSection +
|
||||
u'/enable slide loop', True):
|
||||
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
|
||||
else:
|
||||
self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
|
||||
@ -662,9 +662,9 @@ 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]
|
||||
SlideLimits.End)
|
||||
|
||||
def enableToolBar(self, item):
|
||||
"""
|
||||
@ -692,9 +692,9 @@ 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:
|
||||
True) and self.slideList:
|
||||
self.songMenu.show()
|
||||
if item.is_capable(ItemCapabilities.CanLoop) and \
|
||||
len(item.get_frames()) > 1:
|
||||
@ -813,14 +813,14 @@ 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(
|
||||
False)
|
||||
if Settings().value(
|
||||
self.parent().generalSettingsSection + \
|
||||
u'/audio start paused',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
True):
|
||||
self.audioPauseItem.setChecked(True)
|
||||
self.display.audioPlayer.pause()
|
||||
else:
|
||||
@ -930,9 +930,8 @@ 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(
|
||||
self.parent().generalSettingsSection + u'/screen blank',
|
||||
QtCore.QVariant(u'')).toString()
|
||||
display_type = Settings().value(
|
||||
self.parent().generalSettingsSection + u'/screen blank', u'')
|
||||
if self.screens.which_screen(self.window()) != \
|
||||
self.screens.which_screen(self.display):
|
||||
# Order done to handle initial conversion
|
||||
@ -971,11 +970,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'))
|
||||
u'blanked')
|
||||
else:
|
||||
QtCore.QSettings().remove(
|
||||
Settings().remove(
|
||||
self.parent().generalSettingsSection + u'/screen blank')
|
||||
self.blankPlugin()
|
||||
self.updatePreview()
|
||||
@ -992,11 +991,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'))
|
||||
u'themed')
|
||||
else:
|
||||
QtCore.QSettings().remove(
|
||||
Settings().remove(
|
||||
self.parent().generalSettingsSection + u'/screen blank')
|
||||
self.blankPlugin()
|
||||
self.updatePreview()
|
||||
@ -1013,11 +1012,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'))
|
||||
u'hidden')
|
||||
else:
|
||||
QtCore.QSettings().remove(
|
||||
Settings().remove(
|
||||
self.parent().generalSettingsSection + u'/screen blank')
|
||||
self.hidePlugin(checked)
|
||||
self.updatePreview()
|
||||
@ -1311,8 +1310,8 @@ class SlideController(Controller):
|
||||
"""
|
||||
triggered by clicking the Preview slide items
|
||||
"""
|
||||
if QtCore.QSettings().value(u'advanced/double click live',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
if Settings().value(u'advanced/double click live',
|
||||
False):
|
||||
# Live and Preview have issues if we have video or presentations
|
||||
# playing in both at the same time.
|
||||
if self.serviceItem.is_command():
|
||||
@ -1397,5 +1396,4 @@ class SlideController(Controller):
|
||||
|
||||
def onTrackTriggered(self):
|
||||
action = self.sender()
|
||||
index = action.data().toInt()[0]
|
||||
self.display.audioPlayer.goTo(index)
|
||||
self.display.audioPlayer.goTo(action.data())
|
||||
|
@ -350,38 +350,38 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
if self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Solid):
|
||||
self.colorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_color)
|
||||
self.setField(u'background_type', QtCore.QVariant(0))
|
||||
self.theme.background_color)
|
||||
self.setField(u'background_type', 0)
|
||||
elif self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Gradient):
|
||||
self.gradientStartButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_start_color)
|
||||
self.gradientEndButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_end_color)
|
||||
self.setField(u'background_type', QtCore.QVariant(1))
|
||||
self.setField(u'background_type', 1)
|
||||
elif self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Image):
|
||||
self.imageColorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_border_color)
|
||||
self.imageFileEdit.setText(self.theme.background_filename)
|
||||
self.setField(u'background_type', QtCore.QVariant(2))
|
||||
self.setField(u'background_type', 2)
|
||||
elif self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Transparent):
|
||||
self.setField(u'background_type', QtCore.QVariant(3))
|
||||
self.setField(u'background_type', 3)
|
||||
if self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
|
||||
self.setField(u'gradient', QtCore.QVariant(0))
|
||||
self.setField(u'gradient', 0)
|
||||
elif self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.Vertical):
|
||||
self.setField(u'gradient', QtCore.QVariant(1))
|
||||
self.setField(u'gradient', 1)
|
||||
elif self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.Circular):
|
||||
self.setField(u'gradient', QtCore.QVariant(2))
|
||||
self.setField(u'gradient', 2)
|
||||
elif self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.LeftTop):
|
||||
self.setField(u'gradient', QtCore.QVariant(3))
|
||||
self.setField(u'gradient', 3)
|
||||
else:
|
||||
self.setField(u'gradient', QtCore.QVariant(4))
|
||||
self.setField(u'gradient', 4)
|
||||
|
||||
def setMainAreaPageValues(self):
|
||||
"""
|
||||
@ -391,26 +391,19 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
QtGui.QFont(self.theme.font_main_name))
|
||||
self.mainColorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.font_main_color)
|
||||
self.setField(u'mainSizeSpinBox',
|
||||
QtCore.QVariant(self.theme.font_main_size))
|
||||
self.setField(u'mainSizeSpinBox', self.theme.font_main_size)
|
||||
self.setField(u'lineSpacingSpinBox',
|
||||
QtCore.QVariant(self.theme.font_main_line_adjustment))
|
||||
self.setField(u'outlineCheckBox',
|
||||
QtCore.QVariant(self.theme.font_main_outline))
|
||||
self.theme.font_main_line_adjustment)
|
||||
self.setField(u'outlineCheckBox', self.theme.font_main_outline)
|
||||
self.outlineColorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.font_main_outline_color)
|
||||
self.setField(u'outlineSizeSpinBox',
|
||||
QtCore.QVariant(self.theme.font_main_outline_size))
|
||||
self.setField(u'shadowCheckBox',
|
||||
QtCore.QVariant(self.theme.font_main_shadow))
|
||||
self.setField(u'outlineSizeSpinBox', self.theme.font_main_outline_size)
|
||||
self.setField(u'shadowCheckBox', self.theme.font_main_shadow)
|
||||
self.shadowColorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.font_main_shadow_color)
|
||||
self.setField(u'shadowSizeSpinBox',
|
||||
QtCore.QVariant(self.theme.font_main_shadow_size))
|
||||
self.setField(u'mainBoldCheckBox',
|
||||
QtCore.QVariant(self.theme.font_main_bold))
|
||||
self.setField(u'mainItalicsCheckBox',
|
||||
QtCore.QVariant(self.theme.font_main_italics))
|
||||
self.setField(u'shadowSizeSpinBox', self.theme.font_main_shadow_size)
|
||||
self.setField(u'mainBoldCheckBox', self.theme.font_main_bold)
|
||||
self.setField(u'mainItalicsCheckBox', self.theme.font_main_italics)
|
||||
|
||||
def setFooterAreaPageValues(self):
|
||||
"""
|
||||
@ -420,8 +413,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
QtGui.QFont(self.theme.font_footer_name))
|
||||
self.footerColorButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.font_footer_color)
|
||||
self.setField(u'footerSizeSpinBox',
|
||||
QtCore.QVariant(self.theme.font_footer_size))
|
||||
self.setField(u'footerSizeSpinBox', self.theme.font_footer_size)
|
||||
|
||||
def setPositionPageValues(self):
|
||||
"""
|
||||
@ -429,40 +421,31 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
"""
|
||||
# Main Area
|
||||
self.mainPositionCheckBox.setChecked(not self.theme.font_main_override)
|
||||
self.setField(u'mainPositionX', QtCore.QVariant(self.theme.font_main_x))
|
||||
self.setField(u'mainPositionY', QtCore.QVariant(self.theme.font_main_y))
|
||||
self.setField(u'mainPositionHeight',
|
||||
QtCore.QVariant(self.theme.font_main_height))
|
||||
self.setField(u'mainPositionWidth',
|
||||
QtCore.QVariant(self.theme.font_main_width))
|
||||
self.setField(u'mainPositionX', self.theme.font_main_x)
|
||||
self.setField(u'mainPositionY', self.theme.font_main_y)
|
||||
self.setField(u'mainPositionHeight', self.theme.font_main_height)
|
||||
self.setField(u'mainPositionWidth', self.theme.font_main_width)
|
||||
# Footer
|
||||
self.footerPositionCheckBox.setChecked(
|
||||
not self.theme.font_footer_override)
|
||||
self.setField(u'footerPositionX',
|
||||
QtCore.QVariant(self.theme.font_footer_x))
|
||||
self.setField(u'footerPositionY',
|
||||
QtCore.QVariant(self.theme.font_footer_y))
|
||||
self.setField(u'footerPositionHeight',
|
||||
QtCore.QVariant(self.theme.font_footer_height))
|
||||
self.setField(u'footerPositionWidth',
|
||||
QtCore.QVariant(self.theme.font_footer_width))
|
||||
self.setField(u'footerPositionX', self.theme.font_footer_x)
|
||||
self.setField(u'footerPositionY', self.theme.font_footer_y)
|
||||
self.setField(u'footerPositionHeight', self.theme.font_footer_height)
|
||||
self.setField(u'footerPositionWidth', self.theme.font_footer_width)
|
||||
|
||||
def setAlignmentPageValues(self):
|
||||
"""
|
||||
Handle the display and state of the Alignments page.
|
||||
"""
|
||||
self.setField(u'horizontal',
|
||||
QtCore.QVariant(self.theme.display_horizontal_align))
|
||||
self.setField(u'vertical',
|
||||
QtCore.QVariant(self.theme.display_vertical_align))
|
||||
self.setField(u'slideTransition',
|
||||
QtCore.QVariant(self.theme.display_slide_transition))
|
||||
self.setField(u'horizontal', self.theme.display_horizontal_align)
|
||||
self.setField(u'vertical', self.theme.display_vertical_align)
|
||||
self.setField(u'slideTransition', self.theme.display_slide_transition)
|
||||
|
||||
def setPreviewPageValues(self):
|
||||
"""
|
||||
Handle the display and state of the Preview page.
|
||||
"""
|
||||
self.setField(u'name', QtCore.QVariant(self.theme.theme_name))
|
||||
self.setField(u'name', self.theme.theme_name)
|
||||
|
||||
def onBackgroundComboBoxCurrentIndexChanged(self, index):
|
||||
"""
|
||||
|
@ -36,7 +36,7 @@ from xml.etree.ElementTree import ElementTree, XML
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, get_text_file_string, build_icon, \
|
||||
Receiver, SettingsManager, translate, check_item_selected, \
|
||||
Receiver, Settings, SettingsManager, translate, check_item_selected, \
|
||||
check_directory_exists, create_thumb, validate_thumb
|
||||
from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, \
|
||||
BackgroundGradientType
|
||||
@ -164,9 +164,8 @@ class ThemeManager(QtGui.QWidget):
|
||||
"""
|
||||
Triggered when Config dialog is updated.
|
||||
"""
|
||||
self.global_theme = unicode(QtCore.QSettings().value(
|
||||
self.settingsSection + u'/global theme',
|
||||
QtCore.QVariant(u'')).toString())
|
||||
self.global_theme = Settings().value(
|
||||
self.settingsSection + u'/global theme', u'')
|
||||
|
||||
def checkListState(self, item):
|
||||
"""
|
||||
@ -244,9 +243,8 @@ class ThemeManager(QtGui.QWidget):
|
||||
name = unicode(translate('OpenLP.ThemeManager',
|
||||
'%s (default)')) % self.global_theme
|
||||
self.themeListWidget.item(count).setText(name)
|
||||
QtCore.QSettings().setValue(
|
||||
self.settingsSection + u'/global theme',
|
||||
QtCore.QVariant(self.global_theme))
|
||||
Settings().setValue(
|
||||
self.settingsSection + u'/global theme', self.global_theme)
|
||||
Receiver.send_message(u'theme_update_global',
|
||||
self.global_theme)
|
||||
self._pushThemes()
|
||||
@ -448,9 +446,8 @@ class ThemeManager(QtGui.QWidget):
|
||||
theme = ThemeXML()
|
||||
theme.theme_name = UiStrings().Default
|
||||
self._writeTheme(theme, None, None)
|
||||
QtCore.QSettings().setValue(
|
||||
self.settingsSection + u'/global theme',
|
||||
QtCore.QVariant(theme.theme_name))
|
||||
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 characters.
|
||||
@ -475,7 +472,7 @@ class ThemeManager(QtGui.QWidget):
|
||||
else:
|
||||
icon = create_thumb(theme, thumb)
|
||||
item_name.setIcon(icon)
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(text_name))
|
||||
item_name.setData(QtCore.Qt.UserRole, text_name)
|
||||
self.themeListWidget.addItem(item_name)
|
||||
self.theme_list.append(text_name)
|
||||
self._pushThemes()
|
||||
@ -767,9 +764,8 @@ 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.settingsSection + u'/global theme',
|
||||
QtCore.QVariant(u'')).toString())
|
||||
self.global_theme = unicode(Settings().value(
|
||||
self.settingsSection + u'/global theme', u''))
|
||||
if check_item_selected(self.themeListWidget, select_text):
|
||||
item = self.themeListWidget.currentItem()
|
||||
theme = unicode(item.text())
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, Receiver, translate
|
||||
from openlp.core.lib import Receiver, Settings, SettingsTab, translate
|
||||
from openlp.core.lib.theme import ThemeLevel
|
||||
from openlp.core.lib.ui import UiStrings, find_and_set_in_combo_box
|
||||
|
||||
@ -132,11 +132,11 @@ 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]
|
||||
self.global_theme = unicode(settings.value(u'global theme').toString())
|
||||
self.theme_level = settings.value(u'theme level', ThemeLevel.Song)
|
||||
# TODO: check empty string (logic).
|
||||
self.global_theme = settings.value(u'global theme', u'')
|
||||
settings.endGroup()
|
||||
if self.theme_level == ThemeLevel.Global:
|
||||
self.GlobalLevelRadioButton.setChecked(True)
|
||||
@ -146,10 +146,10 @@ 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))
|
||||
settings.setValue(u'theme level', self.theme_level)
|
||||
settings.setValue(u'global theme', self.global_theme)
|
||||
settings.endGroup()
|
||||
self.mainwindow.renderer.set_global_theme(
|
||||
self.global_theme, self.theme_level)
|
||||
@ -183,15 +183,14 @@ 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.settingsSection + u'/global theme',
|
||||
QtCore.QVariant(u'')).toString())
|
||||
self.global_theme = Settings().value(
|
||||
self.settingsSection + u'/global theme', u'')
|
||||
self.DefaultComboBox.clear()
|
||||
self.DefaultComboBox.addItems(theme_list)
|
||||
find_and_set_in_combo_box(self.DefaultComboBox, self.global_theme)
|
||||
self.mainwindow.renderer.set_global_theme(
|
||||
self.global_theme, self.theme_level)
|
||||
if self.global_theme is not u'':
|
||||
if self.global_theme:
|
||||
self.__previewGlobalTheme()
|
||||
|
||||
def __previewGlobalTheme(self):
|
||||
|
@ -37,6 +37,8 @@ import sys
|
||||
import time
|
||||
import urllib2
|
||||
|
||||
from openlp.core.lib import Settings
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
|
||||
if sys.platform != u'win32' and sys.platform != u'darwin':
|
||||
@ -281,12 +283,12 @@ 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())
|
||||
datetime.now().date()))
|
||||
this_test = unicode(datetime.now().date())
|
||||
settings.setValue(u'last version test', QtCore.QVariant(this_test))
|
||||
settings.setValue(u'last version test', this_test)
|
||||
settings.endGroup()
|
||||
if last_test != this_test:
|
||||
if current_version[u'build']:
|
||||
|
@ -28,6 +28,8 @@
|
||||
The :mod:`~openlp.core.utils.actions` module provides action list classes used
|
||||
by the shortcuts system.
|
||||
"""
|
||||
from openlp.core.lib import Settings
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
class ActionCategory(object):
|
||||
@ -226,10 +228,9 @@ 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()
|
||||
shortcuts = settings.value(action.objectName(), action.shortcuts())
|
||||
settings.endGroup()
|
||||
if not shortcuts:
|
||||
action.setShortcuts([])
|
||||
|
@ -34,7 +34,7 @@ import sys
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import translate, Settings
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -75,13 +75,16 @@ class LanguageManager(object):
|
||||
AppLocation.LanguageDir))
|
||||
trans_dir = QtCore.QDir(AppLocation.get_directory(
|
||||
AppLocation.LanguageDir))
|
||||
file_names = trans_dir.entryList(QtCore.QStringList(u'*.qm'),
|
||||
QtCore.QDir.Files, QtCore.QDir.Name)
|
||||
file_names = trans_dir.entryList(
|
||||
u'*.qm', QtCore.QDir.Files, QtCore.QDir.Name)
|
||||
# Remove qm files from the list which start with "qt_".
|
||||
file_names = file_names.filter(QtCore.QRegExp("^(?!qt_)"))
|
||||
file_names = filter(
|
||||
lambda file_: not file_.startswith(u'qt_'), file_names)
|
||||
names = []
|
||||
for name in file_names:
|
||||
file_names.replaceInStrings(name, trans_dir.filePath(name))
|
||||
return file_names
|
||||
names.append(trans_dir.filePath(name))
|
||||
#file_names.replaceInStrings(name, trans_dir.filePath(name))
|
||||
return names
|
||||
|
||||
@staticmethod
|
||||
def language_name(qm_file):
|
||||
@ -101,9 +104,8 @@ class LanguageManager(object):
|
||||
"""
|
||||
Retrieve a saved language to use from settings
|
||||
"""
|
||||
settings = QtCore.QSettings()
|
||||
language = unicode(settings.value(
|
||||
u'general/language', QtCore.QVariant(u'[en]')).toString())
|
||||
settings = Settings()
|
||||
language = unicode(settings.value(u'general/language', u'[en]'))
|
||||
log.info(u'Language file: \'%s\' Loaded from conf file' % language)
|
||||
reg_ex = QtCore.QRegExp("^\[(.*)\]")
|
||||
if reg_ex.exactMatch(language):
|
||||
@ -133,8 +135,7 @@ class LanguageManager(object):
|
||||
language = unicode(qm_list[action_name])
|
||||
if LanguageManager.auto_language:
|
||||
language = u'[%s]' % language
|
||||
QtCore.QSettings().setValue(
|
||||
u'general/language', QtCore.QVariant(language))
|
||||
Settings().setValue(u'general/language', language)
|
||||
log.info(u'Language file: \'%s\' written to conf file' % language)
|
||||
if message:
|
||||
QtGui.QMessageBox.information(None,
|
||||
|
@ -29,7 +29,8 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
|
||||
Settings
|
||||
from openlp.core.lib.db import Manager
|
||||
from openlp.core.lib.ui import create_action, UiStrings
|
||||
from openlp.core.lib.theme import VerticalType
|
||||
@ -160,8 +161,8 @@ class AlertsPlugin(Plugin):
|
||||
|
||||
def toggleAlertsState(self):
|
||||
self.alertsActive = not self.alertsActive
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/active',
|
||||
QtCore.QVariant(self.alertsActive))
|
||||
Settings().setValue(self.settingsSection + u'/active',
|
||||
self.alertsActive)
|
||||
|
||||
def onAlertsTrigger(self):
|
||||
self.alertForm.loadList()
|
||||
|
@ -77,7 +77,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
||||
order_by_ref=AlertItem.text)
|
||||
for alert in alerts:
|
||||
item_name = QtGui.QListWidgetItem(alert.text)
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(alert.id))
|
||||
item_name.setData(QtCore.Qt.UserRole, alert.id)
|
||||
self.alertListWidget.addItem(item_name)
|
||||
|
||||
def onDisplayClicked(self):
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver, Settings
|
||||
from openlp.core.ui import AlertLocation
|
||||
from openlp.core.lib.ui import UiStrings, create_valign_selection_widgets
|
||||
|
||||
@ -152,19 +152,15 @@ 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(
|
||||
u'font color', QtCore.QVariant(u'#ffffff')).toString())
|
||||
self.font_size = settings.value(
|
||||
u'font size', QtCore.QVariant(40)).toInt()[0]
|
||||
self.bg_color = unicode(settings.value(
|
||||
u'background color', QtCore.QVariant(u'#660000')).toString())
|
||||
self.timeout = settings.value(u'timeout', 5)
|
||||
self.font_color = unicode(settings.value(u'font color', u'#ffffff'))
|
||||
self.font_size = settings.value(u'font size', 40)
|
||||
self.bg_color = unicode(settings.value(u'background color', u'#660000'))
|
||||
self.font_face = unicode(settings.value(
|
||||
u'font face', QtCore.QVariant(QtGui.QFont().family())).toString())
|
||||
self.location = settings.value(
|
||||
u'location', QtCore.QVariant(AlertLocation.Bottom)).toInt()[0]
|
||||
u'font face', QtGui.QFont().family()))
|
||||
self.location = settings.value(u'location', AlertLocation.Bottom)
|
||||
settings.endGroup()
|
||||
self.fontSizeSpinBox.setValue(self.font_size)
|
||||
self.timeoutSpinBox.setValue(self.timeout)
|
||||
@ -180,20 +176,20 @@ 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] != \
|
||||
if settings.value(u'location', 1) != \
|
||||
self.verticalComboBox.currentIndex():
|
||||
self.changed = True
|
||||
settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
|
||||
settings.setValue(u'font color', QtCore.QVariant(self.font_color))
|
||||
settings.setValue(u'font size', QtCore.QVariant(self.font_size))
|
||||
settings.setValue(u'background color', self.bg_color)
|
||||
settings.setValue(u'font color', self.font_color)
|
||||
settings.setValue(u'font size', self.font_size)
|
||||
self.font_face = self.fontComboBox.currentFont().family()
|
||||
settings.setValue(u'font face', QtCore.QVariant(self.font_face))
|
||||
settings.setValue(u'timeout', QtCore.QVariant(self.timeout))
|
||||
settings.setValue(u'font face', self.font_face)
|
||||
settings.setValue(u'timeout', self.timeout)
|
||||
self.location = self.verticalComboBox.currentIndex()
|
||||
settings.setValue(u'location', QtCore.QVariant(self.location))
|
||||
settings.setValue(u'location', self.location)
|
||||
settings.endGroup()
|
||||
if self.changed:
|
||||
Receiver.send_message(u'update_display_css')
|
||||
|
@ -29,7 +29,8 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
|
||||
Settings
|
||||
from openlp.core.lib.ui import create_action, UiStrings
|
||||
from openlp.core.utils.actions import ActionList
|
||||
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
|
||||
@ -91,11 +92,11 @@ 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(
|
||||
u'bookname language', QtCore.QVariant(0)).toInt()[0])
|
||||
u'bookname language', 0))
|
||||
settings.remove(u'bookname language')
|
||||
settings.endGroup()
|
||||
|
||||
|
@ -33,7 +33,7 @@ import locale
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver, translate
|
||||
from openlp.core.lib import Receiver, translate, Settings
|
||||
from openlp.core.lib.db import delete_database
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||
@ -590,32 +590,26 @@ 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)
|
||||
self.cancelButton.setVisible(True)
|
||||
self.setField(u'source_format', QtCore.QVariant(0))
|
||||
self.setField(u'osis_location', QtCore.QVariant(''))
|
||||
self.setField(u'csv_booksfile', QtCore.QVariant(''))
|
||||
self.setField(u'csv_versefile', QtCore.QVariant(''))
|
||||
self.setField(u'opensong_file', QtCore.QVariant(''))
|
||||
self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk))
|
||||
self.setField(u'source_format', 0)
|
||||
self.setField(u'osis_location', '')
|
||||
self.setField(u'csv_booksfile', '')
|
||||
self.setField(u'csv_versefile', '')
|
||||
self.setField(u'opensong_file', '')
|
||||
self.setField(u'web_location', WebDownload.Crosswalk)
|
||||
self.setField(u'web_biblename',
|
||||
QtCore.QVariant(self.webTranslationComboBox.currentIndex()))
|
||||
self.setField(u'proxy_server',
|
||||
settings.value(u'proxy address', QtCore.QVariant(u'')))
|
||||
self.setField(u'proxy_username',
|
||||
settings.value(u'proxy username', QtCore.QVariant(u'')))
|
||||
self.setField(u'proxy_password',
|
||||
settings.value(u'proxy password', QtCore.QVariant(u'')))
|
||||
self.setField(u'openlp1_location', QtCore.QVariant(''))
|
||||
self.setField(u'license_version',
|
||||
QtCore.QVariant(self.versionNameEdit.text()))
|
||||
self.setField(u'license_copyright',
|
||||
QtCore.QVariant(self.copyrightEdit.text()))
|
||||
self.setField(u'license_permissions',
|
||||
QtCore.QVariant(self.permissionsEdit.text()))
|
||||
self.webTranslationComboBox.currentIndex())
|
||||
self.setField(u'proxy_server', settings.value(u'proxy address', u''))
|
||||
self.setField(u'proxy_username', settings.value(u'proxy username', u''))
|
||||
self.setField(u'proxy_password', settings.value(u'proxy password', u''))
|
||||
self.setField(u'openlp1_location', '')
|
||||
self.setField(u'license_version', self.versionNameEdit.text())
|
||||
self.setField(u'license_copyright', self.copyrightEdit.text())
|
||||
self.setField(u'license_permissions', self.permissionsEdit.text())
|
||||
self.onWebSourceComboBoxIndexChanged(WebDownload.Crosswalk)
|
||||
settings.endGroup()
|
||||
|
||||
|
@ -34,7 +34,7 @@ from tempfile import gettempdir
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver, SettingsManager, translate, \
|
||||
check_directory_exists
|
||||
check_directory_exists, Settings
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||
from openlp.core.utils import AppLocation, delete_file
|
||||
@ -341,7 +341,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()
|
||||
|
@ -33,7 +33,7 @@ import re
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import translate, Settings
|
||||
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -185,13 +185,13 @@ 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()),
|
||||
unicode(settings.value(u'range separator').toString()),
|
||||
unicode(settings.value(u'list separator').toString()),
|
||||
unicode(settings.value(u'end separator').toString())]
|
||||
settings.value(u'verse separator'),
|
||||
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'':
|
||||
|
@ -29,7 +29,7 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver, SettingsTab, translate
|
||||
from openlp.core.lib import Receiver, SettingsTab, translate, Settings
|
||||
from openlp.core.lib.ui import UiStrings, find_and_set_in_combo_box
|
||||
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
|
||||
update_reference_separators, get_reference_separator, LanguageSelection
|
||||
@ -414,18 +414,14 @@ 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()
|
||||
self.display_style = settings.value(
|
||||
u'display brackets', QtCore.QVariant(0)).toInt()[0]
|
||||
self.layout_style = settings.value(
|
||||
u'verse layout style', QtCore.QVariant(0)).toInt()[0]
|
||||
self.bible_theme = unicode(
|
||||
settings.value(u'bible theme', QtCore.QVariant(u'')).toString())
|
||||
self.second_bibles = settings.value(
|
||||
u'second bibles', QtCore.QVariant(True)).toBool()
|
||||
self.show_new_chapters = settings.value(u'display new chapter', False)
|
||||
self.display_style = settings.value(u'display brackets', 0)
|
||||
self.layout_style = settings.value(u'verse layout style', 0)
|
||||
#TODO: Check
|
||||
self.bible_theme = unicode(settings.value(u'bible theme', u''))
|
||||
self.second_bibles = settings.value(u'second bibles', True)
|
||||
self.newChaptersCheckBox.setChecked(self.show_new_chapters)
|
||||
self.displayStyleComboBox.setCurrentIndex(self.display_style)
|
||||
self.layoutStyleComboBox.setCurrentIndex(self.layout_style)
|
||||
@ -482,24 +478,19 @@ class BiblesTab(SettingsTab):
|
||||
self.endSeparatorLineEdit.setPalette(
|
||||
self.getGreyTextPalette(False))
|
||||
self.endSeparatorCheckBox.setChecked(True)
|
||||
self.language_selection = settings.value(
|
||||
u'book name language', QtCore.QVariant(0)).toInt()[0]
|
||||
self.language_selection = settings.value(u'book name language', 0)
|
||||
self.languageSelectionComboBox.setCurrentIndex(self.language_selection)
|
||||
settings.endGroup()
|
||||
|
||||
def save(self):
|
||||
settings = QtCore.QSettings()
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
settings.setValue(u'display new chapter',
|
||||
QtCore.QVariant(self.show_new_chapters))
|
||||
settings.setValue(u'display brackets',
|
||||
QtCore.QVariant(self.display_style))
|
||||
settings.setValue(u'verse layout style',
|
||||
QtCore.QVariant(self.layout_style))
|
||||
settings.setValue(u'book name language',
|
||||
QtCore.QVariant(self.language_selection))
|
||||
settings.setValue(u'second bibles', QtCore.QVariant(self.second_bibles))
|
||||
settings.setValue(u'bible theme', QtCore.QVariant(self.bible_theme))
|
||||
settings.setValue(u'display new chapter', self.show_new_chapters)
|
||||
settings.setValue(u'display brackets', self.display_style)
|
||||
settings.setValue(u'verse layout style', self.layout_style)
|
||||
settings.setValue(u'book name language', self.language_selection)
|
||||
settings.setValue(u'second bibles', self.second_bibles)
|
||||
settings.setValue(u'bible theme', self.bible_theme)
|
||||
if self.verseSeparatorCheckBox.isChecked():
|
||||
settings.setValue(u'verse separator',
|
||||
self.verseSeparatorLineEdit.text())
|
||||
|
@ -30,7 +30,7 @@ import os
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Receiver, SettingsManager, translate
|
||||
from openlp.core.lib import Receiver, SettingsManager, translate, Settings
|
||||
from openlp.core.utils import AppLocation, delete_file
|
||||
from openlp.plugins.bibles.lib import parse_reference, \
|
||||
get_reference_separator, LanguageSelection
|
||||
@ -125,9 +125,8 @@ class BibleManager(object):
|
||||
self.web = u'Web'
|
||||
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',
|
||||
QtCore.QVariant(u'')).toString())
|
||||
self.proxy_name = unicode(Settings().value(
|
||||
self.settingsSection + u'/proxy name', u''))
|
||||
self.suffix = u'.sqlite'
|
||||
self.import_wizard = None
|
||||
self.reload_bibles()
|
||||
@ -334,9 +333,8 @@ 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(
|
||||
self.settingsSection + u'/bookname language',
|
||||
QtCore.QVariant(0)).toInt()[0]
|
||||
language_selection = Settings().value(
|
||||
self.settingsSection + u'/bookname language', 0)
|
||||
reflist = parse_reference(versetext, self.db_cache[bible],
|
||||
language_selection, book_ref_id)
|
||||
if reflist:
|
||||
@ -381,9 +379,8 @@ 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(
|
||||
self.settingsSection + u'/bookname language',
|
||||
QtCore.QVariant(0)).toInt()[0]
|
||||
return Settings().value(
|
||||
self.settingsSection + u'/bookname language', 0)
|
||||
|
||||
def verse_search(self, bible, second_bible, text):
|
||||
"""
|
||||
@ -437,7 +434,7 @@ class BibleManager(object):
|
||||
})
|
||||
return None
|
||||
|
||||
def save_meta_data(self, bible, version, copyright, permissions,
|
||||
def save_meta_data(self, bible, version, copyright, permissions,
|
||||
book_name_language=None):
|
||||
"""
|
||||
Saves the bibles meta data.
|
||||
@ -456,7 +453,7 @@ class BibleManager(object):
|
||||
"""
|
||||
log.debug(u'get_meta %s,%s', bible, key)
|
||||
return self.db_cache[bible].get_object(BibleMeta, key)
|
||||
|
||||
|
||||
def update_book(self, bible, book):
|
||||
"""
|
||||
Update a book of the bible.
|
||||
|
@ -31,7 +31,7 @@ import locale
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||
translate, create_separated_list
|
||||
translate, create_separated_list, Settings
|
||||
from openlp.core.lib.searchedit import SearchEdit
|
||||
from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, \
|
||||
create_horizontal_adjusting_combo_box, critical_error_message_box, \
|
||||
@ -101,7 +101,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
reference = bitem.data(QtCore.Qt.UserRole)
|
||||
if isinstance(reference, QtCore.QVariant):
|
||||
reference = reference.toPyObject()
|
||||
obj = reference[QtCore.QString(key)]
|
||||
obj = reference[unicode(key)]
|
||||
if isinstance(obj, QtCore.QVariant):
|
||||
obj = obj.toPyObject()
|
||||
return unicode(obj).strip()
|
||||
@ -294,8 +294,8 @@ class BibleMediaItem(MediaManagerItem):
|
||||
|
||||
def configUpdated(self):
|
||||
log.debug(u'configUpdated')
|
||||
if QtCore.QSettings().value(self.settingsSection + u'/second bibles',
|
||||
QtCore.QVariant(True)).toBool():
|
||||
if Settings().value(self.settingsSection + u'/second bibles',
|
||||
True):
|
||||
self.advancedSecondLabel.setVisible(True)
|
||||
self.advancedSecondComboBox.setVisible(True)
|
||||
self.quickSecondLabel.setVisible(True)
|
||||
@ -362,9 +362,9 @@ 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])
|
||||
BibleSearch.Reference))
|
||||
self.configUpdated()
|
||||
log.debug(u'bible manager initialise complete')
|
||||
|
||||
@ -386,17 +386,16 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.advancedVersionComboBox.addItems(bibles)
|
||||
self.advancedSecondComboBox.addItems(bibles)
|
||||
# set the default value
|
||||
bible = QtCore.QSettings().value(
|
||||
self.settingsSection + u'/advanced bible',
|
||||
QtCore.QVariant(u'')).toString()
|
||||
bible = Settings().value(
|
||||
self.settingsSection + u'/advanced bible', u'')
|
||||
if bible in bibles:
|
||||
find_and_set_in_combo_box(self.advancedVersionComboBox, bible)
|
||||
self.initialiseAdvancedBible(unicode(bible))
|
||||
elif bibles:
|
||||
self.initialiseAdvancedBible(bibles[0])
|
||||
bible = QtCore.QSettings().value(
|
||||
self.settingsSection + u'/quick bible', QtCore.QVariant(
|
||||
self.quickVersionComboBox.currentText())).toString()
|
||||
bible = Settings().value(
|
||||
self.settingsSection + u'/quick bible',
|
||||
self.quickVersionComboBox.currentText())
|
||||
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
|
||||
|
||||
def reloadBibles(self, process=False):
|
||||
@ -417,7 +416,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
|
||||
``bible``
|
||||
The bible to initialise (unicode).
|
||||
|
||||
|
||||
``last_book_id``
|
||||
The "book reference id" of the book which is choosen at the moment.
|
||||
(int)
|
||||
@ -453,14 +452,14 @@ class BibleMediaItem(MediaManagerItem):
|
||||
book[u'book_reference_id'])
|
||||
self.advancedBookComboBox.addItem(data[u'name'])
|
||||
self.advancedBookComboBox.setItemData(
|
||||
row, QtCore.QVariant(book[u'book_reference_id']))
|
||||
row, book[u'book_reference_id'])
|
||||
if first:
|
||||
first = False
|
||||
first_book = book
|
||||
initialise_chapter_verse = True
|
||||
if last_book_id and last_book_id == int(book[u'book_reference_id']):
|
||||
index = self.advancedBookComboBox.findData(
|
||||
QtCore.QVariant(book[u'book_reference_id']))
|
||||
book[u'book_reference_id'])
|
||||
if index == -1:
|
||||
# Not Found.
|
||||
index = 0
|
||||
@ -497,12 +496,11 @@ class BibleMediaItem(MediaManagerItem):
|
||||
"""
|
||||
log.debug(u'updateAutoCompleter')
|
||||
# Save the current search type to the configuration.
|
||||
QtCore.QSettings().setValue(u'%s/last search type' %
|
||||
self.settingsSection,
|
||||
QtCore.QVariant(self.quickSearchEdit.currentSearchType()))
|
||||
Settings().setValue(u'%s/last search type' %
|
||||
self.settingsSection, self.quickSearchEdit.currentSearchType())
|
||||
# Save the current bible to the configuration.
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/quick bible',
|
||||
QtCore.QVariant(self.quickVersionComboBox.currentText()))
|
||||
Settings().setValue(self.settingsSection + u'/quick bible',
|
||||
self.quickVersionComboBox.currentText())
|
||||
books = []
|
||||
# We have to do a 'Reference Search'.
|
||||
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
|
||||
@ -596,22 +594,22 @@ 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))
|
||||
self.settings.layout_style)
|
||||
|
||||
def onAdvancedStyleComboBoxChanged(self):
|
||||
self.settings.layout_style = self.advancedStyleComboBox.currentIndex()
|
||||
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))
|
||||
self.settings.layout_style)
|
||||
|
||||
def onAdvancedVersionComboBox(self):
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/advanced bible',
|
||||
QtCore.QVariant(self.advancedVersionComboBox.currentText()))
|
||||
Settings().setValue(self.settingsSection + u'/advanced bible',
|
||||
self.advancedVersionComboBox.currentText())
|
||||
self.initialiseAdvancedBible(
|
||||
unicode(self.advancedVersionComboBox.currentText()),
|
||||
self.advancedBookComboBox.itemData(
|
||||
@ -855,24 +853,24 @@ class BibleMediaItem(MediaManagerItem):
|
||||
verse.book.book_reference_id)
|
||||
book = data[u'name']
|
||||
data = {
|
||||
'book': QtCore.QVariant(book),
|
||||
'chapter': QtCore.QVariant(verse.chapter),
|
||||
'verse': QtCore.QVariant(verse.verse),
|
||||
'bible': QtCore.QVariant(bible),
|
||||
'version': QtCore.QVariant(version),
|
||||
'copyright': QtCore.QVariant(copyright),
|
||||
'permissions': QtCore.QVariant(permissions),
|
||||
'text': QtCore.QVariant(verse.text),
|
||||
'second_bible': QtCore.QVariant(second_bible),
|
||||
'second_version': QtCore.QVariant(second_version),
|
||||
'second_copyright': QtCore.QVariant(second_copyright),
|
||||
'second_permissions': QtCore.QVariant(second_permissions),
|
||||
'second_text': QtCore.QVariant(u'')
|
||||
'book': book,
|
||||
'chapter': verse.chapter,
|
||||
'verse': verse.verse,
|
||||
'bible': bible,
|
||||
'version': version,
|
||||
'copyright': copyright,
|
||||
'permissions': permissions,
|
||||
'text': verse.text,
|
||||
'second_bible': second_bible,
|
||||
'second_version': second_version,
|
||||
'second_copyright': second_copyright,
|
||||
'second_permissions': second_permissions,
|
||||
'second_text': u''
|
||||
}
|
||||
if second_bible:
|
||||
try:
|
||||
data[u'second_text'] = QtCore.QVariant(
|
||||
self.second_search_results[count].text)
|
||||
data[u'second_text'] = \
|
||||
self.second_search_results[count].text
|
||||
except IndexError:
|
||||
log.exception(u'The second_search_results does not have as '
|
||||
'many verses as the search_results.')
|
||||
@ -883,7 +881,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
bible_text = u'%s %d%s%d (%s)' % (book, verse.chapter,
|
||||
verse_separator, verse.verse, version)
|
||||
bible_verse = QtGui.QListWidgetItem(bible_text)
|
||||
bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
|
||||
bible_verse.setData(QtCore.Qt.UserRole, data)
|
||||
items.append(bible_verse)
|
||||
return items
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate
|
||||
from openlp.core.lib import SettingsTab, translate, Settings
|
||||
|
||||
class CustomTab(SettingsTab):
|
||||
"""
|
||||
@ -66,11 +66,10 @@ class CustomTab(SettingsTab):
|
||||
self.displayFooter = True
|
||||
|
||||
def load(self):
|
||||
self.displayFooter = QtCore.QSettings().value(
|
||||
self.settingsSection + u'/display footer',
|
||||
QtCore.QVariant(True)).toBool()
|
||||
self.displayFooter = Settings().value(
|
||||
self.settingsSection + u'/display footer', True)
|
||||
self.displayFooterCheckBox.setChecked(self.displayFooter)
|
||||
|
||||
def save(self):
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/display footer',
|
||||
QtCore.QVariant(self.displayFooter))
|
||||
Settings().setValue(self.settingsSection + u'/display footer',
|
||||
self.displayFooter)
|
||||
|
@ -32,7 +32,7 @@ from PyQt4 import QtCore, QtGui
|
||||
from sqlalchemy.sql import or_, func
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||
check_item_selected, translate
|
||||
check_item_selected, translate, Settings
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.plugins.custom.forms import EditCustomForm
|
||||
from openlp.plugins.custom.lib import CustomXMLParser
|
||||
@ -99,9 +99,8 @@ class CustomMediaItem(MediaManagerItem):
|
||||
])
|
||||
self.loadList(self.manager.get_all_objects(
|
||||
CustomSlide, order_by_ref=CustomSlide.title))
|
||||
self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value(
|
||||
u'%s/last search type' % self.settingsSection,
|
||||
QtCore.QVariant(CustomSearch.Titles)).toInt()[0])
|
||||
self.searchTextEdit.setCurrentSearchType(Settings().value(
|
||||
u'%s/last search type' % self.settingsSection, CustomSearch.Titles))
|
||||
|
||||
def loadList(self, custom_slides):
|
||||
# Sort out what custom we want to select after loading the list.
|
||||
@ -113,8 +112,7 @@ class CustomMediaItem(MediaManagerItem):
|
||||
cmp=locale.strcoll, key=lambda custom: custom.title.lower())
|
||||
for custom_slide in custom_slides:
|
||||
custom_name = QtGui.QListWidgetItem(custom_slide.title)
|
||||
custom_name.setData(
|
||||
QtCore.Qt.UserRole, QtCore.QVariant(custom_slide.id))
|
||||
custom_name.setData(QtCore.Qt.UserRole, custom_slide.id)
|
||||
self.listView.addItem(custom_name)
|
||||
# Auto-select the custom.
|
||||
if custom_slide.id == self.autoSelectId:
|
||||
@ -218,8 +216,8 @@ 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',
|
||||
QtCore.QVariant(True)).toBool() or credit:
|
||||
if Settings().value(self.settingsSection + u'/display footer',
|
||||
True) or credit:
|
||||
raw_footer.append(title + u' ' + credit)
|
||||
else:
|
||||
raw_footer.append(u'')
|
||||
@ -228,9 +226,8 @@ class CustomMediaItem(MediaManagerItem):
|
||||
|
||||
def onSearchTextButtonClicked(self):
|
||||
# Save the current search type to the configuration.
|
||||
QtCore.QSettings().setValue(u'%s/last search type' %
|
||||
self.settingsSection,
|
||||
QtCore.QVariant(self.searchTextEdit.currentSearchType()))
|
||||
Settings().setValue(u'%s/last search type' %
|
||||
self.settingsSection, self.searchTextEdit.currentSearchType())
|
||||
# Reload the list considering the new search type.
|
||||
search_keywords = unicode(self.searchTextEdit.displayText())
|
||||
search_results = []
|
||||
|
@ -29,8 +29,8 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
import logging
|
||||
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
|
||||
Receiver
|
||||
from openlp.core.lib import build_icon, Plugin, Receiver, Settings, \
|
||||
StringContent, translate
|
||||
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -94,6 +94,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
|
||||
+ u'/background color', QtCore.QVariant(u'#000000')))
|
||||
background = QtGui.QColor(Settings().value(self.settingsSection
|
||||
+ u'/background color', u'#000000'))
|
||||
self.liveController.imageManager.update_images(u'image', background)
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||
from openlp.core.lib import Receiver, Settings, SettingsTab, translate
|
||||
|
||||
class ImageTab(SettingsTab):
|
||||
"""
|
||||
@ -82,19 +82,18 @@ 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())
|
||||
self.bg_color = unicode(settings.value(u'background color', u'#000000'))
|
||||
self.initial_color = self.bg_color
|
||||
settings.endGroup()
|
||||
self.backgroundColorButton.setStyleSheet(
|
||||
u'background-color: %s' % self.bg_color)
|
||||
|
||||
def save(self):
|
||||
settings = QtCore.QSettings()
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
|
||||
settings.setValue(u'background color', self.bg_color)
|
||||
settings.endGroup()
|
||||
if self.initial_color != self.bg_color:
|
||||
Receiver.send_message(u'image_updated')
|
||||
|
@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
|
||||
SettingsManager, translate, check_item_selected, check_directory_exists, \
|
||||
Receiver, create_thumb, validate_thumb
|
||||
Receiver, create_thumb, validate_thumb, Settings
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
from openlp.core.utils import AppLocation, delete_file, get_images_filter
|
||||
|
||||
@ -141,7 +141,7 @@ class ImageMediaItem(MediaManagerItem):
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
item_name.setIcon(icon)
|
||||
item_name.setToolTip(imageFile)
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(imageFile))
|
||||
item_name.setData(QtCore.Qt.UserRole, imageFile)
|
||||
self.listView.addItem(item_name)
|
||||
if not initialLoad:
|
||||
self.plugin.formParent.incrementProgressBar()
|
||||
@ -151,8 +151,8 @@ class ImageMediaItem(MediaManagerItem):
|
||||
|
||||
def generateSlideData(self, service_item, item=None, xmlVersion=False,
|
||||
remote=False):
|
||||
background = QtGui.QColor(QtCore.QSettings().value(self.settingsSection
|
||||
+ u'/background color', QtCore.QVariant(u'#000000')))
|
||||
background = QtGui.QColor(Settings().value(self.settingsSection
|
||||
+ u'/background color', u'#000000'))
|
||||
if item:
|
||||
items = [item]
|
||||
else:
|
||||
@ -220,9 +220,8 @@ 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(
|
||||
self.settingsSection + u'/background color',
|
||||
QtCore.QVariant(u'#000000')))
|
||||
background = QtGui.QColor(Settings().value(
|
||||
self.settingsSection + u'/background color', u'#000000'))
|
||||
item = self.listView.selectedIndexes()[0]
|
||||
bitem = self.listView.item(item.row())
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
|
@ -293,13 +293,13 @@ class MediaMediaItem(MediaManagerItem):
|
||||
filename = os.path.split(unicode(track))[1]
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
item_name.setIcon(build_icon(CLAPPERBOARD))
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
|
||||
item_name.setData(QtCore.Qt.UserRole, track)
|
||||
else:
|
||||
filename = os.path.split(unicode(track))[1]
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
#TODO: add the appropriate Icon
|
||||
#item_name.setIcon(build_icon(DVD_ICON))
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
|
||||
item_name.setData(QtCore.Qt.UserRole, track)
|
||||
item_name.setToolTip(track)
|
||||
self.listView.addItem(item_name)
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||
from openlp.core.lib import Receiver, Settings, SettingsTab, translate
|
||||
from openlp.core.lib.ui import UiStrings, create_button
|
||||
from openlp.core.ui.media import get_media_players, set_media_players
|
||||
class MediaQCheckBox(QtGui.QCheckBox):
|
||||
@ -186,9 +186,8 @@ class MediaTab(SettingsTab):
|
||||
else:
|
||||
checkbox.setChecked(False)
|
||||
self.updatePlayerList()
|
||||
self.overridePlayerCheckBox.setChecked(QtCore.QSettings().value(
|
||||
self.settingsSection + u'/override player',
|
||||
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
|
||||
self.overridePlayerCheckBox.setChecked(Settings().value(
|
||||
self.settingsSection + u'/override player', QtCore.Qt.Unchecked))
|
||||
|
||||
def save(self):
|
||||
override_changed = False
|
||||
@ -200,10 +199,10 @@ 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,
|
||||
QtCore.QVariant(self.overridePlayerCheckBox.checkState()))
|
||||
Settings().setValue(setting_key,
|
||||
self.overridePlayerCheckBox.checkState())
|
||||
override_changed = True
|
||||
if override_changed:
|
||||
Receiver.send_message(u'mediaitem_media_rebuild')
|
||||
|
@ -29,7 +29,8 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
|
||||
Settings
|
||||
from openlp.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')
|
||||
@ -140,8 +141,7 @@ class MediaPlugin(Plugin):
|
||||
if player != u'phonon']
|
||||
new_players.insert(0, u'phonon')
|
||||
self.mediaController.mediaPlayers[u'phonon'].isActive = True
|
||||
settings.setValue(u'players', \
|
||||
QtCore.QVariant(u','.join(new_players)))
|
||||
settings.setValue(u'players', u','.join(new_players))
|
||||
self.settingsTab.load()
|
||||
settings.remove(u'use phonon')
|
||||
settings.endGroup()
|
||||
|
@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, \
|
||||
translate, check_item_selected, Receiver, ItemCapabilities, create_thumb, \
|
||||
validate_thumb
|
||||
validate_thumb, Settings
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
|
||||
create_horizontal_adjusting_combo_box
|
||||
from openlp.plugins.presentations.lib import MessageListener
|
||||
@ -149,8 +149,8 @@ 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',
|
||||
QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
|
||||
if Settings().value(self.settingsSection + u'/override app',
|
||||
QtCore.Qt.Unchecked) == QtCore.Qt.Checked:
|
||||
self.presentationWidget.show()
|
||||
else:
|
||||
self.presentationWidget.hide()
|
||||
@ -211,7 +211,7 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
'This type of presentation is not supported.'))
|
||||
continue
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||
item_name.setData(QtCore.Qt.UserRole, file)
|
||||
item_name.setIcon(icon)
|
||||
item_name.setToolTip(file)
|
||||
self.listView.addItem(item_name)
|
||||
|
@ -32,7 +32,7 @@ import shutil
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Receiver, check_directory_exists, create_thumb, \
|
||||
validate_thumb
|
||||
validate_thumb, Settings
|
||||
from openlp.core.utils import AppLocation
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -392,10 +392,8 @@ class PresentationController(object):
|
||||
"""
|
||||
Return whether the controller is currently enabled
|
||||
"""
|
||||
if QtCore.QSettings().value(
|
||||
self.settings_section + u'/' + self.name,
|
||||
QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0] == \
|
||||
QtCore.Qt.Checked:
|
||||
if Settings().value(self.settings_section + u'/' + self.name,
|
||||
QtCore.Qt.Checked) == QtCore.Qt.Checked:
|
||||
return self.is_available()
|
||||
else:
|
||||
return False
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver, SettingsTab, translate
|
||||
from openlp.core.lib import Receiver, Settings, SettingsTab, translate
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
|
||||
class PresentationTab(SettingsTab):
|
||||
@ -102,12 +102,11 @@ 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.settingsSection + u'/override app',
|
||||
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
|
||||
QtCore.Qt.Checked))
|
||||
self.OverrideAppCheckBox.setChecked(Settings().value(
|
||||
self.settingsSection + u'/override app', QtCore.Qt.Unchecked))
|
||||
|
||||
def save(self):
|
||||
"""
|
||||
@ -123,20 +122,20 @@ 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,
|
||||
QtCore.QVariant(checkbox.checkState()))
|
||||
Settings().setValue(setting_key,
|
||||
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,
|
||||
QtCore.QVariant(self.OverrideAppCheckBox.checkState()))
|
||||
Settings().setValue(setting_key,
|
||||
self.OverrideAppCheckBox.checkState())
|
||||
changed = True
|
||||
if changed:
|
||||
Receiver.send_message(u'mediaitem_presentation_rebuild')
|
||||
|
@ -121,7 +121,7 @@ import urlparse
|
||||
from PyQt4 import QtCore, QtNetwork
|
||||
from mako.template import Template
|
||||
|
||||
from openlp.core.lib import Receiver, PluginStatus, StringContent
|
||||
from openlp.core.lib import Receiver, Settings, PluginStatus, StringContent
|
||||
from openlp.core.utils import AppLocation, translate
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -169,12 +169,10 @@ class HttpServer(object):
|
||||
clients. Listen out for socket connections.
|
||||
"""
|
||||
log.debug(u'Start TCP server')
|
||||
port = QtCore.QSettings().value(
|
||||
self.plugin.settingsSection + u'/port',
|
||||
QtCore.QVariant(4316)).toInt()[0]
|
||||
address = QtCore.QSettings().value(
|
||||
self.plugin.settingsSection + u'/ip address',
|
||||
QtCore.QVariant(u'0.0.0.0')).toString()
|
||||
port = Settings().value(
|
||||
self.plugin.settingsSection + u'/port', 4316)
|
||||
address = Settings().value(
|
||||
self.plugin.settingsSection + u'/ip address', u'0.0.0.0')
|
||||
self.server = QtNetwork.QTcpServer()
|
||||
self.server.listen(QtNetwork.QHostAddress(address), port)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
@ -404,14 +402,11 @@ 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'remotes/twelve hour', QtCore.QVariant(True)).toBool(),
|
||||
u'blank': self.parent.plugin.liveController.blankScreen.\
|
||||
isChecked(),
|
||||
u'theme': self.parent.plugin.liveController.themeScreen.\
|
||||
isChecked(),
|
||||
u'display': self.parent.plugin.liveController.desktopScreen.\
|
||||
isChecked()
|
||||
u'twelve': Settings().value(u'remotes/twelve hour', True),
|
||||
u'blank': self.parent.plugin.liveController.blankScreen.isChecked(),
|
||||
u'theme': self.parent.plugin.liveController.themeScreen.isChecked(),
|
||||
u'display': \
|
||||
self.parent.plugin.liveController.desktopScreen.isChecked()
|
||||
}
|
||||
return HttpResponse(json.dumps({u'results': result}),
|
||||
{u'Content-Type': u'application/json'})
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui, QtNetwork
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||
from openlp.core.lib import Settings, SettingsTab, translate, Receiver
|
||||
|
||||
ZERO_URL = u'0.0.0.0'
|
||||
|
||||
@ -149,30 +149,29 @@ class RemoteTab(SettingsTab):
|
||||
|
||||
def load(self):
|
||||
self.portSpinBox.setValue(
|
||||
QtCore.QSettings().value(self.settingsSection + u'/port',
|
||||
QtCore.QVariant(4316)).toInt()[0])
|
||||
Settings().value(self.settingsSection + u'/port',
|
||||
4316))
|
||||
self.addressEdit.setText(
|
||||
QtCore.QSettings().value(self.settingsSection + u'/ip address',
|
||||
QtCore.QVariant(ZERO_URL)).toString())
|
||||
self.twelveHour = QtCore.QSettings().value(
|
||||
self.settingsSection + u'/twelve hour',
|
||||
QtCore.QVariant(True)).toBool()
|
||||
Settings().value(self.settingsSection + u'/ip address',
|
||||
ZERO_URL))
|
||||
self.twelveHour = Settings().value(
|
||||
self.settingsSection + u'/twelve hour', True)
|
||||
self.twelveHourCheckBox.setChecked(self.twelveHour)
|
||||
self.setUrls()
|
||||
|
||||
def save(self):
|
||||
changed = False
|
||||
if QtCore.QSettings().value(self.settingsSection + u'/ip address',
|
||||
QtCore.QVariant(ZERO_URL).toString() != self.addressEdit.text() or
|
||||
QtCore.QSettings().value(self.settingsSection + u'/port',
|
||||
QtCore.QVariant(4316).toInt()[0]) != self.portSpinBox.value()):
|
||||
if Settings().value(self.settingsSection + u'/ip address',
|
||||
ZERO_URL != self.addressEdit.text() or
|
||||
Settings().value(self.settingsSection + u'/port',
|
||||
4316) != self.portSpinBox.value()):
|
||||
changed = True
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/port',
|
||||
QtCore.QVariant(self.portSpinBox.value()))
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/ip address',
|
||||
QtCore.QVariant(self.addressEdit.text()))
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/twelve hour',
|
||||
QtCore.QVariant(self.twelveHour))
|
||||
Settings().setValue(self.settingsSection + u'/port',
|
||||
self.portSpinBox.value())
|
||||
Settings().setValue(self.settingsSection + u'/ip address',
|
||||
self.addressEdit.text())
|
||||
Settings().setValue(self.settingsSection + u'/twelve hour',
|
||||
self.twelveHour)
|
||||
if changed:
|
||||
Receiver.send_message(u'remotes_config_updated')
|
||||
|
||||
|
@ -145,8 +145,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
for author in authors:
|
||||
row = self.authorsComboBox.count()
|
||||
self.authorsComboBox.addItem(author.display_name)
|
||||
self.authorsComboBox.setItemData(
|
||||
row, QtCore.QVariant(author.id))
|
||||
self.authorsComboBox.setItemData(row, author.id)
|
||||
self.authors.append(author.display_name)
|
||||
set_case_insensitive_completer(self.authors, self.authorsComboBox)
|
||||
|
||||
@ -166,7 +165,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
row = combo.count()
|
||||
combo.addItem(object.name)
|
||||
cache.append(object.name)
|
||||
combo.setItemData(row, QtCore.QVariant(object.id))
|
||||
combo.setItemData(row, object.id)
|
||||
set_case_insensitive_completer(cache, combo)
|
||||
|
||||
def loadThemes(self, theme_list):
|
||||
@ -280,7 +279,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
verse[0][u'label'] = u'1'
|
||||
verse_def = u'%s%s' % (verse[0][u'type'], verse[0][u'label'])
|
||||
item = QtGui.QTableWidgetItem(verse[1])
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))
|
||||
item.setData(QtCore.Qt.UserRole, verse_def)
|
||||
self.verseListWidget.setItem(count, 0, item)
|
||||
else:
|
||||
verses = self.song.lyrics.split(u'\n\n')
|
||||
@ -290,7 +289,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
item = QtGui.QTableWidgetItem(verse)
|
||||
verse_def = u'%s%s' % \
|
||||
(VerseType.Tags[VerseType.Verse], unicode(count + 1))
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))
|
||||
item.setData(QtCore.Qt.UserRole, verse_def)
|
||||
self.verseListWidget.setItem(count, 0, item)
|
||||
if self.song.verse_order:
|
||||
# we translate verse order
|
||||
@ -312,20 +311,19 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self.authorsListView.clear()
|
||||
for author in self.song.authors:
|
||||
author_name = QtGui.QListWidgetItem(unicode(author.display_name))
|
||||
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
|
||||
author_name.setData(QtCore.Qt.UserRole, author.id)
|
||||
self.authorsListView.addItem(author_name)
|
||||
# clear the results
|
||||
self.topicsListView.clear()
|
||||
for topic in self.song.topics:
|
||||
topic_name = QtGui.QListWidgetItem(unicode(topic.name))
|
||||
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
|
||||
topic_name.setData(QtCore.Qt.UserRole, topic.id)
|
||||
self.topicsListView.addItem(topic_name)
|
||||
self.audioListWidget.clear()
|
||||
for media in self.song.media_files:
|
||||
media_file = QtGui.QListWidgetItem(
|
||||
os.path.split(media.file_name)[1])
|
||||
media_file.setData(QtCore.Qt.UserRole,
|
||||
QtCore.QVariant(media.file_name))
|
||||
media_file.setData(QtCore.Qt.UserRole, media.file_name)
|
||||
self.audioListWidget.addItem(media_file)
|
||||
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
|
||||
# Hide or show the preview button.
|
||||
@ -396,7 +394,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
Add an author to the author list.
|
||||
"""
|
||||
author_item = QtGui.QListWidgetItem(unicode(author.display_name))
|
||||
author_item.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
|
||||
author_item.setData(QtCore.Qt.UserRole, author.id)
|
||||
self.authorsListView.addItem(author_item)
|
||||
|
||||
def onAuthorsListViewClicked(self):
|
||||
@ -422,8 +420,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
topic = Topic.populate(name=text)
|
||||
self.manager.save_object(topic)
|
||||
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
|
||||
topic_item.setData(QtCore.Qt.UserRole,
|
||||
QtCore.QVariant(topic.id))
|
||||
topic_item.setData(QtCore.Qt.UserRole, topic.id)
|
||||
self.topicsListView.addItem(topic_item)
|
||||
self.loadTopics()
|
||||
self.topicsComboBox.setCurrentIndex(0)
|
||||
@ -439,8 +436,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
'This topic is already in the list.'))
|
||||
else:
|
||||
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
|
||||
topic_item.setData(QtCore.Qt.UserRole,
|
||||
QtCore.QVariant(topic.id))
|
||||
topic_item.setData(QtCore.Qt.UserRole, topic.id)
|
||||
self.topicsListView.addItem(topic_item)
|
||||
self.topicsComboBox.setCurrentIndex(0)
|
||||
else:
|
||||
@ -469,7 +465,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
after_text, verse_tag, verse_num = self.verseForm.getVerse()
|
||||
verse_def = u'%s%s' % (verse_tag, verse_num)
|
||||
item = QtGui.QTableWidgetItem(after_text)
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))
|
||||
item.setData(QtCore.Qt.UserRole, verse_def)
|
||||
item.setText(after_text)
|
||||
self.verseListWidget.setRowCount(
|
||||
self.verseListWidget.rowCount() + 1)
|
||||
@ -488,7 +484,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
if self.verseForm.exec_():
|
||||
after_text, verse_tag, verse_num = self.verseForm.getVerse()
|
||||
verse_def = u'%s%s' % (verse_tag, verse_num)
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def))
|
||||
item.setData(QtCore.Qt.UserRole, verse_def)
|
||||
item.setText(after_text)
|
||||
# number of lines has changed, repaint the list moving the data
|
||||
if len(tempText.split(u'\n')) != len(after_text.split(u'\n')):
|
||||
@ -557,8 +553,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
if parts.endswith(u'\n'):
|
||||
parts = parts.rstrip(u'\n')
|
||||
item = QtGui.QTableWidgetItem(parts)
|
||||
item.setData(QtCore.Qt.UserRole,
|
||||
QtCore.QVariant(verse_def))
|
||||
item.setData(QtCore.Qt.UserRole, verse_def)
|
||||
self.verseListWidget.setRowCount(
|
||||
self.verseListWidget.rowCount() + 1)
|
||||
self.verseListWidget.setItem(
|
||||
@ -733,8 +728,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
"""
|
||||
filters = u'%s (*)' % UiStrings().AllFiles
|
||||
filenames = QtGui.QFileDialog.getOpenFileNames(self,
|
||||
translate('SongsPlugin.EditSongForm', 'Open File(s)'),
|
||||
QtCore.QString(), filters)
|
||||
translate('SongsPlugin.EditSongForm', 'Open File(s)'), u'', filters)
|
||||
for filename in filenames:
|
||||
item = QtGui.QListWidgetItem(os.path.split(unicode(filename))[1])
|
||||
item.setData(QtCore.Qt.UserRole, filename)
|
||||
|
@ -218,8 +218,9 @@ class SongExportForm(OpenLPWizard):
|
||||
# Add the songs to the list of selected songs.
|
||||
for item in items:
|
||||
song = QtGui.QListWidgetItem(item.text())
|
||||
# TODO: check toPyObject()
|
||||
song.setData(QtCore.Qt.UserRole,
|
||||
QtCore.QVariant(item.data(QtCore.Qt.UserRole).toPyObject()))
|
||||
item.data(QtCore.Qt.UserRole).toPyObject())
|
||||
song.setFlags(QtCore.Qt.ItemIsEnabled)
|
||||
self.selectedListWidget.addItem(song)
|
||||
return True
|
||||
@ -260,7 +261,7 @@ class SongExportForm(OpenLPWizard):
|
||||
for author in song.authors])
|
||||
title = u'%s (%s)' % (unicode(song.title), authors)
|
||||
item = QtGui.QListWidgetItem(title)
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(song))
|
||||
item.setData(QtCore.Qt.UserRole, song)
|
||||
item.setFlags(QtCore.Qt.ItemIsSelectable|
|
||||
QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
|
||||
item.setCheckState(QtCore.Qt.Unchecked)
|
||||
@ -308,8 +309,9 @@ class SongExportForm(OpenLPWizard):
|
||||
``text``
|
||||
The text to search for. (unicode string)
|
||||
"""
|
||||
#TODO: check if unicode() can be removed.
|
||||
return [item for item in listWidget.findItems(
|
||||
QtCore.QString(unicode(text)), QtCore.Qt.MatchContains)
|
||||
unicode(text), QtCore.Qt.MatchContains)
|
||||
]
|
||||
|
||||
def onItemActivated(self, item):
|
||||
@ -333,6 +335,8 @@ class SongExportForm(OpenLPWizard):
|
||||
``text``
|
||||
The text of the *searchLineEdit*. (QString)
|
||||
"""
|
||||
#TODO: check if unicode() can be removed.
|
||||
print type(text)
|
||||
search_result = [
|
||||
song for song in self._findListWidgetItems(
|
||||
self.availableListWidget, unicode(text))
|
||||
|
@ -33,7 +33,7 @@ import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver, SettingsManager, translate
|
||||
from openlp.core.lib import Receiver, Settings, SettingsManager, translate
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||
from openlp.plugins.songs.lib.importer import SongFormat
|
||||
@ -387,7 +387,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():
|
||||
@ -740,7 +740,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():
|
||||
|
@ -131,7 +131,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
||||
else:
|
||||
author_name = QtGui.QListWidgetItem(
|
||||
u' '.join([author.first_name, author.last_name]))
|
||||
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
|
||||
author_name.setData(QtCore.Qt.UserRole, author.id)
|
||||
self.authorsListWidget.addItem(author_name)
|
||||
|
||||
def resetTopics(self):
|
||||
@ -142,7 +142,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
||||
topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name)
|
||||
for topic in topics:
|
||||
topic_name = QtGui.QListWidgetItem(topic.name)
|
||||
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
|
||||
topic_name.setData(QtCore.Qt.UserRole, topic.id)
|
||||
self.topicsListWidget.addItem(topic_name)
|
||||
|
||||
def resetBooks(self):
|
||||
@ -154,7 +154,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
||||
for book in books:
|
||||
book_name = QtGui.QListWidgetItem(u'%s (%s)' % (book.name,
|
||||
book.publisher))
|
||||
book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id))
|
||||
book_name.setData(QtCore.Qt.UserRole, book.id)
|
||||
self.booksListWidget.addItem(book_name)
|
||||
|
||||
def checkAuthor(self, new_author, edit=False):
|
||||
|
@ -34,8 +34,9 @@ import shutil
|
||||
from PyQt4 import QtCore, QtGui
|
||||
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 import MediaManagerItem, Receiver, Settings, \
|
||||
ItemCapabilities, translate, check_item_selected, PluginStatus, \
|
||||
create_separated_list
|
||||
from openlp.core.lib.ui import UiStrings, create_widget_action
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
||||
@ -131,15 +132,13 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.searchTextEdit.setFocus()
|
||||
|
||||
def configUpdated(self):
|
||||
self.searchAsYouType = QtCore.QSettings().value(
|
||||
self.settingsSection + u'/search as type',
|
||||
QtCore.QVariant(u'False')).toBool()
|
||||
self.updateServiceOnEdit = QtCore.QSettings().value(
|
||||
self.settingsSection + u'/update service on edit',
|
||||
QtCore.QVariant(u'False')).toBool()
|
||||
self.addSongFromService = QtCore.QSettings().value(
|
||||
self.settingsSection + u'/add song from service',
|
||||
QtCore.QVariant(u'True')).toBool()
|
||||
# TODO: Check .toBool()
|
||||
self.searchAsYouType = bool(Settings().value(
|
||||
self.settingsSection + u'/search as type', False))
|
||||
self.updateServiceOnEdit = bool(Settings().value(
|
||||
self.settingsSection + u'/update service on edit', False))
|
||||
self.addSongFromService = bool(Settings().value(
|
||||
self.settingsSection + u'/add song from service', True))
|
||||
|
||||
def retranslateUi(self):
|
||||
self.searchTextLabel.setText(u'%s:' % UiStrings().Search)
|
||||
@ -168,16 +167,14 @@ class SongMediaItem(MediaManagerItem):
|
||||
(SongSearch.Themes, u':/slides/slide_theme.png',
|
||||
UiStrings().Themes, UiStrings().SearchThemes)
|
||||
])
|
||||
self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value(
|
||||
u'%s/last search type' % self.settingsSection,
|
||||
QtCore.QVariant(SongSearch.Entire)).toInt()[0])
|
||||
self.searchTextEdit.setCurrentSearchType(Settings().value(
|
||||
u'%s/last search type' % self.settingsSection, SongSearch.Entire))
|
||||
self.configUpdated()
|
||||
|
||||
def onSearchTextButtonClicked(self):
|
||||
# Save the current search type to the configuration.
|
||||
QtCore.QSettings().setValue(u'%s/last search type' %
|
||||
self.settingsSection,
|
||||
QtCore.QVariant(self.searchTextEdit.currentSearchType()))
|
||||
Settings().setValue(u'%s/last search type' %
|
||||
self.settingsSection, self.searchTextEdit.currentSearchType())
|
||||
# Reload the list considering the new search type.
|
||||
search_keywords = unicode(self.searchTextEdit.displayText())
|
||||
search_results = []
|
||||
@ -271,7 +268,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
song_detail = u'%s (%s)' % (song_title,
|
||||
create_separated_list(author_list))
|
||||
song_name = QtGui.QListWidgetItem(song_detail)
|
||||
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
||||
song_name.setData(QtCore.Qt.UserRole, song.id)
|
||||
self.listView.addItem(song_name)
|
||||
# Auto-select the item if name has been set
|
||||
if song.id == self.autoSelectId:
|
||||
@ -288,7 +285,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
continue
|
||||
song_detail = u'%s (%s)' % (author.display_name, song.title)
|
||||
song_name = QtGui.QListWidgetItem(song_detail)
|
||||
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
||||
song_name.setData(QtCore.Qt.UserRole, song.id)
|
||||
self.listView.addItem(song_name)
|
||||
|
||||
def displayResultsBook(self, searchresults, song_number=False):
|
||||
@ -306,7 +303,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
song_detail = u'%s - %s (%s)' % (book.name, song.song_number,
|
||||
song.title)
|
||||
song_name = QtGui.QListWidgetItem(song_detail)
|
||||
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
||||
song_name.setData(QtCore.Qt.UserRole, song.id)
|
||||
self.listView.addItem(song_name)
|
||||
|
||||
def onClearTextButtonClick(self):
|
||||
@ -516,12 +513,10 @@ 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',
|
||||
QtCore.QVariant(u'')).toString():
|
||||
if Settings().value(u'general/ccli number', u''):
|
||||
service_item.raw_footer.append(unicode(
|
||||
translate('SongsPlugin.MediaItem', 'CCLI License: ') +
|
||||
QtCore.QSettings().value(u'general/ccli number',
|
||||
QtCore.QVariant(u'')).toString()))
|
||||
Settings().value(u'general/ccli number', u'')))
|
||||
service_item.audit = [
|
||||
song.title, author_list, song.copyright, unicode(song.ccli_number)
|
||||
]
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate
|
||||
from openlp.core.lib import Settings, SettingsTab, translate
|
||||
|
||||
class SongsTab(SettingsTab):
|
||||
"""
|
||||
@ -110,16 +110,12 @@ 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()
|
||||
self.tool_bar = settings.value(
|
||||
u'display songbar', QtCore.QVariant(True)).toBool()
|
||||
self.update_edit = settings.value(
|
||||
u'update service on edit', QtCore.QVariant(False)).toBool()
|
||||
self.update_load = settings.value(
|
||||
u'add song from service', QtCore.QVariant(True)).toBool()
|
||||
self.song_search = settings.value(u'search as type', False)
|
||||
self.tool_bar = settings.value(u'display songbar', True)
|
||||
self.update_edit = settings.value(u'update service on edit', False)
|
||||
self.update_load = settings.value(u'add song from service', True)
|
||||
self.searchAsTypeCheckBox.setChecked(self.song_search)
|
||||
self.toolBarActiveCheckBox.setChecked(self.tool_bar)
|
||||
self.updateOnEditCheckBox.setChecked(self.update_edit)
|
||||
@ -127,12 +123,10 @@ 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))
|
||||
settings.setValue(u'update service on edit',
|
||||
QtCore.QVariant(self.update_edit))
|
||||
settings.setValue(u'add song from service',
|
||||
QtCore.QVariant(self.update_load))
|
||||
settings.setValue(u'search as type', self.song_search)
|
||||
settings.setValue(u'display songbar', self.tool_bar)
|
||||
settings.setValue(u'update service on edit', self.update_edit)
|
||||
settings.setValue(u'add song from service', self.update_load)
|
||||
settings.endGroup()
|
||||
|
@ -31,7 +31,7 @@ import os
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from sqlalchemy.sql import and_
|
||||
|
||||
from openlp.core.lib import SettingsManager, translate, Receiver, \
|
||||
from openlp.core.lib import Receiver, Settings, SettingsManager, translate, \
|
||||
check_directory_exists
|
||||
from openlp.plugins.songusage.lib.db import SongUsageItem
|
||||
from songusagedetaildialog import Ui_SongUsageDetailDialog
|
||||
@ -59,12 +59,11 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
|
||||
year = QtCore.QDate().currentDate().year()
|
||||
if QtCore.QDate().currentDate().month() < 9:
|
||||
year -= 1
|
||||
toDate = QtCore.QSettings().value(
|
||||
u'songusage/to date',
|
||||
QtCore.QVariant(QtCore.QDate(year, 8, 31))).toDate()
|
||||
fromDate = QtCore.QSettings().value(
|
||||
toDate = Settings().value(
|
||||
u'songusage/to date', QtCore.QDate(year, 8, 31)).toDate()
|
||||
fromDate = Settings().value(
|
||||
u'songusage/from date',
|
||||
QtCore.QVariant(QtCore.QDate(year - 1, 9, 1))).toDate()
|
||||
QtCore.QDate(year - 1, 9, 1)).toDate()
|
||||
self.fromDate.setSelectedDate(fromDate)
|
||||
self.toDate.setSelectedDate(toDate)
|
||||
self.fileLineEdit.setText(
|
||||
@ -103,10 +102,10 @@ 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',
|
||||
QtCore.QVariant(self.fromDate.selectedDate()))
|
||||
QtCore.QSettings().setValue(u'songusage/to date',
|
||||
QtCore.QVariant(self.toDate.selectedDate()))
|
||||
Settings().setValue(u'songusage/from date',
|
||||
self.fromDate.selectedDate())
|
||||
Settings().setValue(u'songusage/to date',
|
||||
self.toDate.selectedDate())
|
||||
usage = self.plugin.manager.get_all_objects(
|
||||
SongUsageItem, and_(
|
||||
SongUsageItem.usagedate >= self.fromDate.selectedDate().toPyDate(),
|
||||
|
@ -30,8 +30,8 @@ from datetime import datetime
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Plugin, StringContent, Receiver, build_icon, \
|
||||
translate
|
||||
from openlp.core.lib import build_icon, Plugin, Receiver, Settings, \
|
||||
StringContent, translate
|
||||
from openlp.core.lib.db import Manager
|
||||
from openlp.core.lib.ui import create_action
|
||||
from openlp.core.utils.actions import ActionList
|
||||
@ -125,9 +125,8 @@ class SongUsagePlugin(Plugin):
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'print_service_started'),
|
||||
self.printSongUsage)
|
||||
self.songUsageActive = QtCore.QSettings().value(
|
||||
self.settingsSection + u'/active',
|
||||
QtCore.QVariant(False)).toBool()
|
||||
self.songUsageActive = Settings().value(
|
||||
self.settingsSection + u'/active', False)
|
||||
# Set the button and checkbox state
|
||||
self.setButtonState()
|
||||
action_list = ActionList.get_instance()
|
||||
@ -168,8 +167,8 @@ class SongUsagePlugin(Plugin):
|
||||
the UI when necessary,
|
||||
"""
|
||||
self.songUsageActive = not self.songUsageActive
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/active',
|
||||
QtCore.QVariant(self.songUsageActive))
|
||||
Settings().setValue(self.settingsSection + u'/active',
|
||||
self.songUsageActive)
|
||||
self.setButtonState()
|
||||
|
||||
def setButtonState(self):
|
||||
|
Loading…
Reference in New Issue
Block a user