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
b0639f93
Commit
b0639f93
authored
Jun 28, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made test app more fancy.
parent
8280ae9b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
13 deletions
+21
-13
TODO.txt
TODO.txt
+0
-1
tests/testapp.py
tests/testapp.py
+21
-12
No files found.
TODO.txt
View file @
b0639f93
...
@@ -4,4 +4,3 @@ Code:
...
@@ -4,4 +4,3 @@ Code:
Report/appendix reference gesture detection:
Report/appendix reference gesture detection:
- Point_leave(+point_enter) kan niet -> flaw v/h systeem/driver?
- Point_leave(+point_enter) kan niet -> flaw v/h systeem/driver?
- "gesture detection component" -> "gesture tracker"
tests/testapp.py
View file @
b0639f93
...
@@ -46,10 +46,11 @@ class Polygon(BoundingBoxArea):
...
@@ -46,10 +46,11 @@ class Polygon(BoundingBoxArea):
self
.
on_pinch
(
self
.
handle_pinch
)
self
.
on_pinch
(
self
.
handle_pinch
)
self
.
on_rotate
(
self
.
handle_rotate
)
self
.
on_rotate
(
self
.
handle_rotate
)
self
.
on_flick
(
self
.
handle_flick
)
self
.
on_flick
(
self
.
handle_flick
)
self
.
on_
double_
tap
(
self
.
circulate_color
)
self
.
on_tap
(
self
.
circulate_color
)
def
circulate_color
(
self
,
g
):
def
circulate_color
(
self
,
g
):
self
.
color
=
self
.
color
[
2
:]
+
self
.
color
[:
2
]
self
.
color
=
self
.
color
[
2
:]
+
self
.
color
[:
2
]
refresh
()
def
flick_drag
(
self
,
amt
):
def
flick_drag
(
self
,
amt
):
tx
,
ty
=
self
.
flick_direction
tx
,
ty
=
self
.
flick_direction
...
@@ -119,6 +120,13 @@ draw_touch_objects = True
...
@@ -119,6 +120,13 @@ draw_touch_objects = True
W
,
H
=
mt
.
screen
.
screen_size
W
,
H
=
mt
.
screen
.
screen_size
def
toggle_fullscreen
():
global
fullscreen
(
window
.
unfullscreen
if
fullscreen
else
window
.
fullscreen
)()
fullscreen
=
not
fullscreen
refresh
()
def
create_context_window
(
w
,
h
,
callback
):
def
create_context_window
(
w
,
h
,
callback
):
def
create_context
(
area
,
event
):
def
create_context
(
area
,
event
):
"""Add Cairo context to GTK window and draw state."""
"""Add Cairo context to GTK window and draw state."""
...
@@ -135,9 +143,7 @@ def create_context_window(w, h, callback):
...
@@ -135,9 +143,7 @@ def create_context_window(w, h, callback):
key
=
chr
(
event
.
keyval
)
key
=
chr
(
event
.
keyval
)
if
key
==
'f'
:
if
key
==
'f'
:
global
fullscreen
toggle_fullscreen
()
(
win
.
unfullscreen
if
fullscreen
else
win
.
fullscreen
)()
fullscreen
=
not
fullscreen
elif
key
==
'b'
:
elif
key
==
'b'
:
global
draw_bounding_boxes
global
draw_bounding_boxes
draw_bounding_boxes
=
not
draw_bounding_boxes
draw_bounding_boxes
=
not
draw_bounding_boxes
...
@@ -149,7 +155,7 @@ def create_context_window(w, h, callback):
...
@@ -149,7 +155,7 @@ def create_context_window(w, h, callback):
elif
key
==
'q'
:
elif
key
==
'q'
:
quit
()
quit
()
def
update
_window
():
def
redraw_updated
_window
():
refresh
()
refresh
()
return
True
return
True
...
@@ -160,7 +166,7 @@ def create_context_window(w, h, callback):
...
@@ -160,7 +166,7 @@ def create_context_window(w, h, callback):
window
.
connect
(
'destroy'
,
quit
)
window
.
connect
(
'destroy'
,
quit
)
window
.
connect
(
'key-press-event'
,
handle_key
)
window
.
connect
(
'key-press-event'
,
handle_key
)
window
.
connect
(
'show'
,
callback
)
window
.
connect
(
'show'
,
callback
)
window
.
on_update
(
update
_window
)
window
.
on_update
(
redraw_updated
_window
)
root
=
window
.
get_area
()
root
=
window
.
get_area
()
if
fullscreen
:
if
fullscreen
:
...
@@ -196,7 +202,13 @@ def draw():
...
@@ -196,7 +202,13 @@ def draw():
cr
.
set_source_rgb
(
*
WHITE
)
cr
.
set_source_rgb
(
*
WHITE
)
for
hand
in
touch_hands
:
for
hand
in
touch_hands
:
cx
,
cy
=
hand
.
get_centroid
()
centroid
=
hand
.
get_centroid
()
# Check if all fingers have not been removed already
if
not
centroid
:
continue
cx
,
cy
=
centroid
# Filled centroid circle
# Filled centroid circle
if
len
(
hand
)
>
1
:
if
len
(
hand
)
>
1
:
...
@@ -247,8 +259,8 @@ def triangle_height(width):
...
@@ -247,8 +259,8 @@ def triangle_height(width):
def
on_show
(
window
):
def
on_show
(
window
):
def
root_dtap
(
g
):
print
'double tapped on root'
# Toggle fullscreen on double tap
root
.
on_double_tap
(
root_dtap
)
root
.
on_double_tap
(
lambda
g
:
toggle_fullscreen
()
)
# Create blue rectangle
# Create blue rectangle
x
,
y
,
w
,
h
=
0
,
0
,
250
,
150
x
,
y
,
w
,
h
=
0
,
0
,
250
,
150
...
@@ -256,9 +268,6 @@ def on_show(window):
...
@@ -256,9 +268,6 @@ def on_show(window):
draw_objects
.
append
(
rect
)
draw_objects
.
append
(
rect
)
root
.
add_area
(
rect
)
root
.
add_area
(
rect
)
def
rect_tap
(
g
):
print
'tapped on rectangle'
rect
.
on_tap
(
rect_tap
,
propagate_up_event
=
False
)
# Create green triangle
# Create green triangle
x
,
y
,
w
=
400
,
400
,
200
x
,
y
,
w
=
400
,
400
,
200
h
=
triangle_height
(
w
)
h
=
triangle_height
(
w
)
...
...
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