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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dos
flow3r firmware
Commits
53a28cda
Verified
Commit
53a28cda
authored
1 year ago
by
dos
Browse files
Options
Downloads
Patches
Plain Diff
py,st3m: overlays: Bring back damage tracking to BatteryIcon and ChargingIcon
parent
14574274
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
python_payload/st3m/ui/elements/overlays.py
+12
-4
12 additions, 4 deletions
python_payload/st3m/ui/elements/overlays.py
with
12 additions
and
4 deletions
python_payload/st3m/ui/elements/overlays.py
+
12
−
4
View file @
53a28cda
...
@@ -561,7 +561,6 @@ class BatteryIcon(Icon):
...
@@ -561,7 +561,6 @@ class BatteryIcon(Icon):
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
super
().
__init__
()
super
().
__init__
()
self
.
_percent
=
100.0
self
.
_percent
=
100.0
self
.
_changed
=
True
def
visible
(
self
)
->
bool
:
def
visible
(
self
)
->
bool
:
return
power
.
has_battery
return
power
.
has_battery
...
@@ -588,8 +587,13 @@ class BatteryIcon(Icon):
...
@@ -588,8 +587,13 @@ class BatteryIcon(Icon):
ctx
.
font_size
=
100
ctx
.
font_size
=
100
ctx
.
rgb
(
255
,
255
,
255
).
text
(
str
(
self
.
_percent
))
ctx
.
rgb
(
255
,
255
,
255
).
text
(
str
(
self
.
_percent
))
self
.
_changed
=
False
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
self
.
_percent
=
power
.
battery_percentage
percent
=
power
.
battery_percentage
if
self
.
_percent
!=
percent
:
self
.
_changed
=
True
self
.
_percent
=
percent
class
ChargingIcon
(
Icon
):
class
ChargingIcon
(
Icon
):
...
@@ -598,7 +602,6 @@ class ChargingIcon(Icon):
...
@@ -598,7 +602,6 @@ class ChargingIcon(Icon):
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
super
().
__init__
()
super
().
__init__
()
self
.
_charging
=
power
.
battery_charging
self
.
_charging
=
power
.
battery_charging
self
.
_changed
=
True
def
visible
(
self
)
->
bool
:
def
visible
(
self
)
->
bool
:
if
not
power
.
has_battery
:
if
not
power
.
has_battery
:
...
@@ -620,8 +623,13 @@ class ChargingIcon(Icon):
...
@@ -620,8 +623,13 @@ class ChargingIcon(Icon):
ctx
.
line_to
(
40
,
35
)
ctx
.
line_to
(
40
,
35
)
ctx
.
stroke
()
ctx
.
stroke
()
self
.
_changed
=
False
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
self
.
_charging
=
power
.
battery_charging
charging
=
power
.
battery_charging
if
self
.
_charging
!=
charging
:
self
.
_changed
=
True
self
.
_charging
=
charging
class
IconTray
(
Overlay
):
class
IconTray
(
Overlay
):
...
...
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