Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT - DO NOT MERGE] Use ml tool output with Python Editor POC #1180

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

microbit-robert
Copy link
Collaborator

This is an alternative to https://github.com/PersonaOASIS/python-editor-v3/tree/ml-area that we can iterate on.

It uses the stubs from https://github.com/PersonaOASIS/micropython-microbit-stubs and the hex from https://github.com/PersonaOASIS/micropython-microbit-v2.

No consideration has been given to supporting other extensions yet.

ml has been renamed to model to match the stubs so that the links to API from the editor work.

Copy link

Preview build will be at
https://review-python-editor-v3.microbit.org/ml-poc/

const json = await readFileAsText(file);
const data = JSON.parse(json) as ActionData[];
this.setMlData(data);
const actionNames = data.map((action) => action.name).join(" ");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action names can have spaces in so this will break. Probably better to have a name per line, but this will require a MicroPython update to change.

@@ -259,7 +291,7 @@ export class ProjectActions {
* @param files the files from drag and drop or an input element.
* @param the type of user event that triggered the load.
*/
load = async (
loadHex = async (
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the best naming, as this function can handle more than just hex files, though it is its main purpose.

content: ModelTopicEntry;
}

const ModelTopicEntry = ({ content }: MlItemProps) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole component is hacky. If we had a markdown alternative for rendering extension documentation, we'd use it here. It's pretty horrible to write the model topic entries in the Sanity format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant