diff options
author | Walter Bender <walter@sugarlabs.org> | 2013-05-25 22:12:48 (GMT) |
---|---|---|
committer | Walter Bender <walter@sugarlabs.org> | 2013-05-25 22:12:48 (GMT) |
commit | 29851fcbe3b4d392efd5a873f92666da27ec0e99 (patch) | |
tree | 27ce347b8465c907836a116d8752ddb7fab48c69 /plugins/accelerometer | |
parent | ed303715f77f79e697e33b3d0df082843ffc1492 (diff) |
patches to create confusion
Diffstat (limited to 'plugins/accelerometer')
-rw-r--r-- | plugins/accelerometer/accelerometer.py | 91 | ||||
-rw-r--r-- | plugins/accelerometer/icons/sensoroff.svg | 79 | ||||
-rw-r--r-- | plugins/accelerometer/icons/sensoron.svg | 63 |
3 files changed, 0 insertions, 233 deletions
diff --git a/plugins/accelerometer/accelerometer.py b/plugins/accelerometer/accelerometer.py deleted file mode 100644 index 26aefd4..0000000 --- a/plugins/accelerometer/accelerometer.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -#Copyright (c) 2011 Walter Bender -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import os - -from gettext import gettext as _ - -from plugins.plugin import Plugin - -from TurtleArt.tapalette import make_palette -from TurtleArt.talogo import primitive_dictionary -from TurtleArt.tautils import debug_output - -import logging -_logger = logging.getLogger('turtleart-activity accelerometer plugin') - - -ACCELEROMETER_DEVICE = '/sys/devices/platform/lis3lv02d/position' - - -class Accelerometer(Plugin): - - def __init__(self, parent): - self._parent = parent - if os.path.exists(ACCELEROMETER_DEVICE): - self._status = True - else: - self._status = False - self.running_sugar = self._parent.running_sugar - - def setup(self): - # set up accelerometer specific blocks - palette = make_palette('sensor', - colors=["#FF6060", "#A06060"], - help_string=_('Palette of sensor blocks'), - position=6) - - primitive_dictionary['xyz'] = self.prim_xyz - if self._status: - palette.add_block('xyz', - style='basic-style-extended-vertical', - label=_('acceleration'), - help_string=\ - _('push acceleration in x, y, z to heap'), - prim_name='xyz') - else: - palette.add_block('xyz', - style='basic-style-extended-vertical', - label=_('acceleration'), - help_string=\ - _('push acceleration in x, y, z to heap'), - hidden=True, - prim_name='xyz') - - self._parent.lc.def_prim( - 'xyz', 0, lambda self: primitive_dictionary['xyz']()) - - def _status_report(self): - debug_output('Reporting accelerator status: %s' % (str(self._status))) - return self._status - - # Block primitives used in talogo - - def prim_xyz(self): - ''' push accelerometer xyz to stack ''' - if not self._status: - self._parent.lc.heap.append(0) - self._parent.lc.heap.append(0) - self._parent.lc.heap.append(0) - else: - fh = open(ACCELEROMETER_DEVICE) - string = fh.read() - xyz = string[1:-2].split(',') - self._parent.lc.heap.append(float(xyz[2]) / 18) - self._parent.lc.heap.append(float(xyz[1]) / 18) - self._parent.lc.heap.append(float(xyz[0]) / 18) - fh.close() diff --git a/plugins/accelerometer/icons/sensoroff.svg b/plugins/accelerometer/icons/sensoroff.svg deleted file mode 100644 index 0a16670..0000000 --- a/plugins/accelerometer/icons/sensoroff.svg +++ /dev/null @@ -1,79 +0,0 @@ -<?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" - version="1.1" - width="55" - height="55" - viewBox="0 0 55 55" - id="svg2" - xml:space="preserve"><metadata - id="metadata15"><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="defs13" /> -<rect - width="42.763924" - height="42.763924" - x="6.1180382" - y="6.1180382" - id="rect2986" - style="fill:#282828;fill-opacity:1;stroke:#282828;stroke-width:2.23607516;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><g - transform="matrix(0.87078705,0,0,0.87078705,3.2821055,2.9298726)" - id="network-wired_1_" - style="display:block"> - <g - id="network-wired"> - <line - id="line3076" - y2="23.993" - y1="32.438999" - x2="16.966999" - x1="16.966999" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round" /> - <line - id="line3078" - y2="28.215" - y1="28.215" - x2="34.938" - x1="29.636999" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round" /> - - <rect - width="9.7939997" - height="7.599" - x="42.157001" - y="24.312" - id="rect3080" - style="fill:#ffffff;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round" /> - <path - d="m 16.967,23.993 c 0,-2.334 -1.892,-4.224 -4.224,-4.224 -2.332,0 -4.223,1.889 -4.223,4.224" - id="path3082" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round" /> - <path - d="m 25.413,32.439 c 0,2.334 -1.891,4.224 -4.224,4.224 -2.332,0 -4.223,-1.89 -4.223,-4.224" - id="path3084" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round" /> - <path - d="m 25.413,32.439 c 0,-2.332 1.893,-4.226 4.224,-4.226" - id="path3086" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round" /> - <path - d="m 8.52,23.993 c 0,2.332 -1.892,4.222 -4.223,4.222" - id="path3088" - style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round" /> - - <rect - width="14.477" - height="11.35" - x="31.945" - y="22.438" - id="rect3090" - style="fill:#ffffff;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round" /> - </g> -</g></svg>
\ No newline at end of file diff --git a/plugins/accelerometer/icons/sensoron.svg b/plugins/accelerometer/icons/sensoron.svg deleted file mode 100644 index d756860..0000000 --- a/plugins/accelerometer/icons/sensoron.svg +++ /dev/null @@ -1,63 +0,0 @@ -<?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" - version="1.1" - width="55" - height="55" - viewBox="0 0 55 55" - id="svg2" - xml:space="preserve"><metadata - id="metadata15"><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="defs13" /><rect - width="55" - height="55" - x="0" - y="0" - id="rect3269" - style="fill:#ffd200;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g - transform="translate(0.27777716,18.796296)" - id="g4054"><line - style="fill:#000000;fill-opacity:1;stroke:#ff0000;stroke-width:3.04775476;stroke-linecap:round;stroke-opacity:1" - x1="17.778971" - x2="17.778971" - y1="12.381037" - y2="5.0263696" - id="line3076" /><line - style="fill:#ff0000;fill-opacity:1;stroke:#ff0000;stroke-width:3.04775476;stroke-linecap:round;stroke-opacity:1" - x1="28.811842" - x2="33.427887" - y1="8.7028332" - y2="8.7028332" - id="line3078" /><rect - width="8.5284882" - height="6.6171107" - x="39.7141" - y="5.3041511" - id="rect3080" - style="fill:#ff0000;fill-opacity:1;stroke:#ff0000;stroke-width:1.95927083;stroke-linecap:round;stroke-opacity:1" /><path - d="m 17.778971,5.0263697 c 0,-2.032417 -1.647529,-3.6782045 -3.678204,-3.6782045 -2.030675,0 -3.677334,1.6449167 -3.677334,3.6782045" - id="path3082" - style="fill:none;stroke:#ff0000;stroke-width:3.04775476;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path - d="m 25.133639,12.381037 c 0,2.032417 -1.646658,3.678205 -3.678205,3.678205 -2.030675,0 -3.677333,-1.645788 -3.677333,-3.678205" - id="path3084" - style="fill:none;stroke:#ff0000;stroke-width:3.04775476;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path - d="m 25.133639,12.381037 c 0,-2.030675 1.6484,-3.679946 3.678204,-3.679946" - id="path3086" - style="fill:#000000;fill-opacity:1;stroke:#ff0000;stroke-width:3.04775476;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path - d="m 10.423433,5.0263697 c 0,2.0306754 -1.6475288,3.6764629 -3.6773334,3.6764629" - id="path3088" - style="fill:#000000;fill-opacity:1;stroke:#ff0000;stroke-width:3.04775476;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><rect - width="12.606384" - height="9.8834333" - x="30.821619" - y="3.6722956" - id="rect3090" - style="fill:#ff0000;fill-opacity:1;stroke:#ff0000;stroke-width:3.04775476;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g></svg>
\ No newline at end of file |