aboutsummaryrefslogtreecommitdiffstats
path: root/tools/example_gallery/main.py
Commit message (Collapse)AuthorAgeFilesLines
* doc: use footer instead of body for hover textCristián Maureira-Fredes2024-12-161-1/+6
| | | | | | | Pick-to: 6.8 Change-Id: Ia185a68fe276c9b83bd47fdb2b964d22bee5e382 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* doc: fix line joins in the descriptionCristián Maureira-Fredes2024-12-161-1/+1
| | | | | | Pick-to: 6.8 Change-Id: I07da9405e29be26fa12f9efc9b6d180dab30a970 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Documentation/Examples: Fix grid forming corner casesShyamnath Premnadh2024-12-121-28/+66
| | | | | | | | | | | | | | | - Amends 83d745497f4d2db0c95e1b3586049b9d68848f7d - The following corner cases were missed - When the example doesn't have a doc file. In this case, the 'desc' will be empty - When the example has a .md doc file instead of .rst - When the example includes a sphinx reference as the first line Pick-to: 6.8 Change-Id: I0f00b74afb9ca6d5d69a77444ef6a54a87680a14 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Ece Cinucen <ece.cinucen@qt.io>
* Documentation/example_gallery: add card description hoverCristián Maureira-Fredes2024-12-091-9/+42
| | | | | | | | | | | | | - Adding the first paragraph (as much as possible) when the example card is hovered, and use the example headline as the title of the card. - Amends 133e8005def4314320062a9a36d950b8692e6f35 by removing the custom html tag and also merging '.sd-card:hover' into '.sd-card-hover:hover' to avoid duplication. Change-Id: I4edf96a5e61138c88a421e70f16ef9bfe4b4e04d Pick-to: 6.8 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Documentation/example gallery: Handle tutorialsFriedemann Kleint2024-12-061-7/+48
| | | | | | | | | | | | | | | - Add the tutorial title to the example data struct and sort them to the front. - The examples under a module which are tutorials are organized under separate subtitles under the module name. - Change the grid layout for the examples and add a hover effect to the grid. Pick-to: 6.8 Task-number: PYSIDE-1106 Change-Id: I4196667404b9ff27851c2dad198b22c673de9bf9 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* doc: hide examples in dropdownsCristián Maureira-Fredes2024-11-251-10/+9
| | | | | | | | | | Avoid displaying the full grid of examples, and instead provide the option to select first the module to display the cards with the examples. Pick-to: 6.8 Change-Id: I248d3d848a4b262b7faee283b09686d48640f7e2 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* doc: improve a bit the gettingstarted pageCristián Maureira-Fredes2024-08-281-0/+2
| | | | | | | | | | | | | | | Add explanation of Qt Widgets and Qt Quick, remove outdated information, and move the notes around where they make more sense. Add a banner for both technologies, and adding a screenshot of the Quick example. At the end, add a section to point the readers to the Examples and Tutorials sections. Change-Id: Ie3b1856b7150a83633f9747a22057d902fb44b48 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Documentation: Sphinx reference for markdown examplesShyamnath Premnadh2024-08-271-1/+9
| | | | | | | | | - Amends 1d1274a57f65b5d16e0d007cc3062be1dd4146a4 to also consider markdown files. Task-number: PYSIDE-2837 Change-Id: Ie4d64c429221c252602df26e6f6f39226b2a63bd Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* example_gallery: Handle examples which have the pyproject file in the "doc" dirFriedemann Kleint2024-08-211-7/+6
| | | | | | | | | | | | | | | Examples like samplebinding, etc. have a CMakeLists.txt and only a dummy pyproject file in the "doc" dir, which caused the zipping to fail. Modify make_zip_archive() to take the complete target path as an argument and remove the move command. Change one level up if the pyproject file is in "doc". Pick-to: 6.7 Change-Id: Ibf6064e6e0e6a4e24e25348d3a4b52d361ae9560 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Docs: Update examples documentation to use sphinx referencesShyamnath Premnadh2024-08-141-4/+15
| | | | | | | | | | | | | - The autogenerated examples documentation was updated to use sphinx references instead of relative paths because they are easier to maintain. - Additionally the 'bindings.rst' was updated to use the correct sphinx references. This has been historically broken. Task-number: PYSIDE-2837 Change-Id: I0c9f2f2e40dbadf8387e62cae05ff7aa12f43f72 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Python-3.10: Allow the new syntax for Python 3.9Christian Tismer2024-06-201-0/+1
| | | | | | | | Add a future statement to all Python source files. Task-number: PYSIDE-2786 Change-Id: Icd6688c7795a9e16fdcaa829686d57792df27690 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Documentation/example_gallery: List gallery examples firstFriedemann Kleint2024-03-191-1/+6
| | | | | | | | | List widget/graphs/quickcontrols gallery examples first. Pick-to: 6.6 Task-number: PYSIDE-2207 Change-Id: I94aad562a4085c2695bb3d0f592bb7034e6eae26 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Documentation/example_gallery: Fix example sort orderFriedemann Kleint2024-03-181-1/+1
| | | | | | | | | | Sort by name instead of target documentation file, which may contain additional subdirectory components. Pick-to: 6.6 Task-number: PYSIDE-2207 Change-Id: Ic5eacb4cf92614f5a4fd1c9cf489ccf8100a8ce4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Documentation/example_gallery: Add a module sort orderFriedemann Kleint2024-03-181-4/+93
| | | | | | | | | | Add a description data structure for modules specifying type (essentials/addons) and a sort key. Bring QML/Quick/Widgets to the front. Fixes: PYSIDE-2207 Change-Id: I491f28bf72b5be30c94d51323a423cf9f2ddd73c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Documentation/example gallery: Ignore existing directoryFriedemann Kleint2024-02-161-1/+1
| | | | | | | | | build_rst_docs can sometimes result in the directory being present and deletion can fail (particularly on Windows). Pick-to: 6.6 Change-Id: Ib0a4f7db9e5010b6150cbfef8a30f443ce0165ee Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* example_gallery: Handle Qt example directoriesFriedemann Kleint2023-08-031-7/+42
| | | | | | | | | | | | | | | Add an option to be able to include examples found in the Qt / qtdoc repository. The build_rst_docs target also uses it if --qt-src-dir is given. It is then possible to include pure QML C++ examples from the qtdoc and other repositories. Task-number: PYSIDE-2206 Change-Id: I1b28d5ba5a134101a21fa936f87264a68bada71e Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* example_gallery: Introduce a data class for example dataFriedemann Kleint2023-08-031-22/+38
| | | | | | | | Pick-to: 6.5 Task-number: PYSIDE-2206 Change-Id: I64c9862696e9fcb281436aff417d41b96211435e Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* example_gallery: Introduce a data class for example parametersFriedemann Kleint2023-08-031-37/+71
| | | | | | | | Pick-to: 6.5 Task-number: PYSIDE-2206 Change-Id: I2c6157671e9618b77dd6d4f0c54d986ed819481a Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* example_gallery: Extract some subroutinesFriedemann Kleint2023-08-031-28/+45
| | | | | | | | Pick-to: 6.5 Task-number: PYSIDE-2206 Change-Id: I7d1c2ebe23cbbad54de4fdda5bd281217e32f2b7 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add the Qt Graphs widgetgallery exampleFriedemann Kleint2023-07-281-1/+1
| | | | | | | | | It is a copy of the QtDataVisualization graph gallery example adapted to Qt Graphs. Task-number: PYSIDE-2206 Change-Id: I908312b15324dd030f5610508f13299921fafc26 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* example_gallery: Support markdownFriedemann Kleint2023-05-151-27/+64
| | | | | | | | Pick-to: 6.5 Initial-patch-by: Dennis Oberst <dennis.oberst@qt.io> Task-number: PYSIDE-1106 Change-Id: Ia8e1dbe33b859ef235db7612f36f2c225ff89902 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* example_gallery: Use headline in galleryFriedemann Kleint2023-05-121-1/+21
| | | | | | | | | | Retrieve headline and use it instead of the standard "found in dir" text where possible. Pick-to: 6.5 Task-number: PYSIDE-1106 Change-Id: I869e28f14fe1d6b7f477a1e01284f3fff45f4eae Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* example_gallery: Remove existing target directoryFriedemann Kleint2023-05-121-3/+7
| | | | | | | | Pick-to: 6.5 Initial-patch-by: Dennis Oberst <dennis.oberst@qt.io> Task-number: PYSIDE-1106 Change-Id: I76466254b455ac07f8b537e2e758d6720885c128 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* example_gallery: Ensure tutorials are grouped togetherFriedemann Kleint2023-05-041-0/+11
| | | | | | | | | | | | Sort the example lists by rst file key. As a drive-by, also shorten dir names with "advanced". Pick-to: 6.5 Task-number: PYSIDE-1106 Change-Id: I61a4759b5ed41a3f99e7a2a9955c47f8b3fb3ed2 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* example_gallery: Restructure codeFriedemann Kleint2023-05-041-111/+112
| | | | | | | | | | Factor out a function writing one example and a string constant from main. Pick-to: 6.5 Task-number: PYSIDE-1106 Change-Id: I5a1e7626d327c2424b8ec26f9618225d8bf8521e Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* example_gallery: Fix literalinclude for project filesFriedemann Kleint2023-04-281-3/+36
| | | | | | | | | | | | Make it possible to reference code snippets from the example by relative file names. This makes it possible to write tutorial examples. Pick-to: 6.5 Task-number: PYSIDE-1106 Change-Id: Ie95d69c3f98be239e210c9c32b8fc9fb484639f4 Reviewed-by: Keith Kyzivat <keith.kyzivat@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* doc: fix issues with pyside rst filesCristián Maureira-Fredes2023-04-051-0/+1
| | | | | | | | | | Fixing extra indentation, syntax issues, and formatting. Adapting too some snippet line highlights, and many other details. Pick-to: 6.5 Change-Id: Ife4eb5cec03577b2902d409b4007ae6d12141747 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Example gallery tool: Enable per source file documentationFriedemann Kleint2023-03-271-0/+16
| | | | | | | | | | | Make it possible to specify a .rstinc per source file in the doc directory with explanations. Task-number: PYSIDE-1106 Pick-to: 6.5 Change-Id: I7b4fc3faf06e5233b619d036799b19f56f4ef6a7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Example gallery tool: Add more file typesFriedemann Kleint2023-03-251-7/+13
| | | | | | | | | | As a drive-by, streamline the code. Task-number: PYSIDE-1106 Pick-to: 6.5 Change-Id: If996cb6f813a641fb4dd51cad2e41be3b26dcc07 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Example gallery tool: Fix repetitive "_" in generated file namesFriedemann Kleint2023-03-251-1/+1
| | | | | | | | Task-number: PYSIDE-1106 Pick-to: 6.5 Change-Id: I9760fc8ab7fac12cce059455811f906ec33dad49 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* doc: migrate to sphinx-design and update sphinxCristián Maureira-Fredes2023-03-171-29/+20
| | | | | | | | | | | | | | | | | | | | sphinx-panels is deprecated, and sphinx-design is the better replacement. This patch migrates everything we had in pyside and shiboken, which was useful to remove many CSS related hacks for things we were forcing before. The example gallery was also adapted to generate sphinx-design valid code. Additional adaptation to some examples and files were included as well, which improved the overall example experience. We used this to change to update sphinx as well, which before was not possible to update due to sphinx-panels. Fixes: PYSIDE-2244 Change-Id: Ia3f57f536591ea299bf87302e930203b64fafd7e Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* example_gallery: Add .webp image formatFriedemann Kleint2023-03-101-4/+2
| | | | | | | | | | As a drive-by, streamline the code. Task-number: PYSIDE-1106 Task-number: PYSIDE-2206 Change-Id: I8a3ac67aea073479a924d73dd34725c350982686 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* doc: add zip file with examples to downloadCristián Maureira-Fredes2023-03-091-3/+31
| | | | | | | | | | | This adds a new functionality to the example gallery tool to create a ZIP file containing all the example files, and including a button to download it on each example page. Change-Id: I703c1d73bf690f2eaafca1012ccce3947e13a245 Task-number: PYSIDE-2246 Pick-to: 6.4 6.2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* example_gallery: Check if a file existsVenugopal Shivashankar2022-11-161-2/+9
| | | | | | | | | | The files in the pyproject could be missing in some cases, so a check is required before appending to the files list. Pick-to: 6.4 Change-Id: Ifc70eebacb35b72d8a9713a8bf75b321284906ff Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* example_gallery: Switch to UTF-8 encodingAdrian Herrmann2022-09-291-4/+4
| | | | | | | | | Switch the encoding when reading example-related files (code, rst, pyproject etc.) to UTF-8 to enable special characters and 😊. Pick-to: 6.3 Change-Id: I6737875bc9b64d069b8adc478912f4ab4567e28e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Documentation: Fix example gallery after adding the PDF examplesFriedemann Kleint2022-09-131-1/+1
| | | | | | | | | Add further exclusions. Amends 322975d2262a5f31bfa5940451458702e82ee010. Change-Id: I22d68a3835969909fbc0518f327c563c0212dc11 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Documentation/example_gallery: Use relative paths in auto-generated titlesFriedemann Kleint2022-09-121-4/+4
| | | | | | | | | | | | | | Currently, auto-generated titles show up as: /tmp/snapshot-pyside-6.3-rel/pyside-setup/examples/widgets/graphicsview/elasticnodes Use a path relative to the repository instead (examples/widgets/graphicsview/elasticnodes). Task-number: PYSIDE-2056 Pick-to: 6.3 6.2 Change-Id: Idbd301d4e2050517185d67c21ed2befb9e2b8506 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix example_gallery tool failureFriedemann Kleint2022-08-021-1/+7
| | | | | | | | | | | | | Fix paths in chapter6-plugins.pyproject. Amends 5fbdfa3ec1df74368316ab0f3ab2ec03781e0df0. As a drive-by, improve error reporting in the tool. Task-number: PYSIDE-1878 Change-Id: Ib692946ebc4168785bba7f6dd39268fd9ea4e30d Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-271-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I065150015bdb84a3096b5b39c061cf0a20ab637d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* flake8: fix styling issues in tools/Cristián Maureira-Fredes2022-04-021-4/+3
| | | | | | Change-Id: I8cbf5d521900df4f55abf8f68997f8a71437f722 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Documentation: Generate the examples directly into the build directoryFriedemann Kleint2021-12-081-0/+4
| | | | | | Pick-to: 6.2 Change-Id: If395979b5a1efa869b3c1c7cb12b53bd1e8f1f7c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* example_gallery: Handle dummy projects in the doc directoryFriedemann Kleint2021-12-081-19/+21
| | | | | | | | | | | | | Make it possible to have a dummy pyproject file with entries pointing to the parent directory in the doc directory as not to clash with a CMakeLists.txt in the examples directory. Separate the code paths for the pyproject_file and the actual examples directory for this purpose. Pick-to: 6.2 Change-Id: I0a1e583bff8cbb8243ba7526b8b2908f6a3e6e9c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* example_gallery: Support more lexersFriedemann Kleint2021-12-071-2/+8
| | | | | | Pick-to: 6.2 Change-Id: I5ed9a304d061b234fb081ca552d6b732fd370e8e Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix customgeometry.pyproject fileFriedemann Kleint2021-11-291-4/+5
| | | | | | | | | | | | | | | It caused: File "tools/example_gallery/main.py", line 298, in <module> content_f += get_code_tabs(pyproject["files"], out_f) KeyError: 'files' Amends b9ec49942b3ad53343317e631320c58e59736c22. As a drive-by, handle the error in the gallery tool. Pick-to: 6.2 Change-Id: Ideca9ccb72021780cf8ae7b3f2204733cc2f5e4f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* example_gallery: Improve error handlingFriedemann Kleint2021-11-231-5/+13
| | | | | | | | | Print error messages about invalid JSON project files and decoding errors caused by binary files. Treat .jpg files as binary files. Pick-to: 6.2 Change-Id: I3d40789fc4680c7f2918a7a23c3d4fcc98ce9f81 Reviewed-by: Christian Tismer <tismer@stackless.com>
* doc: improve tutorials and stylingCristián Maureira-Fredes2021-09-091-0/+3
| | | | | | | | | | | | | - Creating screenshots for tutorials. - Add gallery style for tutorials. - Add corporate Icons to the frontpage. - tools: Reduce example long names in the gallery. - videos: new order using panels - Add tutorial about "Why Qt for Python" Change-Id: I3ba50f74998399a47b4a34c1de029f3b746aa1e2 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* tools: accept gif for example gallery imagesCristián Maureira-Fredes2021-07-011-1/+1
| | | | | | Pick-to: 6.1 Change-Id: Ic65ce24dc23f477b17e0550184960af37d1704a4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* examples: add default imageCristian Maureira-Fredes2021-06-121-4/+6
| | | | | | | | | | Adding a default image for examples that have no screenshot yet, or are terminal based. Task-number: PYSIDE-841 Pick-to: 6.1 Change-Id: I771173801218654a99f11d1062df12aa10a64eec Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* examples: tweak css for the galleryCristian Maureira-Fredes2021-06-111-2/+7
| | | | | | | | | - Using cards with buttons - Fit images as a cover for each example Task-number: PYSIDE-841 Change-Id: I1702fbad8fabc9d0f9e2a06d46afcf73b4075c8d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* tools: display screenshot in example galleryCristian Maureira-Fredes2021-04-181-2/+28
| | | | | | | | | | | | | | Adding the option to display a screenshot on the example gallery. First, the script will look for an image with the same name as the example, otherwise it will just get the first in alphabetical order. Pick-to: 6.0 Fixes: PYSIDE-1490 Change-Id: Ia0328c84206a3d66854197abe5ecad8d1d28abc5 Reviewed-by: Christian Tismer <tismer@stackless.com>