Simple terminal (VT100) editor widget (and other widgets)

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Simple terminal (VT100) editor widget (and other widgets)

Post by pfalcon » Sun Apr 26, 2015 4:17 pm

Splitting topic from http://forum.micropython.org/viewtopic.php?p=3832#p3638 :
Another idea I contemplated for some time is implementing onboard text editor. I actually wanted to lure dhylands into, whose seems to like terminal stuff, but I just had occasion for another project which needs similar functionality, so gave in and went for it myself. The WIP is here if anyone is interested: https://github.com/pfalcon/pyedit . I didn't actually test on pyboard, and it probably won't work because of packet size/transfer delays (would need to use dedicated UART classes), but it works really well on Linux with both MicroPython and Python3. Here's some thing I'm not sure about: on one hand, I'd like to keep it really simple and minimal, so it could run on as small as possible boards and edit as large as possible files, on the other hand, I'd like it to be configurable and reusable, e.g. to be a part of Text UI library. Revision 1 in the repo above represent "minimal" version, further commits add more features. The solution may be to maintain 2 version - one hardcoded and minimal, another - extensible. I welcome feedback on whether someone finds this useful at all and thinking above makes sense.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Damien
Site Admin
Posts: 634
Joined: Mon Dec 09, 2013 5:02 pm

Re: Simple terminal (VT100) editor widget

Post by Damien » Wed Apr 29, 2015 12:21 am

I just found this, a vim "clone" written in pure Python: https://github.com/jonathanslenders/pyvim . Overkill for us perhaps :)

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Simple terminal (VT100) editor widget

Post by pfalcon » Sun May 03, 2015 5:02 pm

I certainly saw text editors written in Python, don't have many links handy, but urwid demo comes to mind: http://urwid.org/examples/index.html#edit-py . But yeah, I didn't try to look into them, because I'm sure they're not minimal enough for us ;-).
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

User avatar
Roberthh
Posts: 1958
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Simple terminal (VT100) editor widget

Post by Roberthh » Sat May 16, 2015 3:21 pm

Hello Pfalcon, searchug for Python code, that woudl allow me to do small bug fixes onboard, I found your seditor.py and editor.py. I ported them to PyBoard, which was not too complicated. Since your code is so nice and clean written, I could not resist adding a few featueres, which help in editing Python code, most important Save, Find, and a few other things. The stuff it attached. Hope it works
Attachments
PyBoard_Editor.zip
(81.88 KiB) Downloaded 180 times

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Simple terminal (VT100) editor widget

Post by pfalcon » Sat May 16, 2015 8:33 pm

Thanks, I'm glad it was helpful to you, I was writing it with a hope it would be. I'll have a look at your changes, though if you think it makes sense to add them to upstream repository, it would be nice to get a github pull request instead of tarball.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

User avatar
Roberthh
Posts: 1958
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Simple terminal (VT100) editor widget

Post by Roberthh » Sun May 17, 2015 11:54 am

Thanks for the response. I never used github, so I was a little bit shy to do so. Meanwhile I have placed the stuff there under
https://github.com/robert-hh/Pyboard-Editor in a slightly fixed version. I'm stll working on it a little bit, searching for bugs (aka unintended features) and trying to reduce redudancy.

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Simple terminal (VT100) editor widget

Post by pfalcon » Sun Jul 19, 2015 7:24 pm

After playing with http://code.google.com/p/npyscreen/ and http://urwid.org/ , and even trying to port a TUI framework from C#, I gave up and decided to write my own. It's at https://github.com/pfalcon/picotui and thus is a continuation of pyedit project (the latter says as is, as just editor widgets).
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

User avatar
Roberthh
Posts: 1958
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Simple terminal (VT100) editor widget

Post by Roberthh » Mon Jul 27, 2015 9:54 am

Thanks for the update. It is always useful. I continued my spinoff from your ideas a little bit, and sometimes I'm even using it for fast On-Board chages with PyBoard. It got more a program editor than a widget, but useful enough for the purpose. Best regards.

User avatar
mbirth
Posts: 25
Joined: Mon Oct 20, 2014 1:00 pm
Location: Berlin, Germany
Contact:

Re: Simple terminal (VT100) editor widget

Post by mbirth » Thu Oct 22, 2015 10:35 am

@pfalcon, could you give a small example on how to invoke your picotui?

@Roberthh: Your repository is missing the shebang file. Also pex.py isn't provided in the repository (and not mentioned in the README). And I'd prefer for the

Code: Select all

if sys.platform in (...)
parts to be omitted in the platform-specific versions so I can test them with MicroPython in different environments, like wipye.py in x86-MicroPython.
pyBoard v1.0 + LCD32MKv1.0 | WiPy + Expansion Board | GitHub

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Simple terminal (VT100) editor widget

Post by pfalcon » Thu Oct 22, 2015 11:35 am

mbirth wrote:@pfalcon, could you give a small example on how to invoke your picotui?
The repository has demo file: https://github.com/pfalcon/picotui/blob ... ts_test.py
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Post Reply