aboutsummaryrefslogtreecommitdiff
path: root/host/terminal.py
diff options
context:
space:
mode:
authorjaseg <jaseg@jaseg.net>2014-03-04 22:49:48 +0100
committerjaseg <jaseg@jaseg.net>2014-03-04 22:49:48 +0100
commit8f86c5ac4576b36aff906b91e194e68eb343c536 (patch)
tree228749e6d71fd247a61c16c5bbad0c2c86a2ef0d /host/terminal.py
parentc4dd54e16fcc31c43c2ccccbb34eea07b9de735c (diff)
parent7878aa1d455ab24d0336fc68eb09f726bcba10b2 (diff)
downloadmatelight-8f86c5ac4576b36aff906b91e194e68eb343c536.tar.gz
matelight-8f86c5ac4576b36aff906b91e194e68eb343c536.tar.bz2
matelight-8f86c5ac4576b36aff906b91e194e68eb343c536.zip
Merge branch 'master' of matelight:matelight
Diffstat (limited to 'host/terminal.py')
-rw-r--r--host/terminal.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/host/terminal.py b/host/terminal.py
new file mode 100644
index 0000000..86b4db1
--- /dev/null
+++ b/host/terminal.py
@@ -0,0 +1,19 @@
+from pixelterm.pixelterm import termify_pixels
+
+class MockImage:
+ def __init__(self, nparray):
+ self.nparray = nparray
+ self.im = self
+
+ @property
+ def size(self):
+ h, w, _ = self.nparray.shape
+ return (w, h)
+
+ def getpixel(self, pos):
+ x, y = pos
+ return tuple(self.nparray[y][x])
+
+def printframe(framedata):
+ print(termify_pixels(MockImage(framedata)))
+