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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flow3r
flow3r firmware
Merge requests
!168
Construct gr33nhouse
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Construct gr33nhouse
anon/appstore
into
main
Overview
1
Commits
16
Pipelines
4
Changes
3
Merged
Anon
requested to merge
anon/appstore
into
main
1 year ago
Overview
1
Commits
16
Pipelines
4
Changes
3
Expand
0
0
Merge request reports
Viewing commit
c1eacb49
Prev
Next
Show latest version
3 files
+
97
−
7
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
c1eacb49
py/gr33nhouse: tweak app store
· c1eacb49
Anon
authored
1 year ago
python_payload/apps/gr33nhouse/__init__.py
+
44
−
1
Options
from
st3m.goose
import
Enum
from
st3m.application
import
Application
,
ApplicationContext
from
st3m.input
import
InputController
,
InputState
from
st3m.ui
import
colours
from
st3m.ui.view
import
ViewManager
from
ctx
import
Context
import
network
from
.applist
import
AppList
from
.background
import
Flow3rView
from
.record
import
RecordView
from
.manual
import
ManualInputView
class
ViewState
(
Enum
):
CONTENT
=
1
NO_INTERNET
=
2
class
Gr33nhouseApp
(
Application
):
items
=
[
"
Browse apps
"
,
"
Record App Seed
"
,
"
Enter App Seed
"
]
selection
=
0
input
:
InputController
background
:
Flow3rView
state
:
ViewState
def
__init__
(
self
,
app_ctx
:
ApplicationContext
)
->
None
:
super
().
__init__
(
app_ctx
=
app_ctx
)
@@ -22,6 +30,8 @@ class Gr33nhouseApp(Application):
self
.
input
=
InputController
()
self
.
background
=
Flow3rView
()
self
.
state
=
ViewState
.
CONTENT
def
on_enter
(
self
,
vm
:
ViewManager
|
None
)
->
None
:
super
().
on_enter
(
vm
)
@@ -29,6 +39,32 @@ class Gr33nhouseApp(Application):
raise
RuntimeError
(
"
vm is None
"
)
def
draw
(
self
,
ctx
:
Context
)
->
None
:
if
self
.
state
==
ViewState
.
NO_INTERNET
:
ctx
.
move_to
(
0
,
0
)
ctx
.
rgb
(
*
colours
.
BLACK
)
ctx
.
rectangle
(
-
120.0
,
-
120.0
,
240.0
,
240.0
,
).
fill
()
ctx
.
save
()
ctx
.
rgb
(
*
colours
.
WHITE
)
ctx
.
font
=
"
Camp Font 3
"
ctx
.
font_size
=
24
ctx
.
text_align
=
ctx
.
CENTER
ctx
.
text_baseline
=
ctx
.
MIDDLE
ctx
.
move_to
(
0
,
-
15
)
ctx
.
text
(
"
No internet
"
)
ctx
.
move_to
(
0
,
15
)
ctx
.
text
(
"
Check settings
"
)
ctx
.
restore
()
return
self
.
background
.
draw
(
ctx
)
ctx
.
save
()
@@ -62,11 +98,18 @@ class Gr33nhouseApp(Application):
ctx
.
restore
()
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
self
.
input
.
think
(
ins
,
delta_ms
)
if
self
.
vm
is
None
:
raise
RuntimeError
(
"
vm is None
"
)
if
not
network
.
WLAN
(
network
.
STA_IF
).
isconnected
():
self
.
state
=
ViewState
.
NO_INTERNET
return
else
:
self
.
state
=
ViewState
.
CONTENT
self
.
background
.
think
(
ins
,
delta_ms
)
self
.
input
.
think
(
ins
,
delta_ms
)
if
self
.
input
.
buttons
.
app
.
left
.
pressed
:
if
self
.
selection
>
0
:
Loading