Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
multitouch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
multitouch
Commits
7f609252
Commit
7f609252
authored
Apr 24, 2012
by
Admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved logging functionality to Logger class.
parent
626039ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
src/logger.py
src/logger.py
+13
-0
src/touch.py
src/touch.py
+5
-7
No files found.
src/logger.py
0 → 100644
View file @
7f609252
#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
)
src/touch.py
View file @
7f609252
...
@@ -2,8 +2,9 @@
...
@@ -2,8 +2,9 @@
import
time
import
time
from
threading
import
Thread
from
threading
import
Thread
from
math
import
atan2
,
pi
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
from
events
import
TapEvent
,
FlickEvent
,
RotateEvent
,
PinchEvent
,
PanEvent
...
@@ -69,8 +70,9 @@ TAP_TIMEOUT = .200
...
@@ -69,8 +70,9 @@ TAP_TIMEOUT = .200
MAX_MULTI_DRAG_DISTANCE
=
100
MAX_MULTI_DRAG_DISTANCE
=
100
class
MultiTouchListener
(
object
):
class
MultiTouchListener
(
Logger
):
def
__init__
(
self
,
verbose
=
0
,
update_rate
=
60
):
def
__init__
(
self
,
verbose
=
0
,
update_rate
=
60
,
**
kwargs
):
super
(
MultiTouchListener
,
self
).
__init__
(
**
kwargs
)
self
.
verbose
=
verbose
self
.
verbose
=
verbose
self
.
last_tap
=
0
self
.
last_tap
=
0
self
.
update_rate
=
update_rate
self
.
update_rate
=
update_rate
...
@@ -251,10 +253,6 @@ class MultiTouchListener(object):
...
@@ -251,10 +253,6 @@ class MultiTouchListener(object):
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
self
.
log
(
'Stopping event loop'
)
self
.
log
(
'Stopping event loop'
)
def
log
(
self
,
msg
,
verbosity
=
1
):
if
self
.
verbose
>=
verbosity
:
print
'| LOG | %s'
%
msg
def
bind
(
self
,
gesture
,
handler
):
def
bind
(
self
,
gesture
,
handler
):
if
gesture
not
in
SUPPORTED_GESTURES
:
if
gesture
not
in
SUPPORTED_GESTURES
:
raise
ValueError
(
'Unsupported gesture "%s".'
%
gesture
)
raise
ValueError
(
'Unsupported gesture "%s".'
%
gesture
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment