Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
5f4b1a8e
Commit
5f4b1a8e
authored
4 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
feat(menu): Add a sub menu to set the default app via a long press
parent
1887124d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!375
Default main app selector
Pipeline
#4530
failed
4 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
preload/menu.py
+26
-0
26 additions, 0 deletions
preload/menu.py
with
26 additions
and
0 deletions
preload/menu.py
+
26
−
0
View file @
5f4b1a8e
...
...
@@ -90,6 +90,24 @@ def usb_mode(disp):
os
.
exit
(
0
)
class
SubMenu
(
simple_menu
.
Menu
):
timeout
=
30.0
def
on_select
(
self
,
name
,
index
):
print
(
name
)
if
name
==
"
Make Default
"
:
self
.
disp
.
clear
(
color
.
CHAOSBLUE
)
self
.
disp
.
print
(
"
Making
"
,
posx
=
0
,
posy
=
20
)
self
.
disp
.
print
(
self
.
app
.
name
,
posx
=
0
,
posy
=
40
)
self
.
disp
.
print
(
"
default
"
,
posx
=
0
,
posy
=
60
)
self
.
disp
.
update
()
import
config
config
.
set_string
(
"
default_app
"
,
self
.
app
.
path
)
utime
.
sleep
(
1
)
self
.
exit
()
class
MainMenu
(
simple_menu
.
Menu
):
timeout
=
30.0
...
...
@@ -112,6 +130,14 @@ class MainMenu(simple_menu.Menu):
utime
.
sleep
(
1.0
)
os
.
exit
(
1
)
def
on_long_select
(
self
,
app
,
index
):
print
(
"
Long press
\n
"
)
if
app
.
path
not
in
[
"
main.py
"
,
"
USB_STORAGE_FLAG
"
]:
# sm = SubMenu(("Make Default", "Fav", "Unfav", "Delete", "Exit"))
sm
=
SubMenu
((
"
Make Default
"
,
"
Exit
"
,
""
,
""
))
sm
.
app
=
app
sm
.
run
()
def
on_timeout
(
self
):
try
:
f
=
open
(
"
main.py
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment