raspberrypi / pico-project-generator

Tool to automatically generate a Pico C SDK Project
BSD 3-Clause "New" or "Revised" License
297 stars 75 forks source link

Separate GUI + CLI from project generation logic #42

Closed matiasilva closed 7 months ago

matiasilva commented 3 years ago

This PR attempts to refactor the entire script into 2 units: "picogenlib" which is a mini library that actually generates the project and the user-facing "cli" and "gui" files. The idea here is that by separating the generation from the user interface, we can programatically create projects, which is useful for unit and/or integration testing (so we don't have our asserts just be shelling out a command..) but also is logically a cleaner separation of code imo. The UI can then be extended and improved while the main generation code base is unchanged. The opposite is also true, more features can be added to the generator, more libs supported, etc while the CLI and GUI remain unchanged.

Additions:

The idea behind separating the CLI and GUI from the main script is that a lot of setting up Tkinter, the cli, etc is boilerplate, or at least code that is not very functionally useful. "picogenlib" is a layer that the CLI and GUI can interact with, while the user interacts with the latter two.

Deletions:

Changes:

Note: this PR is based off my "add-templates" PR/branch so once that is merged I will pull those commits in. Real changes start from f3b5ddb

aallan commented 3 years ago

@matiasilva Can you take a look at the Getting Started with Raspberry Pi Pico book and see what effect this will have on the Project Generator section(s)? This looks like there might well be documentation changes needed after merging.

matiasilva commented 3 years ago

This is now done! Please merge my templating PR first and then this one. After that, I'm planning on adding some real tests and making a few improvements to the GUI.

JamesH65 commented 3 years ago

@matiasilva Hi Matias, I'm trying to test this, but am unable to resolve the conflicts which need to be done on the command line, and I cannot push them back to your repo. Do you have the time to fix the conflicts? Then I can test it all and merge it to master.