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-10-08 15:15:24 (GMT)
committer Walter Bender <walter@sugarlabs.org>2013-10-08 15:15:24 (GMT)
commit824ff6dec125e6b6de0067271be807a188c70fe8 (patch)
treeafacfca0c32d5716b8f667c0bb267d0f976e4b84
parentab360f567baf4588fcfb85dfd2f5e92ed22b7765 (diff)
more robust plugin checks
-rw-r--r--TurtleArt/tawindow.py47
1 files changed, 40 insertions, 7 deletions
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. '''