Fixed #1204629 so that typing an image path actually changes the background.

Made the page validation more robust by including the fileDialog

bzr-revno: 2284
Fixes: https://launchpad.net/bugs/1204629
This commit is contained in:
Philip Ridout 2013-07-31 19:31:59 +02:00 committed by Andreas Preikschat
commit 97de1555fe

View File

@ -71,6 +71,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.gradientStartButton.clicked.connect(self.onGradientStartButtonClicked) self.gradientStartButton.clicked.connect(self.onGradientStartButtonClicked)
self.gradientEndButton.clicked.connect(self.onGradientEndButtonClicked) self.gradientEndButton.clicked.connect(self.onGradientEndButtonClicked)
self.imageBrowseButton.clicked.connect(self.onImageBrowseButtonClicked) self.imageBrowseButton.clicked.connect(self.onImageBrowseButtonClicked)
self.imageFileEdit.editingFinished.connect(self.onImageFileEditEditingFinished)
self.mainColorButton.clicked.connect(self.onMainColorButtonClicked) self.mainColorButton.clicked.connect(self.onMainColorButtonClicked)
self.outlineColorButton.clicked.connect(self.onOutlineColorButtonClicked) self.outlineColorButton.clicked.connect(self.onOutlineColorButtonClicked)
self.shadowColorButton.clicked.connect(self.onShadowColorButtonClicked) self.shadowColorButton.clicked.connect(self.onShadowColorButtonClicked)
@ -178,7 +179,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
""" """
background_image = BackgroundType.to_string(BackgroundType.Image) background_image = BackgroundType.to_string(BackgroundType.Image)
if self.page(self.currentId()) == self.backgroundPage and \ if self.page(self.currentId()) == self.backgroundPage and \
self.theme.background_type == background_image and is_not_image_file(self.imageFileEdit.text()): self.theme.background_type == background_image and is_not_image_file(self.theme.background_filename):
QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeWizard', 'Background Image Empty'), QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeWizard', 'Background Image Empty'),
translate('OpenLP.ThemeWizard', 'You have not selected a ' translate('OpenLP.ThemeWizard', 'You have not selected a '
'background image. Please select one before continuing.')) 'background image. Please select one before continuing.'))
@ -441,6 +442,12 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.theme.background_filename = unicode(filename) self.theme.background_filename = unicode(filename)
self.setBackgroundPageValues() self.setBackgroundPageValues()
def onImageFileEditEditingFinished(self):
"""
Background image path edited
"""
self.theme.background_filename = unicode(self.imageFileEdit.text())
def onMainColorButtonClicked(self): def onMainColorButtonClicked(self):
""" """
Set the main colour value Set the main colour value