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

Changes to files which are not the main sketch are not picked up by GUI #458

Open
ademenev opened this issue Jun 9, 2024 · 2 comments
Open

Comments

@ademenev
Copy link

ademenev commented Jun 9, 2024

For small projects it is OK to have all code in one file, but oftentimes my projects are big and should be better split into multiple files. Even though that works, the imported module files are read only once, and not reloaded on code change

@abey79
Copy link
Owner

abey79 commented Jun 11, 2024

I gave it a look.

It's very easy watch, e.g., all Python files that are located in the same directory as the sketch file. The actual reloading is trickier. You could, e.g., blanket eval all of these files, but this can lead to unwanted (even bad) side effects. For example one may have a "cleanup" (or otherwise filesystem interacting) script in that's only meant to be executed manually. It would be ok to trigger a redraw when such a script is modified, but it would not be ok to actually execute it by mistake.

Ideally, we should extract from the sketch script the actual dependencies, and only watch/reload them. It's not immediately obvious to me how to proceed exactly.

@abey79
Copy link
Owner

abey79 commented Jun 11, 2024

Alternatively, we could add some optional API to the sketch class, like a list of additional files to watch/reload, or a flag to opt-in to watch/reload all python files in the same directory.

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

No branches or pull requests

2 participants