Page 1 of 5

mu editor for micropython

Posted: Thu Jul 28, 2016 5:59 am
by askvictor
I've just discovered mu http://codewith.mu/ for the bbc microbit, and have modified it to work with the ESP8266 (or, indeed any device that communicates purely over serial). My fork is at https://github.com/eduvik/mu - feel free to have a play and/or contribute. It's all written in python :)

Re: mu editor for micropython

Posted: Thu Jul 28, 2016 9:31 am
by pythoncoder
I've had a quick play with this and it looks great: amongst other things a neat way to flash code to the ESP8266 without using webrepl. I like the style checker, very user-friendly! Also the way it connects to Pyboards and ESP8266's automagically :)

Rather than run a binary from the web I cloned the repo, fixed the dependencies and ran the Python code directly. I'm getting the following issues:
  • The REPL doesn't let me send ctrl characters to the target.
  • The REPL doesn't respond normally to editing characters. If I type a followed by backspace it displays garbage.
These may be problems with my setup but any pointers would be welcome. Inability to send ctrl-C, ctrl-E, ctrl-D and suchlike to MicroPython is a bit of a deal-breaker. Control characters are handled normally in the edit window.

It's running under Python 3.4.3 on Linux Mint 17.1 Rebecca.

A minor point: how do you populate the 'files on my computer' pane?

Incidentally spamming the forum will not engender popularity: one post suffices ;)

Re: mu editor for micropython

Posted: Thu Jul 28, 2016 9:57 pm
by askvictor
pythoncoder wrote: Rather than run a binary from the web I cloned the repo, fixed the dependencies and ran the Python code directly. I'm getting the following issues:
The binary isn't compiled with my changes, so you did the right thing!
pythoncoder wrote:
  • The REPL doesn't let me send ctrl characters to the target.
  • The REPL doesn't respond normally to editing characters. If I type a followed by backspace it displays garbage.
These may be problems with my setup but any pointers would be welcome. Inability to send ctrl-C, ctrl-E, ctrl-D and suchlike to MicroPython is a bit of a deal-breaker. Control characters are handled normally in the edit window.
I'll have a look, but feel free to play with the source yourself, it's really quite accessible.

pythoncoder wrote: A minor point: how do you populate the 'files on my computer' pane?
It's files in the folder ~/python (this is hard coded)
pythoncoder wrote: Incidentally spamming the forum will not engender popularity: one post suffices ;)
Fair enough .

Re: mu editor for micropython

Posted: Fri Jul 29, 2016 1:51 am
by askvictor
pythoncoder wrote: Rather than run a binary from the web I cloned the repo, fixed the dependencies and ran the Python code directly. I'm getting the following issues:
  • The REPL doesn't let me send ctrl characters to the target.
  • The REPL doesn't respond normally to editing characters. If I type a followed by backspace it displays garbage.
These may be problems with my setup but any pointers would be welcome. Inability to send ctrl-C, ctrl-E, ctrl-D and suchlike to MicroPython is a bit of a deal-breaker. Control characters are handled normally in the edit window.
I've had a bit of a play with this and found where the culprit is; pls continue discussion at https://github.com/eduvik/mu/issues

Re: mu editor for micropython

Posted: Fri Jul 29, 2016 5:31 am
by pythoncoder
askvictor wrote:...feel free to play with the source yourself, it's really quite accessible...
I may, but it's got some competition for my attention right now ;)
askvictor wrote:...It's files in the folder ~/python (this is hard coded)...
Thanks for that: fixed with a symlink to my current project.

I'll follow the Github progress with interest - I think this app has great promise.

Re: mu editor for micropython

Posted: Fri Jul 29, 2016 6:04 am
by askvictor
OK; latest commit fixes most of the REPL issues (I think, not really tested it much)

Re: mu editor for micropython

Posted: Fri Jul 29, 2016 10:47 am
by pythoncoder
It does indeed: big improvement :D I have a UI issue, though, but should it be raised against your fork or the original?

The dialog box which pops up if you click on files when the REPL is open (and vice versa) does not behave like a proper modal dialog: if you click on the main window it disappears behind the main window and the app appears to hang. For a beginner-focussed app this is confusing: it should remain in the foreground.

Re: mu editor for micropython

Posted: Wed Aug 03, 2016 10:28 am
by askvictor
pythoncoder wrote:It does indeed: big improvement :D I have a UI issue, though, but should it be raised against your fork or the original?

The dialog box which pops up if you click on files when the REPL is open (and vice versa) does not behave like a proper modal dialog: if you click on the main window it disappears behind the main window and the app appears to hang. For a beginner-focussed app this is confusing: it should remain in the foreground.
Raise it against the original.

The original devs are keen on including more functionality, so hopefully I'll merge the modifications upstream.

Re: mu editor for micropython

Posted: Wed Aug 03, 2016 2:26 pm
by pythoncoder
Issue now raised. While your patch has fixed the REPL cursor control keys, it doesn't seem to have fixed the issue of sending selected control characters to the board. I use ^C ^D and ^E daily, but there may be others I'm forgetting.

Re: mu editor for micropython

Posted: Sat Aug 13, 2016 10:27 am
by pythoncoder
I've produced this https://github.com/peterhinch/mu.git fork which allows control characters to be sent to the ESP8266 - at least under Linux. It's a quick hack and needs testing under Windows and OSX. It also eliminates the disappearing dialog boxes which gave the appearance that the app had crashed when a supposedly modal dialog skulked unseen behind the main window.

In general I'm an old-skool terminal-and-print-statement guy. But mu is a great way to flash code to the ESP8266 and run it if you want to work over USB rather than the webrepl; it's undoubtedly speeded up my efforts on the ESP.