Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgnacio Rodríguez <ignaciorodriguez@sugarlabs.org>2013-11-21 12:14:44 (GMT)
committer Ignacio Rodríguez <ignaciorodriguez@sugarlabs.org>2013-11-21 12:14:44 (GMT)
commit7ad86064f443207b9e663d92cfa4059592e442a9 (patch)
tree7ddcf16c742c9b7a1d396bd06c871a2f66383869
parent3a41e216f6edb989a1ef3289c5c71610195d7731 (diff)
Eliminadas algunas plantillas.HEADmaster
-rw-r--r--Accelerometer/LevelActivity.py189
-rw-r--r--Accelerometer/activity/Level.svg120
-rw-r--r--Accelerometer/activity/activity.info9
-rwxr-xr-xAccelerometer/setup.py2
-rw-r--r--Touch/activity.py189
-rw-r--r--Touch/activity/activity-testmultitouch.svg9
-rw-r--r--Touch/activity/activity.info7
-rwxr-xr-xTouch/setup.py3
8 files changed, 0 insertions, 528 deletions
diff --git a/Accelerometer/LevelActivity.py b/Accelerometer/LevelActivity.py
deleted file mode 100644
index 473976b..0000000
--- a/Accelerometer/LevelActivity.py
+++ /dev/null
@@ -1,189 +0,0 @@
-# LevelActivity.py
-# Copyright (C) 2012 Aneesh Dogra <lionaneesh@gmail.com>
-#
-# 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
-
-from gi.repository import Gtk
-from gi.repository import GObject
-from sugar3.activity import widgets
-from sugar3.activity.widgets import StopButton
-from sugar3.activity import activity
-from math import pi, sqrt
-from gettext import gettext as _
-from collections import deque
-
-# Change the following text to change the accelerometer path
-ACCELEROMETER_DEVICE = '/sys/devices/platform/lis3lv02d/position'
-#ACCELEROMETER_DEVICE = 'a.txt'
-
-def read_accelerometer(canvas):
- fh = open(ACCELEROMETER_DEVICE)
- string = fh.read()
- xyz = string[1:-2].split(',')
- try:
- x = float(xyz[0]) / (64 * 18)
- y = float(xyz[1]) / (64 * 18)
- fh.close()
- canvas.motion_cb(x, y)
- except:
- pass
- GObject.timeout_add(100, read_accelerometer, canvas)
-
-class MyCanvas(Gtk.DrawingArea):
- ''' Create a GTK+ widget on which we will draw using Cairo '''
-
- def __init__(self):
- Gtk.DrawingArea.__init__(self)
- self._draw_ruler = False
- self._object = None
- self.connect('draw', self._draw_cb)
- self._dpi = 96
- self.cr = None
- self.width = 0
- self.height = 0
- self.radius = 0
- self.x = 0
- self.y = 0
- self.center = (0, 0)
- self.prev = deque([])
- self.ball_radius = 20
-
- def _draw_cb(self, drawing_area, cr):
- self.center = (self.width / 2, self.height / 2)
- self.radius = min(self.width / 2, self.height / 2) - \
- self.ball_radius - 20
- self.cr = cr
- cr.set_line_width(2)
- self.width = drawing_area.get_allocated_width()
- self.height = drawing_area.get_allocated_height()
-
- cr.set_source_rgb(1, 1, 1)
- cr.rectangle(0, 0, self.width, self.height)
- cr.fill()
-
-
- cr.set_source_rgb(0.9450, 0.9450, 0.9450)
- cr.arc(self.center[0], self.center[1],
- self.radius, 0,
- 2 * pi)
- cr.fill()
-
-
- cr.set_source_rgb(0, 0, 0)
- cr.arc(self.center[0], self.center[1],
- self.ball_radius + 2, 0,
- 2 * pi)
- cr.stroke()
-
- cr.arc(self.center[0], self.center[1],
- self.radius / 3, 0,
- 2 * pi)
- cr.stroke()
-
- cr.arc(self.center[0], self.center[1],
- self.radius * 2 / 3, 0,
- 2 * pi)
- cr.stroke()
-
- cr.arc(self.center[0], self.center[1],
- self.radius, 0,
- 2 * pi)
- cr.stroke()
-
- cr.move_to(self.center[0] - self.radius, self.center[1])
- cr.line_to(self.center[0] + self.radius, self.center[1])
- cr.stroke()
-
- cr.move_to(self.center[0], self.center[1] - self.radius)
- cr.line_to(self.center[0], self.center[1] + self.radius)
- cr.stroke()
-
- self.update_ball_and_text()
-
- def update_ball_and_text(self):
- # Build the ball
- self.cr.set_source_rgb(0.3012, 0.6, 1) # blue
- self.cr.arc(self.x, self.y, self.ball_radius, 0, 2 * pi)
- self.cr.fill()
-
- # Now update the text
-
- # 1. Clear Text
- self.cr.set_source_rgb(1, 1, 1) # white
- self.cr.rectangle(self.width - 110, self.height - 110,
- self.width, self.height)
- self.cr.fill()
-
- # 2. Update Text
- self.cr.set_source_rgb(0, 0, 0) # black
- self.cr.move_to(self.width - 100, self.height - 80)
- self.cr.set_font_size(20)
-
- # TRANS: X is for X axis
- self.cr.show_text(_("X: %.2f") % (self.x - self.width / 2,))
-
- self.cr.move_to(self.width - 99, self.height - 60)
- self.cr.set_font_size(20)
-
- # TRANS: Y is for Y axis
- self.cr.show_text(_("Y: %.2f") % (self.y - self.height / 2,))
-
-
- def motion_cb(self, x, y):
- if len(self.prev) >= 2:
- self.x = self.prev[-2][0] * 0.25 + self.prev[-1][0] * 0.5 + \
- self.radius * x * 0.25
- self.y = self.prev[-2][1] * 0.25 + self.prev[-1][1] * 0.5 + \
- self.radius * y * 0.25
- self.prev.popleft()
- self.prev.append([self.x, self.y])
- else:
- self.x = self.radius * x
- self.y = self.radius * y
- self.prev.append([self.x, self.y])
-
- if self.x and self.y:
- r = sqrt((self.x * self.x) + (self.y * self.y))
- r1 = min(r, self.radius)
- scale = r1 / r
- self.x *= scale
- self.y *= scale
-
- self.x += self.center[0]
- self.y += self.center[1]
-
- self.queue_draw()
-
-class LevelActivity(activity.Activity):
- def __init__(self, handle):
- "The entry point to the Activity"
- activity.Activity.__init__(self, handle)
-
- toolbox = widgets.ActivityToolbar(self)
- toolbox.share.props.visible = False
-
- stop_button = StopButton(self)
- stop_button.show()
- toolbox.insert(stop_button, -1)
-
- self.set_toolbar_box(toolbox)
- toolbox.show()
-
- # Draw the canvas
- self._canvas = MyCanvas()
- self.set_canvas(self._canvas)
- self._canvas.show()
-
- GObject.timeout_add(100, read_accelerometer, self._canvas)
diff --git a/Accelerometer/activity/Level.svg b/Accelerometer/activity/Level.svg
deleted file mode 100644
index 10c53b0..0000000
--- a/Accelerometer/activity/Level.svg
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
- <!ENTITY stroke_color "#000000">
- <!ENTITY fill_color "#OOFFOO">
-]>
-<!-- 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"
- width="55"
- height="55"
- id="svg2"
- version="1.1"
- inkscape:version="0.48.3.1 r9886"
- sodipodi:docname="Level.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="7.890625"
- inkscape:cx="32.611517"
- inkscape:cy="25.169923"
- inkscape:document-units="px"
- inkscape:current-layer="layer2"
- showgrid="false"
- inkscape:window-width="1280"
- inkscape:window-height="741"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1" />
- <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>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(0,-997.3622)">
- <path
- sodipodi:type="arc"
- style="fill-opacity:0;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:0.40000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="path3807"
- sodipodi:cx="8.1425743"
- sodipodi:cy="7.9841585"
- sodipodi:rx="6.7485147"
- sodipodi:ry="6.7485147"
- d="m 14.891089,7.9841585 a 6.7485147,6.7485147 0 1 1 -13.4970293,0 6.7485147,6.7485147 0 1 1 13.4970293,0 z"
- transform="matrix(3.6020297,0,0,3.5933126,-1.8538196,996.3557)" />
- <path
- sodipodi:type="arc"
- style="fill-opacity:0;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:0.78126347;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="path3807-9"
- sodipodi:cx="8.1425743"
- sodipodi:cy="7.9841585"
- sodipodi:rx="6.7485147"
- sodipodi:ry="6.7485147"
- d="m 14.891089,7.9841585 a 6.7485147,6.7485147 0 1 1 -13.4970293,0 6.7485147,6.7485147 0 1 1 13.4970293,0 z"
- transform="matrix(2.2533714,0,0,2.2479181,9.2846503,1007.4385)" />
- <path
- sodipodi:type="arc"
- style="fill-opacity:0;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:0.40000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="path3807-3"
- sodipodi:cx="8.1425743"
- sodipodi:cy="7.9841585"
- sodipodi:rx="6.7485147"
- sodipodi:ry="6.7485147"
- d="m 14.891089,7.9841585 a 6.7485147,6.7485147 0 1 1 -13.4970293,0 6.7485147,6.7485147 0 1 1 13.4970293,0 z"
- transform="matrix(1.1219773,0,0,1.119262,18.682563,1016.6784)" />
- <rect
- style="fill:&stroke_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:0.35184783;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="rect3838"
- width="48.464798"
- height="1.1384753"
- x="3.2817473"
- y="1025.2729" />
- <rect
- style="fill:&stroke_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:0.35976684;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="rect3840"
- width="1.3694848"
- height="48.271351"
- x="27.247725"
- y="1000.9095" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer2"
- inkscape:label="Layer"
- transform="translate(0,39)">
- <path
- sodipodi:type="arc"
- style="fill:&fill_color;;fill-opacity:1;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="path3834"
- sodipodi:cx="7.9841585"
- sodipodi:cy="8.2059402"
- sodipodi:rx="0.76039606"
- sodipodi:ry="0.76039606"
- d="m 8.7445546,8.2059402 a 0.76039606,0.76039606 0 1 1 -1.5207921,0 0.76039606,0.76039606 0 1 1 1.5207921,0 z"
- transform="matrix(6.9304806,0,0,6.9137086,-27.598645,-67.521329)" />
- </g>
-</svg>
diff --git a/Accelerometer/activity/activity.info b/Accelerometer/activity/activity.info
deleted file mode 100644
index 99973cf..0000000
--- a/Accelerometer/activity/activity.info
+++ /dev/null
@@ -1,9 +0,0 @@
-[Activity]
-name = Level
-bundle_id = net.flossmanuals.LevelActivity
-icon = Level
-exec = sugar-activity LevelActivity.LevelActivity
-show_launcher = yes
-mime_types = text/plain;application/zip
-activity_version = 1
-license = GPLv2+
diff --git a/Accelerometer/setup.py b/Accelerometer/setup.py
deleted file mode 100755
index d4b5aa0..0000000
--- a/Accelerometer/setup.py
+++ /dev/null
@@ -1,2 +0,0 @@
-from sugar3.activity import bundlebuilder
-bundlebuilder.start()
diff --git a/Touch/activity.py b/Touch/activity.py
deleted file mode 100644
index 3769329..0000000
--- a/Touch/activity.py
+++ /dev/null
@@ -1,189 +0,0 @@
-# Copyright (c) 2012 Bert Freudenberg
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-"""
-Activity: TestMultiTouch
-Shows multi-touch events
-"""
-
-from gi.repository import Gtk
-from gi.repository import Gdk
-from random import random
-from math import pi as M_PI
-
-from sugar3.activity import activity
-from sugar3.graphics.toolbarbox import ToolbarBox
-from sugar3.activity.widgets import ActivityButton
-from sugar3.activity.widgets import TitleEntry
-from sugar3.activity.widgets import StopButton
-from sugar3.activity.widgets import ShareButton
-from sugar3.activity.widgets import DescriptionItem
-
-class TestMultiTouchActivity(activity.Activity):
-
- def __init__(self, handle):
- activity.Activity.__init__(self, handle)
- # Change the following number to change max participants
- self.max_participants = 1
-
- toolbar_box = ToolbarBox()
-
- activity_button = ActivityButton(self)
- toolbar_box.toolbar.insert(activity_button, 0)
- activity_button.show()
-
- title_entry = TitleEntry(self)
- toolbar_box.toolbar.insert(title_entry, -1)
- title_entry.show()
-
- description_item = DescriptionItem(self)
- toolbar_box.toolbar.insert(description_item, -1)
- description_item.show()
-
- share_button = ShareButton(self)
- toolbar_box.toolbar.insert(share_button, -1)
- share_button.show()
-
- separator = Gtk.SeparatorToolItem()
- separator.props.draw = False
- separator.set_expand(True)
- toolbar_box.toolbar.insert(separator, -1)
- separator.show()
-
- stop_button = StopButton(self)
- toolbar_box.toolbar.insert(stop_button, -1)
- stop_button.show()
-
- self.set_toolbar_box(toolbar_box)
- toolbar_box.show()
-
- # main view
- touch_area = TouchArea()
- self.set_canvas(touch_area)
- touch_area.show()
-
-
-class TouchArea(Gtk.DrawingArea):
-
- def __init__(self):
- Gtk.DrawingArea.__init__(self)
- self.fingers = {}
- self.set_events(Gdk.EventMask.TOUCH_MASK)
- self.connect('draw', self.__draw_cb)
- self.connect('event', self.__event_cb)
-
- def __event_cb(self, widget, event):
- if event.type in (
- Gdk.EventType.TOUCH_BEGIN,
- Gdk.EventType.TOUCH_UPDATE,
- Gdk.EventType.TOUCH_CANCEL,
- Gdk.EventType.TOUCH_END):
- # sequence is a void ptr object identifying the finger
- # we make it a string for use as dict key
- seq = str(event.touch.sequence)
- if event.type == Gdk.EventType.TOUCH_BEGIN:
- new_finger = Finger(event)
- self.fingers[seq] = new_finger
- self.remove_inactive_fingers(new_finger)
- else:
- self.fingers[seq].update(event)
- self.queue_draw()
-
- def __draw_cb(self, widget, ctx):
- alloc = self.get_allocation()
- ctx.set_source_rgb(1, 1, 1)
- ctx.paint()
- for f in self.fingers:
- self.fingers[f].draw(ctx, alloc.width, alloc.height)
-
- def remove_inactive_fingers(self, new_finger):
- for f,old_finger in list(self.fingers.items()):
- if not old_finger.active:
- del self.fingers[f]
- if new_finger.time - old_finger.time < 300:
- new_finger.remember(old_finger)
-
-
-class Finger:
-
- def __init__(self, event):
- self.trail = [ Point(event.touch.x, event.touch.y) ]
- self.color = (random(), random(), random())
- self.time = event.touch.time
- self.active = True
- self.other = None
-
- def update(self, event):
- self.time = event.touch.time
- if event.type == Gdk.EventType.TOUCH_UPDATE:
- self.trail.append( Point(event.touch.x, event.touch.y) )
- elif event.type == Gdk.EventType.TOUCH_END:
- self.active = False
- elif event.type == Gdk.EventType.TOUCH_CANCEL:
- self.active = False
- self.color = (1, 0, 0)
-
- def remember(self, finger):
- if self.other:
- finger.remember(self.other)
- self.other = finger
-
- def draw(self, ctx, width, height):
- if self.other:
- self.other.draw(ctx, width, height)
- (r, g, b) = self.color
- ctx.set_source_rgb(r, g, b)
- self.draw_trail(ctx)
- if self.active:
- self.draw_touch(ctx)
- ctx.set_source_rgb(0.5, 0.5, 0.5)
- self.draw_crosshair(ctx, width, height)
-
- def draw_crosshair(self, ctx, width, height):
- p = self.trail[-1]
- ctx.set_line_width(1)
- ctx.move_to(p.x, 0)
- ctx.line_to(p.x, height)
- ctx.move_to(0, p.y)
- ctx.line_to(width, p.y)
- ctx.stroke()
-
- def draw_touch(self, ctx):
- p = self.trail[-1]
- ctx.set_line_width(10)
- ctx.arc(p.x, p.y, 30, 0, 2 * M_PI)
- ctx.stroke()
-
- def draw_trail(self, ctx):
- ctx.set_line_width(5)
- p = self.trail[0]
- ctx.move_to(p.x, p.y)
- for p in self.trail:
- ctx.line_to(p.x, p.y)
- ctx.stroke()
-
-
-class Point:
-
- def __init__(self, x, y):
- self.x = x
- self.y = y
diff --git a/Touch/activity/activity-testmultitouch.svg b/Touch/activity/activity-testmultitouch.svg
deleted file mode 100644
index c74ac2b..0000000
--- a/Touch/activity/activity-testmultitouch.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-<?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 viewBox="0 0 55 55" xmlns="http://www.w3.org/2000/svg">
- <path d="M9.263,48.396c0.682,1.152,6.027,0.059,8.246-1.463 c2.102-1.432,3.207-2.596,4.336-2.596c1.133,0,12.54,0.92,20.935-5.715c7.225-5.707,9.773-13.788,4.52-21.437 c-5.252-7.644-13.832-9.08-20.878-8.56C16.806,9.342,4.224,16.91,4.677,28.313c0.264,6.711,3.357,9.143,4.922,10.703 c1.562,1.566,4.545,1.566,2.992,5.588C11.981,46.183,8.753,47.522,9.263,48.396z" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5"/>
- <circle cx="20" cy="25" r="5" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" />
- <circle cx="35" cy="30" r="5" fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" />
-</svg>
diff --git a/Touch/activity/activity.info b/Touch/activity/activity.info
deleted file mode 100644
index 025c591..0000000
--- a/Touch/activity/activity.info
+++ /dev/null
@@ -1,7 +0,0 @@
-[Activity]
-name = TestMultiTouch
-activity_version = 5
-bundle_id = org.sugarlabs.TestMultiTouch
-exec = sugar-activity activity.TestMultiTouchActivity
-icon = activity-testmultitouch
-license = MIT
diff --git a/Touch/setup.py b/Touch/setup.py
deleted file mode 100755
index 9a141b3..0000000
--- a/Touch/setup.py
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env python
-from sugar3.activity import bundlebuilder
-bundlebuilder.start()