CobraPy: bits and pieces
As it happens in early stages in fun products, progress in CobraPy has been both faster and slower than expected.
In the past few days a number of things happened:
I made that terminal a whole lot nicer
I already had a terminal but I fixed a number of things.
- The keyboard handling is much better, it now recognizes pretty much all keys, which is always a nice thing.
- It sorta supports things like "á" via mode-switch (no deadkeys support probably ever)
- It has 24-bit color support! I didn't know terminals could support that kind of thing!
I added a graphics protocol to it!
Terminals with graphics support have a very long tradition. This is a VT55, released in 1977 displaying graphics:
How did it work? Well you can read the programmer's manual if you want, but basically you sent a control sequence that put it in "graphics mode" and then sent commands describing what to display.
Similar ideas with different protocol details were used in many different future terminals, including ReGIS graphics and Tektronix vector graphics and you could even trace this all the way to a current Linux desktop's X11 graphics.
So, what did I do? Not that, exactly. I am creating a side-channel as a sort-of-RPC where you send serialized python method names and arguments.
I wrote a Python REPL
I wanted an interactive mode that was slightly friendlier than Python comes with, but not something overwhelming and powerful like IPython or BPython.
I did some research, and found ptpython which is pretty awesome, but still a bit too much awesome.
And then I started on a much, much lamer version of it. Still embrionic, but it does work. I have some plans for it.
I learned a lot more about Raylib
All the graphics and basically everything you see in this project is done using the awesome raylib and a homegrown CFFI binding for it. I was not using it right, now I use it better, and things that took several hundredth seconds now take a few dozen microseconds.
I integrated the whole thing, sorta
So, I integrated it enough that you can start the terminal, launch the REPL in it, and use the graphics protocol to draw something!
Por otro lado, el que dibujar 10 círculos usando IPC tarde 20 segundos sí hay que optimizarlo ahora :-) pic.twitter.com/0ywf9nzxkH
— Roberto H. Alsina (@ralsina) October 11, 2020
What next
Now comes a round of integration, cleanup and optimization.
- Working code needs to be reorganized
- The terminal uses 66% of a CPU core, which is not acceptable, but there's tons of low hanging fruit there.
- Graphics protocol needs to be able to do more things so it's interesting
After that will come a new round of feature work, and so on for the next ... 10 years? If it goes well?