Commit 7f609252 authored by Admin's avatar Admin

Moved logging functionality to Logger class.

parent 626039ad
#import time
class Logger(object):
def __init__(self, **kwargs):
self.identifier = kwargs.get('identifier',
self.__class__.__name__)
self.verbose = kwargs.get('verbose', 0)
def log(self, msg, verbosity=1):
# TODO: log time
if self.verbose >= verbosity:
print '| %s | %s' % (self.identifier, msg)
......@@ -2,8 +2,9 @@
import time
from threading import Thread
from math import atan2, pi
from OSC import OSCServer
from tuio_server import TuiListener
from logger import Logger
from events import TapEvent, FlickEvent, RotateEvent, PinchEvent, PanEvent
......@@ -69,8 +70,9 @@ TAP_TIMEOUT = .200
MAX_MULTI_DRAG_DISTANCE = 100
class MultiTouchListener(object):
def __init__(self, verbose=0, update_rate=60):
class MultiTouchListener(Logger):
def __init__(self, verbose=0, update_rate=60, **kwargs):
super(MultiTouchListener, self).__init__(**kwargs)
self.verbose = verbose
self.last_tap = 0
self.update_rate = update_rate
......@@ -251,10 +253,6 @@ class MultiTouchListener(object):
except KeyboardInterrupt:
self.log('Stopping event loop')
def log(self, msg, verbosity=1):
if self.verbose >= verbosity:
print '| LOG | %s' % msg
def bind(self, gesture, handler):
if gesture not in SUPPORTED_GESTURES:
raise ValueError('Unsupported gesture "%s".' % gesture)
......
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