diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index 672f655f5..04f99bfa7 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -118,7 +118,7 @@ class OpenLP(QtGui.QApplication): # Decide how many screens we have and their size screens = ScreenList.create(self.desktop()) # First time checks in settings - has_run_wizard = Settings().value(u'general/has run wizard') + has_run_wizard = Settings().value(u'general/has run wizard', False) if not has_run_wizard: if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted: Settings().setValue(u'general/has run wizard', True) @@ -129,7 +129,7 @@ class OpenLP(QtGui.QApplication): u'QTableWidget, QListWidget, QTreeWidget {alternate-background-color: ' + base_color.name() + ';}\n' application_stylesheet += nt_repair_stylesheet self.setStyleSheet(application_stylesheet) - show_splash = Settings().value(u'general/show splash') + show_splash = Settings().value(u'general/show splash', True) if show_splash: self.splash = SplashScreen() self.splash.show() @@ -148,7 +148,7 @@ class OpenLP(QtGui.QApplication): self.processEvents() if not has_run_wizard: self.mainWindow.firstTime() - update_check = Settings().value(u'general/update check') + update_check = Settings().value(u'general/update check', True) if update_check: VersionThread(self.mainWindow).start() Receiver.send_message(u'live_display_blank_check') @@ -295,7 +295,7 @@ def main(args=None): if app.isAlreadyRunning(): sys.exit() # First time checks in settings - if not Settings().value(u'general/has run wizard'): + if not Settings().value(u'general/has run wizard', False): if not FirstTimeLanguageForm().exec_(): # if cancel then stop processing sys.exit() diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index c76557346..4a3cf7d54 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # @@ -29,7 +30,6 @@ The :mod:`lib` module contains most of the components and libraries that make OpenLP work. """ -import datetime import logging import os @@ -90,6 +90,68 @@ class ServiceItemAction(object): Next = 3 +class Settings(QtCore.QSettings): + """ + Class to wrap QSettings. + + * Exposes all the methods of QSettings. + * Adds functionality for OpenLP Portable. If the ``defaultFormat`` is set to + ``IniFormat``, and the path to the Ini file is set using ``setFilename``, + then the Settings constructor (without any arguments) will create a Settings + object for accessing settings stored in that Ini file. + """ + __filePath__ = u'' + + @staticmethod + def setFilename(iniFile): + """ + Sets the complete path to an Ini file to be used by Settings objects. + + Does not affect existing Settings objects. + """ + Settings.__filePath__ = iniFile + + def __init__(self, *args): + if not args and Settings.__filePath__ and \ + Settings.defaultFormat() == Settings.IniFormat: + QtCore.QSettings.__init__(self, Settings.__filePath__, + Settings.IniFormat) + else: + QtCore.QSettings.__init__(self, *args) + + def value(self, key, defaultValue): + """ + Returns the value for the given ``key``. The returned ``value`` is + of the same type as the ``defaultValue``. + + ``key`` + The key to return the value from. + + ``defaultValue`` + The value to be returned if the given ``key`` is not present in the + config. Note, the ``defaultValue``'s type defines the type the + returned is converted to. In other words, if the ``defaultValue`` is + a boolean, then the returned value will be converted to a boolean. + + **Note**, this method only converts a few types and might need to be + extended if a certain type is missing! + """ + setting = super(Settings, self).value(key, defaultValue) + # An empty list saved to the settings results in a None type being + # returned. + if setting is None: + return [] + # Convert the setting to the correct type. + if isinstance(defaultValue, bool): + if isinstance(setting, bool): + return setting + # Sometimes setting is string instead of a boolean. + return setting == u'true' + if isinstance(defaultValue, int): + return int(setting) + return setting + + def translate(context, text, comment=None, encoding=QtCore.QCoreApplication.CodecForTr, n=-1, translate=QtCore.QCoreApplication.translate): @@ -112,256 +174,6 @@ def translate(context, text, comment=None, return translate(context, text, comment, encoding, n) -class Settings(QtCore.QSettings): - """ - Class to wrap QSettings. - - * Exposes all the methods of QSettings. - * Adds functionality for OpenLP Portable. If the ``defaultFormat`` is set to - ``IniFormat``, and the path to the Ini file is set using ``setFilename``, - then the Settings constructor (without any arguments) will create a Settings - object for accessing settings stored in that Ini file. - """ - __filePath__ = u'' - __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, - 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'alerts/font face': u'Sans', - u'alerts/font size': 40, - u'alerts/status': 0,#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, - u'bibles/book name language': 0, - u'bibles/verse separator': u'', - u'bibles/advanced bible': u'', - u'bibles/proxy name': u'', - u'bibles/db type': u'sqlite', - u'bibles/status': 0, # PluginStatus.Inactive, - u'bibles/bible theme': u'', - u'bibles/range separator': u'', - u'bibles/display new chapter': False, - u'bibles/verse layout style': 0, - u'bibles/display brackets': 0, - 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': 1, - u'custom/db type': u'sqlite', - u'custom/display footer': True, - u'custom/last search type': 1, - u'custom/status': 0, # PluginStatus.Inactive, - u'displayTags/html_tags': u'', - u'general/ccli number': u'', - u'general/y position': 0, - u'general/has run wizard': False, - u'general/update check': True, - u'general/language': u'[en]', - 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'images/images count': 0, - u'images/background color': u'#000000', - u'images/status': 0, # PluginStatus.Inactive, - u'media/override player': QtCore.Qt.Unchecked, - u'media/media count': 0, - u'media/media auto start': QtCore.Qt.Unchecked, - u'media/status': 0, # PluginStatus.Inactive, - u'media/players': u'webkit', - u'players/background color': u'#000000', - u'presentations/Impress': 2, - u'presentations/override app': QtCore.Qt.Unchecked, - u'presentations/presentations count': 0, - u'presentations/Powerpoint': 2, - u'presentations/status': 0, # PluginStatus.Inactive, - u'presentations/Powerpoint Viewer': 2, - u'remotes/twelve hour': True, - u'remotes/status': 0, # PluginStatus.Inactive, - u'remotes/port': 4316, - u'remotes/ip address': u'0.0.0.0', - u'servicemanager/service theme': u'', - 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], - 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': 1, # BibleSearch.Reference, - u'songusage/db type': u'sqlite', - u'songusage/status': 0, # PluginStatus.Inactive, - u'songusage/active': 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() -} - - @staticmethod - def setFilename(iniFile): - """ - Sets the complete path to an Ini file to be used by Settings objects. - - Does not affect existing Settings objects. - """ - Settings.__filePath__ = iniFile - - def __init__(self, *args): - if not args and Settings.__filePath__ and \ - Settings.defaultFormat() == Settings.IniFormat: - QtCore.QSettings.__init__(self, Settings.__filePath__, - Settings.IniFormat) - else: - QtCore.QSettings.__init__(self, *args) - - def value(self, key): - """ - Returns the value for the given ``key``. The returned ``value`` is - of the same type as the ``defaultValue``. - - ``key`` - The key to return the value from. - - ``defaultValue`` - The value to be returned if the given ``key`` is not present in the - config. Note, the ``defaultValue``'s type defines the type the - returned is converted to. In other words, if the ``defaultValue`` is - a boolean, then the returned value will be converted to a boolean. - - **Note**, this method only converts a few types and might need to be - extended if a certain type is missing! - """ - if u'/' not in key: - key = self.group() + u'/' + key - defaultValue = Settings.__defaultValues__[key] - setting = super(Settings, self).value(key, defaultValue) - # An empty list saved to the settings results in a None type being - # returned. - if setting is None: - return [] - # Convert the setting to the correct type. - if isinstance(defaultValue, bool): - if isinstance(setting, bool): - return setting - # Sometimes setting is string instead of a boolean. - return setting == u'true' - if isinstance(defaultValue, int): - return int(setting) - return setting - - def get_text_file_string(text_file): """ Open a file and return its content as unicode string. If the supplied file diff --git a/openlp/core/lib/formattingtags.py b/openlp/core/lib/formattingtags.py index 6197845ee..c74b81d4d 100644 --- a/openlp/core/lib/formattingtags.py +++ b/openlp/core/lib/formattingtags.py @@ -165,7 +165,7 @@ class FormattingTags(object): FormattingTags.add_html_tags(temporary_tags) # Formatting Tags were also known as display tags. - user_expands = Settings().value(u'displayTags/html_tags') + 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: diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 05de5e5a9..8eb79ddfd 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -465,7 +465,7 @@ class MediaManagerItem(QtGui.QWidget): """ Allows the list click action to be determined dynamically """ - if Settings().value(u'advanced/double click live'): + if Settings().value(u'advanced/double click live', False): self.onLiveClick() else: self.onPreviewClick() @@ -474,9 +474,10 @@ class MediaManagerItem(QtGui.QWidget): """ Allows the change of current item in the list to be actioned """ - if Settings().value(u'advanced/single click preview') and \ - self.quickPreviewAllowed and self.listView.selectedIndexes() and \ - self.autoSelectId == -1: + if Settings().value(u'advanced/single click preview', + False) and self.quickPreviewAllowed \ + and self.listView.selectedIndexes() \ + and self.autoSelectId == -1: self.onPreviewClick(True) def onPreviewClick(self, keepFocus=False): diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 68be6420c..2720c1ab6 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -192,7 +192,8 @@ class Plugin(QtCore.QObject): """ Sets the status of the plugin """ - self.status = Settings().value(self.settingsSection + u'/status') + self.status = Settings().value( + self.settingsSection + u'/status', PluginStatus.Inactive) def toggleStatus(self, new_status): """ diff --git a/openlp/core/lib/settingsmanager.py b/openlp/core/lib/settingsmanager.py index 3bb091f3e..403c15b09 100644 --- a/openlp/core/lib/settingsmanager.py +++ b/openlp/core/lib/settingsmanager.py @@ -61,7 +61,7 @@ class SettingsManager(object): name = u'last directory %d' % num else: name = u'last directory' - return Settings().value(section + u'/' + name) + return Settings().value(section + u'/' + name, u'') @staticmethod def set_last_dir(section, directory, num=None): diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 5d25bc28d..353598909 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -120,7 +120,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): unicode(gettempdir(), get_filesystem_encoding()), u'openlp')) self.noInternetFinishButton.setVisible(False) # Check if this is a re-run of the wizard. - self.hasRunWizard = Settings().value(u'general/has run wizard') + 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') @@ -213,7 +213,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): index = self.themeComboBox.findText(theme) if index == -1: self.themeComboBox.addItem(theme) - default_theme = Settings().value(u'themes/global theme') + default_theme = Settings().value(u'themes/global theme', u'') # Pre-select the current default theme. index = self.themeComboBox.findText(default_theme) self.themeComboBox.setCurrentIndex(index) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 4f5a70827..7193ad024 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -142,7 +142,6 @@ class MainDisplay(Display): # Default to False on Gnome. x11_bypass_default = bool(not os.environ.get(u'GNOME_DESKTOP_SESSION_ID')) - # TODO: check if Settings().value(u'advanced/x11 bypass wm', x11_bypass_default): windowFlags |= QtCore.Qt.X11BypassWindowManagerHint # TODO: The following combination of windowFlags works correctly @@ -210,10 +209,11 @@ class MainDisplay(Display): # Build the initial frame. background_color = QtGui.QColor() background_color.setNamedColor(Settings().value( - u'advanced/default color')) + u'advanced/default color', u'#ffffff')) if not background_color.isValid(): background_color = QtCore.Qt.white - image_file = Settings().value(u'advanced/default image') + image_file = Settings().value(u'advanced/default image', + u':/graphics/openlp-splash-screen.png') splash_image = QtGui.QImage(image_file) self.initialFrame = QtGui.QImage( self.screen[u'size'].width(), @@ -377,7 +377,7 @@ class MainDisplay(Display): # Single screen active if self.screens.display_count == 1: # Only make visible if setting enabled. - if Settings().value(u'general/display on monitor'): + if Settings().value(u'general/display on monitor', True): self.setVisible(True) else: self.setVisible(True) @@ -428,7 +428,7 @@ class MainDisplay(Display): self.footer(serviceItem.foot_text) # if was hidden keep it hidden if self.hideMode and self.isLive and not serviceItem.is_media(): - if Settings().value(u'general/auto unblank'): + if Settings().value(u'general/auto unblank', False): Receiver.send_message(u'slidecontroller_live_unblank') else: self.hideDisplay(self.hideMode) @@ -451,7 +451,7 @@ class MainDisplay(Display): log.debug(u'hideDisplay mode = %d', mode) if self.screens.display_count == 1: # Only make visible if setting enabled. - if not Settings().value(u'general/display on monitor'): + if not Settings().value(u'general/display on monitor', True): return if mode == HideMode.Screen: self.frame.evaluateJavaScript(u'show_blank("desktop");') @@ -475,7 +475,7 @@ class MainDisplay(Display): log.debug(u'showDisplay') if self.screens.display_count == 1: # Only make visible if setting enabled. - if not Settings().value(u'general/display on monitor'): + if not Settings().value(u'general/display on monitor', True): return self.frame.evaluateJavaScript('show_blank("show");') if self.isHidden(): @@ -489,7 +489,7 @@ class MainDisplay(Display): """ Hide mouse cursor when moved over display. """ - if Settings().value(u'advanced/hide mouse'): + if Settings().value(u'advanced/hide mouse', True): self.setCursor(QtCore.Qt.BlankCursor) self.frame.evaluateJavaScript('document.body.style.cursor = "none"') else: diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index b0053233d..42b4740a2 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -104,10 +104,10 @@ class Ui_MainWindow(object): # Create slide controllers self.previewController = SlideController(self) self.liveController = SlideController(self, True) - previewVisible = Settings().value(u'user interface/preview panel') + previewVisible = Settings().value(u'user interface/preview panel', True) self.previewController.panel.setVisible(previewVisible) - liveVisible = Settings().value(u'user interface/live panel') - panelLocked = Settings().value(u'user interface/lock panel') + 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) @@ -701,8 +701,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.previewController.screenSizeChanged() self.liveController.screenSizeChanged() log.info(u'Load data from Settings') - if Settings().value(u'advanced/save current plugin'): - savedPlugin = Settings().value(u'advanced/current media plugin') + if Settings().value(u'advanced/save current plugin', False): + savedPlugin = Settings().value(u'advanced/current media plugin', -1) if savedPlugin != -1: self.mediaToolBox.setCurrentIndex(savedPlugin) self.settingsForm.postSetUp() @@ -754,10 +754,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): filename = unicode(filename, sys.getfilesystemencoding()) self.serviceManagerContents.loadFile(filename) elif Settings().value( - self.generalSettingsSection + u'/auto open'): + self.generalSettingsSection + u'/auto open', False): self.serviceManagerContents.loadLastFile() view_mode = Settings().value(u'%s/view mode' % - self.generalSettingsSection) + self.generalSettingsSection, u'default') if view_mode == u'default': self.modeDefaultItem.setChecked(True) elif view_mode == u'setup': @@ -1168,7 +1168,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): else: event.ignore() else: - if Settings().value(u'advanced/enable exit confirmation'): + if Settings().value(u'advanced/enable exit confirmation', True): ret = QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'Close OpenLP'), translate('OpenLP.MainWindow', @@ -1198,7 +1198,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # Clean temporary files used by services self.serviceManagerContents.cleanUp() if save_settings: - if Settings().value(u'advanced/save current plugin'): + 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. @@ -1340,7 +1340,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): if Settings().contains(self.generalSettingsSection + u'/enable slide loop'): if Settings().value(self.generalSettingsSection + - u'/enable slide loop'): + u'/enable slide loop', True): Settings().setValue(self.advancedSettingsSection + u'/slide limits', SlideLimits.Wrap) else: @@ -1399,7 +1399,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): Updates the recent file menu with the latest list of service files accessed. """ - recentFileCount = Settings().value(u'advanced/recent file count') + 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] @@ -1431,7 +1431,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # The maxRecentFiles value does not have an interface and so never gets # actually stored in the settings therefore the default value of 20 will # always be used. - maxRecentFiles = Settings().value(u'advanced/max recent files') + 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) diff --git a/openlp/core/ui/media/__init__.py b/openlp/core/ui/media/__init__.py index cfac9d461..9435ae1bf 100644 --- a/openlp/core/ui/media/__init__.py +++ b/openlp/core/ui/media/__init__.py @@ -76,10 +76,10 @@ def get_media_players(): from the settings. """ log.debug(u'get_media_players') - saved_players = Settings().value(u'media/players') + saved_players = Settings().value(u'media/players', u'webkit') reg_ex = QtCore.QRegExp(".*\[(.*)\].*") - if Settings().value(u'media/override player') == \ - QtCore.Qt.Checked: + if Settings().value(u'media/override player', + QtCore.Qt.Unchecked)== QtCore.Qt.Checked: if reg_ex.exactMatch(saved_players): overridden_player = u'%s' % reg_ex.cap(1) else: @@ -103,7 +103,7 @@ def set_media_players(players_list, overridden_player=u'auto'): """ log.debug(u'set_media_players') players = u','.join(players_list) - if Settings().value(u'media/override player') == QtCore.Qt.Checked and \ + 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) Settings().setValue(u'media/players', players) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index f380cd570..0ab529141 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -382,7 +382,7 @@ class MediaController(object): elif not hidden or controller.media_info.is_background or serviceItem.will_auto_start: autoplay = True # Unblank on load set - elif Settings().value(u'general/auto unblank'): + elif Settings().value(u'general/auto unblank', False): autoplay = True if autoplay: if not self.media_play(controller): diff --git a/openlp/core/ui/media/phononplayer.py b/openlp/core/ui/media/phononplayer.py index 26a73f3fb..b22219f50 100644 --- a/openlp/core/ui/media/phononplayer.py +++ b/openlp/core/ui/media/phononplayer.py @@ -222,7 +222,7 @@ class PhononPlayer(MediaPlayer): """ Add css style sheets to htmlbuilder """ - background = QtGui.QColor(Settings().value(u'players/background color')).name() + background = QtGui.QColor(Settings().value(u'players/background color', u'#000000')).name() return VIDEO_CSS % (background,background,background) def get_info(self): diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index fff97b327..07204aedc 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -113,7 +113,7 @@ class VlcPlayer(MediaPlayer): command_line_options = u'--no-video-title-show' if not display.hasAudio: command_line_options += u' --no-audio --no-video-title-show' - if Settings().value(u'advanced/hide mouse') and display.controller.isLive: + if Settings().value(u'advanced/hide mouse', True) and display.controller.isLive: command_line_options += u' --mouse-hide-timeout=0' display.vlcInstance = vlc.Instance(command_line_options) display.vlcInstance.set_log_verbosity(2) diff --git a/openlp/core/ui/media/webkitplayer.py b/openlp/core/ui/media/webkitplayer.py index 70fbc2afd..1c01e79a5 100644 --- a/openlp/core/ui/media/webkitplayer.py +++ b/openlp/core/ui/media/webkitplayer.py @@ -282,7 +282,7 @@ class WebkitPlayer(MediaPlayer): """ Add css style sheets to htmlbuilder """ - background = QtGui.QColor(Settings().value(u'players/background color')).name() + background = QtGui.QColor(Settings().value(u'players/background color', u'#000000')).name() css = VIDEO_CSS % (background,background,background) return css + FLASH_CSS diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 715041e2b..129a1addd 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -230,7 +230,7 @@ class ServiceManager(QtGui.QWidget): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.themeChange) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'service_item_update'), self.serviceItemUpdate) # Last little bits of setting up - self.service_theme = Settings().value(self.mainwindow.serviceManagerSettingsSection + u'/service theme') + self.service_theme = Settings().value(self.mainwindow.serviceManagerSettingsSection + u'/service theme', u'') self.servicePath = AppLocation.get_section_data_path(u'servicemanager') # build the drag and drop context menu self.dndMenu = QtGui.QMenu() @@ -318,7 +318,7 @@ class ServiceManager(QtGui.QWidget): """ Triggered when Config dialog is updated. """ - self.expandTabs = Settings().value(u'advanced/expand service item') + self.expandTabs = Settings().value(u'advanced/expand service item', False) def resetSupportedSuffixes(self): """ @@ -595,21 +595,25 @@ class ServiceManager(QtGui.QWidget): Get a file name and then call :func:`ServiceManager.saveFile` to save the file. """ - default_service_enabled = Settings().value(u'advanced/default service enabled') + default_service_enabled = Settings().value(u'advanced/default service enabled', True) if default_service_enabled: - service_day = Settings().value(u'advanced/default service day') + service_day = Settings().value(u'advanced/default service day', 7) if service_day == 7: local_time = datetime.now() else: - service_hour = Settings().value(u'advanced/default service hour') - service_minute = Settings().value(u'advanced/default service minute') + service_hour = Settings().value(u'advanced/default service hour', 11) + service_minute = Settings().value(u'advanced/default service minute', 0) now = datetime.now() day_delta = service_day - now.weekday() if day_delta < 0: day_delta += 7 time = now + timedelta(days=day_delta) local_time = time.replace(hour=service_hour, minute=service_minute) - default_pattern = Settings().value(u'advanced/default service name') + default_pattern = Settings().value(u'advanced/default service name', + translate('OpenLP.AdvancedTab', 'Service %Y-%m-%d %H-%M', + 'This may not contain any of the following characters: ' + '/\\?*|<>\[\]":+\nSee http://docs.python.org/library/' + 'datetime.html#strftime-strptime-behavior for more information.')) default_filename = format_time(default_pattern, local_time) else: default_filename = u'' @@ -737,7 +741,7 @@ class ServiceManager(QtGui.QWidget): service was last closed. Can be blank if there was no service present. """ - fileName = Settings().value(u'servicemanager/last file') + fileName = Settings().value(u'servicemanager/last file', u'') if fileName: self.loadFile(fileName) @@ -1286,7 +1290,8 @@ class ServiceManager(QtGui.QWidget): self.mainwindow.liveController.addServiceManagerItem( self.serviceItems[item][u'service_item'], child) if Settings().value( - self.mainwindow.generalSettingsSection + u'/auto preview'): + self.mainwindow.generalSettingsSection + u'/auto preview', + False): item += 1 if self.serviceItems and item < len(self.serviceItems) and \ self.serviceItems[item][u'service_item'].is_capable(ItemCapabilities.CanPreview): diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 5d2fc00d3..a986dd998 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -211,7 +211,7 @@ class SlideController(DisplayController): self.playSlidesOnce = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd, icon=u':/media/media_time.png', checked=False, shortcuts=[], category=self.category, triggers=self.onPlaySlidesOnce) - if Settings().value(self.parent().generalSettingsSection + u'/enable slide loop'): + if Settings().value(self.parent().generalSettingsSection + u'/enable slide loop', True): self.playSlidesMenu.setDefaultAction(self.playSlidesLoop) else: self.playSlidesMenu.setDefaultAction(self.playSlidesOnce) @@ -585,7 +585,7 @@ class SlideController(DisplayController): """ Updates the Slide Limits variable from the settings. """ - self.slide_limits = Settings().value(self.parent().advancedSettingsSection + u'/slide limits') + self.slide_limits = Settings().value(self.parent().advancedSettingsSection + u'/slide limits', SlideLimits.End) def enableToolBar(self, item): """ @@ -613,7 +613,7 @@ class SlideController(DisplayController): self.playSlidesLoop.setChecked(False) self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png')) if item.is_text(): - if Settings().value(self.parent().songsSettingsSection + u'/display songbar') and self.slideList: + if Settings().value(self.parent().songsSettingsSection + u'/display songbar', True) and self.slideList: self.songMenu.show() if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1: self.toolbar.setWidgetVisible(self.loopList) @@ -727,8 +727,8 @@ class SlideController(DisplayController): action.setData(counter) QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), self.onTrackTriggered) self.display.audioPlayer.repeat = Settings().value( - self.parent().generalSettingsSection + u'/audio repeat list') - if Settings().value(self.parent().generalSettingsSection + u'/audio start paused'): + self.parent().generalSettingsSection + u'/audio repeat list', False) + if Settings().value(self.parent().generalSettingsSection + u'/audio start paused', True): self.audioPauseItem.setChecked(True) self.display.audioPlayer.pause() else: @@ -837,7 +837,8 @@ class SlideController(DisplayController): Allow the main display to blank the main display at startup time """ log.debug(u'mainDisplaySetBackground live = %s' % self.isLive) - display_type = Settings().value(self.parent().generalSettingsSection + u'/screen blank') + 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 if display_type == u'themed': @@ -1191,7 +1192,7 @@ class SlideController(DisplayController): """ triggered by clicking the Preview slide items """ - if Settings().value(u'advanced/double click live'): + 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(): diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 76d26d1cb..6d1222481 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -167,7 +167,7 @@ class ThemeManager(QtGui.QWidget): Triggered when Config dialog is updated. """ self.global_theme = Settings().value( - self.settingsSection + u'/global theme') + self.settingsSection + u'/global theme', u'') def checkListState(self, item): """ @@ -451,7 +451,7 @@ class ThemeManager(QtGui.QWidget): self.settingsSection + u'/global theme', theme.theme_name) self.configUpdated() files = SettingsManager.get_files(self.settingsSection, u'.png') - # Sort the themes by its name considering language specific + # Sort the themes by its name considering language specific files.sort(key=lambda file_name: unicode(file_name), cmp=locale_compare) # now process the file list of png files @@ -767,7 +767,7 @@ class ThemeManager(QtGui.QWidget): is allowed. """ self.global_theme = Settings().value( - self.settingsSection + u'/global theme') + self.settingsSection + u'/global theme', u'') if check_item_selected(self.themeListWidget, select_text): item = self.themeListWidget.currentItem() theme = item.text() diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 71d87d020..12a474881 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -184,7 +184,7 @@ class ThemesTab(SettingsTab): """ # Reload as may have been triggered by the ThemeManager. self.global_theme = Settings().value( - self.settingsSection + u'/global theme') + 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) diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index e3b761f63..2c5c51411 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -107,7 +107,7 @@ class LanguageManager(object): """ Retrieve a saved language to use from settings """ - language = Settings().value(u'general/language') + language = Settings().value(u'general/language', u'[en]') language = str(language) log.info(u'Language file: \'%s\' Loaded from conf file' % language) if re.match(r'[[].*[]]', language): diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index b1c8795ec..1ca67e58f 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -128,7 +128,7 @@ class BibleManager(object): self.db_cache = None self.path = AppLocation.get_section_data_path(self.settingsSection) self.proxy_name = Settings().value( - self.settingsSection + u'/proxy name') + self.settingsSection + u'/proxy name', u'') self.suffix = u'.sqlite' self.import_wizard = None self.reload_bibles() @@ -372,7 +372,7 @@ class BibleManager(object): # If None is returned, it's not the singleton object but a # BibleMeta object with the value "None" language_selection = Settings().value( - self.settingsSection + u'/book name language') + self.settingsSection + u'/book name language', 0) else: language_selection = language_selection.value try: diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 4ce8d21d7..639db6018 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -292,7 +292,7 @@ class BibleMediaItem(MediaManagerItem): def configUpdated(self): log.debug(u'configUpdated') - if Settings().value(self.settingsSection + u'/second bibles'): + if Settings().value(self.settingsSection + u'/second bibles', True): self.advancedSecondLabel.setVisible(True) self.advancedSecondComboBox.setVisible(True) self.quickSecondLabel.setVisible(True) @@ -360,7 +360,8 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'Search Text...')) ]) self.quickSearchEdit.setCurrentSearchType(Settings().value( - u'%s/last search type' % self.settingsSection)) + u'%s/last search type' % self.settingsSection, + BibleSearch.Reference)) self.configUpdated() log.debug(u'bible manager initialise complete') @@ -382,13 +383,12 @@ class BibleMediaItem(MediaManagerItem): self.advancedVersionComboBox.addItems(bibles) self.advancedSecondComboBox.addItems(bibles) # set the default value - bible = Settings().value(self.settingsSection + u'/advanced bible') + 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]) - # TODO: check bible = Settings().value( self.settingsSection + u'/quick bible', self.quickVersionComboBox.currentText()) diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index e441185c2..537261b64 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -69,7 +69,7 @@ class CustomTab(SettingsTab): def load(self): self.displayFooter = Settings().value( - self.settingsSection + u'/display footer') + self.settingsSection + u'/display footer', True) self.displayFooterCheckBox.setChecked(self.displayFooter) def save(self): diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index d6b25218e..7662a3338 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -100,7 +100,6 @@ class CustomMediaItem(MediaManagerItem): ]) self.loadList(self.manager.get_all_objects( CustomSlide, order_by_ref=CustomSlide.title)) - # TODO: check self.searchTextEdit.setCurrentSearchType(Settings().value( u'%s/last search type' % self.settingsSection, CustomSearch.Titles)) @@ -212,7 +211,8 @@ class CustomMediaItem(MediaManagerItem): service_item.title = title for slide in raw_slides: service_item.add_from_text(slide) - if Settings().value(self.settingsSection + u'/display footer') or credit: + if Settings().value(self.settingsSection + u'/display footer', + True) or credit: service_item.raw_footer.append(u' '.join([title, credit])) else: service_item.raw_footer.append(u'') diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index d08263c07..62652ffaf 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -97,6 +97,6 @@ class ImagePlugin(Plugin): last part of saving the config. """ background = QtGui.QColor(Settings().value(self.settingsSection - + u'/background color')) + + u'/background color', u'#000000')) self.liveController.imageManager.updateImagesBorder( ImageSource.ImagePlugin, background) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index af11da624..fb99e9155 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -153,7 +153,7 @@ class ImageMediaItem(MediaManagerItem): def generateSlideData(self, service_item, item=None, xmlVersion=False, remote=False, context=ServiceItemContext.Service): background = QtGui.QColor(Settings().value(self.settingsSection - + u'/background color')) + + u'/background color', u'#000000')) if item: items = [item] else: @@ -222,7 +222,7 @@ class ImageMediaItem(MediaManagerItem): translate('ImagePlugin.MediaItem', 'You must select an image to replace the background with.')): background = QtGui.QColor(Settings().value( - self.settingsSection + u'/background color')) + self.settingsSection + u'/background color', u'#000000')) item = self.listView.selectedIndexes()[0] bitem = self.listView.item(item.row()) filename = bitem.data(QtCore.Qt.UserRole) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index a9e2e739e..efcf3b36e 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -192,7 +192,7 @@ class MediaMediaItem(MediaManagerItem): service_item.add_capability(ItemCapabilities.CanAutoStartForLive) service_item.add_capability(ItemCapabilities.RequiresMedia) service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay) - if Settings().value(self.settingsSection + u'/media auto start') == QtCore.Qt.Checked: + if Settings().value(self.settingsSection + u'/media auto start', QtCore.Qt.Unchecked) == QtCore.Qt.Checked: service_item.will_auto_start = True # force a non-existent theme service_item.theme = -1 diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index ab71f75d5..345edd7a7 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -72,17 +72,19 @@ class MediaTab(SettingsTab): self.autoStartCheckBox.setText(translate('MediaPlugin.MediaTab', 'Start Live items automatically')) def load(self): - self.overridePlayerCheckBox.setChecked(Settings().value(self.settingsSection + u'/override player')) - self.autoStartCheckBox.setChecked(Settings().value(self.settingsSection + u'/media auto start')) + self.overridePlayerCheckBox.setChecked(Settings().value(self.settingsSection + u'/override player', + QtCore.Qt.Unchecked)) + self.autoStartCheckBox.setChecked(Settings().value(self.settingsSection + u'/media auto start', + QtCore.Qt.Unchecked)) def save(self): override_changed = False setting_key = self.settingsSection + u'/override player' - if Settings().value(setting_key) != self.overridePlayerCheckBox.checkState(): + if Settings().value(setting_key, QtCore.Qt.Unchecked) != self.overridePlayerCheckBox.checkState(): Settings().setValue(setting_key, self.overridePlayerCheckBox.checkState()) override_changed = True setting_key = self.settingsSection + u'/media auto start' - if Settings().value(setting_key) != self.autoStartCheckBox.checkState(): + if Settings().value(setting_key, QtCore.Qt.Unchecked) != self.autoStartCheckBox.checkState(): Settings().setValue(setting_key, self.autoStartCheckBox.checkState()) if override_changed: self.parent.resetSupportedSuffixes() diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 8f369ca3c..462d12a5d 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -148,8 +148,8 @@ class PresentationMediaItem(MediaManagerItem): if self.displayTypeComboBox.count() > 1: self.displayTypeComboBox.insertItem(0, self.Automatic) self.displayTypeComboBox.setCurrentIndex(0) - if Settings().value(self.settingsSection + - u'/override app') == QtCore.Qt.Checked: + if Settings().value(self.settingsSection + u'/override app', + QtCore.Qt.Unchecked) == QtCore.Qt.Checked: self.presentationWidget.show() else: self.presentationWidget.hide() diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index f7caa2fc9..746bc7de9 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -392,7 +392,6 @@ class PresentationController(object): """ Return whether the controller is currently enabled """ - # TODO: check if Settings().value(self.settings_section + u'/' + self.name, QtCore.Qt.Checked) == QtCore.Qt.Checked: return self.is_available() diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index 59f0fb1cb..220da0d74 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -105,7 +105,6 @@ class PresentationTab(SettingsTab): for key in self.controllers: controller = self.controllers[key] checkbox = self.PresenterCheckboxes[controller.name] - # TODO check checkbox.setChecked(Settings().value( self.settingsSection + u'/' + controller.name, QtCore.Qt.Checked)) diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index cbc67d4b3..23f2cf83c 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -171,8 +171,10 @@ class HttpServer(object): clients. Listen out for socket connections. """ log.debug(u'Start TCP server') - port = Settings().value(self.plugin.settingsSection + u'/port') - address = Settings().value(self.plugin.settingsSection + u'/ip address') + 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,7 +406,7 @@ class HttpConnection(object): u'slide': self.parent.current_slide or 0, u'item': self.parent.current_item._uuid \ if self.parent.current_item else u'', - u'twelve':Settings().value(u'remotes/twelve hour'), + 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': \ diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index bf235e0bd..75ea3f290 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -151,20 +151,19 @@ class RemoteTab(SettingsTab): def load(self): self.portSpinBox.setValue( - Settings().value(self.settingsSection + u'/port')) + Settings().value(self.settingsSection + u'/port', 4316)) self.addressEdit.setText( - Settings().value(self.settingsSection + u'/ip address')) + Settings().value(self.settingsSection + u'/ip address', ZERO_URL)) self.twelveHour = Settings().value( - self.settingsSection + u'/twelve hour') + self.settingsSection + u'/twelve hour', True) self.twelveHourCheckBox.setChecked(self.twelveHour) self.setUrls() def save(self): changed = False - #TODO: check if Settings().value(self.settingsSection + u'/ip address', ZERO_URL != self.addressEdit.text() or Settings().value(self.settingsSection + - u'/port') != self.portSpinBox.value()): + u'/port', 4316) != self.portSpinBox.value()): changed = True Settings().setValue(self.settingsSection + u'/port', self.portSpinBox.value()) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 6e0f45b8d..e95a277a7 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -343,7 +343,8 @@ class SongImportForm(OpenLPWizard): self.restart() self.finishButton.setVisible(False) self.cancelButton.setVisible(True) - last_import_type = Settings().value(u'songs/last import type') + last_import_type = Settings().value( + u'songs/last import type') if last_import_type < 0 or \ last_import_type >= self.formatComboBox.count(): last_import_type = 0 diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 2df0cba5e..a6419de20 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -171,11 +171,11 @@ class SongMediaItem(MediaManagerItem): def configUpdated(self): self.searchAsYouType = Settings().value( - self.settingsSection + u'/search as type') + self.settingsSection + u'/search as type', False) self.updateServiceOnEdit = Settings().value( - self.settingsSection + u'/update service on edit') + self.settingsSection + u'/update service on edit', False) self.addSongFromService = Settings().value( - self.settingsSection + u'/add song from service') + self.settingsSection + u'/add song from service', True) def retranslateUi(self): self.searchTextLabel.setText(u'%s:' % UiStrings().Search) @@ -204,7 +204,6 @@ class SongMediaItem(MediaManagerItem): (SongSearch.Themes, u':/slides/slide_theme.png', UiStrings().Themes, UiStrings().SearchThemes) ]) - # TODO: check self.searchTextEdit.setCurrentSearchType(Settings().value( u'%s/last search type' % self.settingsSection, SongSearch.Entire)) self.configUpdated() @@ -547,10 +546,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 Settings().value(u'general/ccli number'): + if Settings().value(u'general/ccli number', u''): service_item.raw_footer.append( translate('SongsPlugin.MediaItem', 'CCLI License: ') + - Settings().value(u'general/ccli number')) + Settings().value(u'general/ccli number', u'')) service_item.audit = [ song.title, author_list, song.copyright, unicode(song.ccli_number) ] diff --git a/openlp/plugins/songusage/forms/songusagedetailform.py b/openlp/plugins/songusage/forms/songusagedetailform.py index c15c2f1b2..bd46f9173 100644 --- a/openlp/plugins/songusage/forms/songusagedetailform.py +++ b/openlp/plugins/songusage/forms/songusagedetailform.py @@ -61,7 +61,6 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog): year = QtCore.QDate().currentDate().year() if QtCore.QDate().currentDate().month() < 9: year -= 1 - # TODO: check toDate = Settings().value(self.plugin.settingsSection + u'/to date', QtCore.QDate(year, 8, 31)) fromDate = Settings().value(self.plugin.settingsSection + diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index e3f22da9f..b95d53a6f 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -127,7 +127,7 @@ class SongUsagePlugin(Plugin): QtCore.SIGNAL(u'print_service_started'), self.printSongUsage) self.songUsageActive = Settings().value( - self.settingsSection + u'/active') + self.settingsSection + u'/active', False) # Set the button and checkbox state self.setButtonState() action_list = ActionList.get_instance()