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

[Feature] Set default main program #1903

Open
laurensvalk opened this issue Oct 28, 2024 · 2 comments
Open

[Feature] Set default main program #1903

laurensvalk opened this issue Oct 28, 2024 · 2 comments
Labels
enhancement New feature or request software: pybricks-code Issues with https://code.pybricks.com application

Comments

@laurensvalk
Copy link
Member

My team is putting one file per mission model and one issue is that they often hit play from their mission model file instead of the main file that loads all of them. Any possibility of adding a "default" Play program file?

Originally posted by @davidyang in #1901

@laurensvalk
Copy link
Member Author

Thanks @davidyang for suggesting this.

I've been wondering about this too some times. Use cases:

  • Working on a multi-mission program with one main entry point in another file (OPs case)
  • Working on a library file and having a main program to test it

This is also conventional in full editors, where you might do this with a launch config.

Alternatives considered
Work with __name__ == "__main__" to make this work, but this can get a bit messy with many files.

Implementation idea 1

Mark file as main on file tab with an extra icon there.

Implementation idea 2

Enter main file in somewhere under settings.

Implementation idea 3 (my favorite)
Making this completely persistent in local storage as above could be confusing when you open the editor later to work on something else.

So here's a variant that lets you mark the main file by right clicking on a tab and choosing "mark as starting point".

In fact, since we don't currently have any context dialog for tabs, maybe just double clicking to toggle this will work.

If having an "entry icon" is tricky in this layout framework, we could prefix the displayed name with (main).

image

@dlech dlech added enhancement New feature or request software: pybricks-code Issues with https://code.pybricks.com application labels Oct 28, 2024
@davidyang
Copy link

Hey @laurensvalk - thanks for getting back to me so quickly. For how we use pybricks, the kids don't really switch into and out of projects so having it as a setting that is persisted in localStorage makes sense to me.

If it's just in the tab (or right clicking a tab) I would be concerned about discoverability. This does seem like something that would be in settings if I'm looking for it. (Usually when I'm looking at a code project I'm looking for a run script somewhere in the home directory as a setting).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request software: pybricks-code Issues with https://code.pybricks.com application
Projects
None yet
Development

No branches or pull requests

3 participants