From 7fcbc8b6e7ccc07776d92c0535edc5bd5681e005 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Thu, 25 Jul 2013 20:38:38 +0000 Subject: fix problems with non-interactive mode --- diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index 217a6e5..e20a1cf 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -4480,6 +4480,8 @@ before making changes to your Turtle Blocks program')) def _find_proto_name(self, name, label, palette='blocks'): ''' Look for a protoblock with this name ''' + if not self.interactive_mode: + return False if isinstance(name, unicode): name = name.encode('ascii', 'replace') if isinstance(label, unicode): @@ -4502,6 +4504,8 @@ before making changes to your Turtle Blocks program')) def _new_stack_block(self, name): ''' Add a stack block to the 'blocks' palette ''' + if not self.interactive_mode: + return if isinstance(name, (float, int)): return if isinstance(name, unicode): @@ -4529,6 +4533,8 @@ before making changes to your Turtle Blocks program')) def _new_box_block(self, name): ''' Add a box block to the 'blocks' palette ''' + if not self.interactive_mode: + return if isinstance(name, (float, int)): return if isinstance(name, unicode): @@ -4557,6 +4563,8 @@ before making changes to your Turtle Blocks program')) def _new_storein_block(self, name): ''' Add a storin block to the 'blocks' palette ''' + if not self.interactive_mode: + return if isinstance(name, (float, int)): return if isinstance(name, unicode): diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py index beb9bfb..8f5a94d 100644 --- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py +++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py @@ -957,7 +957,8 @@ Journal objects')) ''' User-defined macros are saved as a json-encoded file; these get loaded into a palette on startup ''' - if os.path.exists(self.tw.macros_path): + if hasattr(self.tw, 'macros_path') and \ + os.path.exists(self.tw.macros_path): files = glob.glob(os.path.join(self.tw.macros_path, '*.tb')) debug_output('making myblocks palette', self.tw.running_sugar) if len(files) > 0: diff --git a/turtleblocks.py b/turtleblocks.py index 98d89d9..7f0ca8f 100755 --- a/turtleblocks.py +++ b/turtleblocks.py @@ -219,7 +219,8 @@ return %s(self)" % (p, P, P) turtle_canvas=self.turtle_canvas, activity=self, running_sugar=False) self.tw.save_folder = self._abspath # os.path.expanduser('~') - if self.client.get_int(self._HOVER_HELP) == 1: + if hasattr(self, 'client') and \ + self.client.get_int(self._HOVER_HELP) == 1: self.hover.set_active(False) self._do_hover_help_off_cb(None) -- cgit v0.9.1