[Sugar-devel] [PATCH] Fix for Ticket #1927
Anish Mangal
anishmangal2002 at gmail.com
Tue May 4 15:31:20 EDT 2010
From: anishmangal2002 <anishmangal2002 at gmail.com>
Changes
-------
[1] The pippy layout now scales according to screen size.
[2] Replaced [h,v]boxes by [h,v]panes to make them adjustable.
[3] Moved the [stop, run, clear] buttons to the activity toolbar.
[4] Added new icons for [stop, run, clear] toolbar buttons.
[5] When the toolbar [stop, run, clear] buttons are clicked, they flash colour momentarily (for approx. 400 milliseconds)
Signed-off-by: anishmangal2002 <anishmangal2002 at gmail.com>
---
icons/eraser_bw.svg | 84 ++++++++++++++++++++++++++++++
icons/eraser_color.svg | 83 ++++++++++++++++++++++++++++++
icons/run_bw.svg | 114 +++++++++++++++++++++++++++++++++++++++++
icons/run_color.svg | 114 +++++++++++++++++++++++++++++++++++++++++
icons/stopit_bw.svg | 100 ++++++++++++++++++++++++++++++++++++
icons/stopit_color.svg | 97 +++++++++++++++++++++++++++++++++++
pippy_app.py | 132 +++++++++++++++++++++++++++++++-----------------
7 files changed, 677 insertions(+), 47 deletions(-)
create mode 100644 icons/eraser_bw.svg
create mode 100644 icons/eraser_color.svg
create mode 100644 icons/run_bw.svg
create mode 100644 icons/run_color.svg
create mode 100644 icons/stopit_bw.svg
create mode 100644 icons/stopit_color.svg
diff --git a/icons/eraser_bw.svg b/icons/eraser_bw.svg
new file mode 100644
index 0000000..8409141
--- /dev/null
+++ b/icons/eraser_bw.svg
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.0"
+ width="44"
+ height="44"
+ id="svg2"
+ inkscape:version="0.47 r22583"
+ sodipodi:docname="eraser_bw.svg">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="787"
+ inkscape:window-height="635"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="5.4883721"
+ inkscape:cx="26.978767"
+ inkscape:cy="26.011603"
+ inkscape:window-x="0"
+ inkscape:window-y="24"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2" />
+ <defs
+ id="defs5">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 21.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="50 : 21.5 : 1"
+ inkscape:persp3d-origin="25 : 14.333333 : 1"
+ id="perspective14" />
+ </defs>
+ <g
+ transform="matrix(0.87048418,0,0,1.003782,0.58498874,1.169632)"
+ id="g3589"
+ style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">
+ <path
+ d="M 36,25.875 36,17.5 48.5,4 47,14.5 36,25.875 z"
+ id="path2394"
+ style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="M 15,17.5 28.5,4 48.5,4 36,17.5 l -21,0 z"
+ id="path2390"
+ style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="M 22.800718,38.5 25.493716,28.5 36,17.5 36,25.875 22.800718,38.5 z"
+ id="path2392"
+ style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="M 3.9497307,28.5 15,17.5 l 21,0 -10.86535,11 -21.1849193,0 z"
+ id="path2388"
+ style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 0.26929982,38.5 3.59066428,-10 21.1849189,0 -2.603231,10 -22.17235218,0 z"
+ id="path2384"
+ style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ </g>
+</svg>
diff --git a/icons/eraser_color.svg b/icons/eraser_color.svg
new file mode 100644
index 0000000..bda20d1
--- /dev/null
+++ b/icons/eraser_color.svg
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.0"
+ width="44"
+ height="44"
+ id="svg2"
+ inkscape:version="0.47 r22583"
+ sodipodi:docname="eraser_color.svg">
+ <metadata
+ id="metadata11">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="640"
+ inkscape:window-height="504"
+ id="namedview9"
+ showgrid="false"
+ inkscape:zoom="5.4883721"
+ inkscape:cx="25"
+ inkscape:cy="21.5"
+ inkscape:window-x="0"
+ inkscape:window-y="24"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2" />
+ <defs
+ id="defs5">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 21.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="50 : 21.5 : 1"
+ inkscape:persp3d-origin="25 : 14.333333 : 1"
+ id="perspective13" />
+ </defs>
+ <g
+ id="g2819"
+ transform="matrix(0.87909457,0,0,1,0.01627991,0)">
+ <path
+ style="fill:#c44000;fill-opacity:1;stroke:#a00000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none"
+ id="path2394"
+ d="m 36.61535,27.125 0,-8.375 12.5,-13.5 -1.5,10.5 -11,11.375 z" />
+ <path
+ style="fill:#c44000;fill-opacity:1;stroke:#a00000;stroke-width:1.5;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="path2390"
+ d="m 15.61535,18.75 13.5,-13.5 20,0 -12.5,13.5 -21,0 z" />
+ <path
+ style="fill:#c4a000;fill-opacity:1;stroke:#a00000;stroke-width:1.5;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none"
+ id="path2392"
+ d="m 23.416068,39.75 2.692998,-10 10.506284,-11 0,8.375 -13.199282,12.625 z" />
+ <path
+ style="fill:#c4a000;fill-opacity:1;stroke:#a00000;stroke-width:1.5;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none"
+ id="path2388"
+ d="m 4.5650808,29.75 11.0502692,-11 21,0 -10.86535,11 -21.1849192,0 z" />
+ <path
+ style="fill:#e0d000;fill-opacity:1;stroke:#a00000;stroke-width:1.5;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none"
+ id="path2384"
+ d="m 0.88464991,39.75 3.59066429,-10 21.1849188,0 -2.603231,10 -22.17235209,0 z" />
+ </g>
+</svg>
diff --git a/icons/run_bw.svg b/icons/run_bw.svg
new file mode 100644
index 0000000..35ea0cb
--- /dev/null
+++ b/icons/run_bw.svg
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.47 r22583"
+ width="44"
+ height="44"
+ version="1.0"
+ sodipodi:docname="stopit_bw (copy).svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs5">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective9" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:window-height="720"
+ inkscape:window-width="1278"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ showgrid="false"
+ inkscape:zoom="2.8284271"
+ inkscape:cx="7.024162"
+ inkscape:cy="19.485782"
+ inkscape:window-x="0"
+ inkscape:window-y="24"
+ inkscape:current-layer="svg2"
+ inkscape:window-maximized="0">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2818" />
+ </sodipodi:namedview>
+ <path
+ sodipodi:type="star"
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.50000000000000000;stroke-opacity:1"
+ id="path2386"
+ sodipodi:sides="8"
+ sodipodi:cx="6.154902"
+ sodipodi:cy="3.6254902"
+ sodipodi:r1="22.234058"
+ sodipodi:r2="20.541592"
+ sodipodi:arg1="0.36853512"
+ sodipodi:arg2="0.7612342"
+ inkscape:flatsided="true"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 26.896078,11.635294 L 15.157342,23.955503 L -1.8549019,24.366666 L -14.175111,12.62793 L -14.586274,-4.3843137 L -2.8475378,-16.704523 L 14.164706,-17.115686 L 26.484915,-5.3769496 L 26.896078,11.635294 z"
+ transform="matrix(1.0676988,3.2621148e-2,-3.2621148e-2,1.0676988,15.546686,17.928289)" />
+ <path
+ sodipodi:type="star"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.31833665000000000;stroke-opacity:1"
+ id="path3158"
+ sodipodi:sides="8"
+ sodipodi:cx="6.154902"
+ sodipodi:cy="3.6254902"
+ sodipodi:r1="22.234058"
+ sodipodi:r2="20.541592"
+ sodipodi:arg1="0.36853512"
+ sodipodi:arg2="0.7612342"
+ inkscape:flatsided="true"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 26.896078,11.635294 L 15.157342,23.955503 L -1.8549019,24.366666 L -14.175111,12.62793 L -14.586274,-4.3843137 L -2.8475378,-16.704523 L 14.164706,-17.115686 L 26.484915,-5.3769496 L 26.896078,11.635294 z"
+ transform="matrix(0.8982409,2.7775002e-2,-2.7443742e-2,0.9090831,16.347508,18.533176)" />
+ <path
+ sodipodi:type="star"
+ style="fill:#ffffff;fill-opacity:1"
+ id="path2824"
+ sodipodi:sides="3"
+ sodipodi:cx="5"
+ sodipodi:cy="15"
+ sodipodi:r1="14"
+ sodipodi:r2="7"
+ sodipodi:arg1="1.5707963"
+ sodipodi:arg2="2.6179939"
+ inkscape:flatsided="false"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 5.0000004,29 -1.0621779,18.5 -7.1243558,8.0000003 5.0000002,8 17.124355,7.9999997 11.062178,18.5 5.0000004,29 z"
+ transform="matrix(-0.00257519,-0.78354679,0.82270363,-0.00245262,8.9373438,25.614132)" />
+</svg>
diff --git a/icons/run_color.svg b/icons/run_color.svg
new file mode 100644
index 0000000..753a746
--- /dev/null
+++ b/icons/run_color.svg
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.47 r22583"
+ width="44"
+ height="44"
+ version="1.0"
+ sodipodi:docname="run_bw.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs5">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective9" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:window-height="720"
+ inkscape:window-width="1278"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ showgrid="false"
+ inkscape:zoom="2.8284271"
+ inkscape:cx="-56.261895"
+ inkscape:cy="19.485782"
+ inkscape:window-x="0"
+ inkscape:window-y="24"
+ inkscape:current-layer="svg2"
+ inkscape:window-maximized="0">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2818" />
+ </sodipodi:namedview>
+ <path
+ sodipodi:type="star"
+ style="opacity:1;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1.50000000000000000;stroke-opacity:1"
+ id="path2386"
+ sodipodi:sides="8"
+ sodipodi:cx="6.154902"
+ sodipodi:cy="3.6254902"
+ sodipodi:r1="22.234058"
+ sodipodi:r2="20.541592"
+ sodipodi:arg1="0.36853512"
+ sodipodi:arg2="0.7612342"
+ inkscape:flatsided="true"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 26.896078,11.635294 L 15.157342,23.955503 L -1.8549019,24.366666 L -14.175111,12.62793 L -14.586274,-4.3843137 L -2.8475378,-16.704523 L 14.164706,-17.115686 L 26.484915,-5.3769496 L 26.896078,11.635294 z"
+ transform="matrix(1.0676988,3.2621148e-2,-3.2621148e-2,1.0676988,15.546686,17.928289)" />
+ <path
+ sodipodi:type="star"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.31833665000000000;stroke-opacity:1"
+ id="path3158"
+ sodipodi:sides="8"
+ sodipodi:cx="6.154902"
+ sodipodi:cy="3.6254902"
+ sodipodi:r1="22.234058"
+ sodipodi:r2="20.541592"
+ sodipodi:arg1="0.36853512"
+ sodipodi:arg2="0.7612342"
+ inkscape:flatsided="true"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 26.896078,11.635294 L 15.157342,23.955503 L -1.8549019,24.366666 L -14.175111,12.62793 L -14.586274,-4.3843137 L -2.8475378,-16.704523 L 14.164706,-17.115686 L 26.484915,-5.3769496 L 26.896078,11.635294 z"
+ transform="matrix(0.8982409,2.7775002e-2,-2.7443742e-2,0.9090831,16.347508,18.533176)" />
+ <path
+ sodipodi:type="star"
+ style="fill:#ffffff;fill-opacity:1"
+ id="path2824"
+ sodipodi:sides="3"
+ sodipodi:cx="5"
+ sodipodi:cy="15"
+ sodipodi:r1="14"
+ sodipodi:r2="7"
+ sodipodi:arg1="1.5707963"
+ sodipodi:arg2="2.6179939"
+ inkscape:flatsided="false"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 5.0000004,29 -1.0621779,18.5 -7.1243558,8.0000003 5.0000002,8 17.124355,7.9999997 11.062178,18.5 5.0000004,29 z"
+ transform="matrix(-0.00257519,-0.78354679,0.82270363,-0.00245262,8.9373438,25.614132)" />
+</svg>
diff --git a/icons/stopit_bw.svg b/icons/stopit_bw.svg
new file mode 100644
index 0000000..18ec82b
--- /dev/null
+++ b/icons/stopit_bw.svg
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.47 r22583"
+ width="44"
+ height="44"
+ version="1.0"
+ sodipodi:docname="test.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs5">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective9" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:window-height="720"
+ inkscape:window-width="1278"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ showgrid="false"
+ inkscape:zoom="10"
+ inkscape:cx="7.024162"
+ inkscape:cy="19.082313"
+ inkscape:window-x="0"
+ inkscape:window-y="24"
+ inkscape:current-layer="svg2"
+ inkscape:window-maximized="0" />
+ <path
+ sodipodi:type="star"
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.50000000000000000;stroke-opacity:1"
+ id="path2386"
+ sodipodi:sides="8"
+ sodipodi:cx="6.154902"
+ sodipodi:cy="3.6254902"
+ sodipodi:r1="22.234058"
+ sodipodi:r2="20.541592"
+ sodipodi:arg1="0.36853512"
+ sodipodi:arg2="0.7612342"
+ inkscape:flatsided="true"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 26.896078,11.635294 L 15.157342,23.955503 L -1.8549019,24.366666 L -14.175111,12.62793 L -14.586274,-4.3843137 L -2.8475378,-16.704523 L 14.164706,-17.115686 L 26.484915,-5.3769496 L 26.896078,11.635294 z"
+ transform="matrix(1.0676988,3.2621148e-2,-3.2621148e-2,1.0676988,15.546686,17.928289)" />
+ <path
+ sodipodi:type="star"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.31833665000000000;stroke-opacity:1"
+ id="path3158"
+ sodipodi:sides="8"
+ sodipodi:cx="6.154902"
+ sodipodi:cy="3.6254902"
+ sodipodi:r1="22.234058"
+ sodipodi:r2="20.541592"
+ sodipodi:arg1="0.36853512"
+ sodipodi:arg2="0.7612342"
+ inkscape:flatsided="true"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 26.896078,11.635294 L 15.157342,23.955503 L -1.8549019,24.366666 L -14.175111,12.62793 L -14.586274,-4.3843137 L -2.8475378,-16.704523 L 14.164706,-17.115686 L 26.484915,-5.3769496 L 26.896078,11.635294 z"
+ transform="matrix(0.8982409,2.7775002e-2,-2.7443742e-2,0.9090831,16.347508,18.533176)" />
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0.5;stroke-opacity:1"
+ d="M 16.987782,36.466398 L 16.987782,31.060516 C 16.987782,31.060516 15.454015,30.38416 14.964253,29.880123 C 14.30166,29.198216 13.446606,27.097771 13.446606,27.097771 L 13.428206,15.466398 C 13.428206,15.466398 14.116058,14.43353 14.599464,14.48868 C 15.098301,14.545591 15.575838,15.466398 15.575838,15.466398 L 15.575838,21.466398 C 15.575838,21.466398 16.264462,22.047049 16.481899,22.038947 C 16.679317,22.031591 17.13801,21.466398 17.13801,21.466398 L 17.222322,11.716398 C 17.222322,11.716398 17.80243,10.809048 18.252488,10.825222 C 18.62827,10.838727 19.17994,11.716398 19.17994,11.716398 L 19.348567,18.466398 C 19.348567,18.466398 19.754261,19.166353 20.023077,19.17228 C 20.184998,19.17585 20.7451,18.466398 20.7451,18.466398 L 20.613273,8.4663984 C 20.613273,8.4663984 21.4426,7.4683451 21.793664,7.536987
+ C 22.138531,7.604417 22.80543,8.4663984 22.80543,8.4663984 L 22.889742,18.716398 C 22.889742,18.716398 23.339523,19.198362 23.564253,19.17228 C 23.760489,19.149505 24.325837,18.716398 24.325837,18.716398 L 24.325837,11.466398 C 24.325837,11.466398 24.989235,10.533447 25.437283,10.487967 C 25.887444,10.442273 26.575837,11.579069 26.575837,11.579069 L 26.575837,24.596716 L 28.454448,24.905614 C 28.454448,24.905614 29.743051,22.436507 30.646605,21.701692 C 31.411938,21.079285 32.676626,20.470888 33.644343,20.662327 C 34.030345,20.738688 34.571793,21.514664 34.571793,21.514664 C 34.571793,21.514664 32.320674,23.896383 31.630012,25.167755 C 31.114202,26.11726 30.873374,27.938957 30.177523,28.765645 C 29.629973,29.416148 28.579515,29.845615 27.845095,30.274092 C 27.061923,30.731012 25.45671,31.453727 25.45671,31.453727 L 25.419154,36.466398 L 16.987782,36.466398 z"
+ id="path3162"
+ sodipodi:nodetypes="ccsccsccsccsccsccsccsccscccsscsssccc" />
+</svg>
diff --git a/icons/stopit_color.svg b/icons/stopit_color.svg
new file mode 100644
index 0000000..7f891cc
--- /dev/null
+++ b/icons/stopit_color.svg
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ width="44"
+ height="44"
+ version="1.0"
+ sodipodi:docname="stopiton.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs5">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective9" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:window-height="1000"
+ inkscape:window-width="1679"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ showgrid="false"
+ inkscape:zoom="10"
+ inkscape:cx="24.924162"
+ inkscape:cy="3.0823126"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:current-layer="svg2" />
+ <path
+ sodipodi:type="star"
+ style="opacity:1;fill:#d00000;fill-opacity:1;stroke:none;stroke-width:1.5;stroke-opacity:1"
+ id="path2386"
+ sodipodi:sides="8"
+ sodipodi:cx="6.154902"
+ sodipodi:cy="3.6254902"
+ sodipodi:r1="22.234058"
+ sodipodi:r2="20.541592"
+ sodipodi:arg1="0.36853512"
+ sodipodi:arg2="0.7612342"
+ inkscape:flatsided="true"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 26.896078,11.635294 L 15.157342,23.955503 L -1.8549019,24.366666 L -14.175111,12.62793 L -14.586274,-4.3843137 L -2.8475378,-16.704523 L 14.164706,-17.115686 L 26.484915,-5.3769496 L 26.896078,11.635294 z"
+ transform="matrix(1.0676988,3.2621148e-2,-3.2621148e-2,1.0676988,15.546686,17.928289)" />
+ <path
+ sodipodi:type="star"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.31833665000000000;stroke-opacity:1"
+ id="path3158"
+ sodipodi:sides="8"
+ sodipodi:cx="6.154902"
+ sodipodi:cy="3.6254902"
+ sodipodi:r1="22.234058"
+ sodipodi:r2="20.541592"
+ sodipodi:arg1="0.36853512"
+ sodipodi:arg2="0.7612342"
+ inkscape:flatsided="true"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 26.896078,11.635294 L 15.157342,23.955503 L -1.8549019,24.366666 L -14.175111,12.62793 L -14.586274,-4.3843137 L -2.8475378,-16.704523 L 14.164706,-17.115686 L 26.484915,-5.3769496 L 26.896078,11.635294 z"
+ transform="matrix(0.8982409,2.7775002e-2,-2.7443742e-2,0.9090831,16.347508,18.533176)" />
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0.5;stroke-opacity:1"
+ d="M 16.987782,36.466398 L 16.987782,31.060516 C 16.987782,31.060516 15.454015,30.38416 14.964253,29.880123 C 14.30166,29.198216 13.446606,27.097771 13.446606,27.097771 L 13.428206,15.466398 C 13.428206,15.466398 14.116058,14.43353 14.599464,14.48868 C 15.098301,14.545591 15.575838,15.466398 15.575838,15.466398 L 15.575838,21.466398 C 15.575838,21.466398 16.264462,22.047049 16.481899,22.038947 C 16.679317,22.031591 17.13801,21.466398 17.13801,21.466398 L 17.222322,11.716398 C 17.222322,11.716398 17.80243,10.809048 18.252488,10.825222 C 18.62827,10.838727 19.17994,11.716398 19.17994,11.716398 L 19.348567,18.466398 C 19.348567,18.466398 19.754261,19.166353 20.023077,19.17228 C 20.184998,19.17585 20.7451,18.466398 20.7451,18.466398 L 20.613273,8.4663984 C 20.613273,8.4663984 21.4426,7.4683451 21.793664,7.536987
+ C 22.138531,7.604417 22.80543,8.4663984 22.80543,8.4663984 L 22.889742,18.716398 C 22.889742,18.716398 23.339523,19.198362 23.564253,19.17228 C 23.760489,19.149505 24.325837,18.716398 24.325837,18.716398 L 24.325837,11.466398 C 24.325837,11.466398 24.989235,10.533447 25.437283,10.487967 C 25.887444,10.442273 26.575837,11.579069 26.575837,11.579069 L 26.575837,24.596716 L 28.454448,24.905614 C 28.454448,24.905614 29.743051,22.436507 30.646605,21.701692 C 31.411938,21.079285 32.676626,20.470888 33.644343,20.662327 C 34.030345,20.738688 34.571793,21.514664 34.571793,21.514664 C 34.571793,21.514664 32.320674,23.896383 31.630012,25.167755 C 31.114202,26.11726 30.873374,27.938957 30.177523,28.765645 C 29.629973,29.416148 28.579515,29.845615 27.845095,30.274092 C 27.061923,30.731012 25.45671,31.453727 25.45671,31.453727 L 25.419154,36.466398 L 16.987782,36.466398 z"
+ id="path3162"
+ sodipodi:nodetypes="ccsccsccsccsccsccsccsccscccsscsssccc" />
+</svg>
diff --git a/pippy_app.py b/pippy_app.py
index abaf397..09a65f2 100644
--- a/pippy_app.py
+++ b/pippy_app.py
@@ -43,6 +43,12 @@ from sugar.presence import presenceservice
from sugar.presence.tubeconn import TubeConnection
+from sugar.graphics.toolbutton import ToolButton
+from sugar.graphics.toolbarbox import ToolbarBox
+from sugar.graphics.toolbarbox import ToolbarButton
+from sugar.activity.widgets import ActivityToolbarButton
+from sugar.activity.widgets import StopButton
+
SERVICE = "org.laptop.Pippy"
IFACE = SERVICE
PATH = "/org/laptop/Pippy"
@@ -53,6 +59,10 @@ PYTHON_PREFIX="""#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
+# get screen sizes
+SIZE_X = gtk.gdk.screen_width()
+SIZE_Y = gtk.gdk.screen_height()
+
class PippyActivity(ViewSourceActivity):
"""Pippy Activity as specified in activity.info"""
def __init__(self, handle):
@@ -62,6 +72,7 @@ class PippyActivity(ViewSourceActivity):
# Top toolbar with share and close buttons:
toolbox = ActivityToolbox(self)
+ activity_toolbar = toolbox.get_activity_toolbar()
# add 'make bundle' entry to 'keep' palette.
palette = toolbox.get_activity_toolbar().keep.get_palette()
# XXX: should clear out old palette entries?
@@ -77,13 +88,58 @@ class PippyActivity(ViewSourceActivity):
menu_item.connect('activate', self.makebutton_cb)
palette.menu.append(menu_item)
menu_item.show()
+
+ # The "go" button
+ goicon_bw = gtk.Image()
+ goicon_bw.set_from_file("%s/icons/run_bw.svg" % os.getcwd())
+ goicon_color = gtk.Image()
+ goicon_color.set_from_file("%s/icons/run_color.svg" % os.getcwd())
+ gobutton = ToolButton(label=_("_Run!"))
+ gobutton.set_icon_widget(goicon_bw)
+ gobutton.set_tooltip("Run")
+ gobutton.connect('clicked', self.flash_cb, dict({'bw':goicon_bw,
+ 'color':goicon_color}))
+ gobutton.connect('clicked', self.gobutton_cb)
+ activity_toolbar.insert(gobutton, 2)
+
+ # The "stop" button
+ stopicon_bw = gtk.Image()
+ stopicon_bw.set_from_file("%s/icons/stopit_bw.svg" % os.getcwd())
+ stopicon_color = gtk.Image()
+ stopicon_color.set_from_file("%s/icons/stopit_color.svg" % os.getcwd())
+ stopbutton = ToolButton(label=_("_Stop"))
+ stopbutton.set_icon_widget(stopicon_bw)
+ stopbutton.connect('clicked', self.flash_cb, dict({'bw':stopicon_bw,
+ 'color':stopicon_color}))
+ stopbutton.connect('clicked', self.stopbutton_cb)
+ stopbutton.set_tooltip("Stop Running")
+ activity_toolbar.insert(stopbutton, 3)
+
+ # The "clear" button
+ clearicon_bw = gtk.Image()
+ clearicon_bw.set_from_file("%s/icons/eraser_bw.svg" % os.getcwd())
+ clearicon_color = gtk.Image()
+ clearicon_color.set_from_file("%s/icons/eraser_color.svg" % os.getcwd())
+ clearbutton = ToolButton(label=_("_Clear"))
+ clearbutton.set_icon_widget(clearicon_bw)
+ clearbutton.connect('clicked', self.flash_cb, dict({'bw':clearicon_bw,
+ 'color':clearicon_color}))
+ clearbutton.connect('clicked', self.clearbutton_cb)
+ clearbutton.set_tooltip("Clear")
+ activity_toolbar.insert(clearbutton, 4)
+
+ # A vertical toolbar separator
+ separator = gtk.SeparatorToolItem()
+ separator.set_draw(True)
+ activity_toolbar.insert(separator, 5)
+
self.set_toolbox(toolbox)
toolbox.show()
# Main layout.
- hbox = gtk.HBox()
- vbox = gtk.VBox()
-
+ hpane = gtk.HPaned()
+ vpane = gtk.VPaned()
+
# The sidebar.
sidebar = gtk.VBox()
self.model = gtk.TreeStore(gobject.TYPE_PYOBJECT, gobject.TYPE_STRING)
@@ -92,13 +148,13 @@ class PippyActivity(ViewSourceActivity):
treecolumn = gtk.TreeViewColumn(_("Examples"), cellrenderer, text=1)
treeview.get_selection().connect("changed", self.selection_cb)
treeview.append_column(treecolumn)
- treeview.set_size_request(220, 900)
+ treeview.set_size_request(int(SIZE_X * 0.3), SIZE_Y)
# Create scrollbars around the view.
scrolled = gtk.ScrolledWindow()
scrolled.add(treeview)
sidebar.pack_start(scrolled)
- hbox.pack_start(sidebar)
+ hpane.add1(sidebar)
root = os.path.join(get_bundle_path(), 'data')
for d in sorted(os.listdir(root)):
@@ -108,7 +164,7 @@ class PippyActivity(ViewSourceActivity):
olditer = self.model.insert_before(None, None)
self.model.set_value(olditer, 0, direntry)
self.model.set_value(olditer, 1, direntry["name"])
-
+
for _file in sorted(os.listdir(os.path.join(root, d))):
if _file.endswith('~'): continue # skip emacs backups
entry = { "name": _(_file.capitalize()),
@@ -141,7 +197,7 @@ class PippyActivity(ViewSourceActivity):
# The GTK source view window
self.text_view = gtksourceview2.View(text_buffer)
- self.text_view.set_size_request(900, 350)
+ self.text_view.set_size_request(0, int(SIZE_Y * 0.5))
self.text_view.set_editable(True)
self.text_view.set_cursor_visible(True)
self.text_view.set_show_line_numbers(True)
@@ -161,42 +217,15 @@ class PippyActivity(ViewSourceActivity):
codesw.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
codesw.add(self.text_view)
- vbox.pack_start(codesw)
-
- # An hbox for the buttons
- buttonhbox = gtk.HBox()
-
- # The "go" button
- goicon = gtk.Image()
- goicon.set_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_BUTTON)
- gobutton = gtk.Button(label=_("_Run!"))
- gobutton.set_image(goicon)
- gobutton.connect('clicked', self.gobutton_cb)
- gobutton.set_size_request(650, 2)
- buttonhbox.pack_start(gobutton)
-
- # The "stop" button
- stopbutton = gtk.Button(stock=gtk.STOCK_STOP)
- stopbutton.connect('clicked', self.stopbutton_cb)
- stopbutton.set_size_request(200, 2)
- buttonhbox.pack_start(stopbutton)
-
- # The "clear" button
- clearbutton = gtk.Button(stock=gtk.STOCK_CLEAR)
- clearbutton.connect('clicked', self.clearbutton_cb)
- clearbutton.set_size_request(150, 2)
- buttonhbox.pack_end(clearbutton)
-
- vbox.pack_start(buttonhbox)
+ vpane.add1(codesw)
# An hbox to hold the vte window and its scrollbar.
outbox = gtk.HBox()
-
+
# The vte python window
self._vte = vte.Terminal()
self._vte.set_encoding('utf-8')
self._vte.set_size(30, 5)
- self._vte.set_size_request(200, 300)
font = 'Monospace ' + str(font_zoom(style.FONT_SIZE))
self._vte.set_font(pango.FontDescription(font))
self._vte.set_colors(gtk.gdk.color_parse ('#000000'),
@@ -209,16 +238,15 @@ class PippyActivity(ViewSourceActivity):
gtk.gdk.ACTION_COPY)
self._vte.connect('drag_data_received', self.vte_drop_cb)
outbox.pack_start(self._vte)
-
+
outsb = gtk.VScrollbar(self._vte.get_adjustment())
outsb.show()
outbox.pack_start(outsb, False, False, 0)
- vbox.pack_end(outbox)
- hbox.pack_end(vbox)
- self.set_canvas(hbox)
+ vpane.add2(outbox)
+ hpane.add2(vpane)
+ self.set_canvas(hpane)
self.show_all()
-
self.hellotube = None
# get the Presence Service
@@ -231,7 +259,7 @@ class PippyActivity(ViewSourceActivity):
except TypeError:
self._logger.debug('No Telepathy CM, offline')
self.initiating = None
-
+
self.connect('shared', self._shared_cb)
# Buddy object for you
@@ -265,7 +293,17 @@ class PippyActivity(ViewSourceActivity):
self.stopbutton_cb(None)
self._reset_vte()
self.text_view.grab_focus()
-
+
+ def timer_cb(self, button, icons):
+ button.set_icon_widget(icons['bw'])
+ button.show_all()
+ return False
+
+ def flash_cb(self, button, icons):
+ button.set_icon_widget(icons['color'])
+ button.show_all()
+ gobject.timeout_add(400, self.timer_cb, button, icons)
+
def clearbutton_cb(self, button):
self.save()
global text_buffer
@@ -295,10 +333,10 @@ class PippyActivity(ViewSourceActivity):
from shutil import copy2
self.stopbutton_cb(button) # try stopping old code first.
self._reset_vte()
-
+
# FIXME: We're losing an odd race here
# gtk.main_iteration(block=False)
-
+
pippy_app_name = '%s/tmp/pippy_app.py' % self.get_activity_root()
self._write_text_buffer(pippy_app_name)
# write activity.py here too, to support pippy-based activities.
@@ -415,14 +453,14 @@ class PippyActivity(ViewSourceActivity):
text = text_buffer.get_text(start, end)
_file = open(file_path, 'w')
_file.write(text)
-
+
def read_file(self, file_path):
text = open(file_path).read()
# discard the '#!/usr/bin/python' and 'coding: utf-8' lines, if present
text = re.sub(r'^' + re.escape(PYTHON_PREFIX), '', text)
global text_buffer
text_buffer.set_text(text)
-
+
def _shared_cb(self, activity):
self._logger.debug('My activity was shared')
self.initiating = True
--
1.7.0.4
More information about the Sugar-devel
mailing list