Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multitouch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
multitouch
Commits
27d097aa
Commit
27d097aa
authored
12 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Added tracker for 'basic' events.
parent
72d93bef
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/tracker.py
+1
-2
1 addition, 2 deletions
src/tracker.py
src/trackers/basic.py
+32
-0
32 additions, 0 deletions
src/trackers/basic.py
tests/basic.py
+47
-0
47 additions, 0 deletions
tests/basic.py
with
80 additions
and
2 deletions
src/tracker.py
+
1
−
2
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
...
...
This diff is collapsed.
Click to expand it.
src/trackers/basic.py
0 → 100644
+
32
−
0
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
'
This diff is collapsed.
Click to expand it.
tests/basic.py
0 → 100644
+
47
−
0
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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment