Remove theme image if moving from image to solid or gradient.

Fixes: https://launchpad.net/bugs/769988
This commit is contained in:
Tim Bentley 2011-04-25 08:06:35 +01:00
parent b561221647
commit 10fca2dd05
2 changed files with 13 additions and 2 deletions

View File

@ -637,4 +637,4 @@ class ThemeXML(object):
self.font_footer_shadow_size)
self.add_display(self.display_horizontal_align,
self.display_vertical_align,
self.display_slide_transition)
self.display_slide_transition)

View File

@ -56,6 +56,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.setupUi(self)
self.registerFields()
self.updateThemeAllowed = True
self.temp_background_filename = u''
QtCore.QObject.connect(self.backgroundComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.onBackgroundComboBoxCurrentIndexChanged)
@ -279,6 +280,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
Run the wizard.
"""
log.debug(u'Editing theme %s' % self.theme.theme_name)
self.theme.background_filename != u''
self.updateThemeAllowed = False
self.setDefaults()
self.updateThemeAllowed = True
@ -432,6 +434,15 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
# do not allow updates when screen is building for the first time.
if self.updateThemeAllowed:
self.theme.background_type = BackgroundType.to_string(index)
if self.theme.background_type != \
BackgroundType.to_string(BackgroundType.Image):
self.temp_background_filename = self.theme.background_filename
self.theme.background_filename = u''
if self.theme.background_type == \
BackgroundType.to_string(BackgroundType.Image) and \
self.temp_background_filename != u'':
self.theme.background_filename = self.temp_background_filename
self.temp_background_filename = u''
self.setBackgroundPageValues()
def onGradientComboBoxCurrentIndexChanged(self, index):
@ -589,4 +600,4 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
QtGui.QColor(field), self)
if new_color.isValid():
field = new_color.name()
return field
return field