From df55fb1ebb38d6bec0bb555d7c9c65e64323e517 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 20 Jan 2013 12:46:19 +0100 Subject: [PATCH] improved screen list settings --- openlp/core/lib/screen.py | 24 ++++++++++-------------- openlp/core/lib/settings.py | 8 ++------ 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/openlp/core/lib/screen.py b/openlp/core/lib/screen.py index e0a356990..4c9032c97 100644 --- a/openlp/core/lib/screen.py +++ b/openlp/core/lib/screen.py @@ -244,13 +244,19 @@ class ScreenList(object): Loads the screen size and the monitor number from the settings. """ from openlp.core.lib import Settings + # Add the screen settings to the settings dict. This has to be done here due to crycle dependency. + # Do not do this anywhere else. + screen_settings = { + u'general/x position': self.current[u'size'].x(), + u'general/y position': self.current[u'size'].y(), + u'general/monitor': self.display_count - 1, + u'general/height': self.current[u'size'].height(), + u'general/width': self.current[u'size'].width() + } + Settings.extend_default_settings(screen_settings) settings = Settings() settings.beginGroup(u'general') monitor = settings.value(u'monitor') - # If -1 has been returned we have to use default values. - if monitor == -1: - monitor = self.display_count - 1 - settings.setValue(u'monitor', monitor) self.set_current_display(monitor) self.display = settings.value(u'display on monitor') override_display = settings.value(u'override position') @@ -258,16 +264,6 @@ class ScreenList(object): y = settings.value(u'y position') width = settings.value(u'width') height = settings.value(u'height') - # If -1 has been returned we have to use default values. - if width == -1 or height == -1: - x = self.current[u'size'].x() - settings.setValue(u'x position', x) - y = self.current[u'size'].y() - settings.setValue(u'y position', y) - width = self.current[u'size'].width() - settings.setValue(u'width', width) - height = self.current[u'size'].height() - settings.setValue(u'height', height) self.override[u'size'] = QtCore.QRect(x, y, width, height) self.override[u'primary'] = False settings.endGroup() diff --git a/openlp/core/lib/settings.py b/openlp/core/lib/settings.py index 1b534410f..2ae916fd9 100644 --- a/openlp/core/lib/settings.py +++ b/openlp/core/lib/settings.py @@ -126,13 +126,9 @@ class Settings(QtCore.QSettings): u'general/enable slide loop': True, u'general/show splash': True, u'general/screen blank': False, + # The oder display settings (display position and dimensions) are defined in the ScreenList class due to crycle + # dependency. u'general/override position': False, - # Display defaults are set in core/lib/screen.py due to a circle dependency. - u'general/x position': 0, # All integers are valid, that is why we use 0. - u'general/y position': 0, # All integers are valid, that is why we use 0. - u'general/monitor': -1, - u'general/height': -1, - u'general/width': -1, u'general/loop delay': 5, u'general/songselect username': u'', u'general/audio repeat list': False,