Page 1 of 3

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

Posted: Sun Apr 26, 2015 4:17 pm
by pfalcon
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.

Re: Simple terminal (VT100) editor widget

Posted: Wed Apr 29, 2015 12:21 am
by Damien
I just found this, a vim "clone" written in pure Python: https://github.com/jonathanslenders/pyvim . Overkill for us perhaps :)

Re: Simple terminal (VT100) editor widget

Posted: Sun May 03, 2015 5:02 pm
by pfalcon
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 ;-).

Re: Simple terminal (VT100) editor widget

Posted: Sat May 16, 2015 3:21 pm
by Roberthh
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

Re: Simple terminal (VT100) editor widget

Posted: Sat May 16, 2015 8:33 pm
by pfalcon
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.

Re: Simple terminal (VT100) editor widget

Posted: Sun May 17, 2015 11:54 am
by Roberthh
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.

Re: Simple terminal (VT100) editor widget

Posted: Sun Jul 19, 2015 7:24 pm
by pfalcon
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).

Re: Simple terminal (VT100) editor widget

Posted: Mon Jul 27, 2015 9:54 am
by Roberthh
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.

Re: Simple terminal (VT100) editor widget

Posted: Thu Oct 22, 2015 10:35 am
by mbirth
@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.

Re: Simple terminal (VT100) editor widget

Posted: Thu Oct 22, 2015 11:35 am
by pfalcon
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