Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2013-05-25 19:54:11 (GMT)
committer Walter Bender <walter@sugarlabs.org>2013-05-25 19:54:11 (GMT)
commit6d9ac3f513cdcca0b7a370f82650c6d183533ea0 (patch)
tree40a40a83fca487e44662ae9e5b946c05207825a2
parent6af0a4fcc3390fbdb3aa0e4d0dabf21f65bf5749 (diff)
restore cursor if chooser dialog is aborted
-rw-r--r--TurtleArt/tautils.py6
-rw-r--r--TurtleArt/tawindow.py7
-rw-r--r--TurtleArtActivity.py6
3 files changed, 14 insertions, 5 deletions
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index b520907..ff9ae7e 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -342,12 +342,12 @@ def chooser_dialog(parent_window, filter, action):
chooser.destroy()
del chooser
- if dsobject is not None:
- gobject.idle_add(_take_action, action, dsobject)
+ gobject.idle_add(_take_action, action, dsobject)
def _take_action(action, dsobject):
action(dsobject)
- dsobject.destroy()
+ if dsobject is not None:
+ dsobject.destroy()
def data_from_file(ta_file):
''' Open the .ta file, ignoring any .png file that might be present. '''
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index e4c7b65..064df2f 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -3370,8 +3370,9 @@ before making changes to your Turtle Blocks program'))
def _update_media_blk(self, dsobject):
''' Called from the chooser to load a media block '''
- self._update_media_icon(self.selected_blk, dsobject,
- dsobject.object_id)
+ if dsobject is not None:
+ self._update_media_icon(self.selected_blk, dsobject,
+ dsobject.object_id)
def _update_media_icon(self, blk, name, value=''):
''' Update the icon on a 'loaded' media block. '''
@@ -3700,6 +3701,8 @@ before making changes to your Turtle Blocks program'))
def load_python_code_from_journal(self, dsobject, blk=None):
''' Read the Python code from the Journal object '''
self.python_code = None
+ if dsobject is None:
+ return
try:
file_handle = open(dsobject.file_path, "r")
self.python_code = file_handle.read()
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py
index 48fb47f..9dcf352 100644
--- a/TurtleArtActivity.py
+++ b/TurtleArtActivity.py
@@ -199,6 +199,9 @@ class TurtleArtActivity(activity.Activity):
def _load_ta_project(self, dsobject):
''' Load a TA project from the datastore. '''
+ if dsobject is None:
+ self.restore_cursor()
+ return
try:
_logger.debug('Opening %s ' % (dsobject.file_path))
self.read_file(dsobject.file_path, plugin=False)
@@ -217,6 +220,9 @@ class TurtleArtActivity(activity.Activity):
def _load_ta_plugin(self, dsobject):
''' Load a TA plugin from the datastore. '''
+ if dsobject is None:
+ self.restore_cursor()
+ return
_logger.debug('Opening %s ' % (dsobject.file_path))
self.read_file(dsobject.file_path, plugin=True)