-
Notifications
You must be signed in to change notification settings - Fork 95
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
Conversation
…re possible in the docs
…es instead of pyside2
@@ -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 |
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.
This screenshot appears to be messed up. I will revert this.
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.
LGTM with a couple of comments. I guess you were planning on deleting the old image files in a separate PR?
docs/source/traitsui_user_manual/scripts/regenerate_example_screenshots.py
Outdated
Show resolved
Hide resolved
def get_editor_example_filees(python_files): | ||
Editor_demo_files = [] | ||
for filename in python_files: | ||
if filename.endswith('Editor_demo.py'): |
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.
did you take a look at the examples to ensure that this convention is followed by all of the relevant examples files?
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.
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
docs/source/traitsui_user_manual/scripts/regenerate_example_screenshots.py
Show resolved
Hide resolved
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 |
Part of #1556
This PR adds a script
regenerate_example_screenshots.py
which looks through all the demo examples for files ending withEditor_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 newscripts
folder sitting inside the user manual docs.