From 10fca2dd05605df9c2d65d7fd21e6396440f82e8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 25 Apr 2011 08:06:35 +0100 Subject: [PATCH] Remove theme image if moving from image to solid or gradient. Fixes: https://launchpad.net/bugs/769988 --- openlp/core/lib/theme.py | 2 +- openlp/core/ui/themeform.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 698f0d644..7f2204c67 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -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) \ No newline at end of file + self.display_slide_transition) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index ebba45e7c..a03cbea3b 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -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 \ No newline at end of file + return field