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
Hide 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:
Report/appendix reference gesture detection:
- 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):
self
.
on_pinch
(
self
.
handle_pinch
)
self
.
on_rotate
(
self
.
handle_rotate
)
self
.
on_flick
(
self
.
handle_flick
)
self
.
on_
double_
tap
(
self
.
circulate_color
)
self
.
on_tap
(
self
.
circulate_color
)
def
circulate_color
(
self
,
g
):
self
.
color
=
self
.
color
[
2
:]
+
self
.
color
[:
2
]
refresh
()
def
flick_drag
(
self
,
amt
):
tx
,
ty
=
self
.
flick_direction
...
...
@@ -119,6 +120,13 @@ draw_touch_objects = True
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
(
area
,
event
):
"""Add Cairo context to GTK window and draw state."""
...
...
@@ -135,9 +143,7 @@ def create_context_window(w, h, callback):
key
=
chr
(
event
.
keyval
)
if
key
==
'f'
:
global
fullscreen
(
win
.
unfullscreen
if
fullscreen
else
win
.
fullscreen
)()
fullscreen
=
not
fullscreen
toggle_fullscreen
()
elif
key
==
'b'
:
global
draw_bounding_boxes
draw_bounding_boxes
=
not
draw_bounding_boxes
...
...
@@ -149,7 +155,7 @@ def create_context_window(w, h, callback):
elif
key
==
'q'
:
quit
()
def
update
_window
():
def
redraw_updated
_window
():
refresh
()
return
True
...
...
@@ -160,7 +166,7 @@ def create_context_window(w, h, callback):
window
.
connect
(
'destroy'
,
quit
)
window
.
connect
(
'key-press-event'
,
handle_key
)
window
.
connect
(
'show'
,
callback
)
window
.
on_update
(
update
_window
)
window
.
on_update
(
redraw_updated
_window
)
root
=
window
.
get_area
()
if
fullscreen
:
...
...
@@ -196,7 +202,13 @@ def draw():
cr
.
set_source_rgb
(
*
WHITE
)
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
if
len
(
hand
)
>
1
:
...
...
@@ -247,8 +259,8 @@ def triangle_height(width):
def
on_show
(
window
):
def
root_dtap
(
g
):
print
'double tapped on root'
root
.
on_double_tap
(
root_dtap
)
# Toggle fullscreen on double tap
root
.
on_double_tap
(
lambda
g
:
toggle_fullscreen
()
)
# Create blue rectangle
x
,
y
,
w
,
h
=
0
,
0
,
250
,
150
...
...
@@ -256,9 +268,6 @@ def on_show(window):
draw_objects
.
append
(
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
x
,
y
,
w
=
400
,
400
,
200
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