Theme values are preserved correctly

Fixes: https://launchpad.net/bugs/684901
This commit is contained in:
Tim Bentley 2010-12-03 20:22:59 +00:00
parent 22f52b74c1
commit 41dfd114d7
2 changed files with 10 additions and 8 deletions

View File

@ -318,7 +318,6 @@ class ThemeXML(object):
``shadow_size`` ``shadow_size``
How big the Shadow is How big the Shadow is
""" """
background = self.theme_xml.createElement(u'font') background = self.theme_xml.createElement(u'font')
background.setAttribute(u'type', fonttype) background.setAttribute(u'type', fonttype)

View File

@ -55,6 +55,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.setupUi(self) self.setupUi(self)
self.registerFields() self.registerFields()
self.accepted = False self.accepted = False
self.updateThemeAllowed = True
QtCore.QObject.connect(self.backgroundTypeComboBox, QtCore.QObject.connect(self.backgroundTypeComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'), QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.onBackgroundComboBox) self.onBackgroundComboBox)
@ -164,8 +165,6 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
u'background_image', self.imageLineEdit) u'background_image', self.imageLineEdit)
self.backgroundPage.registerField( self.backgroundPage.registerField(
u'gradient', self.gradientComboBox) u'gradient', self.gradientComboBox)
self.mainAreaPage.registerField(
u'mainFontComboBox', self.mainFontComboBox)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
u'mainColorPushButton', self.mainColorPushButton) u'mainColorPushButton', self.mainColorPushButton)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
@ -285,7 +284,9 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
""" """
Run the wizard. Run the wizard.
""" """
self.updateThemeAllowed = False
self.setDefaults() self.setDefaults()
self.updateThemeAllowed = True
return QtGui.QWizard.exec_(self) return QtGui.QWizard.exec_(self)
def initializePage(self, id): def initializePage(self, id):
@ -526,11 +527,11 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.theme.background_filename = unicode(filename) self.theme.background_filename = unicode(filename)
self.setBackgroundTabValues() self.setBackgroundTabValues()
def onMainFontComboBox(self): # def onMainFontComboBox(self):
""" # """
Main Font Combo box changed # Main Font Combo box changed
""" # """
self.theme.font_main_name = self.mainFontComboBox.currentFont().family() # self.theme.font_main_name = self.mainFontComboBox.currentFont().family()
def onMainColourPushButtonClicked(self): def onMainColourPushButtonClicked(self):
self.theme.font_main_color = \ self.theme.font_main_color = \
@ -557,6 +558,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
Update the theme object from the UI for fields not already updated Update the theme object from the UI for fields not already updated
when the are changed. when the are changed.
""" """
if not self.updateThemeAllowed:
return
log.debug(u'updateTheme') log.debug(u'updateTheme')
# main page # main page
self.theme.font_main_name = \ self.theme.font_main_name = \