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
55146f9f
Commit
55146f9f
authored
2 years ago
by
iggy
Browse files
Options
Downloads
Patches
Plain Diff
ui: debugging stuff out, fixes
parent
f6965a4e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
python_payload/application.py
+2
-1
2 additions, 1 deletion
python_payload/application.py
python_payload/menu.py
+1
-5
1 addition, 5 deletions
python_payload/menu.py
python_payload/ui.py
+10
-13
10 additions, 13 deletions
python_payload/ui.py
with
13 additions
and
19 deletions
python_payload/application.py
+
2
−
1
View file @
55146f9f
...
@@ -27,7 +27,8 @@ class Application():
...
@@ -27,7 +27,8 @@ class Application():
condition
=
lambda
e
:
e
[
"
type
"
]
==
"
button
"
and
e
.
get
(
"
from
"
)
==
2
and
e
[
"
change
"
]
condition
=
lambda
e
:
e
[
"
type
"
]
==
"
button
"
and
e
.
get
(
"
from
"
)
==
2
and
e
[
"
change
"
]
))
))
#self.ui.add(ui.Icon(label=self.title))
self
.
ui
.
add
(
ui
.
Icon
(
label
=
self
.
title
))
def
__repr__
(
self
):
def
__repr__
(
self
):
return
"
App
"
+
self
.
title
return
"
App
"
+
self
.
title
def
init
(
self
):
def
init
(
self
):
...
...
This diff is collapsed.
Click to expand it.
python_payload/menu.py
+
1
−
5
View file @
55146f9f
...
@@ -216,7 +216,6 @@ def render():
...
@@ -216,7 +216,6 @@ def render():
return
return
ui
.
the_ctx
.
rectangle
(
-
120
,
-
120
,
240
,
240
).
rgb
(
0
,
0
,
0
).
fill
()
ui
.
the_ctx
.
rectangle
(
-
120
,
-
120
,
240
,
240
).
rgb
(
0
,
0
,
0
).
fill
()
print
(
"
before draw
"
)
active_menu
.
draw
()
active_menu
.
draw
()
#hardware.display_update()
#hardware.display_update()
...
@@ -231,14 +230,11 @@ def menu_disable():
...
@@ -231,14 +230,11 @@ def menu_disable():
active_menu
=
None
active_menu
=
None
def
menu_back
():
def
menu_back
():
print
(
"
back
"
)
if
not
menu_stack
:
if
not
menu_stack
:
return
return
previous
=
menu_stack
.
pop
()
previous
=
menu_stack
.
pop
()
set_active_menu
(
previous
)
set_active_menu
(
previous
)
#ui.the_ctx = hardware.reset_ctx()
print
(
"
almost
"
)
render
()
render
()
print
(
"
rendered
"
)
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
python_payload/ui.py
+
10
−
13
View file @
55146f9f
...
@@ -79,7 +79,7 @@ class Icon(UIElement):
...
@@ -79,7 +79,7 @@ class Icon(UIElement):
super
().
__init__
()
super
().
__init__
()
def
_draw
(
self
,
pos
):
def
_draw
(
self
,
pos
):
print
(
"
ui.Icon._draw()
"
)
#
print("ui.Icon._draw()")
x
=
int
(
pos
[
0
])
x
=
int
(
pos
[
0
])
y
=
int
(
pos
[
1
])
y
=
int
(
pos
[
1
])
...
@@ -94,7 +94,7 @@ class Icon(UIElement):
...
@@ -94,7 +94,7 @@ class Icon(UIElement):
hs
,
hs
,
hs
//
2
hs
,
hs
,
hs
//
2
).
fill
()
).
fill
()
print
(
"
arc
"
)
#
print(" arc")
self
.
ctx
.
move_to
(
x
,
y
).
rgb
(
self
.
bg_r
,
self
.
bg_g
,
self
.
bg_b
).
arc
(
x
,
y
,
self
.
size
/
2
,
-
math
.
pi
,
math
.
pi
,
True
).
fill
()
self
.
ctx
.
move_to
(
x
,
y
).
rgb
(
self
.
bg_r
,
self
.
bg_g
,
self
.
bg_b
).
arc
(
x
,
y
,
self
.
size
/
2
,
-
math
.
pi
,
math
.
pi
,
True
).
fill
()
#self.ctx.move_to(x,y-self.size/2).rgb(self.bg_r,self.bg_g,self.bg_b).
#self.ctx.move_to(x,y-self.size/2).rgb(self.bg_r,self.bg_g,self.bg_b).
#.round_rectangle(
#.round_rectangle(
...
@@ -102,17 +102,14 @@ class Icon(UIElement):
...
@@ -102,17 +102,14 @@ class Icon(UIElement):
# y-self.size/2,
# y-self.size/2,
# self.size,self.size,self.size//2
# self.size,self.size,self.size//2
#).fill()
#).fill()
micropython
.
mem_info
()
gc
.
collect
()
print
(
self
.
label
)
self
.
ctx
.
rgb
(
1
,
1
,
1
).
move_to
(
x
,
y
)
#micropython.mem_info()
micropython
.
mem_info
(
"
data
"
)
#gc.collect()
print
(
"
moved
"
)
#print(self.label)
print
(
"
crash here:
"
)
self
.
ctx
.
text
(
self
.
label
)
self
.
ctx
.
rgb
(
1
,
1
,
1
).
move_to
(
x
,
y
).
text
(
self
.
label
)
#micropython.mem_info("data")
print
(
"
text
"
)
class
IconValue
(
Icon
):
class
IconValue
(
Icon
):
def
__init__
(
self
,
value
=
0
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
value
=
0
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
super
().
__init__
(
*
args
,
**
kwargs
)
...
@@ -145,12 +142,12 @@ class GroupRing(UIElement):
...
@@ -145,12 +142,12 @@ class GroupRing(UIElement):
pos
=
(
self
.
origin
[
0
]
+
offset
[
0
],
self
.
origin
[
1
]
+
offset
[
1
])
pos
=
(
self
.
origin
[
0
]
+
offset
[
0
],
self
.
origin
[
1
]
+
offset
[
1
])
self
.
_draw
(
pos
)
self
.
_draw
(
pos
)
for
index
in
range
(
len
(
self
.
children
)):
for
index
in
range
(
len
(
self
.
children
)):
print
(
"
child
"
,
index
)
#
print("child",index)
child
=
self
.
children
[
index
]
child
=
self
.
children
[
index
]
angle
=
2
*
math
.
pi
/
len
(
self
.
children
)
*
index
+
self
.
angle_offset
angle
=
2
*
math
.
pi
/
len
(
self
.
children
)
*
index
+
self
.
angle_offset
x
=
math
.
sin
(
angle
)
*
self
.
r
+
pos
[
0
]
x
=
math
.
sin
(
angle
)
*
self
.
r
+
pos
[
0
]
y
=
-
math
.
cos
(
angle
)
*
self
.
r
+
pos
[
1
]
y
=
-
math
.
cos
(
angle
)
*
self
.
r
+
pos
[
1
]
print
(
"
pos
"
,(
x
,
y
))
#
print("pos",(x,y))
child
.
draw
(
offset
=
(
x
,
y
))
child
.
draw
(
offset
=
(
x
,
y
))
def
_draw
(
self
,
pos
):
def
_draw
(
self
,
pos
):
...
...
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