Commit 72d93bef authored by Taddeus Kroes's avatar Taddeus Kroes

Added some test scripts.

parent 50f9fec0
from events import *
from touch import MultiTouchServer
import os
src_path = os.path.realpath('src')
import sys
sys.path.insert(0, src_path)
del sys.argv[0]
execfile(sys.argv[0])
import argparse
import logging
from src.server import GestureServer
from src.window import FullscreenWindow
from src.trackers.tap import TapTracker
from src.logger import Logger
# Parse arguments
parser = argparse.ArgumentParser(description='Basic test program for usage '
'of multi-touch API.')
parser.add_argument('--log', metavar='LOG_LEVEL', default='INFO',
choices=['DEBUG', 'INFO', 'WARNING'],
help='set log level (defaults to INFO)')
parser.add_argument('--logfile', metavar='FILENAME',
help='filename for the log file (the log is printed to '
'stdout by default)')
args = parser.parse_args()
# Configure logger
log_config = {'level': getattr(logging, args.log)}
if args.logfile:
log_config['filename'] = args.logfile
Logger.configure(**log_config)
# Create server
server = GestureServer()
# Create a window to add trackers to
win = FullscreenWindow(server=server)
# Above is short for:
#win = FullscreenWindow()
#server.add_window(win)
# Add tracker and handlers
tracker = TapTracker(win)
def handler(gesture): pass
#print 'handler:', gesture
tracker.bind('tap', handler)
tracker.bind('single_tap', handler)
tracker.bind('double_tap', handler)
# Start listening to TUIO events
try:
server.start()
except KeyboardInterrupt:
server.stop()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment