Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix flake8 and typing issuesAdrian Herrmann2024-06-211-7/+7
| | | | | | | | | Fix a number of miscellaneous flake8 and typing issues exposed after updating to the modern typing syntax from 3.10 onwards. Task-number: PYSIDE-2786 Change-Id: I5476d1208dd1da3fa93bdec02bc6124a80b247fc Reviewed-by: Christian Tismer <tismer@stackless.com>
* Use modern typing syntaxAdrian Herrmann2024-06-201-11/+10
| | | | | | | | | | | | We can already use the modern typing syntax introduced with Python 3.10 in 3.9 via future statement definitions, even before we raise the minimum Python version to 3.10. Note that direct expressions with "|" don't work yet. Task-number: PYSIDE-2786 Change-Id: Ie36c140fc960328322502ea29cf6868805a7c558 Reviewed-by: Christian Tismer <tismer@stackless.com>
* 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>
* snippets_translate: Fix repetitive snippet ID linesFriedemann Kleint2023-04-271-4/+11
| | | | | | | | | | | | | | | | | | | | When writing consecutive snippets like // [1] line1 // [1] [2] line2 // [2] the line "// [1] [2]" would appear twice as end marker of snippet 1 and start marker of snippet 2, causing QtXmlToSphinx to extract an empty snippet for [2]. Fix by reconstructing the ID lines to use one ID per line. Task-number: PYSIDE-1106 Pick-to: 6.5 Change-Id: I0d7c0b30ff6bcc51c7d9ea6c9bfc844316a41c67 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* snippets_translate: Warn about possible errorsAdrian Herrmann2023-01-251-0/+1
| | | | | | | | | | | Display a message on top of pages that may contain automatically translated snippets. The message warns about possible errors in translation, and encourages readers to contribute or report errors. Pick-to: 6.4 Fixes: PYSIDE-2111 Change-Id: Ib76c9da5e11934676ab4b102649396cb43f98b92 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* snippets_translate: Fix the license handlingFriedemann Kleint2022-11-261-29/+27
| | | | | | | | | | | Adapt to SPDX licenses, leave the old code path as is. As a drive-by, avoid reading the snippets file twice. Pick-to: 6.4 6.2 Task-number: PYSIDE-1106 Change-Id: Ia518124b09e22d01e37970f30605d94b86123106 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix snippets_translate on Windows, take 2Friedemann Kleint2022-11-231-10/+14
| | | | | | | | | | | Fix another occurrence of opening a file. Amends ed0f55c1d79636040843ae5c5e0d9308e35da65a. Pick-to: 6.4 Change-Id: I7b1fa6068b620acafe51df539ad9379d922277b1 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix snippets_translate on WindowsFriedemann Kleint2022-11-221-5/+10
| | | | | | | | | Force UTF-8 encoding. As a drive-by, use Pathlib methods. Complements 81d81baf0ef6c42ebdb6a2b2293d09031ce6dd5c. Pick-to: 6.4 Change-Id: Iccdb33429a030ec76dc55699b07210cd533ba7c2 Reviewed-by: Christian Tismer <tismer@stackless.com>
* pathlib: migrate tools away from os.pathCristián Maureira-Fredes2022-10-141-2/+2
| | | | | | Task-number: PYSIDE-2080 Change-Id: Id4a16e314df0f47e1a74001a23c825dbfa2956a7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* snippets_translate: Add a way of using snippets from PythonFriedemann Kleint2022-08-111-28/+83
| | | | | | | | | | | | | | Split a helper off the snippet extraction function taking the comment pattern and let it return a dict by id to make it possible to replace snippets by id. Prototypically use it for the modelview tutorial. Fixes: PYSIDE-1984 Task-number: PYSIDE-1952 Pick-to: 6.3 6.2 Change-Id: I05dbc3e36825761fe2968d6507880cd6f588682d Reviewed-by: Christian Tismer <tismer@stackless.com>
* snippets_translate: Replace spaces in overridden snippet ids by '_'Friedemann Kleint2022-08-051-1/+2
| | | | | | | | | | | Amends 22bc41605a4dd18330a39f6346143ec55a7d6074. Manifests as "Quoting ModelView Tutorial". Task-number: PYSIDE-1984 Task-number: PYSIDE-1952 Pick-to: 6.3 6.2 Change-Id: Ie74080136d825adcdaf2348d2e2cd5db35ac1ff7 Reviewed-by: Christian Tismer <tismer@stackless.com>
* snippets_translate: Add a way of overriding snippetsFriedemann Kleint2022-08-031-5/+36
| | | | | | | | | | | | Prototypically fix the QInputDialog dialog snippets. Task-number: PYSIDE-1984 Fixes: PYSIDE-1952 Pick-to: 6.3 6.2 Change-Id: Iad75971b8778a6364123963d28f54f02a0c56737 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* snippet translate: Fix errorFriedemann Kleint2022-08-021-13/+14
| | | | | | | | | | | | | Adapt to get_snippets() returning a list after 168f0c941cefe2fcdaaa12498272f181fe246986: File "pyside-setup-devt/tools/snippets_translate/converter.py", line 21, in snippet_translate if x.strip().startswith("content-type: text/html"): AttributeError: 'list' object has no attribute 'strip' Pick-to: 6.3 6.2 Change-Id: I3366b6fcf7647e24cf50ad7afe1f62ff0d04f9e2 Reviewed-by: Christian Tismer <tismer@stackless.com>
* snippet translate: add option to process directoryCristián Maureira-Fredes2022-06-301-56/+89
| | | | | | | | | | | | Including option to process the snippets inside a directory, and refactoring the general script to adapt this option. Initial-Patch-by: Jaime Resano <gemailpersonal02@gmail.com> Pick-to: 6.2 6.3 Change-Id: I629be8b7c13bc0445279ced73c3159800cd0644d Reviewed-by: Christian Tismer <tismer@stackless.com>
* snippet translate: fix get_snippetsJaime Resano2022-06-291-16/+33
| | | | | | | | | | - Fixed the get_snippets function which did not work properly when more than one snippet id was on the same line. - Tests were added Pick-to: 6.2 6.3 Change-Id: Idffbb0aee258522d7855e2ad0e2b8df61a1872c8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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-2/+1
| | | | | | Change-Id: I8cbf5d521900df4f55abf8f68997f8a71437f722 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Turn snippets_translate / example_gallery into normal CMake targetsFriedemann Kleint2021-12-091-1/+1
| | | | | | | Pick-to: 6.2 Change-Id: Ib318e8f90dda38566da11877ab52f32eba4762f6 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Documentation: Loosen snippet patternFriedemann Kleint2021-12-081-1/+1
| | | | | | | | | Some examples(queuedcustomtype, codeeditor) use '//![snippet]'. Change-Id: If13fd12f8eff8a41a3b8e4f74a7bf3a03c8b39b3 Pick-to: 6.2 Task-number: PYSIDE-1721 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Documentation: Remove the snippets copy stepFriedemann Kleint2021-12-071-12/+7
| | | | | | | | | | This is no longer necessary since the snippets have been removed from the repository. Generate them directly into the build directory. Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: I0a4d9bc3c466b689fa28a982f608104cc5936570 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Documentation: Fix snippets resolutionFriedemann Kleint2021-12-071-64/+13
| | | | | | | | | | | | | | | | | Change snippets_translate to replicate the complete Qt tree including module name under the codesnippet directory. Resolving the snippet is then a matter of replacing the Qt source path by the PySide 6 snippet path in the fallback paths contained in WebXML and checking for the converted .py files. This basically reduces the snippet warnings to 0. Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: I344004ddd1580f96ebf0c132923388ad08852374 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* snippets_translate: Enable all modulesFriedemann Kleint2021-11-291-3/+0
| | | | | | | | | | | | | Fix a fixme commment. To make this pass, make the conditions matches more strict and add some warnings and error handling. Remove the checking of stderr from the CMake statement as this will produce some warnings. Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: I8aeefa8355144d98524a622733d82d337cd3c23b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* snippets_translate: Fix broken loggingFriedemann Kleint2021-11-271-1/+1
| | | | | | | | | Amends 742a39962f1ba9c0e42f387394768c13793144c0 Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: Ib1cbfd99a7a96e902df4f273c0b997e694a6a7a9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* snippets_translate: Handle header files as wellFriedemann Kleint2021-11-271-7/+4
| | | | | | | | | Use suffix .h.py for them to distinguish them from .cpp files. Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: Iea4bfa770833f319b65c1ea7f83fb1a325ce8c62 Reviewed-by: Christian Tismer <tismer@stackless.com>
* snippets_translate: Streamline writing filesFriedemann Kleint2021-11-271-12/+12
| | | | | | | | | | | | | | The code created all example directories first and extracted the snippets to .cpp files which were later moved to .py files to overwrite the snippets in the repository (back then). Write to the Python file directly and create the directory only when needed. This removes a lot of empty directories. Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: I38e695db4aae386be18cd3b85708f684bfa228d5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* snippets_translate: Fix example pathFriedemann Kleint2021-11-271-1/+1
| | | | | | | | | Remove superfluous doc/codesnippets element. Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: Iff81bf9b3dc7a26d3f9c8924a450508ccbdb1dd4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* snippets_translate: Fix parsing of overlapping snippetsFriedemann Kleint2021-11-261-41/+42
| | | | | | | | | | | Change get_snippets() to return a flat list of all snippets. It internally uses a list of active snippet ids to decide whether a line should be included. Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: Ifaa313a7aaa36dd125767b8b0c50a25db637c0ed Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* doc: snippets_translate make quiet mode by defaultCristian Maureira-Fredes2021-04-281-23/+24
| | | | | | | | | | | | | | | | | Without being 'quiet' the script was generating output to the stdout and stderr, which was triggering the cmake instruction to make the build fail This change makes the quiet mode by default, the old output that summarize each snippet file can be obtained by using the '--verbose' option. A new option called '--debug' was introduced to get even more output related to each translation happening per file. Pick-to: 6.0.4 Change-Id: I7fce09f0b60e626c957efc4fe24948e0eaf3db74 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* doc: snippet translate add missing quiet caseCristian Maureira-Fredes2021-03-261-1/+2
| | | | | | Pick-to: 6.0 Change-Id: I6d3520e9544d7d169a9c933a8aa904747bc7c6c4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* doc: enable snippets translate toolCristian Maureira-Fredes2021-03-251-26/+53
| | | | | | | | | | | | | | | | Create snippets directories in case they don't exist. Add "-q" option as the examples directory to keep the "--quiet" option from the build. Something to consider with this patch: Removing all the previous old snippets, which include not only 'cpp' files, but also '.h', '.qdoc', '.qrc', '.png', and '.qml', which might be used in the snippets, but will need to be updated in the generation tool, to not translate, and copy them over. Pick-to: 6.0 Change-Id: Icbef9e1c93a12b90dbcfa990ef055ca6f8868407 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Long live snippets_translate!Cristian Maureira-Fredes2021-03-181-0/+438
This is not a C++ -> Python translator, but a line-by-line conversion tool. This scripts requires two arguments to identify a Qt and PySide directory including the sources. There is a set of file extensions that are currently omitted from the process, and for the ones that will be copied, there will be messages related if the file already exists or if it's new. If you use the '-v' option, you will see the C++ code and the converted Python code, so it's easy to check for issues and missing features. Also, two command line options were added to have a different behavior '--filter' to include a word to filter the full paths of all the snippets found (for example the name of a directory), and '-s/--single' to translate only a specific C++ file to be translated. Including test cases for transformations related to the C++ snippets. Fixes: PYSIDE-691 Pick-to: 6.0 Change-Id: I208e3a9139c7e84fe369a7c2ea93af240d83fa83 Reviewed-by: Christian Tismer <tismer@stackless.com>