10000 Add static files for editor · python/pythonineducation.org@0a60c31 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0a60c31

Browse files
committed
Add static files for editor
1 parent 4d63a1d commit 0a60c31

File tree

393 files changed

+42784
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

393 files changed

+42784
-1
lines changed

media/static/editor

Lines changed: 0 additions & 1 deletion
This file was deleted.

media/static/editor/AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Nicholas H.Tollervey (@ntoll)
2+
Damien P.George (@dpgeorge)

media/static/editor/CHANGELOG

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
0.6
2+
---
3+
4+
* Update to the latest version of MicroPython:
5+
- File system.
6+
- Radio.
7+
- Audio.
8+
- Speech.
9+
* Fork to work on pythonineducation.org website.
10+
* Initial internationalisation work.
11+
12+
0.5
13+
---
14+
15+
* Update to the latest version of MicroPython:
16+
- Various minor code refactors.
17+
- More efficient ticker (reduces overhead of display update by 90%).
18+
- Add builtin set and frozenset types (from core Python).
19+
- Don't show SystemExit or KeyboardInterrupt exceptions on the display.
20+
* Update bug in editor that caused the status icon not to update to cloud.
21+
* Added test script here: https://stage.microbit.co.uk/hoqumw
22+
* Revised button-press code to be simpler.
23+
* Minor documentation updates.
24+
25+
0.4
26+
---
27+
28+
Initial tested public release.
29+
30+
0.1-0.3
31+
-------
32+
33+
Private test versions.

media/static/editor/CONTRIBUTING.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Contributing to the Editor
2+
==========================
3+
4+
Hey! Many thanks for wanting to improve the editor.
5+
6+
Contributions are welcome without prejudice from *anyone* irrespective of
7+
age, gender, religion, race or sexuality. Good quality code and engagement
8+
with respect, humour and intelligence wins every time.
9+
10+
We expect contributors to follow the Python Software Foundation's Code of
11+
Conduct: https://www.python.org/psf/codeofconduct/
12+
13+
Feedback may be given for contributions and, where necessary, changes will
14+
be politely requested and discussed with the originating author. Respectful
15+
yet robust argument is most welcome.
16+
17+
Checklist
18+
+++++++++
19+
20+
* Your code should be commented in *plain English* (British spelling).
21+
* If your contribution is for a major block of work and you've not done so
22+
already, add yourself to the AUTHORS file following the convention found
23+
therein.
24+
* Try to include tests!
25+
* Have fun!

media/static/editor/LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2015 The Python Software Foundation (http://python.org/)
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

media/static/editor/README.rst

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
BBC micro:bit MicroPython Editor for pythonineducation.org
2+
==========================================================
3+
4+
This project is an editor that targets the MicroPython
5+
(http://micropython.org) version of the Python programming language
6+
(http://python.org/). Code written with this editor is expected to run on the
7+
BBC's micro:bit device (https://en.wikipedia.org/wiki/Micro_Bit).
8+
9+
Developer Setup
10+
---------------
11+
12+
This editor is written to be embedded in the http://pythonineducation.org/
13+
website. It means this project is served within an iFrame in the hosting
14+
website. For this to work for development purposes, you'll need both the
15+
pythonineducation.org site and this project serving locally.
16+
17+
https://github.com/python/pythonineducation.org
18+
19+
Code
20+
++++
21+
22+
* ace - a directory containing the Ace editor (http://ace.c9.io).
23+
* design - a directory containing design resources created by Steve Hawkes.
24+
* editor.html - the page to be embedded within the iFrame in TouchDevelop.
25+
* firmware.hex - copy of the "vanilla" MicroPython firmware used by the editor.
26+
* help.html - a single page user facing help page.
27+
* tests.html - the browser based test runner.
28+
* static - contains css, js and img sub-directories.
29+
* tests - contains the Python specific test suite.
30+
31+
Usage
32+
-----
33+
34+
The Python editor is based upon the "Ace" JavaScript editor (http://ace.c9.io)
35+
and includes syntax highlighting, code folding and (semi) intelligent
36+
auto-indentation.
37+
38+
Following the TouchDevelop conventions, naming scripts is done automatically -
39+
it'll be something like, "distinct script" or "awesome script 2". This also
40+
applies to the description - it's automatically set to "A MicroPython script".
41+
You can change these at any time by clicking on them.
42+
43+
All new scripts default to something simple and sensible.
44+
45+
The layout and functionality apes Microsoft's own editors. Importantly this
46+
includes saving scripts to Microsoft's cloud and sharing them with others via
47+
TouchDevelop's publish functionality.
48+
49+
The four buttons at the top left, act as follows:
50+
51+
* My Scripts - returns you to the main menu listing all your scripts.
52+
* Download - creates a .hex file locally in the user's browser and prompts the user to download it. The resulting file should be copied over to the micro:bit device just like when using all the other editors. The filename will be the name of the script with spaces replaced by "_" and ending in .py. So "extraordinary script" is saved as extraordinary_script.py.
53+
* Snippets - allow user's to write code from pre-defined Python fragments (functions, loops, if...else etc). They are triggered by typing a keyword followed by TAB. For example, type "wh" followed by TAB to insert a while... loop. Clicking on the code snippets button opens up a modal dialog window containing instructions and a table of the available snippets along with their trigger and a short and simple description.
54+
* Help - opens a single page in a new tab that contains user-facing help.
55+
56+
Directly next to the four large buttons are four smaller icons. In the first
57+
column are zoom in and zoom out buttons that make it easy for teachers to
58+
display code via a projector. In the second column the top icon indicates the
59+
script's status (changed, saved locally, saved to the cloud) and the other,
60+
shaped like a bug, will display a log of the events that occured during the
61+
current session of using the editor.
62+
63+
In other TouchDevelop editors there are "compile" and "run" buttons. These
64+
target the TouchDevelop platform to create an AST and either use a third party
65+
service contacted via the network to create a downloadable .hex
66+
file (for the former) or run the code on an embedded simulator (for the
67+
latter).
68+
69+
Since we're targeting MicroPython instead, we simply allow the user to
70+
download their locally generated .hex file. They simply drag the resulting
71+
file onto the device. If you connect to the device (and the script ISN'T in an
72+
infinite loop) you'll be presented with the Python REPL. If there was an error
73+
you should also see an error message.
74+
75+
If you plug in your micro:bit and want to get the REPL you'll need to install
76+
pyserial and run the following command with the appropriate permissions (such
77+
as root, as shockingly demonstrated below)::
78+
79+
$ sudo python -m serial.tools.miniterm -b 115200 /dev/ttyACM0
80+
81+
Remember to replace tty/ACM0 with the appropriate device for your computer.
82+
83+
The .hex file is generated in the following way:
84+
85+
* A "vanilla" version of the MicroPython hex is hidden within the DOM.
86+
* We take the Python code in the editor and turn it into a hex representation.
87+
* We insert the Python derived hex into the correct place within the MicroPython hex.
88+
* The resulting combination is downloaded onto the user's local filesystem for flashing onto the device.
89+
90+
The hidden MicroPython hex is just over 600k. While this sounds large, it's
91+
relatively small when you consider:
92+
93+
* The Guardian's front page is around 1.5mb
94+
* compression is built into the server
95+
* the web has caching built in (we should trust it)
96+
* we actually want kids to view source and find the .hex file in as raw a form as possible.
97+
98+
Finally, we have removed the device simulator from the right hand side and
99+
put something "Pythonic" in its place.
100+
101+
Documentation
102+
-------------
103+
104+
For documentation for this project - you're reading it. ;-)
105+
106+
For in-editor documentation aimed at the user, this is to be done but will
107+
encompass both code snippets and generic help in the help.html file.

media/static/editor/ace/ace.js

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

media/static/editor/ace/ext-beautify.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

media/static/editor/ace/ext-chromevox.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0