Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex <alex@Tiresias.(none)>2008-07-08 21:57:10 (GMT)
committer Alex <alex@Tiresias.(none)>2008-07-08 21:57:10 (GMT)
commit40c895937c2dbbcd09ec98ae2a1cb532e0d3be38 (patch)
tree80335c70c91606c4c7eca2c0cd804646bd79e6e9
parentebabc24acb310697ce2b397541cc7ef0e2ef05a5 (diff)
Added sugar menu
-rw-r--r--activity.py78
-rwxr-xr-xicons/box.svg11
-rwxr-xr-xicons/circle.svg11
-rwxr-xr-xicons/destroy.svg6
-rwxr-xr-xicons/grab.svg17
-rwxr-xr-xicons/joint.svg11
-rwxr-xr-xicons/magicpen.svg21
-rwxr-xr-xicons/minus.svg15
-rwxr-xr-xicons/plus.svg16
-rwxr-xr-xicons/polygon.svg12
-rwxr-xr-xicons/triangle.svg11
11 files changed, 163 insertions, 46 deletions
diff --git a/activity.py b/activity.py
index 4d3638b..11702fe 100644
--- a/activity.py
+++ b/activity.py
@@ -13,21 +13,69 @@ class PhysicsActivity(olpcgames.PyGameActivity):
toolbar = super(PhysicsActivity, self).build_toolbar()
# Add buttons
- toolbar.button1 = ToolButton('minus')
- toolbar.button1.set_tooltip(_('Button One'))
- toolbar.button1.connect('clicked', self._button1_cb)
- toolbar.insert(toolbar.button1, 2)
- toolbar.button1.show()
+ toolbar.box = ToolButton('box')
+ toolbar.box.set_tooltip(_('Box'))
+ toolbar.box.connect('clicked', self._box_cb)
+ toolbar.insert(toolbar.box, 2)
+ toolbar.box.show()
- toolbar.button2 = ToolButton('plus')
- toolbar.button2.set_tooltip(_('button-2'))
- toolbar.button2.connect('clicked', self._button2_cb)
- toolbar.insert(toolbar.button2, 2)
- toolbar.button2.show()
+ toolbar.circle = ToolButton('circle')
+ toolbar.circle.set_tooltip(_('Circle'))
+ toolbar.circle.connect('clicked', self._circle_cb)
+ toolbar.insert(toolbar.circle, 2)
+ toolbar.circle.show()
+
+ toolbar.triangle = ToolButton('triangle')
+ toolbar.triangle.set_tooltip(_('Triangle'))
+ toolbar.triangle.connect('clicked', self._triangle_cb)
+ toolbar.insert(toolbar.triangle, 2)
+ toolbar.triangle.show()
+
+ toolbar.polygon = ToolButton('polygon')
+ toolbar.polygon.set_tooltip(_('Polygon'))
+ toolbar.polygon.connect('clicked', self._polygon_cb)
+ toolbar.insert(toolbar.polygon, 2)
+ toolbar.polygon.show()
+
+ toolbar.magicpen = ToolButton('magicpen')
+ toolbar.magicpen.set_tooltip(_('Magic Pen'))
+ toolbar.magicpen.connect('clicked', self._magicpen_cb)
+ toolbar.insert(toolbar.magicpen, 2)
+ toolbar.magicpen.show()
+
+ toolbar.grab = ToolButton('grab')
+ toolbar.grab.set_tooltip(_('Grab'))
+ toolbar.grab.connect('clicked', self._grab_cb)
+ toolbar.insert(toolbar.grab, 2)
+ toolbar.grab.show()
+
+ toolbar.joint = ToolButton('joint')
+ toolbar.joint.set_tooltip(_('Joint'))
+ toolbar.joint.connect('clicked', self._joint_cb)
+ toolbar.insert(toolbar.joint, 2)
+ toolbar.joint.show()
+
+ toolbar.destroy = ToolButton('destroy')
+ toolbar.destroy.set_tooltip(_('Destroy'))
+ toolbar.destroy.connect('clicked', self._destroy_cb)
+ toolbar.insert(toolbar.destroy, 2)
+ toolbar.destroy.show()
+
return toolbar
- def _button1_cb(self, button):
- pygame.event.post(olpcgames.eventwrap.Event(pygame.USEREVENT, action='button1'))
-
- def _button2_cb(self, button):
- pygame.event.post(olpcgames.eventwrap.Event(pygame.USEREVENT, action='button2'))
+ def _box_cb(self, button):
+ pygame.event.post(olpcgames.eventwrap.Event(pygame.USEREVENT, action='box'))
+ def _circle_cb(self, button):
+ pygame.event.post(olpcgames.eventwrap.Event(pygame.USEREVENT, action='circle'))
+ def _triangle_cb(self, button):
+ pygame.event.post(olpcgames.eventwrap.Event(pygame.USEREVENT, action='triangle'))
+ def _polygon_cb(self, button):
+ pygame.event.post(olpcgames.eventwrap.Event(pygame.USEREVENT, action='polygon'))
+ def _magicpen_cb(self, button):
+ pygame.event.post(olpcgames.eventwrap.Event(pygame.USEREVENT, action='magicpen'))
+ def _grab_cb(self, button):
+ pygame.event.post(olpcgames.eventwrap.Event(pygame.USEREVENT, action='grab'))
+ def _joint_cb(self, button):
+ pygame.event.post(olpcgames.eventwrap.Event(pygame.USEREVENT, action='joint'))
+ def _destroy_cb(self, button):
+ pygame.event.post(olpcgames.eventwrap.Event(pygame.USEREVENT, action='destroy'))
diff --git a/icons/box.svg b/icons/box.svg
new file mode 100755
index 0000000..d926cd1
--- /dev/null
+++ b/icons/box.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="55px"
+ height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+
+<g id="Rectangle" >
+ <rect x="8.832" y="8.833" display="inline" fill="#FFFFFF" width="37.334" height="37.334"/>
+</g>
+
+</svg>
diff --git a/icons/circle.svg b/icons/circle.svg
new file mode 100755
index 0000000..2cdb119
--- /dev/null
+++ b/icons/circle.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="55px"
+ height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+
+<g id="Ellipse" >
+ <circle display="inline" fill="#FFFFFF" cx="27.499" cy="27.5" r="19.802"/>
+</g>
+
+</svg>
diff --git a/icons/destroy.svg b/icons/destroy.svg
new file mode 100755
index 0000000..bf2a7ac
--- /dev/null
+++ b/icons/destroy.svg
@@ -0,0 +1,6 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#FFFFFF">
+]><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="edit-clear">
+ <path d="M5,10.033v34.934h45V10.033H5z M37.575,35.1c0.684,0.683,0.684,1.793,0,2.476 c-0.341,0.342-0.789,0.513-1.237,0.513s-0.896-0.171-1.238-0.513l-7.601-7.602l-7.602,7.602c-0.342,0.342-0.79,0.513-1.237,0.513 s-0.895-0.171-1.237-0.513c-0.684-0.683-0.684-1.793,0-2.476l7.601-7.601l-7.601-7.602c-0.684-0.684-0.684-1.791,0-2.474 c0.683-0.684,1.791-0.684,2.474,0l7.602,7.601l7.601-7.601c0.683-0.684,1.793-0.684,2.476,0c0.684,0.683,0.684,1.791,0,2.474 l-7.602,7.602L37.575,35.1z" fill="&fill_color;"/>
+</g></svg> \ No newline at end of file
diff --git a/icons/grab.svg b/icons/grab.svg
new file mode 100755
index 0000000..c620d0a
--- /dev/null
+++ b/icons/grab.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="55px"
+ height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+
+<g id="Insert_Image" >
+ <g display="inline">
+ <polyline fill="#C6C8CA" points="44.475,19.063 10.275,19.063 10.275,44.264 44.475,44.264 44.475,19.063 "/>
+
+ <line fill="none" stroke="#FFFFFF" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" x1="27.376" y1="34.664" x2="27.376" y2="8.711"/>
+ <polyline fill="none" stroke="#FFFFFF" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" points="
+ 35.098,25.51 27.376,34.664 19.653,25.51"/>
+ </g>
+</g>
+
+</svg>
diff --git a/icons/joint.svg b/icons/joint.svg
new file mode 100755
index 0000000..f26c41f
--- /dev/null
+++ b/icons/joint.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="55px"
+ height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+
+<g id="Line" >
+ <line display="inline" fill="none" stroke="#FFFFFF" stroke-width="2.25" x1="8.708" y1="47.167" x2="48.042" y2="7.833"/>
+</g>
+
+</svg>
diff --git a/icons/magicpen.svg b/icons/magicpen.svg
new file mode 100755
index 0000000..c7a1ef9
--- /dev/null
+++ b/icons/magicpen.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="55px"
+ height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+
+<g id="Pencil" >
+ <g display="inline">
+ <path fill="#FFFFFF" d="M12.727,45.969c-0.053,0.132-0.02,0.281,0.09,0.373s0.264,0.103,0.385,0.025l4.635-2.984l-3.009-2.407
+ L12.727,45.969z M42.967,14.071c0-0.073-0.004-0.15-0.014-0.227c-0.112-0.949-0.903-2.109-2.062-3.025
+ c-1.16-0.915-2.474-1.413-3.424-1.304c-0.414,0.052-0.747,0.228-0.973,0.491l-0.021-0.015L19.716,32.17l-0.073,0.073l-0.011,0.015
+ c-0.026,0.029-0.029,0.069-0.05,0.103l-2.177,2.677c0,0,0.128,0.099,0.256,0.201l-0.002,0.004l-0.009,0.011
+ c-0.128-0.103-0.252-0.197-0.252-0.197l-0.042,0.051c-0.097,0.121-0.155,0.271-0.203,0.429c-0.015,0.019-0.046,0.025-0.057,0.048
+ l-1.361,3.236l4.097,3.278l3.202-2.062c0.019-0.011,0.015-0.037,0.031-0.052c0.083-0.065,0.178-0.121,0.243-0.201
+ c0.008-0.011,0.043-0.059,0.048-0.062l2.237-2.79l0.033-0.033l-0.004-0.004l0.023-0.029l0.006,0.004L42.59,15.02
+ c0.029-0.029,0.071-0.044,0.1-0.077c0.032-0.044,0.049-0.103,0.076-0.15l0.015-0.019l-0.003-0.003
+ C42.895,14.566,42.967,14.339,42.967,14.071z"/>
+ </g>
+</g>
+
+</svg>
diff --git a/icons/minus.svg b/icons/minus.svg
deleted file mode 100755
index 5b1caef..0000000
--- a/icons/minus.svg
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
- <!ENTITY fill_color "#FFFFFF">
- <!ENTITY stroke_color "#000000">
-]>
-<svg version="1.1" id="Layer_5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="74.5px" height="74px" viewBox="0 0 74.5 74" enable-background="new 0 0 74.5 74" xml:space="preserve">
-<g>
- <circle cx="37.026" cy="37.18" r="30" fill="&fill_color;"/>
- <g>
- <line fill="none" stroke="&stroke_color;" stroke-width="4" x1="55.026" y1="37.18" x2="19.026" y2="37.18"/>
- </g>
-</g>
-</svg>
diff --git a/icons/plus.svg b/icons/plus.svg
deleted file mode 100755
index e1fc560..0000000
--- a/icons/plus.svg
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
- <!ENTITY fill_color "#FFFFFF">
- <!ENTITY stroke_color "#000000">
-]>
-<svg version="1.1" id="Layer_5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="74.5px" height="74px" viewBox="0 0 74.5 74" enable-background="new 0 0 74.5 74" xml:space="preserve">
-<g>
- <circle cx="37.026" cy="37.18" r="30" fill="&fill_color;"/>
- <g>
- <line fill="none" stroke="&stroke_color;" stroke-width="4" x1="37.026" y1="19.18" x2="37.026" y2="55.18"/>
- <line fill="none" stroke="&stroke_color;" stroke-width="4" x1="55.026" y1="37.18" x2="19.026" y2="37.18"/>
- </g>
-</g>
-</svg>
diff --git a/icons/polygon.svg b/icons/polygon.svg
new file mode 100755
index 0000000..5008d4d
--- /dev/null
+++ b/icons/polygon.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="55px"
+ height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+
+<g id="Polygon" >
+ <polygon display="inline" fill="#FFFFFF" points="16.834,46.58 5.83,27.522 16.834,8.464 38.841,8.464 49.844,27.522 38.841,46.58
+ "/>
+</g>
+
+</svg>
diff --git a/icons/triangle.svg b/icons/triangle.svg
new file mode 100755
index 0000000..0bce240
--- /dev/null
+++ b/icons/triangle.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="55px"
+ height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+
+<g id="Triangle" >
+ <polygon display="inline" fill="#FFFFFF" points="5.731,46.536 27.5,8.833 49.268,46.536 "/>
+</g>
+
+</svg>