Nicer handling of missing images in gkofoto.
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 7 Jul 2004 15:47:06 +0000 (15:47 +0000)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 7 Jul 2004 15:47:06 +0000 (15:47 +0000)
doc/todo.txt
setup.py
src/gkofoto/environment.py
src/gkofoto/icons/unknownimage.png [new file with mode: 0644]
src/gkofoto/imageview.py
src/gkofoto/objectcollection.py

index 7bc7af5..a160706 100644 (file)
 
 * Preload next and previous image in gkofoto by a separate thread.
 
-* Handle that an image is missing on the disk, at least by displaying
-  a "not found" icon.
-
 * Make it possible to mark images as being off-line. If an image is
   off-line, don't look for it in the recorded location but instead
   make use of the largest available image in the image cache.
index a2c3541..c987a0b 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,8 @@ data_files = [
                              "src/gkofoto/icons/fullscreen-24.png",
                              "src/gkofoto/icons/objectview.png",
                              "src/gkofoto/icons/tableview.png",
-                             "src/gkofoto/icons/thumbnailsview.png"])
+                             "src/gkofoto/icons/thumbnailsview.png",
+                             "src/gkofoto/icons/unknownimage.png"])
     ]
 if os.name == "posix":
     if os.system("cd src/web && make") != 0:
index 25dc96c..603a245 100644 (file)
@@ -40,7 +40,8 @@ class Environment:
         self.albumIconFileName = os.path.join(self.iconDir, "album.png")
         self.albumIconPixbuf = gtk.gdk.pixbuf_new_from_file(self.albumIconFileName)
         self.loadingPixbuf = self.albumIconPixbuf # TODO: create another icon with a hour-glass or something
-        self.thumbnailErrorIconPixbuf = self.albumIconPixbuf # TODO: create another icon
+        self.unknownImageIconFileName = os.path.join(self.iconDir, "unknownimage.png")
+        self.unknownImageIconPixbuf = gtk.gdk.pixbuf_new_from_file(self.unknownImageIconFileName)
         from clipboard import Clipboard
         self.clipboard = Clipboard()
 
diff --git a/src/gkofoto/icons/unknownimage.png b/src/gkofoto/icons/unknownimage.png
new file mode 100644 (file)
index 0000000..e9377b8
Binary files /dev/null and b/src/gkofoto/icons/unknownimage.png differ
index 4afd223..f71dee5 100644 (file)
@@ -41,14 +41,14 @@ class ImageView(gtk.ScrolledWindow):
             self.clear()
             env.debug("ImageView is loading image from file: " + fileName)
             self.__pixBuf = gtk.gdk.pixbuf_new_from_file(fileName)
-            self._image.show()
-            self._newImageLoaded = True
-            self.fitToWindow()
             self.__loadedFileName = fileName
         except gobject.GError, e:
             print "Error while loading image:", e # TODO show error dialog box.
-            self.__pixBuf = None
-            self._image.hide()
+            self.__pixBuf = env.unknownImageIconPixbuf
+            self.__loadedFileName = None
+        self._newImageLoaded = True
+        self._image.show()
+        self.fitToWindow()
 
     def clear(self):
         self._image.hide()
index 642a991..45dffd7 100644 (file)
@@ -301,6 +301,6 @@ class ObjectCollection(object):
                 pixbuf = gtk.gdk.pixbuf_new_from_file(thumbnailLocation.encode(env.codeset))
                 # TODO Set and use COLUMN_VALID_LOCATION and COLUMN_VALID_CHECKSUM
             except IOError:
-                pixbuf = env.thumbnailErrorIconPixbuf
+                pixbuf = env.unknownImageIconPixbuf
         model.set_value(iter, self.COLUMN_THUMBNAIL, pixbuf)