From b5b37549ff391bb9afe7eb34935c8ccab7d3e314 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Thu, 08 Nov 2012 20:05:07 +0000 Subject: change scope of init_complete to activity parent --- (limited to 'turtleblocks.py') diff --git a/turtleblocks.py b/turtleblocks.py index 5c536a2..b508c5b 100755 --- a/turtleblocks.py +++ b/turtleblocks.py @@ -89,20 +89,22 @@ class TurtleMain(): self._init_vars() self._parse_command_line() self._ensure_sugar_paths() - self._plugins = [] + self._gnome_plugins = [] if self._output_png: # Outputing to file, so no need for a canvas self.canvas = None self._build_window(interactive=False) + self.init_complete = True self._draw_and_quit() else: self._read_initial_pos() - self._init_plugins() + self._init_gnome_plugins() self._setup_gtk() self._build_window() - self._run_plugins() + self._run_gnome_plugins() self._start_gtk() + self.init_complete = True def get_config_home(self): return CONFIG_HOME @@ -125,7 +127,7 @@ class TurtleMain(): plugin_files.append(c.split('.')[0]) return plugin_files - def _init_plugins(self): + def _init_gnome_plugins(self): ''' Try launching any plugins we may have found. ''' for p in self._get_plugin_candidates(self._get_gnome_plugin_home()): P = p.capitalize() @@ -134,13 +136,13 @@ class TurtleMain(): plugin = {} try: exec f in globals(), plugin - self._plugins.append(plugin.values()[0](self)) + self._gnome_plugins.append(plugin.values()[0](self)) except ImportError, e: print 'failed to import %s: %s' % (P, str(e)) - def _run_plugins(self): + def _run_gnome_plugins(self): ''' Tell the plugin about the TurtleWindow instance. ''' - for p in self._plugins: + for p in self._gnome_plugins: p.set_tw(self.tw) def _mkdir_p(self, path): @@ -212,6 +214,7 @@ class TurtleMain(): self.current_palette = 0 self.scale = 2.0 self.tw = None + self.init_complete = False def _parse_command_line(self): ''' Try to make sense of the command-line arguments. ''' @@ -408,7 +411,7 @@ class TurtleMain(): menu_bar.append(turtle_menu) # Add menus for plugins - for p in self._plugins: + for p in self._gnome_plugins: menu_bar.append(p.get_menu()) return menu_bar @@ -421,7 +424,7 @@ class TurtleMain(): else: if self.tw.project_has_changed(): self._show_save_dialog(False) - for plugin in self.tw._plugins: + for plugin in self.tw.turtleart_plugins: if hasattr(plugin, 'quit'): plugin.quit() gtk.main_quit() -- cgit v0.9.1