fixed screen default values (-1 is also allowed as x,y); fixed syntax

This commit is contained in:
Andreas Preikschat 2013-01-18 22:06:09 +01:00
parent 2b38081b47
commit 6f3f9ce0ea
4 changed files with 6 additions and 8 deletions

View File

@ -173,6 +173,7 @@ class OpenLP(QtGui.QApplication):
return False
def hookException(self, exctype, value, traceback):
print ''.join(format_exception(exctype, value, traceback))
if not hasattr(self, u'mainWindow'):
log.exception(''.join(format_exception(exctype, value, traceback)))
return

View File

@ -259,16 +259,13 @@ class ScreenList(object):
width = settings.value(u'width')
height = settings.value(u'height')
# If -1 has been returned we have to use default values.
if x == -1:
if width == -1 or height == -1:
x = self.current[u'size'].x()
settings.setValue(u'x position', x)
if y == -1:
self.current[u'size'].y()
y = self.current[u'size'].y()
settings.setValue(u'y position', y)
if width == -1:
width = self.current[u'size'].width()
settings.setValue(u'width', width)
if height == -1:
height = self.current[u'size'].height()
settings.setValue(u'height', height)
self.override[u'size'] = QtCore.QRect(x, y, width, height)

View File

@ -128,8 +128,8 @@ class Settings(QtCore.QSettings):
u'general/screen blank': False,
u'general/override position': False,
# Display defaults are set in core/lib/screen.py due to a circle dependency.
u'general/x position': -1,
u'general/y position': -1,
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,

View File

@ -280,5 +280,5 @@ class OpenLPWizard(QtGui.QWizard):
Settings().value(self.plugin.settingsSection + u'/' + setting_name),
QtGui.QFileDialog.ShowDirsOnly)
if folder:
editbox.setText(folder
editbox.setText(folder)
Settings().setValue(self.plugin.settingsSection + u'/' + setting_name, folder)