From ec0a4a5d4bfda70500b5cda6255b915a6e9f3e7b Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 18 Jan 2013 13:34:18 -0500 Subject: [PATCH] Handle cancels of imports gracefully --- lightningbeam.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lightningbeam.py b/lightningbeam.py index 2820002..ab0169d 100755 --- a/lightningbeam.py +++ b/lightningbeam.py @@ -629,7 +629,11 @@ def save_file_as(widget=None): svlgui.FILE = thetarfile pass 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"): if thefile.endswith(i): # im = svlgui.Image(thefile)