A "micro" editor for MicroPython and the BBC micro:bit - this fork targets the ESP8266 and other micropython boards - switch to the feature/multi-board branch to use this. Written in Python and Qt5.
the webREPL for supported devices would be nice to implement in mu. Bonus points for device auto-discovery, as well as first-time-connection simplification.
Cloned from repo feature/multi-board branch, but crashes when python3 run.py is executed.
Only shows the splash screen for a second, before crashing.
Terminal output:
Henriks-MacBook-Pro:mu HenriksFolder$ python3 run.py
Logging to /Users/HenriksFolder/Library/Logs/mu/mu.log
QThread: Destroyed while thread is still running
Abort trap: 6
This severely limits its usability. The fix under Linux is as follows, but evidently testing is needed on Mac and Windows, which I'm not equipped to do.
interface.py
defkeyPressEvent(self, data):
#lines omittedelifdata.modifiers() ==Qt.ControlModifier:
# # Handle the Control key. I would've expected us to have to test# # for Qt.ControlModifier, but on (my!) OSX Qt.MetaModifier does# # correspond to the Control key. I've read something that suggests# # that it's different on other platforms.# # see http://doc.qt.io/qt-5/qt.html#KeyboardModifier-enumifQt.Key_A<=key<=Qt.Key_Z:
# # The microbit treats an input of \x01 as Ctrl+A, etc.msg=bytes([1+key-Qt.Key_A])
self.serial.write(msg)
The board now responds correctly to ctrl-A ctrl-B ctrl-C ctrl-D and ctrl-E
in straight repl, the password prompt appears as part of the normal text flow. When browsing files, we need a way to implement sending the password. This could be a config setting, or prompt the user.
I'm starting to imagine how the UI could provide a better workflow. I'm thinking of:
putting the file panes as a side-bar on the left
having a 'new project' button that creates a new project folder, which contains a settings file for that project, and create boot.py and main.py files (with some boilerplate starting comments/code)
sync buttons (in either direction) that will copy all files from the project folder to the device (or vice versa)
a 'run' button that will upload and run the current file
Having failed to either run the binaries of mu on my Acer with an exec error I downloaded the Windows variant onto my XP (SP3) desktop. After thinking about it for a bit it gives Fatal Error. run returns -1. The mbed serial driver is installed and working OK and the Microbit attaches its file system OK but no mu.
Running the Python online interface from the Microbit website works on both machines so the communications are OK on both, I am confused and my brain hurts.
Trying out your python scripts on my mu editor but there is an import error with the line 'import logging'. How to import the logging module (and other modules) on mu editor?
with python3 on win D:\TEMP\micropython\mu-feature-multi-board>python run.py
Traceback (most recent call last):
File "run.py", line 2, in
from mu.app import run
File "D:\TEMP\micropython\mu-feature-multi-board\mu\app.py", line 27, in
from mu.logic import Editor, LOG_FILE, LOG_DIR
File "D:\TEMP\micropython\mu-feature-multi-board\mu\logic.py", line 380
self.fs = get_upython_device(async=False)
^
SyntaxError: invalid syntax
Looks like the REPL uses a QTextEdit widget, which might never support sending Control characters over the wire. Might need to investigate some hacks, or a different widget