aboutsummaryrefslogtreecommitdiffstats
path: root/examples/scriptableapplication/pythonutils.cpp
Commit message (Collapse)AuthorAgeFilesLines
* scriptable application: Actually make the generated module availableFriedemann Kleint2021-01-061-10/+7
| | | | | | | | | | | A call to PyImport_AppendInittab() before Py_Initialize() is required to be able to import the module. Previously, the example would only add the instance of the mainwindow under the "__main__" module. Pick-to: 6.0 Task-number: PYSIDE-841 Change-Id: Ib87ddd9fa9e4dbdcf413abe1d9e6273811fc414c Reviewed-by: Christian Tismer <tismer@stackless.com>
* scriptable application/Unix: Remove setting of PYTHONHOME for virtualenvFriedemann Kleint2021-01-051-3/+1
| | | | | | | | | | | | | On Linux, with 3.8, it causes an error in conjunction with virtualenv: Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding Python runtime state: core initialized ModuleNotFoundError: No module named 'encodings' Pick-to: 6.0 Pick-to: 5.15 Task-number: PYSIDE-841 Change-Id: Ibf1caa1a797faab5dd8e4bfa6eb23296bb7945a5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Revert "Fix running scriptableapplication in a virtualenv on Linux with ↵Friedemann Kleint2020-09-171-0/+2
| | | | | | | | | | | Python 3.8" It still is required for macOS. This reverts commit 38814354ff6a30258b79947304fd3a6be4dc7089. Change-Id: Ic24c113009db9b0ade3a77f147ffc6f452663715 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix running scriptableapplication in a virtualenv on Linux with Python 3.8Friedemann Kleint2020-09-161-2/+0
| | | | | | | | | | | | | | | Remove the environment setting introduced by 435bc2744cd108efc1511bf17117bd4f0de15b43 for Linux. It is required for Windows only due to the changed library load policy. On Linux, it causes: Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding Python runtime state: core initialized ModuleNotFoundError: No module named 'encodings' Task-number: PYSIDE-1236 Change-Id: I58e71f877b6cb754290a4d0ae41518255181fafc Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix running scriptableapplication in a virtualenv on Windows with Python 3.8Friedemann Kleint2020-03-041-4/+20
| | | | | | | | | | As of Python 3.8, Python is no longer is able to run stand-alone in a virtualenv due to missing libraries. Add the path to the modules instead. Task-number: PYSIDE-1236 Change-Id: I4ef1f02925d11900d35cc4e5fcc9f50a5e123c2f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* scriptableapplication: execution as one lineCristian Maureira-Fredes2018-06-061-9/+16
| | | | | | | | | | | | | | | | | | The previous approach executed the entered script line-by-line, it was not possible to execute multi-line statements, for example: for i in range(0, 10): print(i) because PyRun_SimpleString was complaining about the colon. To avoid all these extra steps we can concatenate all the lines into one, and then execute it, instead of creating a temporary file. This will delegate error handling to Python. Change-Id: Idda572aa1b2e3daad2ba1ed9d70f0a8714b8c995 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix scriptableapplication after PEP384Cristian Maureira-Fredes2018-06-051-1/+1
| | | | | | | | | | | | | | Due to the PEP384 many casts related to SbkObjectTypes dropped the `const` because of a change on the signature of the methods like `pointerToPython`, `referenceToPython`, among others. Many examples of these changs can be found in the commit: 18dc31becdd994c53a9f894087cf1ef99fbd0232 file `sbkconverter.cpp`. Change-Id: Id7b9f8e14fd931c686608a89e0d989d9026e0c85 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Change license from all the filesCristian Maureira-Fredes2018-05-031-1/+1
| | | | | | | | | | | | | | | | | Removing the word 'project' from all the headers, and changing the PySide reference from the examples to Qt for Python: The following line was used inside the source/ and build_scripts/ directory: for i in $(grep -r "the Qt for Python project" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/the\ Qt\ for\ Python\ project/Qt\ for\ Python/g' $i;done and the following line was used inside the examples/ directory: for i in $(grep -r "of the PySide" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/of\ the\ PySide/of\ the\ Qt\ for\ Python/g' $i;done Change-Id: Ic480714686ad62ac4d81c670f87f1c2033d4ffa1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Move examples from submodule to pyside-setupFriedemann Kleint2018-01-121-0/+169
Move PySide2 examples that are owned by the Qt Company to a new examples directory. Done-with: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Task-number: PYSIDE-363 Change-Id: I14099764d9eef2bc35e067086121427955862e3a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>