diff options
author | Pootle daemon <pootle@pootle.sugarlabs.org> | 2013-10-08 17:52:19 (GMT) |
---|---|---|
committer | Pootle daemon <pootle@pootle.sugarlabs.org> | 2013-10-08 17:52:19 (GMT) |
commit | 86f63f3a724d4be597018194813368db827b7993 (patch) | |
tree | 99fafe29f81859a3786eef81bede1e86673f7084 | |
parent | 7dd3558fa0596e85bb928d00097034c4de224501 (diff) | |
parent | 824ff6dec125e6b6de0067271be807a188c70fe8 (diff) |
Merge branch 'master' of git.sugarlabs.org:turtleart/mainline
-rw-r--r-- | TurtleArt/tabasics.py | 3 | ||||
-rw-r--r-- | TurtleArt/tawindow.py | 47 | ||||
-rw-r--r-- | plugins/turtle_blocks_extras/turtle_blocks_extras.py | 13 | ||||
-rwxr-xr-x | turtleblocks.py | 2 |
4 files changed, 52 insertions, 13 deletions
diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py index 8586ad9..3d1eb10 100644 --- a/TurtleArt/tabasics.py +++ b/TurtleArt/tabasics.py @@ -278,10 +278,11 @@ turtle (can be used in place of a number block)'), 0, lambda self: self.tw.turtles.get_active_turtle().get_heading()) + # This block is used for holding the remote turtle name palette.add_block('turtle-label', hidden=True, style='blank-style', - label=['turtle']) + label=['remote turtle name']) # Deprecated palette.add_block('setxy', diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index ecdf090..785a666 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -404,38 +404,71 @@ class TurtleArtWindow(): def _setup_plugins(self): ''' Initial setup -- called just once. ''' for plugin in self.turtleart_plugins: - plugin.setup() + try: + plugin.setup() + except Exception as e: + debug_output('Plugin %s failed during setup: %s' % + (plugin_class, str(e)), self.running_sugar) def _start_plugins(self): ''' Start is called everytime we execute blocks. ''' for plugin in self.turtleart_plugins: - plugin.start() + if hasattr(plugin, 'start'): + try: + plugin.start() + except Exception as e: + debug_output('Plugin %s failed during start: %s' % + (plugin_class, str(e)), self.running_sugar) def stop_plugins(self): ''' Stop is called whenever we stop execution. ''' for plugin in self.turtleart_plugins: - plugin.stop() + if hasattr(plugin, 'stop'): + try: + plugin.stop() + except Exception as e: + debug_output('Plugin %s failed during stop: %s' % + (plugin_class, str(e)), self.running_sugar) def clear_plugins(self): ''' Clear is called from the clean block and erase button. ''' for plugin in self.turtleart_plugins: if hasattr(plugin, 'clear'): - plugin.clear() + try: + plugin.clear() + except Exception as e: + debug_output('Plugin %s failed during clear: %s' % + (plugin_class, str(e)), self.running_sugar) def background_plugins(self): ''' Background is called when we are pushed to the background. ''' for plugin in self.turtleart_plugins: - plugin.goto_background() + if hasattr(plugin, 'goto_background'): + try: + plugin.goto_background() + except Exception as e: + debug_output('Plugin %s failed during background: %s' % + (plugin_class, str(e)), self.running_sugar) def foreground_plugins(self): ''' Foreground is called when we are return from the background. ''' for plugin in self.turtleart_plugins: - plugin.return_to_foreground() + if hasattr(plugin, 'return_to_foreground'): + try: + plugin.return_to_foreground() + except Exception as e: + debug_output('Plugin %s failed during foreground: %s' % + (plugin_class, str(e)), self.running_sugar) def quit_plugins(self): ''' Quit is called upon program exit. ''' for plugin in self.turtleart_plugins: - plugin.quit() + if hasattr(plugin, 'quit'): + try: + plugin.quit() + except Exception as e: + debug_output('Plugin %s failed during quit: %s' % + (plugin_class, str(e)), self.running_sugar) def _setup_events(self): ''' Register the events we listen to. ''' diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py index defd35f..1f910fd 100644 --- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py +++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py @@ -674,11 +674,11 @@ module found in the Journal')) palette.add_block('addturtle', style='basic-style-1arg', label=_('turtle'), - prim_name='turtle', + prim_name='addturtle', default=1, string_or_number=True, help_string=_('chooses which turtle to command')) - self.tw.lc.def_prim('turtle', 1, + self.tw.lc.def_prim('addturtle', 1, lambda self, x: self.tw.turtles.set_turtle(x)) @@ -1009,7 +1009,7 @@ Journal objects')) for tafile in files: data = data_from_file(tafile) name = os.path.basename(tafile)[:-3] - print 'loading macro %s' % (name) + # print 'loading macro %s' % (name) MACROS['user-defined-' + name] = hat_on_top(listify(data)) palette.add_block('user-defined-' + name, style='basic-style-extended-vertical', @@ -1575,13 +1575,16 @@ Journal objects')) x, y = self.tw.turtles.turtle_to_screen_coordinates((x, y)) for name in block_names: # Translate label name into block/prim name. - if blkname in block_names[name]: + if blkname in block_names[name]: # block label is an array + # print 'found a match', blkname, name, block_names[name] if name in content_blocks or \ (name in block_primitives and block_primitives[name] == name): + # print '_make_block', blkname, name return self._make_block(name, x, y, defaults) elif blkname in block_names: - return self._make_block(blkname, x, y, defaults) + # print '_make_block', blkname + return self._make_block(blkname, x, y, defaults) for name in special_names: # Translate label name into block/prim name. if blkname in special_names[name]: diff --git a/turtleblocks.py b/turtleblocks.py index 24b6343..d982307 100755 --- a/turtleblocks.py +++ b/turtleblocks.py @@ -619,6 +619,8 @@ Would you like to save before quitting?')) def _do_hover_help_off_cb(self, button): ''' Turn hover help off ''' + if self.tw.no_help: # Debounce + return self.tw.no_help = True self.tw.last_label = None if self.tw.status_spr is not None: |