From 270d4813374b4ebae7899d8f97d3e274aa211d00 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sun, 18 Jan 2009 02:39:41 +0000 Subject: added run button to toolbar --- diff --git a/images/en/toolbar/runoff.svg b/images/en/toolbar/runoff.svg new file mode 100644 index 0000000..588182e --- /dev/null +++ b/images/en/toolbar/runoff.svg @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/images/en/toolbar/runon.svg b/images/en/toolbar/runon.svg new file mode 100644 index 0000000..f3ba2f3 --- /dev/null +++ b/images/en/toolbar/runon.svg @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/images/es/toolbar/runoff.svg b/images/es/toolbar/runoff.svg new file mode 100644 index 0000000..588182e --- /dev/null +++ b/images/es/toolbar/runoff.svg @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/images/es/toolbar/runon.svg b/images/es/toolbar/runon.svg new file mode 100644 index 0000000..f3ba2f3 --- /dev/null +++ b/images/es/toolbar/runon.svg @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/images/fi/toolbar/runoff.svg b/images/fi/toolbar/runoff.svg new file mode 100644 index 0000000..588182e --- /dev/null +++ b/images/fi/toolbar/runoff.svg @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/images/fi/toolbar/runon.svg b/images/fi/toolbar/runon.svg new file mode 100644 index 0000000..f3ba2f3 --- /dev/null +++ b/images/fi/toolbar/runon.svg @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/images/fr/toolbar/runoff.svg b/images/fr/toolbar/runoff.svg new file mode 100644 index 0000000..588182e --- /dev/null +++ b/images/fr/toolbar/runoff.svg @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/images/fr/toolbar/runon.svg b/images/fr/toolbar/runon.svg new file mode 100644 index 0000000..f3ba2f3 --- /dev/null +++ b/images/fr/toolbar/runon.svg @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/images/mn/toolbar/runoff.svg b/images/mn/toolbar/runoff.svg new file mode 100644 index 0000000..588182e --- /dev/null +++ b/images/mn/toolbar/runoff.svg @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/images/mn/toolbar/runon.svg b/images/mn/toolbar/runon.svg new file mode 100644 index 0000000..f3ba2f3 --- /dev/null +++ b/images/mn/toolbar/runon.svg @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/images/pt/toolbar/runoff.svg b/images/pt/toolbar/runoff.svg new file mode 100644 index 0000000..588182e --- /dev/null +++ b/images/pt/toolbar/runoff.svg @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/images/pt/toolbar/runon.svg b/images/pt/toolbar/runon.svg new file mode 100644 index 0000000..f3ba2f3 --- /dev/null +++ b/images/pt/toolbar/runon.svg @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/images/ru/toolbar/runoff.svg b/images/ru/toolbar/runoff.svg new file mode 100644 index 0000000..588182e --- /dev/null +++ b/images/ru/toolbar/runoff.svg @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/images/ru/toolbar/runon.svg b/images/ru/toolbar/runon.svg new file mode 100644 index 0000000..f3ba2f3 --- /dev/null +++ b/images/ru/toolbar/runon.svg @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/images/tr/toolbar/runoff.svg b/images/tr/toolbar/runoff.svg new file mode 100644 index 0000000..588182e --- /dev/null +++ b/images/tr/toolbar/runoff.svg @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/images/tr/toolbar/runon.svg b/images/tr/toolbar/runon.svg new file mode 100644 index 0000000..f3ba2f3 --- /dev/null +++ b/images/tr/toolbar/runon.svg @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/tasetup.py b/tasetup.py index 2f26094..649edeb 100644 --- a/tasetup.py +++ b/tasetup.py @@ -114,7 +114,8 @@ selectors = ( toolbaritems = ( ('stopit',75), ('eraser',75), - ('hideshow',75)) + ('hideshow',75) + ('run',75)) dockdetails = { 'noarg': (('flow',True,37,5),('flow',False,37,44)), diff --git a/tawindow.py b/tawindow.py index 08fe410..d0765b4 100644 --- a/tawindow.py +++ b/tawindow.py @@ -384,6 +384,7 @@ def tooldispatch(tw, spr): if spr.blocktype == 'hideshow': hideshow_blocks(tw,spr) elif spr.blocktype == 'eraser': runtool(tw, spr, clearscreen, tw.turtle) elif spr.blocktype == 'stopit': stop_logo(tw) + elif spr.blocktype == 'run': run(tw, spr) def runtool(tw, spr, cmd, *args): setshape(spr,spr.onshape) @@ -399,7 +400,22 @@ def hideshow_blocks(tw,spr): setshape(spr,spr.offshape) inval(tw.turtle.canvas) - +def run(tw, spr): + print "you better run, turtle, run!!" + for b in blocks(tw): + if find_block_to_run(tw, b): + setshape(spr,spr.onshape) + run_stack(tw, b) + setshape(spr,spr.offshape) + return + +# find a stack to run (a stack without a hat) +def find_block_to_run(tw, spr): + top = find_top_block(spr) + if spr == top and spr.proto.name[0:3] != 'hat': + return True + else: + return False def blocks(tw): return [spr for spr in tw.sprites if spr.type == 'block'] def xy(event): return map(int, event.get_coords()) -- cgit v0.9.1