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
27d097aa
Commit
27d097aa
authored
May 29, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tracker for 'basic' events.
parent
72d93bef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
2 deletions
+80
-2
src/tracker.py
src/tracker.py
+1
-2
src/trackers/basic.py
src/trackers/basic.py
+32
-0
tests/basic.py
tests/basic.py
+47
-0
No files found.
src/tracker.py
View file @
27d097aa
...
...
@@ -26,8 +26,7 @@ class GestureTracker(Logger):
passed to the handler along with a Gesture object can be specified.
"""
if
gesture_type
not
in
self
.
__gesture_types__
:
raise
AttributeError
(
'Unsupported gesture type "%s".'
\
%
gesture_type
)
raise
ValueError
(
'Unsupported gesture type "%s".'
%
gesture_type
)
h
=
handler
,
args
,
kwargs
...
...
src/trackers/basic.py
0 → 100644
View file @
27d097aa
from
..tracker
import
GestureTracker
,
Gesture
from
..geometry
import
Positionable
from
utils
import
PointGesture
class
BasicTracker
(
GestureTracker
):
"""
The main goal of this class is to provide a triggering mechanism for the
low-level point-down, point-move and point-up events.
"""
__gesture_types__
=
[
'down'
,
'move'
,
'up'
]
def
on_point_down
(
self
,
point
):
self
.
trigger
(
DownGesture
(
point
))
def
on_point_move
(
self
,
point
):
self
.
trigger
(
MoveGesture
(
point
))
def
on_point_up
(
self
,
point
):
self
.
trigger
(
UpGesture
(
point
))
class
DownGesture
(
PointGesture
):
__type__
=
'down'
class
MoveGesture
(
PointGesture
):
__type__
=
'move'
class
UpGesture
(
PointGesture
):
__type__
=
'up'
tests/basic.py
0 → 100644
View file @
27d097aa
import
argparse
import
logging
from
src.server
import
GestureServer
from
src.window
import
FullscreenWindow
from
src.trackers.basic
import
BasicTracker
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
)
# Add tracker and handlers
tracker
=
BasicTracker
(
win
)
tracker
.
bind
(
'down'
,
lambda
g
:
0
)
tracker
.
bind
(
'move'
,
lambda
g
:
0
)
tracker
.
bind
(
'up'
,
lambda
g
:
0
)
# Start listening to TUIO events
try
:
server
.
start
()
except
KeyboardInterrupt
:
server
.
stop
()
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