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

Add script to regenerate screenshots of editors for documentation #1574

Merged
merged 11 commits into from
Apr 22, 2021

Conversation

aaronayres35
Copy link
Contributor

@aaronayres35 aaronayres35 commented Apr 8, 2021

Part of #1556

This PR adds a script regenerate_example_screenshots.py which looks through all the demo examples for files ending with Editor_demo.py, launches the demo and takes a screenshot of the UI. The screenshot is saved to a .png file of the same name as the demo.

Note, some editors in the docs do not have examples currently, and for others, more than one screenshot is needed. As a result this PR is simply the first step of a larger process towards automating this whole thing. Separate follow up issues/PRs will need to be opened until we are at a place where we have fully automated the regeneration of all the relevant screenshots for the docs.

Much of the code for the script was directly pulled from https://github.com/enthought/traitsui/blob/master/integrationtests/test_all_examples.py

I am also unsure where the script should sit. I will move it as needed (it shouldn't stay where it is) Edit I moved it into a new scripts folder sitting inside the user manual docs.

@@ -699,7 +706,7 @@ same type of editor, regardless of the style specified. Figure 34 shows an HTML
editor in the upper pane, with a code editor in the lower pane, displaying the
uninterpreted text.

.. figure:: images/html_code_editor.png
.. figure:: images/HTMLEditor_demo.png
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This screenshot appears to be messed up. I will revert this.

@rahulporuri rahulporuri deleted the regenerate-docs-screenshots branch April 9, 2021 10:08
@aaronayres35 aaronayres35 restored the regenerate-docs-screenshots branch April 9, 2021 13:58
@aaronayres35 aaronayres35 reopened this Apr 9, 2021
@aaronayres35 aaronayres35 changed the title [WIP] Add script to regenerate screenshots of editors for documentation Add script to regenerate screenshots of editors for documentation Apr 19, 2021
@aaronayres35
Copy link
Contributor Author

aaronayres35 commented Apr 19, 2021

I've opened #1579 and #1580

@rahulporuri rahulporuri added this to Sprint 1 : 5 April - 16 April 2021 in Enthought OSS Q2 2021 Apr 20, 2021
@aaronayres35 aaronayres35 mentioned this pull request Apr 20, 2021
28 tasks
@rahulporuri rahulporuri self-requested a review April 20, 2021 13:55
Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a couple of comments. I guess you were planning on deleting the old image files in a separate PR?

def get_editor_example_filees(python_files):
Editor_demo_files = []
for filename in python_files:
if filename.endswith('Editor_demo.py'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you take a look at the examples to ensure that this convention is followed by all of the relevant examples files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true for all the examples in examples/demo/StandardEditors. There are a couple others which endup having this name eg examples/demo/Advanced/Dynamic_EnumEditor_demo.py which may not yet be currently included in the docs page. Others which do not have this name may potentially be relevant in the docs, but are not currently included. Most of those that do not have this naming convention are showcasing more advanced/specific features and aren't what we would want to screenshot to show in the docs most likely.

This does tie into the need for special handling certain files though, and again this can be done in follow up PR(s) where this script progressively gets more an more complex or other scripts are added

@aaronayres35
Copy link
Contributor Author

I guess you were planning on deleting the old image files in a separate PR?

I'm happy to do that here actually. It is probably easier that way to make sure everything is kept track of / nothing gets forgotten

@aaronayres35 aaronayres35 merged commit 18e35a3 into master Apr 22, 2021
@aaronayres35 aaronayres35 deleted the regenerate-docs-screenshots branch April 22, 2021 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Enthought OSS Q2 2021
  
Sprint 1 : 5 April - 16 April 2021
Development

Successfully merging this pull request may close these issues.

None yet

2 participants