From f1ccebc4832294c41a95c6f941936449593b8f4e Mon Sep 17 00:00:00 2001 From: dequis <dx@dxzone.com.ar> Date: Sun, 6 Aug 2023 23:30:26 +0200 Subject: [PATCH] apps: fix a few more missing Ctx renames, sorry! --- python_payload/apps/demo_cap_touch/main.py | 6 +++--- python_payload/apps/demo_harmonic/__init__.py | 4 ++-- python_payload/apps/demo_melodic/__init__.py | 4 ++-- python_payload/apps/nick/__init__.py | 4 ++-- python_payload/apps/simple_drums/__init__.py | 1 - 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/python_payload/apps/demo_cap_touch/main.py b/python_payload/apps/demo_cap_touch/main.py index 6bd490c5eb..2c13be1e05 100644 --- a/python_payload/apps/demo_cap_touch/main.py +++ b/python_payload/apps/demo_cap_touch/main.py @@ -1,7 +1,7 @@ from st3m import application, logging from st3m.goose import List -from st3m.ui.ctx import Ctx from st3m.input import InputState +from ctx import Context log = logging.Log(__name__, level=logging.INFO) log.info("import") @@ -19,7 +19,7 @@ class Dot: self.imag = imag self.real = real - def draw(self, i: int, ctx: Ctx) -> None: + def draw(self, i: int, ctx: Context) -> None: imag = self.imag real = self.real size = self.size @@ -67,7 +67,7 @@ class CapTouchDemo(application.Application): self.dots.append(Dot(size, x.imag, x.real)) - def draw(self, ctx: Ctx) -> None: + def draw(self, ctx: Context) -> None: # print(self.last_calib) # TODO (q3k) bug: we have to do this, otherwise we have horrible blinking diff --git a/python_payload/apps/demo_harmonic/__init__.py b/python_payload/apps/demo_harmonic/__init__.py index 936207e9db..7eccb43333 100644 --- a/python_payload/apps/demo_harmonic/__init__.py +++ b/python_payload/apps/demo_harmonic/__init__.py @@ -5,9 +5,9 @@ blm = bl00mbox.Channel() import leds import hardware -from st3m.ui.ctx import Ctx from st3m.goose import List from st3m.input import InputState +from ctx import Context chords = [ [-4, 0, 3, 8, 10], @@ -52,7 +52,7 @@ class HarmonicApp(Application): self.chord = chords[i] leds.update() - def draw(self, ctx: Ctx) -> None: + def draw(self, ctx: Context) -> None: i = self.color_intensity ctx.rgb(i, i, i).rectangle(-120, -120, 240, 240).fill() diff --git a/python_payload/apps/demo_melodic/__init__.py b/python_payload/apps/demo_melodic/__init__.py index f0dfcb6c3e..10f4f79ca2 100644 --- a/python_payload/apps/demo_melodic/__init__.py +++ b/python_payload/apps/demo_melodic/__init__.py @@ -9,7 +9,7 @@ import leds from st3m.goose import List, Optional from st3m.input import InputState from st3m.ui.view import ViewManager -from st3m.ui.ctx import Ctx +from ctx import Context octave = 0 synths = [] @@ -92,7 +92,7 @@ class MelodicApp(Application): super().__init__(name) init() - def draw(self, ctx: Ctx) -> None: + def draw(self, ctx: Context) -> None: ctx.rgb(1, 1, 1).rectangle(-120, -120, 240, 240).fill() ctx.rgb(0, 0, 0) scope_draw(ctx) diff --git a/python_payload/apps/nick/__init__.py b/python_payload/apps/nick/__init__.py index fae347cc10..83f1972820 100644 --- a/python_payload/apps/nick/__init__.py +++ b/python_payload/apps/nick/__init__.py @@ -1,8 +1,8 @@ from st3m.application import Application from st3m.property import PUSH_RED, GO_GREEN, BLACK from st3m.goose import Dict, Any -from st3m.ui.ctx import Ctx from st3m.input import InputState +from ctx import Context import leds import json @@ -56,7 +56,7 @@ class NickApp(Application): self._filename = "/flash/nick.json" self._config = Configuration.load(self._filename) - def draw(self, ctx: Ctx) -> None: + def draw(self, ctx: Context) -> None: ctx.text_align = ctx.CENTER ctx.text_baseline = ctx.MIDDLE ctx.font_size = self._config.size diff --git a/python_payload/apps/simple_drums/__init__.py b/python_payload/apps/simple_drums/__init__.py index 3cf02db4e1..31c95f90e4 100644 --- a/python_payload/apps/simple_drums/__init__.py +++ b/python_payload/apps/simple_drums/__init__.py @@ -4,7 +4,6 @@ import captouch import leds from st3m.application import Application -from st3m.ui.ctx import Ctx from st3m.input import InputState -- GitLab