/usr/share/pyshared/pymt/modules/touchring.py is in python-pymt 0.5.1-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | '''
Show a circle under all touchs
'''
import os
from pymt import MTWidget, set_color, getCurrentTouches, pymt_data_dir, Image
if not 'PYMT_DOC' in os.environ:
ring_fn = os.path.join(pymt_data_dir, 'ring.png')
ring_img = Image(ring_fn)
ring_img.scale = .30
ring_img.anchor_x = ring_img.width / 2
ring_img.anchor_y = ring_img.height / 2
class TouchRing(MTWidget):
def __init__(self, **kwargs):
super(TouchRing, self).__init__(**kwargs)
def on_update(self):
self.bring_to_front()
def draw(self):
color = self.style.get('color')
ring_img.color = color
for touch in getCurrentTouches():
alpha = color[3]
if 'kinetic' in touch.profile:
alpha = .2
# draw touch
ring_img.opacity = alpha
ring_img.pos = touch.pos
ring_img.draw()
def start(win, ctx):
ctx.w = TouchRing()
win.add_widget(ctx.w)
def stop(win, ctx):
win.remove_widget(ctx.w)
|