Handle cancels of imports gracefully

This commit is contained in:
Skyler Lehmkuhl 2013-01-18 13:34:18 -05:00
parent 3354775a9a
commit ec0a4a5d4b
1 changed files with 5 additions and 1 deletions

View File

@ -629,7 +629,11 @@ def save_file_as(widget=None):
svlgui.FILE = thetarfile svlgui.FILE = thetarfile
pass pass
def import_to_stage(widget=None): def import_to_stage(widget=None):
thefile = svlgui.file_dialog("open",None,["jpg","png","bmp","wav"]).path try:
thefile = svlgui.file_dialog("open",None,["jpg","png","bmp","wav"]).path
except AttributeError:
# User cancelled
return
for i in ("jpg","png","bmp"): for i in ("jpg","png","bmp"):
if thefile.endswith(i): if thefile.endswith(i):
# im = svlgui.Image(thefile) # im = svlgui.Image(thefile)