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
2e6468ef
Commit
2e6468ef
authored
Jun 01, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Centralized argument parsing in test files.
parent
3b6bb1c6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
22 deletions
+34
-22
tests/basic.py
tests/basic.py
+2
-1
tests/draw.py
tests/draw.py
+7
-5
tests/parse_arguments.py
tests/parse_arguments.py
+21
-14
tests/tap.py
tests/tap.py
+2
-1
tests/transform.py
tests/transform.py
+2
-1
No files found.
tests/basic.py
View file @
2e6468ef
...
...
@@ -2,7 +2,8 @@ from src.server import GestureServer
from
src.window
import
FullscreenWindow
from
src.trackers.basic
import
BasicTracker
import
tests.parse_arguments
from
tests.parse_arguments
import
create_parser
,
parse_args
parse_args
(
create_parser
())
# Create server
server
=
GestureServer
()
...
...
tests/draw.py
View file @
2e6468ef
...
...
@@ -12,17 +12,19 @@ from src.trackers.transform import TransformationTracker
from
src.trackers.tap
import
TapTracker
from
src.screen
import
screen_size
import
tests.parse_arguments
from
tests.parse_arguments
import
create_parser
,
parse_args
parser
=
create_parser
()
parser
.
add_argument
(
'-f'
,
'--fullscreen'
,
action
=
'store_true'
,
default
=
False
,
help
=
'run in fullscreen'
)
args
=
parse_args
(
parser
)
pygame
.
init
()
FULLSCREEN
=
'-f'
in
sys
.
argv
[
1
:]
# Config
FINGER_RADIUS
=
20
CENTROID_RADIUS
=
15
W
,
H
=
screen_size
if
FULLSCREEN
else
(
640
,
480
)
W
,
H
=
screen_size
if
args
.
fullscreen
else
(
640
,
480
)
BG_COLOR
=
0
,
0
,
0
LINE_COLOR
=
128
,
128
,
128
...
...
@@ -42,7 +44,7 @@ BEAM_INCREMENT = .8
MAX_SCALE
=
10
# Create canvas GUI
flags
=
pygame
.
FULLSCREEN
if
FULLSCREEN
else
0
flags
=
pygame
.
FULLSCREEN
if
args
.
fullscreen
else
0
screen
=
pygame
.
display
.
set_mode
((
W
,
H
),
flags
)
...
...
tests/parse_arguments.py
View file @
2e6468ef
...
...
@@ -3,22 +3,29 @@ import logging
from
src.logger
import
Logger
# Parse arguments
parser
=
argparse
.
ArgumentParser
(
description
=
'Basic test program for usage '
def
create_parser
():
parser
=
argparse
.
ArgumentParser
(
description
=
'Basic test program for usage '
'of multi-touch API.'
)
parser
.
add_argument
(
'--log'
,
metavar
=
'LOG_LEVEL'
,
default
=
'INFO'
,
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'
,
parser
.
add_argument
(
'--logfile'
,
metavar
=
'FILENAME'
,
help
=
'filename for the log file (the log is printed to '
'stdout by default)'
)
args
=
parser
.
parse_args
()
return
parser
def
parse_args
(
parser
):
args
=
parser
.
parse_args
()
# Configure logger
log_config
=
{
'level'
:
getattr
(
logging
,
args
.
log
)}
# Configure logger
log_config
=
{
'level'
:
getattr
(
logging
,
args
.
log
)}
if
args
.
logfile
:
if
args
.
logfile
:
log_config
[
'filename'
]
=
args
.
logfile
Logger
.
configure
(
**
log_config
)
Logger
.
configure
(
**
log_config
)
return
args
tests/tap.py
View file @
2e6468ef
...
...
@@ -2,7 +2,8 @@ from src.server import GestureServer
from
src.window
import
FullscreenWindow
from
src.trackers.tap
import
TapTracker
import
tests.parse_arguments
from
tests.parse_arguments
import
create_parser
,
parse_args
parse_args
(
create_parser
())
# Create server
server
=
GestureServer
()
...
...
tests/transform.py
View file @
2e6468ef
...
...
@@ -2,7 +2,8 @@ from src.server import GestureServer
from
src.window
import
FullscreenWindow
from
src.trackers.transform
import
TransformationTracker
import
tests.parse_arguments
from
tests.parse_arguments
import
create_parser
,
parse_args
parse_args
(
create_parser
())
# Create server
server
=
GestureServer
()
...
...
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