mu editor for micropython

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.
askvictor
Posts: 24
Joined: Tue Mar 22, 2016 9:08 pm

mu editor for micropython

Post by askvictor » Thu Jul 28, 2016 5:59 am

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 :)

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: mu editor for micropython

Post by pythoncoder » Thu Jul 28, 2016 9:31 am

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 ;)
Peter Hinch
Index to my micropython libraries.

askvictor
Posts: 24
Joined: Tue Mar 22, 2016 9:08 pm

Re: mu editor for micropython

Post by askvictor » Thu Jul 28, 2016 9:57 pm

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 .

askvictor
Posts: 24
Joined: Tue Mar 22, 2016 9:08 pm

Re: mu editor for micropython

Post by askvictor » Fri Jul 29, 2016 1:51 am

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

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: mu editor for micropython

Post by pythoncoder » Fri Jul 29, 2016 5:31 am

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.
Peter Hinch
Index to my micropython libraries.

askvictor
Posts: 24
Joined: Tue Mar 22, 2016 9:08 pm

Re: mu editor for micropython

Post by askvictor » Fri Jul 29, 2016 6:04 am

OK; latest commit fixes most of the REPL issues (I think, not really tested it much)

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: mu editor for micropython

Post by pythoncoder » Fri Jul 29, 2016 10:47 am

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.
Peter Hinch
Index to my micropython libraries.

askvictor
Posts: 24
Joined: Tue Mar 22, 2016 9:08 pm

Re: mu editor for micropython

Post by askvictor » Wed Aug 03, 2016 10:28 am

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.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: mu editor for micropython

Post by pythoncoder » Wed Aug 03, 2016 2:26 pm

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.
Peter Hinch
Index to my micropython libraries.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: mu editor for micropython

Post by pythoncoder » Sat Aug 13, 2016 10:27 am

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.
Peter Hinch
Index to my micropython libraries.

Post Reply