phill has proposed merging lp:~phill-ridout/openlp/issue1000 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
  phill (phill-ridout)
Related bugs:
  Bug #1039221 in OpenLP: "No validation on background image field in theme 
wizard"
  https://bugs.launchpad.net/openlp/+bug/1039221

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/issue1000/+merge/121249

Fixes bug 1039221 No validation on background image field in theme wizard
Also normalise the path
-- 
https://code.launchpad.net/~phill-ridout/openlp/issue1000/+merge/121249
Your team OpenLP Core is requested to review the proposed merge of 
lp:~phill-ridout/openlp/issue1000 into lp:openlp.
=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py	2012-07-08 08:23:56 +0000
+++ openlp/core/ui/themeform.py	2012-08-24 17:31:25 +0000
@@ -524,7 +524,8 @@
             translate('OpenLP.ThemeForm', 'Select Image'), u'',
             images_filter)
         if filename:
-            self.theme.background_filename = unicode(filename)
+            self.theme.background_filename = \
+                os.path.normpath(unicode(filename))
         self.setBackgroundPageValues()
 
     def onMainColorButtonClicked(self):
@@ -617,6 +618,14 @@
         saveTo = None
         if self.theme.background_type == \
             BackgroundType.to_string(BackgroundType.Image):
+            if not os.path.isfile(self.theme.background_filename):
+                critical_error_message_box(
+                    translate('OpenLP.ThemeForm', 'Background Image Invalid'),
+                    translate('OpenLP.ThemeForm',
+                        'Image was selected as the Background Type, but the '
+                        'image you selected is invalid. Please go back and '
+                        'choose another image'))
+                return
             filename = \
                 os.path.split(unicode(self.theme.background_filename))[1]
             saveTo = os.path.join(self.path, self.theme.theme_name, filename)

_______________________________________________
Mailing list: https://launchpad.net/~openlp-core
Post to     : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp

Reply via email to