← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/bug-1071170 into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/bug-1071170 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1071170 in OpenLP: "Exception on missing theme background image"
  https://bugs.launchpad.net/openlp/+bug/1071170

For more details, see:
https://code.launchpad.net/~trb143/openlp/bug-1071170/+merge/134736

To test this you need to set up your environment.

1) clone a theme with a background image
2) edit the file system and delete/rename the background image file.

in Trunk

Using the theme gives a black background.
Reindexing the themes goes bang.

In this version:
Using the theme gives a black background.
Reindexing the themes amends the theme to have a black background.



-- 
https://code.launchpad.net/~trb143/openlp/bug-1071170/+merge/134736
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bug-1071170 into lp:openlp.
=== modified file 'openlp/core/lib/imagemanager.py'
--- openlp/core/lib/imagemanager.py	2012-11-11 21:16:14 +0000
+++ openlp/core/lib/imagemanager.py	2012-11-16 19:53:23 +0000
@@ -126,7 +126,9 @@
         self.priority = Priority.Normal
         self.source = source
         self.background = background
-        self.timestamp = os.stat(path).st_mtime
+        self.timestamp = 0
+        if os.path.exists(path):
+            self.timestamp = os.stat(path).st_mtime
         self.secondary_priority = Image.secondary_priority
         Image.secondary_priority += 1
 
@@ -296,9 +298,11 @@
         # Check if the there are any images with the same path and check if the
         # timestamp has changed.
         for image in self._cache.values():
-            if image.path == path and image.timestamp != os.stat(path).st_mtime:
-                image.timestamp = os.stat(path).st_mtime
-                self._resetImage(image)
+            if os.path.exists(path):
+                if image.path == path and \
+                    image.timestamp != os.stat(path).st_mtime:
+                    image.timestamp = os.stat(path).st_mtime
+                    self._resetImage(image)
         # We want only one thread.
         if not self.imageThread.isRunning():
             self.imageThread.start()


Follow ups