[Microbit-Python] A native editor

Nicholas H.Tollervey ntoll at ntoll.org
Mon Dec 7 04:13:00 EST 2015


Folks,

None of this is documented, it's unfinished and is basically a working
brain dump. Give me some time to write up what I've done..! (I was doing
this most evening's last week and over the weekend. By Sunday evening I
was sick of the site of the damn thing - especially after most of the
time I'd spent on it was wasted on the non-working USB API).

I'll get to it, but in the meantime:

This will be a Chrome App that you download and install from Google's
"App Store" thingamabob for Chrome Apps. When you download the app
you'll be walked through the permissions required (that you accept or
decline). I'm doing my work on Debian Jessie and it worked for me. This
is a very important user journey, but one that I can't test until we
have something semi-functional telling us what the permissions need to
be (currently, storage, serial and filesystem).

I'm using Google's "Chrome Dev Editor" to do this work
(https://chrome.google.com/webstore/detail/chrome-dev-editor-develop/pnoffddplpippgcfjdhbmhkofpnaalpg).
I suggest you use it too.

Like I said... a very early brain dump.

In an ideal world we'd have just a static .exe for Windows that gave us
something functionally equivalent to what I've done already. I might
take a look at some of the Puppy work myself, Dan Pope and Damien did to
see if this is possible.

Basically, all the amazing work on MicroPython should be easily
accessible. Teachers have a bad time of it. I want to fix that problem
and I'm doing so in public so those who want to help can dive in.

N.

On 06/12/15 23:13, Naomi Ceder wrote:
> Tom, use the entire base directory as the unpacked extension - that
> worked for me.
> 
> Naomi
> 
> On 6 December 2015 at 17:11, Tom Viner <tom at viner.tv
> <mailto:tom at viner.tv>> wrote:
> 
>     I'm opening python-native-editor/index.html in Chrome and I don't
>     see how to get any extension (and there doesn't appear to be
>     unpacked extension to load in developer
>     <https://developer.chrome.com/extensions/getstarted#unpacked> mode
>     either).
> 
>     I just get:
>     repl.js:75 Uncaught TypeError: Cannot read property 'sync' of undefined
> 
>     on the line:
>     hterm.defaultStorage = new lib.Storage.Chrome(chrome.storage.sync); 
> 
>     On 6 December 2015 at 22:53, Naomi Ceder <naomi.ceder at gmail.com
>     <mailto:naomi.ceder at gmail.com>> wrote:
> 
>         Ooops! My apologies! I see from looking at the code that new,
>         open and save are not yet implemented, just stubbed out, it
>         appears. 
> 
>         I misunderstood that. Never mind.
> 
>         Naomi
> 
>         On 6 December 2015 at 16:43, Naomi Ceder <naomi.ceder at gmail.com
>         <mailto:naomi.ceder at gmail.com>> wrote:
> 
>             Thanks for the reference Carlos. That makes sense...
> 
>             At any rate, when I removed that permission, the warning of
>             course went away. However it still coudn't find my
>             micro:bit, since the port objects have neither a productId
>             nor a vendorId on my system, only a path. When I matched on
>             the path to what I knew to be the right path, I could get a
>             repl working just fine. Which would imply that a different
>             way of finding the right port is needed.
> 
>             I suppose the next thing is to look at the load/save issue.
> 
>             Cheers,
>             Naomi
> 
>             On 6 December 2015 at 16:25, Carlos P.A.
>             <carlos.p.a.87 at gmail.com <mailto:carlos.p.a.87 at gmail.com>>
>             wrote:
> 
>                 Looks like RequestFileSystem might only be supported in
>                 ChromeOS, is that the platform you've been using Nicholas?
> 
>                 https://groups.google.com/a/chromium.org/forum/m/#!msg/apps-dev/LEne7qedZrc/7ZEY0uwfDgAJ
> 
>                 On 6 December 2015 at 22:09, Naomi Ceder
>                 <naomi.ceder at gmail.com <mailto:naomi.ceder at gmail.com>>
>                 wrote:
> 
>                     Sadly I can't get the extension to work on either
>                     OSX or Linux - instead, the extension reports
> 
>                      There were warnings when trying to install this
>                     extension:
> 
>                       * 'fileSystem.requestFileSystem' is not allowed
>                         for specified platform.
> 
> 
>                     So the result for me is that the new, open, and save
>                     functions don't do anything at all, and the repl
>                     says it can't find the microbit. 
> 
>                     I'm not finding any explanations of line, but I've
>                     attached a screen shot of the warning... 
> 
>                     I'm also not seeing any setting for Chrome that
>                     would seem to help.
> 
>                     Cheers,
>                     Naomi
> 
> 
> 
>                     On 6 December 2015 at 15:15, Carlos P.A.
>                     <carlos.p.a.87 at gmail.com
>                     <mailto:carlos.p.a.87 at gmail.com>> wrote:
> 
>                         Excellent work Nicholas!
> 
>                         Will the pluggin also automatically work when
>                         the interface is accessed from the
>                         https://www.microbit.co.uk/create-code python
>                         link? (once it is implemented in the webiste).
> 
>                         As a small suggestion, probably with a low
>                         priority, is that having some visual feedback on
>                         the page that the program is being flashed would
>                         be ideal, even better if there was a tiny
>                         progress bar on the button.
> 
>                         Regards,
>                         Carlos
> 
>                         On 6 December 2015 at 20:34, Nicholas
>                         H.Tollervey <ntoll at ntoll.org
>                         <mailto:ntoll at ntoll.org>> wrote:
> 
>                             Basically, this:
> 
>                             https://www.youtube.com/watch?v=S8MGFVuZrrs
> 
>                             ...is a first draft and the source code is here:
> 
>                             https://github.com/ntoll/python-native-editor
> 
>                             There's no documentation and I'll be working
>                             on it over the coming days
>                             with a view to showing it on Wednesday to a
>                             bunch of teachers.
> 
>                             FYI - working out how to flash the device
>                             took several tortuous days.
>                             Chrome has a USB API that was documented to
>                             appear to be exactly what I
>                             needed (pushing file based data to the
>                             device). I spent far too much
>                             time learning about USB and getting
>                             permission to write to the device to
>                             work.
> 
>                             In the end I gave up when I realised there
>                             was a really easy hack that
>                             was right in front of my nose... just copy
>                             the damn .hex file to the
>                             device via the built-in file-system API.
> 
>                             It worked first time..! :-)
> 
>                             That's several hours of my time I'll never
>                             get back.
> 
>                             Early days. Collaboration welcome!
> 
>                             Best wishes,
> 
>                             Nicholas.
> 
> 
>                             _______________________________________________
>                             Microbit mailing list
>                             Microbit at python.org <mailto:Microbit at python.org>
>                             https://mail.python.org/mailman/listinfo/microbit
> 
> 
> 
>                         _______________________________________________
>                         Microbit mailing list
>                         Microbit at python.org <mailto:Microbit at python.org>
>                         https://mail.python.org/mailman/listinfo/microbit
> 
> 
> 
> 
>                     -- 
>                     Naomi Ceder
>                     https://plus.google.com/u/0/111396744045017339164/about
> 
>                     _______________________________________________
>                     Microbit mailing list
>                     Microbit at python.org <mailto:Microbit at python.org>
>                     https://mail.python.org/mailman/listinfo/microbit
> 
> 
> 
>                 _______________________________________________
>                 Microbit mailing list
>                 Microbit at python.org <mailto:Microbit at python.org>
>                 https://mail.python.org/mailman/listinfo/microbit
> 
> 
> 
> 
>             -- 
>             Naomi Ceder
>             https://plus.google.com/u/0/111396744045017339164/about
> 
> 
> 
> 
>         -- 
>         Naomi Ceder
>         https://plus.google.com/u/0/111396744045017339164/about
> 
>         _______________________________________________
>         Microbit mailing list
>         Microbit at python.org <mailto:Microbit at python.org>
>         https://mail.python.org/mailman/listinfo/microbit
> 
> 
> 
>     _______________________________________________
>     Microbit mailing list
>     Microbit at python.org <mailto:Microbit at python.org>
>     https://mail.python.org/mailman/listinfo/microbit
> 
> 
> 
> 
> -- 
> Naomi Ceder
> https://plus.google.com/u/0/111396744045017339164/about
> 
> 
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/microbit/attachments/20151207/54ad42ff/attachment.sig>


More information about the Microbit mailing list