Fix error in Theme Wizard backgrounds

bzr-revno: 1491
Fixes: https://launchpad.net/bugs/769988
This commit is contained in:
Tim Bentley 2011-04-26 19:25:52 +01:00
commit a1f4d5cd2b
2 changed files with 14 additions and 2 deletions

View File

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