diff --git a/python_payload/application.py b/python_payload/application.py index 37402d328f2b400e5af833f7311270aa67ab404e..f7bd5e7425c38b68a47d11df41786dc46f154647 100644 --- a/python_payload/application.py +++ b/python_payload/application.py @@ -27,7 +27,8 @@ class Application(): 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): return "App "+self.title def init(self): diff --git a/python_payload/menu.py b/python_payload/menu.py index d0354caa65afad6517554abf489b5de07749adfe..885bb9f5de86dc9489bc9fac13716da16f336780 100644 --- a/python_payload/menu.py +++ b/python_payload/menu.py @@ -216,7 +216,6 @@ def render(): return ui.the_ctx.rectangle(-120,-120,240,240).rgb(0,0,0).fill() - print("before draw") active_menu.draw() #hardware.display_update() @@ -231,14 +230,11 @@ def menu_disable(): active_menu=None def menu_back(): - print ("back") if not menu_stack: return previous = menu_stack.pop() set_active_menu(previous) - #ui.the_ctx = hardware.reset_ctx() - print("almost") render() - print("rendered") \ No newline at end of file + \ No newline at end of file diff --git a/python_payload/ui.py b/python_payload/ui.py index 17ee6063512ce3adae4455be1dfed536871f71ce..33f0dcfc91f6a5565989129150de3b3166f4c7ce 100644 --- a/python_payload/ui.py +++ b/python_payload/ui.py @@ -79,7 +79,7 @@ class Icon(UIElement): super().__init__() def _draw(self,pos): - print("ui.Icon._draw()") + #print("ui.Icon._draw()") x = int(pos[0]) y = int(pos[1]) @@ -94,7 +94,7 @@ class Icon(UIElement): hs,hs,hs//2 ).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-self.size/2).rgb(self.bg_r,self.bg_g,self.bg_b). #.round_rectangle( @@ -102,17 +102,14 @@ class Icon(UIElement): # y-self.size/2, # self.size,self.size,self.size//2 #).fill() - micropython.mem_info() - gc.collect() - print(self.label) - self.ctx.rgb(1,1,1).move_to(x,y) - micropython.mem_info("data") - print(" moved") - print(" crash here:") - self.ctx.text(self.label) + #micropython.mem_info() + #gc.collect() + #print(self.label) - print(" text") + self.ctx.rgb(1,1,1).move_to(x,y).text(self.label) + #micropython.mem_info("data") + class IconValue(Icon): def __init__(self, value=0, *args, **kwargs): super().__init__(*args, **kwargs) @@ -145,12 +142,12 @@ class GroupRing(UIElement): pos = (self.origin[0]+offset[0],self.origin[1]+offset[1]) self._draw(pos) for index in range(len(self.children)): - print("child",index) + #print("child",index) child = self.children[index] angle = 2*math.pi/len(self.children)*index+self.angle_offset x = math.sin(angle)*self.r+pos[0] y = -math.cos(angle)*self.r+pos[1] - print("pos",(x,y)) + #print("pos",(x,y)) child.draw(offset=(x,y)) def _draw(self,pos):