Activities/TAExperimental
From Sugar Labs
|
The experimental version of Turtle Art
The current version (19) is here. Note: The first time you run TAPortfolio, it takes a very long time to load (1+ minute on an OLPC-XO-1).
The source code is here.
Background
This experimental branch of Turtle Art is for staging potential new features.
Turtle Art Portfolio
The inspiration (and much of the codebase) for TAPortfolio comes from Turtle Art. I added one new panel, Templates:
You create a slide by dragging a template from the panel and then populating the template with journal objects.
When you click on the journal icon, it will initiate a Journal search, allowing you to select an object to import. (Hint: Use the "What" filter on the Journal Chooser to select images.) You can import (almost) any Journal object. The preview image will be used along with any text in the description field of the Journal detail view.
The typical usage I envision is that three program stacks will be created for each slide show:
- a stack of slides
- a stack that decorates the screen before rendering each slide
- a stack that handles the transition between each slide, such as waiting for a fixed number of seconds or for keyboard input (you can even program your slides to advance based upon sound
- a sound block can be used to play an audio narration or sound track over the slides
Toolbar buttons
Know bugs and areas in need of improvement
- need to make it save/reload on pre-767 builds
- get count-down timer working during start up (which is much too slow)
- need to add tool tips
- need to write a style sheet for HTML export
- need better activity icon
- need to fix label overrun
- need to add copy/paste (and generally redo text input)
- need to <video src="myvideo.ogg" control> for HTML export
-
want to add pippy block -
want add blank block (for expansion) -
want to just save .ta, not the .ta .png tarball - need to write document
- need an undo
- want a scrolling canvas
- want to be able to replace value in block dock in single step (not remove/replace)
- need to fix templates in Logo export; sort out "or"; ignore programmable functions.
- need to add support for other TA languages, i.e., fr, pt, tr, ru, fi, and mn
- need to test fix to pitch code
- need to play any movie format, not just ogv
- need to enhance share (share state, share journal objects)
- nop block only works with Rainbow turned off
Portfolio
I am hoping that some predefined "projects" can be created with TAPortfolio that represent different portfolio templates, e.g., a template for telling a story about one's family might be appropriate for a first grader.
Source
See http://git.sugarlabs.org/projects/taportfolio/repos/mainline/trees/master
Quick Tutorial
Naive sharing
There is naive sharing in Turtle Art. All events are shared among the participants.
There are a few known bugs:
-
labels are not displayed when changed -
the initial state of the canvas is not shared (when joining late) - Journal items are not shared
-
resync hotkey - need a resync button as it is easy to get out of sync
- need to hand off sync responsibility to non-sharer if sharer leaves
Some new approaches to arithmetic operators
myblock.py
And a block that can be programmed by the Pippy interface:
A copy of the tamyblock.py module is stored in the Journal when you first launch Turtle Art. You can edit the module in Pippy and then import your custom code into Turtle Art using the Pippy button.
To use the customized block, select the "view source" block from the Sensors palette.
Examples:
from taturtle import *
def myblock(lc,x):
# draw a dotted line of length x
# make sure x is a number
if type(x) != int and type(x) != float:
return
dist = 0
# save current turtle pen state
pen = lc.tw.turtle.pendown
# repeat drawing dots
while dist+lc.tw.turtle.pensize < x:
setpen(lc.tw.turtle, True)
forward(lc.tw.turtle, 1)
setpen(lc.tw.turtle, False)
forward(lc.tw.turtle, (lc.tw.turtle.pensize*2)-1)
dist += (lc.tw.turtle.pensize*2)
# make sure we have moved exactly x
forward(lc.tw.turtle, x-dist)
# restore pen state
setpen(lc.tw.turtle, pen)
return
from taturtle import *
def myblock(lc,x):
# push an uppercase version of a string onto the heap
if type(x) != str:
X = str(x).upper()
else:
X = x.upper()
# push result onto heap (use the pop block to use the new string)
lc.heap.append(X)
return
from taturtle import * def myblock(lc,x): # push hours, minutes, seconds onto the heap # use three pop blocks to retrieve the values # remember: the heap is a FILO (first in, last out) # the first value you will pop will be seconds lc.heap.append(localtime().tm_hour) lc.heap.append(localtime().tm_min) lc.heap.append(localtime().tm_sec) return
from taturtle import *
def myblock(lc,x):
# add a third dimension (gray) to the color model
# calculate the value (brightness) of the current color
val = 0.3 * lc.tw.rgb[0] + 0.6 * lc.tw.rgb[1] + 0.1 * lc.tw.rgb[2]
# make sure gray is in range from 0 to 100
if x != 100:
x = int(x)%100
# mix in gray
r = int((val*(100-x) + lc.tw.rgb[0]*x)/100)
g = int((val*(100-x) + lc.tw.rgb[1]*x)/100)
b = int((val*(100-x) + lc.tw.rgb[2]*x)/100)
# reallocate current color
lc.tw.fgcolor = lc.tw.cm.alloc_color(r<<8,g<<8,b<<8)
return
We got game
Turtle Art can be used to write games, such as a simple falling block game:
Some of the false steps along the way towards developing the Activity


