Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TurtleArt/tabasics.py3
-rw-r--r--TurtleArt/tawindow.py47
-rw-r--r--plugins/turtle_blocks_extras/turtle_blocks_extras.py13
-rwxr-xr-xturtleblocks.py2
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: