From 37bb3511cce75fd4b2433ac664cc30fc1e227eec Mon Sep 17 00:00:00 2001 From: dequis <dx@dxzone.com.ar> Date: Mon, 7 Aug 2023 00:10:00 +0200 Subject: [PATCH] apps: fix Ctx renames in scroll and worms demos (sorry again!) --- python_payload/apps/demo_scroll/__init__.py | 5 +++-- python_payload/apps/demo_worms/__init__.py | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/python_payload/apps/demo_scroll/__init__.py b/python_payload/apps/demo_scroll/__init__.py index 530dd08b91..b649f7d1bb 100644 --- a/python_payload/apps/demo_scroll/__init__.py +++ b/python_payload/apps/demo_scroll/__init__.py @@ -4,12 +4,13 @@ import time import math # flow3r imports -from st3m import Ctx, InputState +from st3m import InputState from st3m.application import Application from st3m.property import BLUE, WHITE from st3m.goose import Optional from st3m.utils import xy_from_polar, tau from st3m.ui.interactions import CapScrollController +from ctx import Context class ScrollDemo(Application): @@ -19,7 +20,7 @@ class ScrollDemo(Application): super().__init__(name) self.scroll = CapScrollController() - def draw(self, ctx: Ctx) -> None: + def draw(self, ctx: Context) -> None: ctx.save() ctx.move_to(0, 0) ctx.gray(0) diff --git a/python_payload/apps/demo_worms/__init__.py b/python_payload/apps/demo_worms/__init__.py index 9a462e817b..8f73ea532a 100644 --- a/python_payload/apps/demo_worms/__init__.py +++ b/python_payload/apps/demo_worms/__init__.py @@ -4,12 +4,13 @@ import time import math # flow3r imports -from st3m import Ctx, InputState +from st3m import InputState from st3m.application import Application from st3m.property import BLUE, WHITE from st3m.goose import Optional from st3m.utils import xy_from_polar from st3m.ui.view import ViewManager +from ctx import Context tau = 2 * math.pi @@ -46,7 +47,7 @@ class AppWorms(Application): super().on_enter(vm) self.just_shown = True - def draw(self, ctx: Ctx) -> None: + def draw(self, ctx: Context) -> None: if self.bufn <= 5: # TODO (q3k) bug: we have to do this, otherwise we have horrible blinking @@ -105,7 +106,7 @@ class Worm: # (self.dx,self.dy) = xy_from_polar(1,self.direction) self._lastdist = 0.0 - def draw(self, ctx: Ctx) -> None: + def draw(self, ctx: Context) -> None: ctx.rgb(*self.color) ctx.round_rectangle( self.x - self.size / 2, -- GitLab