From 10fca2dd05605df9c2d65d7fd21e6396440f82e8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 25 Apr 2011 08:06:35 +0100 Subject: [PATCH 1/4] 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 From a173bce04719679db23196147da32e1d851abc5e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 25 Apr 2011 08:13:17 +0100 Subject: [PATCH 2/4] Minor fix --- openlp/core/ui/themeform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index a03cbea3b..f459289f6 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -280,7 +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.theme.background_filename = u'' self.updateThemeAllowed = False self.setDefaults() self.updateThemeAllowed = True From abf44320c34f01f9b8d11081ba849f45d39e5e6e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 25 Apr 2011 08:56:13 +0100 Subject: [PATCH 3/4] Set correct field to blank --- openlp/core/ui/themeform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index f459289f6..621493488 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -280,7 +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.temp_background_filename = u'' self.updateThemeAllowed = False self.setDefaults() self.updateThemeAllowed = True From 100fb77456fe162f3a996f4c8d4fee77f5f8bb1d Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 25 Apr 2011 11:26:21 +0100 Subject: [PATCH 4/4] Fix double edit --- openlp/core/ui/themeform.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 621493488..019ab5bfe 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -435,7 +435,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): if self.updateThemeAllowed: self.theme.background_type = BackgroundType.to_string(index) if self.theme.background_type != \ - BackgroundType.to_string(BackgroundType.Image): + 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 == \