started work to store setting in a (half) central place

This commit is contained in:
Andreas Preikschat 2013-01-10 20:33:48 +01:00
parent 14430e3a56
commit eb6bc6adbc
14 changed files with 235 additions and 9 deletions

View File

@ -31,6 +31,7 @@ The :mod:`lib` module contains most of the components and libraries that make
OpenLP work.
"""
import logging
import datetime
import os
from PyQt4 import QtCore, QtGui, Qt
@ -101,6 +102,15 @@ class Settings(QtCore.QSettings):
object for accessing settings stored in that Ini file.
"""
__filePath__ = u''
__defaultValues__ = {
u'displayTags/html_tags': u'',
u'players/background color': u'#000000',
u'servicemanager/service theme': u'',
}
@staticmethod
def appendDefaultValues(defaultValues):
Settings.__defaultValues__ = dict(defaultValues.items() + Settings.__defaultValues__.items())
@staticmethod
def setFilename(iniFile):

View File

@ -43,6 +43,7 @@ from openlp.core.lib import SlideLimits
log = logging.getLogger(__name__)
class AdvancedTab(SettingsTab):
"""
The :class:`AdvancedTab` manages the advanced settings tab including the UI

View File

@ -79,6 +79,69 @@ PROGRESSBAR_STYLE = """
height: 10px;
}
"""
__defaultValues__ = {
u'advanced/x11 bypass wm': True,
u'advanced/default service enabled': True,
u'advanced/enable exit confirmation': True,
u'advanced/save current plugin': False,
u'advanced/single click preview': False,
u'advanced/default service day': 7,
u'advanced/max recent files': 20,
u'advanced/is portable': False,
u'advanced/hide mouse': True,
u'advanced/current media plugin': -1,
u'advanced/double click live': False,
u'advanced/default service hour': 11,
u'advanced/default color': u'#ffffff',
u'advanced/default image': u':/graphics/openlp-splash-screen.png',
u'advanced/expand service item': False,
u'advanced/recent file count': 4,
# TODO: Check if translate works here.
u'advanced/default service name': translate('OpenLP.AdvancedTab', 'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: /\\?*|<>\[\]":+\nSee http://docs.python.org/library/'
'datetime.html#strftime-strptime-behavior for more information.'),
u'advanced/default service minute': 0,
u'advanced/slide limits': SlideLimits.End,
u'general/ccli number': u'',
u'general/y position': 0,
u'general/has run wizard': False,
u'general/update check': True,
u'general/language': u'[en]',
u'general/songselect password': u'',
u'general/recent files': [],
u'general/save prompt': False,
u'general/auto preview': False,
u'general/override position': False,
u'general/view mode': u'default',
u'general/auto open': False,
u'general/enable slide loop': True,
u'general/show splash': True,
u'general/screen blank': False,
u'general/x position': 0,
u'general/loop delay': 5,
u'general/height': 1024,
u'general/monitor': 0,
u'general/songselect username': u'',
u'general/audio repeat list': False,
u'general/auto unblank': False,
u'general/display on monitor': True,
u'general/width': 1280,
u'general/audio start paused': True,
u'general/last version test': datetime.datetime.now().date(),
u'general/blank warning': False,
u'themes/theme level': 3,
u'themes/global theme': u'',
u'user interface/main window position': QtCore.QPoint(),
u'user interface/preview panel': True,
u'user interface/live panel': True,
u'user interface/main window geometry': QtCore.QByteArray(),
u'user interface/preview splitter geometry': QtCore.QByteArray(),
u'user interface/lock panel': False,
u'user interface/mainwindow splitter geometry': QtCore.QByteArray(),
u'user interface/live splitter geometry': QtCore.QByteArray(),
u'user interface/main window state': QtCore.QByteArray()
}
class Ui_MainWindow(object):
def setupUi(self, mainWindow):

View File

@ -40,6 +40,74 @@ from shortcutlistdialog import Ui_ShortcutListDialog
REMOVE_AMPERSAND = re.compile(r'&{1}')
log = logging.getLogger(__name__)
__defaultValues__ = {
u'shortcuts/viewPreviewPanel': [QtGui.QKeySequence(u'F11')],
u'shortcuts/settingsImportItem': [],
u'shortcuts/settingsPluginListItem': [QtGui.QKeySequence(u'Alt+F7')],
u'shortcuts/modeLiveItem': [],
u'shortcuts/songUsageStatus': [QtCore.Qt.Key_F4],
u'shortcuts/nextTrackItem': [],
u'shortcuts/makeLive': [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
u'shortcuts/webSiteItem': [],
u'shortcuts/shortcutAction_P': [QtGui.QKeySequence(u'P')],
u'shortcuts/previousItem_live': [QtCore.Qt.Key_Up, QtCore.Qt.Key_PageUp],
u'shortcuts/shortcutAction_V': [QtGui.QKeySequence(u'V')],
u'shortcuts/fileOpenItem': [QtGui.QKeySequence(u'Ctrl+O')],
u'shortcuts/viewMediaManagerItem': [QtGui.QKeySequence(u'F8')],
u'shortcuts/desktopScreen': [QtGui.QKeySequence(u'D')],
u'shortcuts/songExportItem': [],
u'shortcuts/modeDefaultItem': [],
u'shortcuts/audioPauseItem': [],
u'shortcuts/themeScreen': [QtGui.QKeySequence(u'T')],
u'shortcuts/expand': [QtCore.Qt.Key_Plus],
u'shortcuts/exportThemeItem': [],
u'shortcuts/viewThemeManagerItem': [QtGui.QKeySequence(u'F10')],
u'shortcuts/playSlidesLoop': [],
u'shortcuts/playSlidesOnce': [],
u'shortcuts/toolsReindexItem': [],
u'shortcuts/toolsAlertItem': [u'F7'],
u'shortcuts/printServiceItem': [QtGui.QKeySequence(u'Ctrl+P')],
u'shortcuts/moveUp': [QtCore.Qt.Key_PageUp],
u'shortcuts/settingsShortcutsItem': [],
u'shortcuts/nextItem_live': [QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown],
u'shortcuts/moveTop': [QtCore.Qt.Key_Home],
u'shortcuts/blankScreen': [QtCore.Qt.Key_Period],
u'shortcuts/settingsConfigureItem': [],
u'shortcuts/modeSetupItem': [],
u'shortcuts/songUsageDelete': [],
u'shortcuts/shortcutAction_C': [QtGui.QKeySequence(u'C')],
u'shortcuts/shortcutAction_B': [QtGui.QKeySequence(u'B')],
u'shortcuts/shortcutAction_E': [QtGui.QKeySequence(u'E')],
u'shortcuts/shortcutAction_I': [QtGui.QKeySequence(u'I')],
u'shortcuts/shortcutAction_O': [QtGui.QKeySequence(u'O')],
u'shortcuts/importBibleItem': [],
u'shortcuts/fileExitItem': [QtGui.QKeySequence(u'Alt+F4')],
u'shortcuts/fileSaveItem': [QtGui.QKeySequence(u'Ctrl+S')],
u'shortcuts/up': [QtCore.Qt.Key_Up],
u'shortcuts/nextService': [QtCore.Qt.Key_Right],
u'shortcuts/songImportItem': [],
u'shortcuts/toolsOpenDataFolder': [],
u'shortcuts/fileNewItem': [QtGui.QKeySequence(u'Ctrl+N')],
u'shortcuts/aboutItem': [QtGui.QKeySequence(u'Ctrl+F1')],
u'shortcuts/viewLivePanel': [QtGui.QKeySequence(u'F12')],
u'shortcuts/songUsageReport': [],
u'shortcuts/updateThemeImages': [],
u'shortcuts/toolsAddToolItem': [],
u'shortcuts/fileSaveAsItem': [QtGui.QKeySequence(u'Ctrl+Shift+S')],
u'shortcuts/settingsExportItem': [],
u'shortcuts/onlineHelpItem': [QtGui.QKeySequence(u'Alt+F1')],
u'shortcuts/escapeItem': [QtCore.Qt.Key_Escape],
u'shortcuts/displayTagItem': [],
u'shortcuts/moveBottom': [QtCore.Qt.Key_End],
u'shortcuts/toolsFirstTimeWizard': [],
u'shortcuts/moveDown': [QtCore.Qt.Key_PageDown],
u'shortcuts/collapse': [QtCore.Qt.Key_Minus],
u'shortcuts/viewServiceManagerItem': [QtGui.QKeySequence(u'F9')],
u'shortcuts/previousService': [QtCore.Qt.Key_Left],
u'shortcuts/importThemeItem': [],
u'shortcuts/down': [QtCore.Qt.Key_Down],
}
class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
"""

View File

@ -33,6 +33,7 @@ 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
class ThemesTab(SettingsTab):
"""
ThemesTab is the theme settings tab in the settings dialog.

View File

@ -31,7 +31,7 @@ import logging
from PyQt4 import QtCore
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings, PluginStatus
from openlp.core.lib.db import Manager
from openlp.core.lib.ui import create_action, UiStrings
from openlp.core.lib.theme import VerticalType
@ -113,6 +113,18 @@ HTML = """
<div id="alert" style="visibility:hidden"></div>
"""
__defaultValues__ = {
u'alerts/font face': u'Sans',
u'alerts/font size': 40,
u'alerts/status': PluginStatus.Inactive,
u'alerts/db type': u'sqlite',
u'alerts/location': 2,
u'alerts/background color': u'#660000',
u'alerts/font color': u'#ffffff',
u'alerts/timeout': 5
}
class AlertsPlugin(Plugin):
log.info(u'Alerts Plugin loaded')

View File

@ -31,13 +31,34 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings, PluginStatus
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
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem, LayoutStyle, DisplayStyle, \
LanguageSelection
from openlp.plugins.bibles.lib.mediaitem import BibleSearch
from openlp.plugins.bibles.forms import BibleUpgradeForm
log = logging.getLogger(__name__)
__defaultValues__ = {
u'bibles/book name language': LanguageSelection.Bible,
u'bibles/verse separator': u'',
u'bibles/advanced bible': u'',
u'bibles/proxy name': u'',
u'bibles/db type': u'sqlite',
u'bibles/status': PluginStatus.Inactive,
u'bibles/bible theme': u'',
u'bibles/range separator': u'',
u'bibles/display new chapter': False,
u'bibles/verse layout style': LayoutStyle.VersePerSlide,
u'bibles/display brackets': DisplayStyle.NoBrackets,
u'bibles/list separator': u'',
u'bibles/second bibles': True,
u'bibles/quick bible': u'Afrikaans Bybel',
u'bibles/end separator': u'',
u'bibles/last search type': BibleSearch.Reference
}
class BiblePlugin(Plugin):
log.info(u'Bible Plugin loaded')

View File

@ -29,13 +29,21 @@
import logging
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib import Plugin, StringContent, build_icon, translate, PluginStatus
from openlp.core.lib.db import Manager
from openlp.plugins.custom.lib import CustomMediaItem, CustomTab
from openlp.plugins.custom.lib.db import CustomSlide, init_schema
from openlp.plugins.custom.lib.mediaitem import CustomSearch
log = logging.getLogger(__name__)
__defaultValues__ = {
u'custom/db type': u'sqlite',
u'custom/display footer': True,
u'custom/last search type': CustomSearch.Titles,
u'custom/status': PluginStatus.Inactive
}
class CustomPlugin(Plugin):
"""
This plugin enables the user to create, edit and display

View File

@ -31,10 +31,15 @@ from PyQt4 import QtCore, QtGui
import logging
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Receiver, ImageSource, Settings
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Receiver, ImageSource, Settings, PluginStatus
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
log = logging.getLogger(__name__)
__defaultValues__ = {
u'images/images count': 0,
u'images/background color': u'#000000',
u'images/status': PluginStatus.Inactive
}
class ImagePlugin(Plugin):
log.info(u'Image Plugin loaded')

View File

@ -31,11 +31,17 @@ import logging
from PyQt4 import QtCore
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
Settings
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings, PluginStatus
from openlp.plugins.media.lib import MediaMediaItem, MediaTab
log = logging.getLogger(__name__)
__defaultValues__ = {
u'media/override player': QtCore.Qt.Unchecked,
u'media/media count': 0,
u'media/media auto start': QtCore.Qt.Unchecked,
u'media/status': PluginStatus.Inactive,
u'media/players': u'webkit'
}
class MediaPlugin(Plugin):
log.info(u'%s MediaPlugin loaded', __name__)

View File

@ -39,6 +39,15 @@ from openlp.plugins.presentations.lib import PresentationController, \
PresentationMediaItem, PresentationTab
log = logging.getLogger(__name__)
__defaultValues__ = {
u'presentations/Impress': 2,
u'presentations/override app': QtCore.Qt.Unchecked,
u'presentations/presentations count': 0,
u'presentations/Powerpoint': 2,
u'presentations/status': PluginStatus.Inactive,
u'presentations/Powerpoint Viewer': 2
}
class PresentationPlugin(Plugin):
"""

View File

@ -29,11 +29,19 @@
import logging
from openlp.core.lib import Plugin, StringContent, translate, build_icon
from openlp.core.lib import Plugin, StringContent, translate, build_icon, PluginStatus
from openlp.plugins.remotes.lib import RemoteTab, HttpServer
log = logging.getLogger(__name__)
__defaultValues__ = {
u'remotes/twelve hour': True,
u'remotes/status': PluginStatus.Inactive,
u'remotes/port': 4316,
u'remotes/ip address': u'0.0.0.0'
}
class RemotesPlugin(Plugin):
log.info(u'Remote Plugin loaded')

View File

@ -41,10 +41,18 @@ from openlp.core.utils import get_filesystem_encoding
from openlp.core.utils.actions import ActionList
from openlp.plugins.songs.lib import clean_song, upgrade, SongMediaItem, SongsTab
from openlp.plugins.songs.lib.db import init_schema, Song
from openlp.plugins.songs.lib.mediaitem import SongSearch
from openlp.plugins.songs.lib.importer import SongFormat
from openlp.plugins.songs.lib.olpimport import OpenLPSongImport
log = logging.getLogger(__name__)
__defaultValues__ = {
u'songs/update service on edit': False,
u'songs/search as type': False,
u'songs/add song from service': True,
u'songs/display songbar': True,
u'songs/last search type': SongSearch.Entire
}
class SongsPlugin(Plugin):
"""

View File

@ -32,7 +32,7 @@ from datetime import datetime
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, Plugin, Receiver, Settings, StringContent, translate
from openlp.core.lib import build_icon, Plugin, Receiver, Settings, StringContent, translate, PluginStatus
from openlp.core.lib.db import Manager
from openlp.core.lib.ui import create_action
from openlp.core.utils.actions import ActionList
@ -42,6 +42,12 @@ from openlp.plugins.songusage.lib.db import init_schema, SongUsageItem
log = logging.getLogger(__name__)
__defaultValues__ = {
u'songusage/db type': u'sqlite',
u'songusage/status': PluginStatus.Inactive,
u'songusage/active': False,
}
class SongUsagePlugin(Plugin):
log.info(u'SongUsage Plugin loaded')