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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dos
flow3r firmware
Commits
93e13a9f
Commit
93e13a9f
authored
1 year ago
by
dos
Committed by
ave
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
py,st3m: MenuItemAppLaunch: Scroll too long labels into view
I believe this concludes the scrolling label saga.
parent
50a8a541
No related branches found
No related tags found
No related merge requests found
Pipeline
#8212
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/st3m/application.py
+18
-0
18 additions, 0 deletions
python_payload/st3m/application.py
with
18 additions
and
0 deletions
python_payload/st3m/application.py
+
18
−
0
View file @
93e13a9f
...
...
@@ -18,6 +18,7 @@ import stat
import
sys
import
sys_display
import
random
from
math
import
sin
log
=
Log
(
__name__
)
...
...
@@ -320,6 +321,8 @@ class MenuItemAppLaunch(MenuItem):
def
__init__
(
self
,
bundle
:
BundleMetadata
):
self
.
_bundle
=
bundle
self
.
_instance
:
Optional
[
Application
]
=
None
self
.
_scroll_pos
=
0.0
self
.
_highlighted
=
False
def
press
(
self
,
vm
:
Optional
[
ViewManager
])
->
None
:
if
vm
is
None
:
...
...
@@ -340,6 +343,21 @@ class MenuItemAppLaunch(MenuItem):
def
label
(
self
)
->
str
:
return
self
.
_bundle
.
name
def
highlight
(
self
,
active
:
bool
)
->
None
:
self
.
_highlighted
=
active
self
.
_scroll_pos
=
0.0
def
draw
(
self
,
ctx
:
Context
)
->
None
:
ctx
.
save
()
if
self
.
_highlighted
and
(
width
:
=
ctx
.
text_width
(
self
.
label
()))
>
220
:
ctx
.
translate
(
sin
(
self
.
_scroll_pos
)
*
(
width
-
220
)
/
2
,
0
)
super
().
draw
(
ctx
)
ctx
.
restore
()
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
if
self
.
_highlighted
:
self
.
_scroll_pos
+=
delta_ms
/
1000
class
BundleManager
:
"""
...
...
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