~ubuntu-branches/ubuntu/trusty/geis/trusty

« back to all changes in this revision

Viewing changes to python/pygeis

  • Committer: Package Import Robot
  • Author(s): Stephen M. Webb
  • Date: 2012-11-09 13:57:29 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20121109135729-poludf0asjcht9sx
Tags: 2.2.13-0ubuntu1
* New upstream release.
* debian/control: bumped libgrail-dev build dependency to 3.0.8
* debian/patches: removed all patches (merged upstream)
* debian/patches: patched test case for missing symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
# You should have received a copy of the GNU General Public License
19
19
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
20
#
 
21
from __future__ import print_function, absolute_import, unicode_literals
21
22
 
22
23
import argparse
23
24
import geis
28
29
def _print_gesture(attrs):
29
30
    touchset = attrs[geis.GEIS_EVENT_ATTRIBUTE_TOUCHSET]
30
31
    groupset = attrs[geis.GEIS_EVENT_ATTRIBUTE_GROUPSET]
31
 
    print "  touches (" + str(len(touchset)) + "):"
 
32
    print("  touches (" + str(len(touchset)) + "):")
32
33
    for touch in touchset:
33
 
        print "    ", touch.id(), touch.attrs()
34
 
    print "  groups:"
 
34
        print("    ", touch.id(), touch.attrs())
 
35
    print("  groups:")
35
36
    for group in groupset:
36
 
        print "    ", group.id(), ":"
 
37
        print("    ", group.id(), ":")
37
38
        for frame in group:
38
 
            print "   frame ", frame.id(), ":"
 
39
            print("   frame ", frame.id(), ":")
39
40
            for (k, v) in frame.attrs().iteritems():
40
 
                print "      " + k + ":", v
41
 
            print "      touches: ", frame.touches()
 
41
                print("      " + k + ":", v)
 
42
            print("      touches: ", frame.touches())
42
43
 
43
44
def _do_init_complete(event, sub):
44
 
    print "init complete"
 
45
    print("init complete")
45
46
    sub.activate()
46
47
 
47
48
def _do_device_available(event, sub):
48
 
    print "device available"
 
49
    print("device available")
49
50
 
50
51
def _do_gesture_begin(event, sub):
51
 
    print "gesture begin"
 
52
    print("gesture begin")
52
53
    _print_gesture(event.attrs())
53
54
 
54
55
def _do_gesture_update(event, sub):
55
 
    print "gesture update"
 
56
    print("gesture update")
56
57
    _print_gesture(event.attrs())
57
58
 
58
59
def _do_gesture_end(event, sub):
59
 
    print "gesture end"
 
60
    print("gesture end")
60
61
    _print_gesture(event.attrs())
61
62
 
62
63
def _do_other_event(event, sub):
63
 
    print "unknown geis event received"
 
64
    print("unknown geis event received")
64
65
 
65
66
_geis_event_action = {
66
67
    geis.GEIS_EVENT_INIT_COMPLETE:    _do_init_complete,
90
91
    if event.type() == geis.GEIS_EVENT_CLASS_AVAILABLE:
91
92
        gclass = event.attrs()[geis.GEIS_EVENT_ATTRIBUTE_CLASS]
92
93
        name = gclass.name()
93
 
        print ".. adding class %s" % name
 
94
        print(".. adding class %s" % name)
94
95
        filt = geis.Filter(g, name)
95
96
        filt.add_term(geis.GEIS_FILTER_CLASS,
96
97
                     (geis.GEIS_CLASS_ATTRIBUTE_NAME, geis.GEIS_FILTER_OP_EQ, name),
115
116
    try:
116
117
      options.parse_args()
117
118
    except argparse.ArgumentError, ex:
118
 
      print ex
 
119
      print(ex)
119
120
      sys.exit(1)
120
121
 
121
122
    g = geis.Geis(geis.GEIS_INIT_TRACK_DEVICES,