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-11-01 04:30:35 (GMT)
committer Pootle daemon <pootle@pootle.sugarlabs.org>2013-11-01 04:30:35 (GMT)
commit76622c8b3d82bb8ea8833fe4956644294e4b80ba (patch)
treebf46e7830d749fcd10764ed6005274bea03f82fb
parent4ed97f79ceb34d615fb9406ad4e724fe75b17f8f (diff)
parentd0b3ef4fe54c58efae577f96fc3c799a649fec2b (diff)
Merge branch 'master' of git.sugarlabs.org:turtleart/mainline
-rw-r--r--TurtleArt/taconstants.py42
-rw-r--r--TurtleArt/taexportpython.py23
-rw-r--r--TurtleArt/talogo.py11
-rw-r--r--TurtleArt/taprimitive.py25
-rw-r--r--TurtleArt/tawindow.py9
-rw-r--r--plugins/accelerometer/accelerometer.py1
-rw-r--r--plugins/audio_sensors/audio_sensors.py1
-rw-r--r--plugins/camera_sensor/camera_sensor.py1
-rw-r--r--plugins/light_sensor/light_sensor.py1
-rw-r--r--plugins/rfid/rfid.py1
-rw-r--r--plugins/turtle_blocks_extras/turtle_blocks_extras.py109
11 files changed, 94 insertions, 130 deletions
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index 43ae9bc..1cedaa3 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -344,7 +344,7 @@ MACROS = {
[5, ['number', '0.1'], 0, 0, [4, None]],
[6, 'kbinput', 0, 0, [4, None]]],
'picturelist':
- [[0, 'sandwichtop_no_label', 0, 0, [None, 1]],
+ [[0, ['sandwichclamp', 252], 0, 0, [None, 1, None]],
[1, 'penup', 0, 0, [0, 2]],
[2, 'setxy2', 0, 0, [1, 3, 4, 5]],
[3, 'titlex', 0, 0, [2, None]],
@@ -361,12 +361,11 @@ MACROS = {
[14, 'pendown', 0, 0, [11, 15]],
[15, 'setscale', 0, 0, [14, 16, 17]],
[16, ['number', '67'], 0, 0, [15, None]],
- [17, 'list', 0, 0, [15, 18, 19, 20]],
+ [17, 'list', 0, 0, [15, 18, 19, None]],
[18, ['string', '∙ '], 0, 0, [17, None]],
- [19, ['string', '∙ '], 0, 0, [17, None]],
- [20, 'sandwichbottom', 0, 0, [17, None]]],
+ [19, ['string', '∙ '], 0, 0, [17, None]]],
'picture1x1a':
- [[0, 'sandwichtop_no_label', 0, 0, [None, 1]],
+ [[0, ['sandwichclamp', 231], 0, 0, [None, 1, None]],
[1, 'penup', 0, 0, [0, 2]],
[2, 'setxy2', 0, 0, [1, 3, 4, 5]],
[3, 'titlex', 0, 0, [2, None]],
@@ -383,11 +382,10 @@ MACROS = {
[14, 'pendown', 0, 0, [11, 15]],
[15, 'setscale', 0, 0, [14, 16, 17]],
[16, ['number', '90'], 0, 0, [15, None]],
- [17, 'showaligned', 0, 0, [15, 18, 19]],
- [18, 'journal', 0, 0, [17, None]],
- [19, 'sandwichbottom', 0, 0, [17, None]]],
+ [17, 'showaligned', 0, 0, [15, 18, None]],
+ [18, 'journal', 0, 0, [17, None]]],
'picture2x2':
- [[0, 'sandwichtop_no_label', 0, 0, [None, 1]],
+ [[0, ['sandwichclamp', 546], 0, 0, [None, 1, None]],
[1, 'penup', 0, 0, [0, 2]],
[2, 'setxy2', 0, 0, [1, 3, 4, 5]],
[3, 'titlex', 0, 0, [2, None]],
@@ -425,11 +423,10 @@ MACROS = {
[35, 'rightx', 0, 0, [34, None]],
[36, 'bottomy', 0, 0, [34, None]],
[37, 'pendown', 0, 0, [34, 38]],
- [38, 'showaligned', 0, 0, [37, 39, 40]],
- [39, 'journal', 0, 0, [38, None]],
- [40, 'sandwichbottom', 0, 0, [38, None]]],
+ [38, 'showaligned', 0, 0, [37, 39, None]],
+ [39, 'journal', 0, 0, [38, None]]],
'picture1x2':
- [[0, 'sandwichtop_no_label', 0, 0, [None, 1]],
+ [[0, ['sandwichclamp', 546], 0, 0, [None, 1, None]],
[1, 'penup', 0, 0, [0, 2]],
[2, 'setxy2', 0, 0, [1, 3, 4, 5]],
[3, 'titlex', 0, 0, [2, None]],
@@ -467,11 +464,10 @@ MACROS = {
[35, 'rightx', 0, 0, [34, None]],
[36, 'bottomy', 0, 0, [34, None]],
[37, 'pendown', 0, 0, [34, 38]],
- [38, 'showaligned', 0, 0, [37, 39, 40]],
- [39, 'description', 0, 0, [38, None]],
- [40, 'sandwichbottom', 0, 0, [38, None]]],
+ [38, 'showaligned', 0, 0, [37, 39, None]],
+ [39, 'description', 0, 0, [38, None]]],
'picture2x1':
- [[0, 'sandwichtop_no_label', 0, 0, [None, 1]],
+ [[0, ['sandwichclamp', 546], 0, 0, [None, 1, None]],
[1, 'penup', 0, 0, [0, 2]],
[2, 'setxy2', 0, 0, [1, 3, 4, 5]],
[3, 'titlex', 0, 0, [2, None]],
@@ -509,11 +505,10 @@ MACROS = {
[35, 'rightx', 0, 0, [34, None]],
[36, 'bottomy', 0, 0, [34, None]],
[37, 'pendown', 0, 0, [34, 38]],
- [38, 'showaligned', 0, 0, [37, 39, 40]],
- [39, 'description', 0, 0, [38, None]],
- [40, 'sandwichbottom', 0, 0, [38, None]]],
+ [38, 'showaligned', 0, 0, [37, 39, None]],
+ [39, 'description', 0, 0, [38, None]]],
'picture1x1':
- [[0, 'sandwichtop_no_label', 0, 0, [None, 1]],
+ [[0, ['sandwichclamp', 336], 0, 0, [None, 1, None]],
[1, 'penup', 0, 0, [0, 2]],
[2, 'setxy2', 0, 0, [1, 3, 4, 5]],
[3, 'titlex', 0, 0, [2, None]],
@@ -537,9 +532,8 @@ MACROS = {
[21, 'rightx', 0, 0, [20, None]],
[22, 'topy', 0, 0, [20, None]],
[23, 'pendown', 0, 0, [20, 24]],
- [24, 'showaligned', 0, 0, [23, 25, 26]],
- [25, 'description', 0, 0, [24, None]],
- [26, 'sandwichbottom', 0, 0, [24, None]]],
+ [24, 'showaligned', 0, 0, [23, 25, None]],
+ [25, 'description', 0, 0, [24, None]]],
'reskin':
[[0, 'skin', 0, 0, [None, 1, None]],
[1, 'journal', 0, 0, [0, None]]]}
diff --git a/TurtleArt/taexportpython.py b/TurtleArt/taexportpython.py
index 76087ad..49bde06 100644
--- a/TurtleArt/taexportpython.py
+++ b/TurtleArt/taexportpython.py
@@ -33,7 +33,7 @@ from talogo import LogoCode
from taprimitive import (ast_yield_true, Primitive, PyExportError,
value_to_ast)
from tautils import (debug_output, find_group, find_top_block, get_stack_name)
-
+from tawindow import global_objects
_SETUP_CODE_START = """\
@@ -66,10 +66,11 @@ def %s():
"""
_START_STACK_START_ADD = """\
tw.start_plugins()
+ global_objects = tw.get_global_objects()
"""
_ACTION_STACK_PREAMBLE = """\
- turtle = tw.turtles.get_active_turtle()
turtles = tw.turtles
+ turtle = turtles.get_active_turtle()
canvas = tw.canvas
logo = tw.lc
@@ -83,7 +84,7 @@ PAT_IDENTIFIER_ILLEGAL_CHAR = re.compile("[^A-Za-z0-9_]")
def save_python(tw):
- """ Find all the action stacks and turn each into python code """
+ """ Find all the action stacks and turn each into Python code """
all_blocks = tw.just_blocks()
blocks_covered = set()
tops_of_stacks = []
@@ -98,22 +99,23 @@ def save_python(tw):
for block in tops_of_stacks:
stack_name = get_stack_name(block)
if stack_name:
- pythoncode = _action_stack_to_python(block, tw.lc, name=stack_name)
+ pythoncode = _action_stack_to_python(block, tw, name=stack_name)
snippets.append(pythoncode)
snippets.append(linesep)
snippets.append(_SETUP_CODE_END)
return "".join(snippets)
-def _action_stack_to_python(block, lc, name="start"):
- """ Turn a stack of blocks into python code
+def _action_stack_to_python(block, tw, name="start"):
+ """ Turn a stack of blocks into Python code
name -- the name of the action stack (defaults to "start") """
+
if isinstance(name, int):
name = float(name)
if not isinstance(name, basestring):
name = str(name)
# traverse the block stack and get the AST for every block
- ast_list = _walk_action_stack(block, lc)
+ ast_list = _walk_action_stack(block, tw.lc)
if not isinstance(ast_list[-1], ast.Yield):
ast_list.append(ast_yield_true())
action_stack_ast = ast.Module(body=ast_list)
@@ -126,6 +128,11 @@ def _action_stack_to_python(block, lc, name="start"):
name_id = _make_identifier(name)
if name == 'start':
pre_preamble = _START_STACK_START_ADD
+ # TODO: only add the objects we are using
+ for k in global_objects.keys():
+ if k not in ['window', 'canvas', 'logo', 'turtles']:
+ pre_preamble += " %s = global_objects['%s']\n" % (
+ k.lower(), k)
else:
pre_preamble = ''
generated_code = _indent(generated_code, 1)
@@ -255,5 +262,3 @@ def _indent(code, num_levels=1):
for line in line_list:
new_line_list.append(indentation + line)
return linesep.join(new_line_list)
-
-
diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py
index 2b297ef..1ee11f2 100644
--- a/TurtleArt/talogo.py
+++ b/TurtleArt/talogo.py
@@ -1054,6 +1054,17 @@ class LogoCode:
gobject.idle_add(self.tw.send_event, event)
os.remove(tmp_file)
+ def showlist(self, objects):
+ """ 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)
+ for obj in objects:
+ self.tw.turtles.get_active_turtle().set_xy(x, y, pendown=False)
+ self.show(obj)
+ y -= int(self.tw.canvas.textsize * self.tw.lead)
+
def show(self, obj, center=False):
""" Show is the general-purpose media-rendering block. """
# media
diff --git a/TurtleArt/taprimitive.py b/TurtleArt/taprimitive.py
index 112540a..3f922b4 100644
--- a/TurtleArt/taprimitive.py
+++ b/TurtleArt/taprimitive.py
@@ -33,7 +33,7 @@ from talogo import (LogoCode, logoerror, NegativeRootError)
from taturtle import (Turtle, Turtles)
from tatype import *
from tautils import debug_output
-from tawindow import (global_objects, TurtleArtWindow)
+from tawindow import TurtleArtWindow, global_objects
from util import ast_extensions
@@ -138,6 +138,14 @@ class Primitive(object):
func_name = "logo.heap."
elif self.wants_tawindow():
func_name = "tw."
+ else:
+ results, plugin = self.wants_plugin()
+ if results:
+ for k in global_objects.keys():
+ if k == plugin:
+ func_name = k.lower() + '.'
+ break
+
# get the name of the function directly from the function itself
func_name += self.func.__name__
return func_name
@@ -290,6 +298,10 @@ class Primitive(object):
first_arg = global_objects["logo"].heap
elif new_prim.wants_tawindow():
first_arg = global_objects["window"]
+ else:
+ result, plugin = new_prim.wants_plugin()
+ if result:
+ first_arg = plugin
# execute the actual function
if first_arg is None:
@@ -556,6 +568,14 @@ class Primitive(object):
as its first argument? """
return self._wants(TurtleArtWindow)
+ def wants_plugin(self):
+ """Does this Primitive want to get a plugin instance as its first
+ argument? """
+ for obj in global_objects.keys():
+ if self._wants(global_objects[obj].__class__):
+ return True, obj
+ return False, None
+
def wants_nothing(self):
""" Does this Primitive want nothing as its first argument? I.e. does
it want to be passed all the arguments of the block and nothing
@@ -727,7 +747,8 @@ class Primitive(object):
@staticmethod
def comment(text):
- """ In 'snail' execution mode, display the comment. Else, do nothing. """
+ """In 'snail' execution mode, display the comment. Else, do
+ nothing."""
tw = global_objects["window"]
if not tw.hide and tw.step_time != 0:
tw.showlabel('print', text)
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index 5d8f715..448dbf3 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -96,7 +96,8 @@ _UNFULLSCREEN_VISIBILITY_TIMEOUT = 2
_PLUGIN_SUBPATH = 'plugins'
_MACROS_SUBPATH = 'macros'
-global_objects = {} # the global instances of single-instance classes
+# the global instances of single-instance classes
+global_objects = {}
class TurtleArtWindow():
@@ -315,6 +316,9 @@ class TurtleArtWindow():
self._init_plugins()
self._setup_plugins()
+ def get_global_objects(self):
+ return global_objects
+
def _lazy_init(self):
self._init_plugins()
self._setup_plugins()
@@ -388,10 +392,11 @@ class TurtleArtWindow():
# Add the icon dir to the icon_theme search path
self._add_plugin_icon_dir(os.path.join(self._get_plugin_home(),
plugin_dir))
+ # Add the plugin to the list of global objects
+ global_objects[plugin_class] = self.turtleart_plugins[-1]
except Exception as e:
debug_output('Failed to load %s: %s' % (plugin_class, str(e)),
self.running_sugar)
-
def _add_plugin_icon_dir(self, dirname):
''' If there is an icon subdir, add it to the search path. '''
diff --git a/plugins/accelerometer/accelerometer.py b/plugins/accelerometer/accelerometer.py
index 26aefd4..c364235 100644
--- a/plugins/accelerometer/accelerometer.py
+++ b/plugins/accelerometer/accelerometer.py
@@ -35,6 +35,7 @@ ACCELEROMETER_DEVICE = '/sys/devices/platform/lis3lv02d/position'
class Accelerometer(Plugin):
def __init__(self, parent):
+ Plugin.__init__(self)
self._parent = parent
if os.path.exists(ACCELEROMETER_DEVICE):
self._status = True
diff --git a/plugins/audio_sensors/audio_sensors.py b/plugins/audio_sensors/audio_sensors.py
index 8d45395..1e0ed01 100644
--- a/plugins/audio_sensors/audio_sensors.py
+++ b/plugins/audio_sensors/audio_sensors.py
@@ -57,6 +57,7 @@ def _avg(array, abs_value=False):
class Audio_sensors(Plugin):
def __init__(self, parent):
+ Plugin.__init__(self)
self._parent = parent
self._status = True # TODO: test for audio device
# These flags are referenced by audiograb
diff --git a/plugins/camera_sensor/camera_sensor.py b/plugins/camera_sensor/camera_sensor.py
index 6509a88..585174c 100644
--- a/plugins/camera_sensor/camera_sensor.py
+++ b/plugins/camera_sensor/camera_sensor.py
@@ -39,6 +39,7 @@ from TurtleArt.taconstants import MEDIA_SHAPES, NO_IMPORT, SKIN_PATHS, \
class Camera_sensor(Plugin):
def __init__(self, parent):
+ Plugin.__init__(self)
''' Make sure there is a camera device '''
self._parent = parent
self._status = False
diff --git a/plugins/light_sensor/light_sensor.py b/plugins/light_sensor/light_sensor.py
index bd5655e..97ab6b6 100644
--- a/plugins/light_sensor/light_sensor.py
+++ b/plugins/light_sensor/light_sensor.py
@@ -35,6 +35,7 @@ LIGHT_SENSOR_DEVICE = '/sys/devices/platform/olpc-ols.0/level'
class Light_sensor(Plugin):
def __init__(self, parent):
+ Plugin.__init__(self)
self._parent = parent
if os.path.exists(LIGHT_SENSOR_DEVICE):
self._status = True
diff --git a/plugins/rfid/rfid.py b/plugins/rfid/rfid.py
index de96a1f..1b3bc48 100644
--- a/plugins/rfid/rfid.py
+++ b/plugins/rfid/rfid.py
@@ -41,6 +41,7 @@ REGEXP_SERUSB = '\/org\/freedesktop\/Hal\/devices\/usb_device['\
class Rfid(Plugin):
def __init__(self, parent):
+ Plugin.__init__(self)
self._parent = parent
self._status = False
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
index 9136a83..c900a3c 100644
--- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py
+++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
@@ -49,6 +49,7 @@ class Turtle_blocks_extras(Plugin):
from Turtle Art """
def __init__(self, turtle_window):
+ Plugin.__init__(self)
self.tw = turtle_window
def setup(self):
@@ -298,7 +299,6 @@ complete'))
help_string=_('resume playing video or audio'))
self.tw.lc.def_prim('mediaplay', 0, self.tw.lc.media_play, True)
- primitive_dictionary['speak'] = self._prim_speak
palette.add_block('speak',
style='basic-style-1arg',
label=_('speak'),
@@ -306,7 +306,8 @@ complete'))
default=_('hello'),
help_string=_('speaks text'))
self.tw.lc.def_prim('speak', 1,
- lambda self, x: primitive_dictionary['speak'](x))
+ Primitive(self.prim_speak,
+ arg_descs=[ArgSlot(TYPE_STRING)]))
primitive_dictionary['sinewave'] = self._prim_sinewave
palette.add_block('sinewave',
@@ -734,6 +735,7 @@ module found in the Journal'))
help_string=_('loads a block'))
self.tw.lc.def_prim('loadblock', 1,
Primitive(self.tw.prim_load_block,
+ export_me=False,
arg_descs=[ArgSlot(TYPE_STRING)]))
palette.add_block('loadblock2arg',
@@ -746,6 +748,7 @@ module found in the Journal'))
help_string=_('loads a block'))
self.tw.lc.def_prim('loadblock2', 2,
Primitive(self.tw.prim_load_block,
+ export_me=False,
arg_descs=[ArgSlot(TYPE_STRING),
ArgSlot(TYPE_OBJECT)]))
@@ -759,6 +762,7 @@ module found in the Journal'))
help_string=_('loads a block'))
self.tw.lc.def_prim('loadblock3', 3,
Primitive(self.tw.prim_load_block,
+ export_me=False,
arg_descs=[ArgSlot(TYPE_STRING),
ArgSlot(TYPE_OBJECT),
ArgSlot(TYPE_OBJECT)]))
@@ -772,6 +776,7 @@ module found in the Journal'))
help_string=_('selects a palette'))
self.tw.lc.def_prim('loadpalette', 1,
Primitive(self.tw.prim_load_palette,
+ export_me=False,
arg_descs=[ArgSlot(TYPE_STRING)]))
palette.add_block('addturtle',
@@ -889,8 +894,9 @@ templates'),
label=_('Fullscreen').lower(),
prim_name='fullscreen',
help_string=_('hides the Sugar toolbars'))
- self.tw.lc.def_prim('fullscreen', 0,
- lambda self: self.tw.set_fullscreen())
+ self.tw.lc.def_prim(
+ 'fullscreen', 0,
+ Primitive(self.tw.set_fullscreen, export_me=False))
primitive_dictionary['bulletlist'] = self._prim_list
palette.add_block('list',
@@ -1128,12 +1134,6 @@ Journal objects'))
chr(self.tw.keyboard))
self.tw.keypress = ''
- def _prim_list(self, blklist):
- """ Expandable list block """
- self._prim_showlist(blklist)
- self.tw.lc.ireturn()
- yield True
-
def after_pop(self, *ignored_args):
if self.tw.lc.update_values:
if not self.tw.lc.heap:
@@ -1156,7 +1156,7 @@ Journal objects'))
""" Save SVG to file """
self.tw.save_as_image(name, svg=True)
- def _prim_speak(self, text):
+ def prim_speak(self, text):
""" Speak text """
if type(text) == float and int(text) == text:
text = int(text)
@@ -1267,88 +1267,11 @@ Journal objects'))
'see',
self.tw.turtles.get_active_turtle().get_color_index())
- def _prim_show(self, string, center=False):
- """ Show is the general-purpose media-rendering block. """
- if type(string) == str or type(string) == unicode:
- if string in ['media_', 'descr_', 'audio_', 'video_',
- 'media_None', 'descr_None', 'audio_None',
- 'video_None']:
- pass
- elif string[0:6] in ['media_', 'descr_', 'audio_', 'video_']:
- self.tw.lc.filepath = None
- self.tw.lc.pixbuf = None # Camera writes directly to pixbuf
- self.tw.lc.dsobject = None
- if string[6:].lower() in media_blocks_dictionary:
- media_blocks_dictionary[string[6:].lower()]()
- elif os.path.exists(string[6:]): # is it a path?
- self.tw.lc.filepath = string[6:]
- elif self.tw.running_sugar: # is it a datastore object?
- from sugar.datastore import datastore
- try:
- self.tw.lc.dsobject = datastore.get(string[6:])
- except:
- debug_output("Couldn't find dsobject %s" %
- (string[6:]), self.tw.running_sugar)
- if self.tw.lc.dsobject is not None:
- self.tw.lc.filepath = self.tw.lc.dsobject.file_path
- if self.tw.lc.pixbuf is not None:
- self.tw.lc.insert_image(center=center, pixbuf=True)
- elif self.tw.lc.filepath is None:
- if self.tw.lc.dsobject is not None:
- self.tw.showlabel(
- 'nojournal',
- self.tw.lc.dsobject.metadata['title'])
- else:
- self.tw.showlabel('nojournal', string[6:])
- debug_output("Couldn't open %s" % (string[6:]),
- self.tw.running_sugar)
- elif string[0:6] == 'media_':
- self.tw.lc.insert_image(center=center)
- elif string[0:6] == 'descr_':
- mimetype = None
- if self.tw.lc.dsobject is not None and \
- 'mime_type' in self.tw.lc.dsobject.metadata:
- mimetype = self.tw.lc.dsobject.metadata['mime_type']
- description = None
- if self.tw.lc.dsobject is not None and \
- 'description' in self.tw.lc.dsobject.metadata:
- description = self.tw.lc.dsobject.metadata[
- 'description']
- self.tw.lc.insert_desc(mimetype, description)
- elif string[0:6] == 'audio_':
- self.tw.lc.play_sound()
- elif string[0:6] == 'video_':
- self.tw.lc.play_video()
- if self.tw.lc.dsobject is not None:
- self.tw.lc.dsobject.destroy()
- else: # assume it is text to display
- x, y = self.tw.lc.x2tx(), self.tw.lc.y2ty()
- if center:
- y -= self.tw.canvas.textsize
- self.tw.turtles.get_active_turtle().draw_text(string, x, y,
- int(self.tw.canvas.textsize *
- self.tw.lc.scale / 100.),
- self.tw.canvas.width - x)
- elif type(string) == float or type(string) == int:
- string = round_int(string)
- x, y = self.tw.lc.x2tx(), self.tw.lc.y2ty()
- if center:
- y -= self.tw.canvas.textsize
- self.tw.turtles.get_active_turtle().draw_text(string, x, y,
- int(self.tw.canvas.textsize *
- self.tw.lc.scale / 100.),
- self.tw.canvas.width - x)
-
- 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)
- for s in sarray:
- self.tw.turtles.get_active_turtle().set_xy(x, y, pendown=False)
- self._prim_show(s)
- y -= int(self.tw.canvas.textsize * self.tw.lead)
+ def _prim_list(self, blklist):
+ """ Expandable list block """
+ self.tw.lc.showlist(blklist)
+ self.tw.lc.ireturn()
+ yield True
def after_time(self, elapsed_time):
""" Update the label of the 'time' block after computing the new