Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
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
Container 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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flow3r
flow3r firmware
Commits
b33f18db
Commit
b33f18db
authored
1 year ago
by
moon2
Browse files
Options
Downloads
Patches
Plain Diff
Revert "audio_config: Push submenus onto the view stack"
This reverts commit
6df6c9a0
.
parent
565f7022
No related branches found
No related tags found
No related merge requests found
Pipeline
#9487
passed
1 year ago
Stage: check
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
python_payload/apps/audio_config/__init__.py
+54
-59
54 additions, 59 deletions
python_payload/apps/audio_config/__init__.py
with
54 additions
and
59 deletions
python_payload/apps/audio_config/__init__.py
+
54
−
59
View file @
b33f18db
from
st3m.application
import
Application
from
st3m.ui.view
import
View
,
ViewTransitionDirection
import
math
,
random
,
sys_display
from
st3m
import
settings
import
audio
...
...
@@ -272,8 +271,10 @@ class Drawable:
class
Submenu
(
Drawable
):
def
__init__
(
self
,
press
):
super
().
__init__
(
press
)
self
.
submenu_active
=
False
def
draw
(
self
,
ctx
):
if
self
.
submenu_active
:
self
.
_draw
(
ctx
)
def
_draw
(
self
,
ctx
):
...
...
@@ -564,18 +565,6 @@ class Press:
self
.
select_pressed
=
False
class
SubView
(
View
):
def
__init__
(
self
,
menu
,
app
):
self
.
menu
=
menu
self
.
app
=
app
def
think
(
self
,
ins
,
delta_ms
):
self
.
app
.
think
(
ins
,
delta_ms
)
def
draw
(
self
,
ctx
):
self
.
menu
.
draw
(
ctx
)
class
App
(
Application
):
def
__init__
(
self
,
app_ctx
):
super
().
__init__
(
app_ctx
)
...
...
@@ -607,6 +596,13 @@ class App(Application):
def
draw
(
self
,
ctx
):
self
.
ctx
=
ctx
main_menu_active
=
True
for
menu
in
self
.
menus
:
menu
.
draw
(
self
.
ctx
)
if
menu
.
submenu_active
:
main_menu_active
=
False
if
main_menu_active
:
self
.
draw_bg
()
ctx
.
save
()
ctx
.
rgb
(
*
colours
.
GO_GREEN
)
...
...
@@ -655,12 +651,12 @@ class App(Application):
super
().
think
(
ins
,
delta_ms
)
for
i
in
range
(
1
,
10
,
2
):
if
self
.
input
.
captouch
.
petals
[
i
].
whole
.
pressed
:
if
not
self
.
is_active
()
:
self
.
vm
.
pop
()
for
menu
in
self
.
menus
:
menu
.
submenu_active
=
False
if
i
<
5
:
self
.
vm
.
push
(
SubView
(
self
.
menus
[
i
//
2
],
self
))
self
.
menus
[
i
//
2
].
submenu_active
=
True
elif
i
>
5
:
self
.
vm
.
push
(
SubView
(
self
.
menus
[(
i
//
2
)
-
1
],
self
))
self
.
menus
[(
i
//
2
)
-
1
].
submenu_active
=
True
if
(
self
.
input
.
buttons
.
app
.
right
.
pressed
...
...
@@ -674,12 +670,11 @@ class App(Application):
def
on_enter
(
self
,
vm
):
super
().
on_enter
(
vm
)
if
self
.
vm
.
direction
==
ViewTransitionDirection
.
FORWARD
:
settings
.
load_all
()
def
on_exit
(
self
):
if
self
.
vm
.
direction
==
ViewTransitionDirection
.
BACKWARD
:
settings
.
save_all
()
super
().
on_exit
()
if
__name__
==
"
__main__
"
:
...
...
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