-
Notifications
You must be signed in to change notification settings - Fork 1
Bundle images #5
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
Conversation
Assumptions are a bit different: * We will list paths on the commandline * We will run from the bundle directory, not from the screenshot maker directory * The path elements 'examples', 'libraries', 'drivers', and 'helpers' can be omitted * A screenshot is generated for each file, and no other .py files are used (though, subdirectories are shown even if they contain no files that would be included) This also still behaves compatibly with the learn repo script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm not understanding how the new mode is meant to operate. I tried running a command like this:
python create_requirement_images.py bundle adafruit-circuitpython-bundle-6.x-mpy-20210527/examples/turtle_swirl.py
But I end up with a different output image:
It looks like it grabbed all of the other directories inside of the examples folder in the bundle. Perhaps it's meant to be run on examples directories inside of individual repos rather than the full bundle itself?
create_requirement_images.py
Outdated
file_hidden_icon = Image.open("img/file_hidden.png") | ||
file_empty_icon = Image.open("img/file_empty.png") | ||
file_empty_hidden_icon = Image.open("img/file_empty_hidden.png") | ||
def asset_path(x): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor, but would be good if we can use asset_name
or filename
or something more descriptive than x
for the parameter here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat! My "TerminalFu" is not quite to the level that I would have figured out how to use find
to automate the whole list like that.
I can work this weekend on trying to filter out folders that are not used for the specific example being built.
My first thought is to check if the code contains the folder name anywhere and not show it if not, this would not be guaranteed to be 100% error proof but should filter out things like the directories in the io library examples I think.
.. this will not work until circuitpython/CircuitPython_Library_Screenshot_Maker#5 is merged.
Typical image (for the "turtle_swirl" example, filename turtle_turtle_swirl py)
Re-uses all the dependency chasing code of the code for Learn but generalizes it a bit so it can be used for library examples.
A subsequent pull-request over in https://github.com/adafruit/Adafruit_CircuitPython_Bundle/ will add automatic generation of these images so that they can also be embedded in the Learn website.