Nicer crash handling for PIL problem with a warning etc.

This commit is contained in:
Cas Cremers
2008-05-02 17:10:29 +02:00
parent eb64f68968
commit 76bf6328b6
4 changed files with 33 additions and 5 deletions

View File

@@ -30,6 +30,7 @@ import time
""" Import scyther-gui components """
import Icon
import Preference
import Error
#---------------------------------------------------------------------------
if Preference.usePIL():
@@ -70,7 +71,11 @@ class AttackDisplay(wx.ScrolledWindow):
self.original = wx.Image(filename,wx.BITMAP_TYPE_PNG)
elif attack.filetype == "ps":
# depends on PIL lib
self.original = Image.open(filename)
try:
self.original = Image.open(filename)
except:
Preference.doNotUsePIL()
raise Error.PILError
else:
print "Unknown file type %s." % (self.filetype)