From 8c22cc83d06ef0da66e8b664b82940d7dcd1c7fd Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sat, 02 Jun 2012 04:19:30 +0000 Subject: don't drag canvas while program is executing --- diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index 4aae737..db44a8e 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -156,6 +156,7 @@ class LogoCode: from tagplay import stop_media stop_media(self) self.tw.active_turtle.show() + self.tw.running_blocks = False def def_prim(self, name, args, fcn, rprim=False): """ Define the primitives associated with the blocks """ @@ -215,6 +216,7 @@ class LogoCode: except IndexError: self.tw.showlabel('#nostack') self.tw.showblocks() + self.tw.running_blocks = False return None if type(convert(x, float, False)) == float: if int(float(x)) == x: @@ -498,6 +500,7 @@ class LogoCode: except ValueError: debug_output('generator already executing', self.tw.running_sugar) + self.tw.running_blocks = False return False else: return False @@ -508,12 +511,14 @@ class LogoCode: self.hidden_turtle = None else: self.tw.active_turtle.show() + self.tw.running_blocks = False return False except logoerror, e: self.tw.showblocks() self.tw.display_coordinates() self.tw.showlabel('syntaxerror', str(e)) self.tw.turtles.show_all() + self.tw.running_blocks = False return False return True diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index 2d4c38e..c2ae04b 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -135,6 +135,7 @@ class TurtleArtWindow(): self.mouse_flag = 0 self.mouse_x = 0 self.mouse_y = 0 + self.running_blocks = False try: locale.setlocale(locale.LC_NUMERIC, '') @@ -1198,7 +1199,8 @@ class TurtleArtWindow(): self.dragging_canvas[1] = x self.dragging_canvas[2] = y if spr is None: - self.dragging_canvas[0] = True + if not self.running_blocks: + self.dragging_canvas[0] = True return True self.dragging_canvas[0] = False self.selected_spr = spr @@ -2242,6 +2244,7 @@ class TurtleArtWindow(): if len(self.block_list.get_similar_blocks('block', 'savesvg')) > 0: if self.canvas.cr_svg is None: self.canvas.setup_svg_surface() + self.running_blocks = True self._start_plugins() # Let the plugins know we are running. top = find_top_block(blk) self.lc.run_blocks(top, self.just_blocks(), True) -- cgit v0.9.1