Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/turtleblocks.py
diff options
context:
space:
mode:
authorMarion <marion.zepf@gmail.com>2013-08-01 16:35:58 (GMT)
committer Marion <marion.zepf@gmail.com>2013-08-01 16:35:58 (GMT)
commit555063f706111aaae91fe0e2714feab88c608463 (patch)
tree41464ff7f4286a98bda7a8092708e1bf50332c36 /turtleblocks.py
parente7712483930edb82a57e47e8afd104bfc305ee7f (diff)
show a nice error message if the program contains non-exportable blocks
Diffstat (limited to 'turtleblocks.py')
-rwxr-xr-xturtleblocks.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/turtleblocks.py b/turtleblocks.py
index d5dca1c..a42420b 100755
--- a/turtleblocks.py
+++ b/turtleblocks.py
@@ -52,6 +52,7 @@ from gettext import gettext as _
from TurtleArt.taconstants import (OVERLAY_LAYER, DEFAULT_TURTLE_COLORS,
TAB_LAYER, SUFFIX)
+from TurtleArt.taprimitive import PyExportError
from TurtleArt.tautils import (data_from_string, get_save_name)
from TurtleArt.tawindow import TurtleArtWindow
from TurtleArt.taexportlogo import save_logo
@@ -532,8 +533,12 @@ Would you like to save before quitting?'))
def _do_save_python_cb(self, widget):
''' Callback for saving the project as Python code. '''
- # TODO implement
- pythoncode = save_python(self.tw)
+ # catch PyExportError and display a user-friendly message instead
+ try:
+ pythoncode = save_python(self.tw)
+ except PyExportError as pyee:
+ self.tw.showlabel('status', str(pyee))
+ return
if not pythoncode:
return
save_type = '.py'