Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPootle daemon <pootle@pootle.sugarlabs.org>2013-09-06 04:25:26 (GMT)
committer Pootle daemon <pootle@pootle.sugarlabs.org>2013-09-06 04:25:26 (GMT)
commita1dad7bbe4c2ce58d44777c2d85319abffc77bb8 (patch)
treed7b8fdda0b6119cbf7897f5be2f8cf581a8620fa
parentb06075b14978eae8879b8a4cce48ad8d83db6c64 (diff)
parent89c3fc127cadc61da556165020f7cd82649cf7fd (diff)
Merge branch 'master' of git.sugarlabs.org:turtleart/mainline
-rw-r--r--NEWS4
-rw-r--r--TurtleArt/tabasics.py4
-rw-r--r--TurtleArt/taturtle.py13
-rw-r--r--TurtleArt/tawindow.py48
-rw-r--r--plugins/turtle_blocks_extras/turtle_blocks_extras.py6
-rw-r--r--pysamples/dotted_line.py4
6 files changed, 47 insertions, 32 deletions
diff --git a/NEWS b/NEWS
index 450d30c..c9159ed 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,10 @@
ENHANCEMENT:
* Set maximum number of participants
+BUG FIX:
+* Fix problem with null index when action and store-in blocks are
+ missing arguments.
+
189
ENHANCEMENT:
diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py
index 0346d0e..beccd2a 100644
--- a/TurtleArt/tabasics.py
+++ b/TurtleArt/tabasics.py
@@ -217,7 +217,7 @@ degrees)'))
'setxy2',
2,
lambda self, x, y: primitive_dictionary['move'](
- self.tw.turtles.get_active_turtle().set_xy, (x, y)))
+ self.tw.turtles.get_active_turtle().set_xy, x, y))
define_logo_function('tasetxy', 'to tasetxy :x :y\nsetxy :x :y\nend\n')
primitive_dictionary['set'] = self._prim_set
@@ -295,7 +295,7 @@ turtle (can be used in place of a number block)'),
'setxy',
2,
lambda self, x, y: primitive_dictionary['move'](
- self.tw.turtles.get_active_turtle().set_xy, (x, y),
+ self.tw.turtles.get_active_turtle().set_xy, x, y,
pendown=False))
define_logo_function('tasetxypenup', 'to tasetxypenup :x :y\npenup\n\
setxy :x :y\npendown\nend\n')
diff --git a/TurtleArt/taturtle.py b/TurtleArt/taturtle.py
index 1ed557c..8d2afea 100644
--- a/TurtleArt/taturtle.py
+++ b/TurtleArt/taturtle.py
@@ -157,7 +157,7 @@ class Turtles:
# if it is a new turtle, start it in the center of the screen
self._active_turtle = self.get_turtle(turtle_name, True, colors)
self._active_turtle.set_heading(0.0, False)
- self._active_turtle.set_xy((0.0, 0.0), False, pendown=False)
+ self._active_turtle.set_xy(0.0, 0.0, False, pendown=False)
self._active_turtle.set_pen_state(True)
elif colors is not None:
self._active_turtle = self.get_turtle(turtle_name, False)
@@ -562,16 +562,15 @@ class Turtle:
int(distance)]))
self._turtles.turtle_window.send_event(event)
- def set_xy(self, pos, share=True, pendown=True, dragging=False):
+ def set_xy(self, x, y, share=True, pendown=True, dragging=False):
old = self.get_xy()
-
try:
if dragging:
- xcor = pos[0]
- ycor = pos[1]
+ xcor = x
+ ycor = y
else:
- xcor = pos[0] * self._turtles.turtle_window.coord_scale
- ycor = pos[1] * self._turtles.turtle_window.coord_scale
+ xcor = x * self._turtles.turtle_window.coord_scale
+ ycor = y * self._turtles.turtle_window.coord_scale
except (TypeError, ValueError):
debug_output('bad value sent to %s' % (__name__),
self._turtles.turtle_window.running_sugar)
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index 50691c8..4e55d5b 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -2557,10 +2557,12 @@ before making changes to your Turtle Blocks program'))
pos = self.turtles.screen_to_turtle_coordinates((dx, dy))
if self.selected_turtle.get_pen_state():
self.selected_turtle.set_pen_state(False)
- self.selected_turtle.set_xy(pos, share=False, dragging=True)
+ self.selected_turtle.set_xy(*pos, share=False,
+ dragging=True)
self.selected_turtle.set_pen_state(True)
else:
- self.selected_turtle.set_xy(pos, share=False, dragging=True)
+ self.selected_turtle.set_xy(*pos, share=False,
+ dragging=True)
if self.update_counter % 5:
self.lc.update_label_value(
'xcor', self.selected_turtle.get_xy()[0] /
@@ -3959,34 +3961,42 @@ before making changes to your Turtle Blocks program'))
self._process_block_data[b[0]] = [
b[0], b[1], b[2], b[3], [b[4][0], i, b[4][1]]]
elif btype == 'hat':
+ name = None
if b[4][1] < len(self._process_block_data):
i = b[4][1]
- name = self._process_block_data[i][1][1]
+ if i is not None:
+ name = self._process_block_data[i][1][1]
else:
i = b[4][1] - len(self._process_block_data)
name = self._extra_block_data[i][1][1]
- while self._find_proto_name('stack_%s' % (name), name):
- name = increment_name(name)
- if b[4][1] < len(self._process_block_data):
- dblk = self._process_block_data[i]
- self._process_block_data[i] = [dblk[0], (dblk[1][0], name),
- dblk[2], dblk[3], dblk[4]]
- else:
- dblk = self._extra_block_data[i]
- self._extra_block_data[i] = [dblk[0], (dblk[1][0], name),
- dblk[2], dblk[3], dblk[4]]
- self._new_stack_block(name)
+ if name is not None:
+ while self._find_proto_name('stack_%s' % (name), name):
+ name = increment_name(name)
+ if b[4][1] < len(self._process_block_data):
+ dblk = self._process_block_data[i]
+ self._process_block_data[i] = [
+ dblk[0], (dblk[1][0], name), dblk[2], dblk[3],
+ dblk[4]]
+ else:
+ dblk = self._extra_block_data[i]
+ self._extra_block_data[i] = [
+ dblk[0], (dblk[1][0], name), dblk[2], dblk[3],
+ dblk[4]]
+ self._new_stack_block(name)
elif btype == 'storein':
+ name = None
if b[4][1] < len(self._process_block_data):
i = b[4][1]
- name = self._process_block_data[i][1][1]
+ if i is not None:
+ name = self._process_block_data[i][1][1]
else:
i = b[4][1] - len(self._process_block_data)
name = self._extra_block_data[i][1][1]
- if not self._find_proto_name('storein_%s' % (name), name):
- self._new_storein_block(name)
- if not self._find_proto_name('box_%s' % (name), name):
- self._new_box_block(name)
+ if name is not None:
+ if not self._find_proto_name('storein_%s' % (name), name):
+ self._new_storein_block(name)
+ if not self._find_proto_name('box_%s' % (name), name):
+ self._new_box_block(name)
if btype in content_blocks:
if btype == 'number':
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
index 8f5a94d..2ae320a 100644
--- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py
+++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
@@ -1403,8 +1403,10 @@ Journal objects'))
def _prim_showlist(self, sarray):
""" Display list of media objects """
- x = self.tw.turtles.get_active_turtle.get_xy()[0] / self.tw.coord_scale
- y = self.tw.turtles.get_active_turtle.get_xy()[1] / self.tw.coord_scale
+ x = (self.tw.turtles.get_active_turtle().get_xy()[0] /
+ self.tw.coord_scale)
+ y = (self.tw.turtles.get_active_turtle().get_xy()[1] /
+ self.tw.coord_scale)
for s in sarray:
self.tw.turtles.get_active_turtle().set_xy(x, y, pendown=False)
self._prim_show(s)
diff --git a/pysamples/dotted_line.py b/pysamples/dotted_line.py
index c581f83..c0d3008 100644
--- a/pysamples/dotted_line.py
+++ b/pysamples/dotted_line.py
@@ -94,8 +94,8 @@
# fillscreen(self, c, s)
# tw.turtles.get_active_turtle().fillscreen(70, 90)
# Note: Fill the screen with color 70, shade 90 (light blue)
-# self.set_xy(self, (x, y))
-# tw.turtles.get_active_turtle().set_xy((100,100))
+# self.set_xy(self, x, y)
+# tw.turtles.get_active_turtle().set_xy(100,100)
# Note: Move the turtle to position (100, 100)
# self.get_xy tw.turtles.get_active_turtle().get_xy()[0]
# Note: The current x coordinate of the turtle