Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ActivityTracker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
willm3
ActivityTracker
Merge requests
!18
Ability to view all activities
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Ability to view all activities
wmalisch/view-all-activities
into
main
Overview
2
Commits
1
Pipelines
0
Changes
4
Merged
willm3
requested to merge
wmalisch/view-all-activities
into
main
1 year ago
Overview
2
Commits
1
Pipelines
0
Changes
4
Expand
Created by: will-malisch
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
e01f70c7
1 commit,
1 year ago
4 files
+
59
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
src/controller.py
+
52
−
2
Options
import
time
import
numpy
as
np
from
sense_hat
import
SenseHat
@@ -35,11 +36,60 @@ class Controller:
self
.
view_activities
(
activity_log
)
# Use a short sleep statement to help save battery. Calls to the SenseHat are battery intensive, this slightly reduces the number of calls
time
.
sleep
(
0.
1
)
time
.
sleep
(
0.
2
)
except
KeyboardInterrupt
:
print
(
"
Exiting...
"
)
self
.
sense
.
clear
()
def
view_activities
(
self
,
activity_log
):
print
(
activity_log
)
\ No newline at end of file
view
=
True
print
=
True
alog
=
np
.
array
(
activity_log
)
row
=
0
column
=
0
while
view
:
if
print
:
self
.
print_current_stat
(
row
,
column
,
alog
)
print
=
False
for
event
in
self
.
sense
.
stick
.
get_events
():
if
event
.
action
==
"
pressed
"
:
print
=
True
if
event
.
direction
==
"
up
"
and
row
>
0
:
row
-=
1
elif
event
.
direction
==
"
down
"
and
row
<
alog
.
shape
[
0
]
-
1
:
row
+=
1
elif
event
.
direction
==
"
left
"
and
column
>
0
:
column
-=
1
elif
event
.
direction
==
"
right
"
and
column
<
alog
.
shape
[
1
]
-
1
:
column
+=
1
# Press joy stick in the middle to exit view mode
elif
event
.
direction
==
"
middle
"
:
view
=
False
# Use a short sleep statement to help save battery. Calls to the SenseHat are battery intensive, this slightly reduces the number of calls
time
.
sleep
(
0.2
)
def
print_current_stat
(
self
,
row
,
column
,
activity_log
):
if
column
==
0
:
message
=
f
"
Id:
{
activity_log
[
row
,
column
]
}
"
self
.
logger
.
print_individual_stat_in_activity_log
(
message
)
elif
column
==
1
:
message
=
f
"
S Date:
{
activity_log
[
row
,
column
]
}
"
self
.
logger
.
print_individual_stat_in_activity_log
(
message
)
elif
column
==
2
:
message
=
f
"
S Time:
{
activity_log
[
row
,
column
]
}
"
self
.
logger
.
print_individual_stat_in_activity_log
(
message
)
elif
column
==
3
:
message
=
f
"
Steps:
{
activity_log
[
row
,
column
]
}
"
self
.
logger
.
print_individual_stat_in_activity_log
(
message
)
elif
column
==
4
:
message
=
f
"
Duration:
{
activity_log
[
row
,
column
]
}
"
self
.
logger
.
print_individual_stat_in_activity_log
(
message
)
else
:
print
(
"
Error
"
)
\ No newline at end of file
Loading