Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarion <marion.zepf@gmail.com>2013-08-27 12:51:05 (GMT)
committer Marion <marion.zepf@gmail.com>2013-08-27 12:51:05 (GMT)
commit75b09fa3329de3e2b9a856ba0263ce74d6b28f3f (patch)
treee66bb909cd613a1148e8ba67a17142df0ce4df32
parentdbc9daecdc6894fe62c23a86aaa91a9513742c13 (diff)
change interface of Turtle.set_xy to set_xy(x, y, share, pendown)
- Used to be set_xy(pos, share, pendown) with pos = (x, y). - Some calls to set_xy were already assuming the new interface. - Also fix the 'bullet list' block from the 'presentations' palette. (Small, related bug.)
-rw-r--r--TurtleArt/tabasics.py4
-rw-r--r--TurtleArt/taturtle.py8
-rw-r--r--TurtleArt/tawindow.py4
-rw-r--r--plugins/turtle_blocks_extras/turtle_blocks_extras.py6
-rw-r--r--pysamples/dotted_line.py4
5 files changed, 14 insertions, 12 deletions
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 12882db..10d0230 100644
--- a/TurtleArt/taturtle.py
+++ b/TurtleArt/taturtle.py
@@ -154,7 +154,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)
@@ -555,12 +555,12 @@ class Turtle:
int(distance)]))
self._turtles.turtle_window.send_event(event)
- def set_xy(self, pos, share=True, pendown=True):
+ def set_xy(self, x, y, share=True, pendown=True):
old = self.get_xy()
try:
- 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 e20a1cf..a791919 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -2511,10 +2511,10 @@ 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)
+ self.selected_turtle.set_xy(*pos, share=False)
self.selected_turtle.set_pen_state(True)
else:
- self.selected_turtle.set_xy(pos, share=False)
+ self.selected_turtle.set_xy(*pos, share=False)
if self.update_counter % 5:
self.lc.update_label_value(
'xcor', self.selected_turtle.get_xy()[0] /
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