Activities/TAExperimental

From Sugar Labs

Jump to: navigation, search

Contents

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:

Image:TAtemplates.svg

You create a slide by dragging a template from the panel and then populating the template with journal objects.

Image:TAtp1.svg

Image:TApicture.svg

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:

  1. a stack of slides
  2. a stack that decorates the screen before rendering each slide
  3. 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
  4. a sound block can be used to play an audio narration or sound track over the slides

Image:TAslide-stack.svg Image:TAdecoration-stack.svg Image:TAtransition-stack.svg Image:TAsound.svgImage:TAsound-object.svg

Toolbar buttons

Show/Hide palettes
Show/Hide blocks
Run your program
Step through your program
Stop the program
Erase the screen
Save presentation to Journal as HTML document

Know bugs and areas in need of improvement

  1. need to make it save/reload on pre-767 builds
  2. get count-down timer working during start up (which is much too slow)
  3. need to add tool tips
  4. need to write a style sheet for HTML export
  5. need better activity icon
  6. need to fix label overrun
  7. need to add copy/paste (and generally redo text input)
  8. need to <video src="myvideo.ogg" control> for HTML export
  9. want to add pippy block
  10. want add blank block (for expansion)
  11. want to just save .ta, not the .ta .png tarball
  12. need to write document
  13. need an undo
  14. want a scrolling canvas
  15. want to be able to replace value in block dock in single step (not remove/replace)
  16. need to fix templates in Logo export; sort out "or"; ignore programmable functions.
  17. need to add support for other TA languages, i.e., fr, pt, tr, ru, fi, and mn
  18. need to test fix to pitch code
  19. need to play any movie format, not just ogv
  20. need to enhance share (share state, share journal objects)
  21. 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

Start by selecting a slide template from the palette.
Click on the Journal icon to initiate a search for slide content.
Select a journal object.
The Journal preview and description will be used.
A thumbnail will appear in the template.
Click on the slide template to view the slide.
Click on the Hide Blocks button on the toolbar to hide any blocks that are covering your slide.
Congratulations. You've made a slide.
Try using some of the other templates.
View them by clicking on them (you may want to use the Eraser button first).
You can program a simple slide show by making a stack: clear the screen; show Slide 1; wait; clear the screen; show Slide 2.
You can also program stacks for your slide decorations and slide transitions.
In this example, we draw a rule under the title of each slide and poll for keyboard input to transition between slides.
Run your slide show by clicking on the Run Button (rabbit) on the toolbar.
In this example, we use microphone input to transition between slides.
Using "lock blocks" to extend long stacks.

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.

Image:TAPippyButton.svg

To use the customized block, select the "view source" block from the Sensors palette.

Image:TAMyblock.svg

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

Image:TA-dotted-line.png

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

clap to advance to next slide
type to advance to next slide
first pass at a list
a few more templates and blocks


Personal tools
Sugar
Community
Projects
Google Translations
Using the Wiki