circuitpython / web-editor

Online web editor for CircuitPython
https://code.circuitpython.org
MIT License
37 stars 18 forks source link

Future Ideas for additional features #20

Open makermelissa opened 2 years ago

makermelissa commented 2 years ago

This issue will mostly serve as a thread that other can contribute to with some ideas for future functionality with the CircuitPython Code Editor. Here's an initial list I came up with based on taking a look at https://python.microbit.org/v/beta:

Feel free to contribute your own ideas.

makermelissa commented 2 years ago

Another idea I had was to support additional language color coding based on file extension that was opened. This would be fairly easy to add.

makermelissa commented 2 years ago

This is more of a "way out there" idea and is probably impractical.

A GUI that allowed a person to create a program interface and add code to the widgets kinda like Visual Basic or Hypercard and it generates a CircuitPython program that somebody could download to a device. Maybe something for PyPortal to start with. Maybe it could make use of the displayio layout library and various UI elements we already have done.

urfdvw commented 2 years ago

In USB workflow. Opening a folder instead of a file is going to make many interesting features possible. For example, instead of creating a new file, download it and drag it into the CIRCUITPY drive, having a directory handle will allow you to directly create a new file on the CIRCUITPY drive edit it. Many other functions like reading the CPY version number from boot_out.txt are also possible in that way.

makermelissa commented 2 years ago

In USB workflow. Opening a folder instead of a file is going to make many interesting features possible. For example, instead of creating a new file, download it and drag it into the CIRCUITPY drive, having a directory handle will allow you to directly create a new file on the CIRCUITPY drive edit it. Many other functions like reading the CPY version number from boot_out.txt are also possible in that way.

Huh, ok. If you know how to to this, or could at least provide further information, that would be great. I tried to implement this using webkitdirectory (as I described in more detail in #15) and it just returned all of the files. Perhaps I didn't explore this option as thoroughly as I should have.

makermelissa commented 2 years ago

Is this what you're referring to? https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle

makermelissa commented 2 years ago

Is this what you're referring to? https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle

Ok, yeah, this looks very promising and is more in line with how I wanted USB workflow to work anyways. I will explore this option very soon. Thanks for the suggestion and pointing me in the right direction.

urfdvw commented 2 years ago

Is this what you're referring to? https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle

Ok, yeah, this looks very promising and is more in line with how I wanted USB workflow to work anyways. I will explore this option very soon. Thanks for the suggestion and pointing me in the right direction.

No problem. Just beware that some of the features are only available in https environment. And even in https I didn't get renaming file working. If you know how please also let me know.

makermelissa commented 2 years ago

Thanks. The intention is to have the USB workflow only run from https://code.circuitpython.org, so #28 would probably need to be completed first.

urfdvw commented 2 years ago

Thanks. The intention is to have the USB workflow only run from https://code.circuitpython.org, so #28 would probably need to be completed first.

Sorry, just want to know a little more. What do you mean by "run from https://code.circuitpython.org/"? Are the workflows currently running somewhere else?

makermelissa commented 2 years ago

Sorry, just want to know a little more. What do you mean by "run from https://code.circuitpython.org/"? Are the workflows currently running somewhere else?

Ah, to get around some browser security issues, Web Workflow loads from the device itself using http. The device loads https://github.com/circuitpython/web-editor/blob/main/assets/js/device.js which pulls in and loads the website. More information is available at https://learn.adafruit.com/getting-started-with-web-workflow-using-the-code-editor/usage.

makermelissa commented 9 months ago

I think the circup-like feature (as mentioned in the first post above) is what would be probably most useful. With Web Workflow, because the file system needs to have USB mass storage disabled, updating libraries becomes really inconvenient.

makermelissa commented 9 months ago

Something that could be built on top of the circ-up feature would be a code scanner that automatically detects the libraries you need and asks if you would like to update/install them.

urfdvw commented 9 months ago

Something that could be built on top of the circ-up feature would be a code scanner that automatically detects the libraries you need and asks if you would like to update/install them.

curious to know what is the best way to pull the latest libraries from front end?

urfdvw commented 9 months ago

One simple but helpful idea:

Open 2 directories

At the moment saving file to CIRCUITPY, make the same update to the local directory.

This is useful for project backup.

makermelissa commented 9 months ago

curious to know what is the best way to pull the latest libraries from front end?

Here's one way I've done it before: https://github.com/adafruit/Adafruit_Dynamic_Bundler, though it likely needs updating for more recent CP versions.

s-light commented 8 months ago

i like the idea to program CP in a visual way

just some thoughts on this

i personally like the flow based version more than the blocky approach as its more of a real visual appealing design..

in general i think it would need a automagic system to parse the libraries and create components for them. (maybe as a build job on the library builds...) as otherwise you have no libs to use.. (its a to big burden for the lib maintainers to generate something special for the editor i think...)

what do you think about this?

would be a PR including some simple beginner friendly visual editor be an option? i think it would make most sens to include this in the web-editor... this way the visual editor is just a different representation of the normal code. (and with this written down i think it will be difficult to follow the flow based approach - as it will be ?very difficult? to generate a flow out of some hand written code?!)

urfdvw commented 8 months ago

i like the idea to program CP in a visual way

just some thoughts on this

i personally like the flow based version more than the blocky approach as its more of a real visual appealing design..

in general i think it would need a automagic system to parse the libraries and create components for them. (maybe as a build job on the library builds...) as otherwise you have no libs to use.. (its a to big burden for the lib maintainers to generate something special for the editor i think...)

what do you think about this?

would be a PR including some simple beginner friendly visual editor be an option? i think it would make most sens to include this in the web-editor... this way the visual editor is just a different representation of the normal code. (and with this written down i think it will be difficult to follow the flow based approach - as it will be ?very difficult? to generate a flow out of some hand written code?!)

Hi @s-light !

Have you checked https://make.playpiper.com/ before? It provides a block based CPY editor and packages for components. There you can ignore the python part, or open the tab to see the generated python code from the blocks. I am not sure if you can edit some part of the python code directly.

s-light commented 8 months ago

no i did not tried this.. as fare as i can tell it uses the blocky editor / MS make. where did you find the packages ? do you know if the editor implementation from them is opensourced?

just also found https://think.cs.vt.edu/blockpy/blockpy/load

so to integrate blockly should be possible..

after more research on flow-based UIs i think there is no easy fitting framework/library out there.. (without writing all the code-generation myself)

so for now i thin blockly is the only option.

and found a good starting point for this: https://github.com/blockpy-edu/BlockMirror

s-light commented 8 months ago

i extracted this in its own featurerequest