Add screenshot provenance to notebooks #90
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not sure if provenance is really the right word for it, but here it is.
Right now it's using a base64 image of a cat, but the logic is the same and will be replaced with a call to
Map.screenshot
when OpenGeoscience/geojs#665 is merged.This essentially adds a screenshot of the map (hidden to the user) to the Jupyter notebook output each time a python cell is executed. The screenshot is stored in the
.ipynb
file which means that when an export to other formats (such as static HTML) is performed, the user can see step by step what happened to the GeoJS map as python commands were executed.The only really hacky part about this (besides using
_.wrap
) is that we have to hide all PNG output by default with css to avoid our screenshot PNGs flashing on the screen for a second when the user loads the notebook. This means we have to "unhide" the other PNGs when they're rendered (and on load).Integration test forthcoming.