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
b3dd89c3
Commit
b3dd89c3
authored
Jul 03, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added 'threaded' keyword argument to event driver.
parent
a7d80112
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
src/driver.py
src/driver.py
+11
-2
tests/draw.py
tests/draw.py
+1
-4
tests/testapp.py
tests/testapp.py
+1
-4
No files found.
src/driver.py
View file @
b3dd89c3
from
threading
import
Thread
from
logger
import
Logger
from
logger
import
Logger
...
@@ -24,14 +26,21 @@ class EventDriver(Logger):
...
@@ -24,14 +26,21 @@ class EventDriver(Logger):
if
self
.
root_area
.
contains_event
(
event
):
if
self
.
root_area
.
contains_event
(
event
):
self
.
root_area
.
delegate_event
(
event
)
self
.
root_area
.
delegate_event
(
event
)
def
start
(
self
):
def
start
(
self
,
threaded
=
False
):
"""
"""
Start the event loop. A root area is needed to be able to delegate
Start the event loop. A root area is needed to be able to delegate
events, so check if it exists first.
events, so check if it exists first. The argument determines if the
driver should start in a new (daemon) thread.
"""
"""
if
not
self
.
root_area
:
if
not
self
.
root_area
:
raise
ValueError
(
'Cannot start event server without root area.'
)
raise
ValueError
(
'Cannot start event server without root area.'
)
if
threaded
:
thread
=
Thread
(
target
=
self
.
start
)
thread
.
daemon
=
True
thread
.
start
()
return
thread
self
.
start_loop
()
self
.
start_loop
()
def
start_loop
(
self
):
def
start_loop
(
self
):
...
...
tests/draw.py
View file @
b3dd89c3
#!/usr/bin/env python
#!/usr/bin/env python
from
__future__
import
division
from
__future__
import
division
import
pygame
import
pygame
from
threading
import
Thread
from
math
import
degrees
from
math
import
degrees
from
src
import
FullscreenArea
,
create_driver
from
src
import
FullscreenArea
,
create_driver
...
@@ -160,9 +159,7 @@ area.on_point_up(lambda g: points.remove(g.get_event().point))
...
@@ -160,9 +159,7 @@ area.on_point_up(lambda g: points.remove(g.get_event().point))
try
:
try
:
# Start touch gesture server in separate thread
# Start touch gesture server in separate thread
thread
=
Thread
(
target
=
driver
.
start
)
driver
.
start
(
threaded
=
True
)
thread
.
daemon
=
True
thread
.
start
()
# Start GUI event loop
# Start GUI event loop
def
is_quit_event
(
e
):
def
is_quit_event
(
e
):
...
...
tests/testapp.py
View file @
b3dd89c3
...
@@ -342,10 +342,7 @@ if __name__ == '__main__':
...
@@ -342,10 +342,7 @@ if __name__ == '__main__':
create_context_window
(
800
,
600
,
on_show
)
create_context_window
(
800
,
600
,
on_show
)
# Run multi-touch gesture server in separate thread
# Run multi-touch gesture server in separate thread
driver
=
mt
.
create_driver
(
screen
)
mt
.
create_driver
(
screen
).
start
(
threaded
=
True
)
mt_thread
=
Thread
(
target
=
driver
.
start
)
mt_thread
.
daemon
=
True
mt_thread
.
start
()
# Flick movement is also handled in a separate thread
# Flick movement is also handled in a separate thread
flicks
=
FlickThread
()
flicks
=
FlickThread
()
...
...
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