peterhinch / micropython-nano-gui

A lightweight MicroPython GUI library for display drivers based on framebuf class
MIT License
511 stars 88 forks source link

unix port: add b/w terminal driver (braille/ascii, scrolling/ucurses), add SDL driver (color) #24

Closed eudoxos closed 3 years ago

eudoxos commented 3 years ago

Uses adapted drawille for braille output, and can use ucurses for terminal clearing (both optional). Not made for high FPS (probably).

Say this in color_setup.py:

from drivers.terminal import Terminal
SSD=Terminal
ssd=SSD(width=196,height=128,curse=True,braille=True)

image

eudoxos commented 3 years ago

Quick&dirty driver based on SDL2 (author of 99% of this: Paul Sokolovsky, MIT/zlib licensed): aclock_large.py with color_setup.py looks like this:

from drivers.usdl2 import FrameBuffer as SSD
ssd=SSD(width=480,height=320)

image

eudoxos commented 3 years ago

I managed to use micropython buffer as texture and map that to the SDL surface, including scaling.

from drivers.usdl2 import SDLWindow as SSD
ssd=SSD(width=256,height=256,title='SDL test',scale=3)

I just can't get the colors right (the rgb function)... - any hint?

image

peterhinch commented 3 years ago

I think this is best progressed as a fork. There are three reasons why I don't intend to merge this:

That said, what you are doing is very worthwhile. I think a fork dedicated to Unix/Braille (removing all my drivers and simplifying the docs) is the way to go with this.

eudoxos commented 3 years ago

The intent was to develop for microcontrollers on desktop (Linux), not to run those drivers on uCs.

I only went quickly at drawille preamble and it "looked like* MIT; but it is in fact AGPL :/ too bad, though most of it could be re-implemented (it is just a special way of putting bits into array).

I understand your reservations and I am closing this PR then.