gnome-games r7965 - branches/gnome-2-24/glchess/src/lib/scene/opengl
- From: rancell svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r7965 - branches/gnome-2-24/glchess/src/lib/scene/opengl
- Date: Wed, 8 Oct 2008 04:08:29 +0000 (UTC)
Author: rancell
Date: Wed Oct 8 04:08:29 2008
New Revision: 7965
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7965&view=rev
Log:
Handle exceptions loading OpenGL textures (Bug #548916)
Modified:
branches/gnome-2-24/glchess/src/lib/scene/opengl/texture.py
Modified: branches/gnome-2-24/glchess/src/lib/scene/opengl/texture.py
==============================================================================
--- branches/gnome-2-24/glchess/src/lib/scene/opengl/texture.py (original)
+++ branches/gnome-2-24/glchess/src/lib/scene/opengl/texture.py Wed Oct 8 04:08:29 2008
@@ -48,11 +48,17 @@
def __loadPNG(self, fileName):
"""
"""
- reader = png.Reader(fileName)
+ try:
+ reader = png.Reader(fileName)
+ except IOError, e:
+ print 'Error loading texture file: %s: %s' % (fileName, e.strerror)
+ self.__data = None
+ return
+
try:
(width, height, data, metaData) = reader.read()
except png.Error, e:
- print 'Error loading texture %s: %s' % (fileName, e.message)
+ print 'Error parsing PNG file %s: %s' % (fileName, e.message)
self.__data = None
return
@@ -71,7 +77,12 @@
import Image
# Load the image file
- image = Image.open(fileName)
+ try:
+ image = Image.open(fileName)
+ except IOError, e:
+ print 'Error loading texture file: %s: %s' % (fileName, e.strerror)
+ self.__data = None
+ return
# Crop the image so it has height/width a multiple of 2
width = image.size[0]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]