From 2f6c7ca871a70142da454441e32986f937c3109e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Veres-Szentkir=C3=A1lyi?= Date: Mon, 22 Feb 2016 17:34:21 +0100 Subject: [PATCH] codegen: use configurable SSTV subclass --- pysstv/examples/codegen.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pysstv/examples/codegen.py b/pysstv/examples/codegen.py index 9063175..cb04130 100644 --- a/pysstv/examples/codegen.py +++ b/pysstv/examples/codegen.py @@ -40,10 +40,15 @@ class Image(object): from pysstv.color import MartinM1 import re +supported = [MartinM1] ROW_RE = re.compile(r'ROW\(\d+\)') -def main(): - sstv = MartinM1(Image('img'), 44100, 16) +def main(sstv_class=None): + if sstv_class is None: + sstv_class = MartinM1 + elif sstv_class not in supported: + raise NotImplementedError() + sstv = sstv_class(Image('img'), 44100, 16) n = 0 print '#define ROW(x) x' print '#define COL(x) x'