From fc756bccc943ab07b094af572dd9e6a7752fafa2 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Tue, 30 Nov 2021 16:10:02 +0100 Subject: [PATCH] Optimize flash usage of calc app Signed-off-by: Francesco Gazzetta --- wasp/apps/calc.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/wasp/apps/calc.py b/wasp/apps/calc.py index 2d7e12d..a3dbeec 100644 --- a/wasp/apps/calc.py +++ b/wasp/apps/calc.py @@ -88,29 +88,32 @@ class CalculatorApp(): def _draw(self): draw = wasp.watch.drawable + theme = wasp.system.theme + line = draw.line + fill = draw.fill - hi = wasp.system.theme('bright') - lo = wasp.system.theme('mid') + hi = theme('bright') + lo = theme('mid') mid = draw.lighten(lo, 2) - bg = draw.darken(wasp.system.theme('ui'), wasp.system.theme('contrast')) + bg = draw.darken(theme('ui'), theme('contrast')) bg2 = draw.darken(bg, 2) # Draw the background - draw.fill(0, 0, 0, 239, 47) - draw.fill(0, 236, 239, 3) - draw.fill(bg, 141, 48, 239-141, 236-48) - draw.fill(bg2, 0, 48, 141, 236-48) + fill(0, 0, 0, 239, 47) + fill(0, 236, 239, 3) + fill(bg, 141, 48, 239-141, 236-48) + fill(bg2, 0, 48, 141, 236-48) # Make grid: draw.set_color(lo) for i in range(4): # horizontal lines - draw.line(x0=0,y0=(i+1)*47,x1=239,y1=(i+1)*47) + line(x0=0,y0=(i+1)*47,x1=239,y1=(i+1)*47) # vertical lines - draw.line(x0=(i+1)*47,y0=47,x1=(i+1)*47,y1=235) - draw.line(x0=0, y0=47, x1=0, y1=236) - draw.line(x0=239, y0=47, x1=239, y1=236) - draw.line(x0=0, y0=236, x1=239, y1=236) + line(x0=(i+1)*47,y0=47,x1=(i+1)*47,y1=235) + line(x0=0, y0=47, x1=0, y1=236) + line(x0=239, y0=47, x1=239, y1=236) + line(x0=0, y0=236, x1=239, y1=236) # Draw button labels draw.set_color(hi, bg2)