Skip to content

Commit bf9432e

Browse files
usiemsmrbean-bremen
authored andcommittedDec 21, 2023
Small documentation updates
- changed default Python version from 2.6 to 3.10
1 parent d059d72 commit bf9432e

File tree

4 files changed

+49
-28
lines changed

4 files changed

+49
-28
lines changed
 

‎.github/workflows/build.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,13 @@ jobs:
117117
which python 2>/dev/null && export PYTHON_VERSION_SUFFIX= || export PYTHON_VERSION_SUFFIX=3
118118
uname -a; gcc --version | grep "gcc"; python${PYTHON_VERSION_SUFFIX} --version; qmake-qt5 --version
119119
echo ============================
120+
export PYTHON_VERSION_SHORT=`python${PYTHON_VERSION_SUFFIX} --version | cut -d " " -f 2 | cut -d "." -f1,2`
121+
if [[ `echo ${PYTHON_VERSION_SHORT} | wc -w` = 0 ]]; then export PYTHON_VERSION_SHORT=2.7; fi
122+
export PYTHON_DIR=`which python${PYTHON_VERSION_SUFFIX} | xargs dirname | xargs dirname`
123+
echo PYTHON_VERSION_SHORT=${PYTHON_VERSION_SHORT}
124+
echo PYTHON_DIR=${PYTHON_DIR}
120125
qmake-qt5 -r PythonQt.pro CONFIG+=${{ matrix.configuration }} \
121-
PYTHON_VERSION=$(python${PYTHON_VERSION_SUFFIX} --version | cut -d " " -f 2 | cut -d "." -f1,2) \
122-
PYTHON_DIR=$(which python${PYTHON_VERSION_SUFFIX} | xargs dirname | xargs dirname)
126+
"PYTHON_VERSION=${PYTHON_VERSION_SHORT}" "PYTHON_DIR=${PYTHON_DIR}"
123127
make -j $(nproc) && make check TESTARGS="-platform offscreen"
124128
125129
- name: Generate Wrappers

‎README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@ updating the typesystems as well.
3636
## Building on Windows with MinGW
3737

3838
To build PythonQt, you need to set the environment variable `PYTHON_PATH` to
39-
point to the root dir of the python installation and `PYTHON_LIB` to point to
40-
the directory where the python lib file is located. Then you should set the
39+
point to the root dir of the python installation. Then you should set the
4140
`PYTHON_VERSION` variable to the Python version number.
4241

4342
When using the prebuild Python installer, this will be:
4443

4544
```cmd
46-
set PYTHON_PATH=c:\Python311
47-
set PYTHON_LIB=c:\Python311\libs
48-
set PYTHON_VERSION=3.11
45+
set PYTHON_PATH=c:\Python310
46+
set PYTHON_VERSION=3.10
4947
```

‎build/python.prf

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# profile to include and link Python
22

33

4-
# Change this variable to your python version (2.6, 2.7, 3.3, ...)
4+
# Change this variable to your python version (3.7, 3.8, ...)
55
isEmpty( PYTHON_VERSION ) {
66
PYTHON_VERSION=$$(PYTHON_VERSION)
77
}
88
isEmpty( PYTHON_VERSION ) {
9-
PYTHON_VERSION=2.7
9+
PYTHON_VERSION=3.10
1010
}
1111

1212
isEmpty( PYTHON_DIR ) {
@@ -36,7 +36,7 @@ equals(PYTHON_VERSION_MAJOR, 2) {
3636
}
3737

3838
contains(PKGCONFIG, "python.*"){
39-
# If `pkg-config` is configured, use `qmake PKGCONFIG+=python3.8-embed CONFIG+=...`
39+
# If `pkg-config` is configured, use `qmake PKGCONFIG+=python3.10-embed CONFIG+=...`
4040
# or `PKGCONFIG+=python2.7m`-like form for older versions,
4141
# see `pkg-config --list-all | grep python` for details.
4242
# This can help with GNU/Linux (including macOS with Homebrew), MSYS2/MinGW environment,
@@ -54,16 +54,12 @@ contains(PKGCONFIG, "python.*"){
5454
# for windows install a Python development kit or build Python yourself from the sources
5555
# Make sure that you set the environment variable PYTHON_PATH to point to your
5656
# python installation (or the python sources/header files when building from source).
57-
# Make sure that you set the environment variable PYTHON_LIB to point to
58-
# the directory where the python libs are located.
5957
#
6058
# When using the prebuild Python installer, this will be:
61-
# set PYTHON_PATH = c:\Python26
62-
# set PYTHON_LIB = c:\Python26\libs
59+
# set PYTHON_PATH = c:\Python310
6360
#
6461
# When using the python sources, this will be something like:
65-
# set PYTHON_PATH = c:\yourDir\Python-2.6.1\
66-
# set PYTHON_LIB = c:\yourDir\Python-2.6.1\PCbuild8\Win32
62+
# set PYTHON_PATH = c:\yourDir\Python-3.10.12\
6763

6864
# check if debug or release
6965
CONFIG(debug, debug|release) {

‎src/PythonQtDoc.h

+35-12
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,13 @@ Qt framework</a>.
112112
- QtCore
113113
- QtGui
114114
- QtNetwork
115-
- QtOpenGL
115+
- QtOpenGL (before Qt6)
116116
- QtSql
117117
- QtSvg
118-
- QtWebKit
118+
- QtWebEngineWidgets
119+
- QtWebKit (when available)
119120
- QtXml
120-
- QtXmlPatterns
121+
- QtXmlPatterns (before Qt6)
121122
- QtMultimedia
122123
- QtQml
123124
- QtQuick
@@ -268,6 +269,27 @@ Qt framework</a>.
268269
269270
\endcode
270271
272+
And this example shows how you can define your own signals and slots:
273+
274+
\code
275+
class MySender(QtCore.QObject):
276+
277+
emitProgress = QtCore.Signal(float) # this is actually a double argument in C++
278+
279+
class MyReceiver(QtCore.QObject):
280+
281+
@QtCore.Slot(float)
282+
def progress(self, value):
283+
print(f"progress: {value}")
284+
285+
sender = MySender()
286+
receiver = MyReceiver()
287+
# connecting with the effective signature:
288+
sender.connect("emitProgress(double)", receiver, "progress(double)")
289+
sender.emitProgress(2.0)
290+
291+
\endcode
292+
271293
\section CPP CPP Wrapping
272294
273295
You can create dedicated wrapper QObjects for any C++ class. This is done by deriving from PythonQtCppWrapperFactory
@@ -307,6 +329,8 @@ QtCore.QDate.currentDate()
307329
308330
# enum value
309331
QtCore.QFont.UltraCondensed
332+
# or, alternatively
333+
QtCore.QFont.Stretch.UltraCondensed
310334
311335
\endcode
312336
@@ -453,11 +477,11 @@ yourCpp = None
453477
454478
\page Building Building
455479
456-
PythonQt requires at least Qt 4.6.1 (for earlier Qt versions, you will need to run the pythonqt_generator, Qt 4.3 is the absolute minimum) and Python 2.6.x/2.7.x or Python 3.3 (or higher).
480+
PythonQt requires at least Qt 5.0 and Python 2.7.x or Python 3.6 (or higher).
457481
To compile PythonQt, you will need a python developer installation which includes Python's header files and
458482
the python2x.[lib | dll | so | dynlib].
459483
The recommended way to build PythonQt is to use the QMake-based *.pro file.
460-
The build scripts a currently set to use Python 2.6.
484+
The build scripts are currently set to use Python 3.10 by default.
461485
You may need to tweak the \b build/python.prf file to set the correct Python includes and libs on your system.
462486
463487
\subsection Windows
@@ -468,21 +492,20 @@ the python2x.[lib | dll | so | dynlib].
468492
Python yourself, using your compiler.
469493
470494
To build PythonQt, you need to set the environment variable \b PYTHON_PATH to point to the root
471-
dir of the python installation and \b PYTHON_LIB to point to
472-
the directory where the python lib file is located.
495+
dir of the python installation and \b PYTHON_VERSION should state the used Python version.
473496
474497
When using the prebuild Python installer, this will be:
475498
476499
\code
477-
> set PYTHON_PATH = c:\Python26
478-
> set PYTHON_LIB = c:\Python26\libs
500+
> set PYTHON_PATH = c:\Python310
501+
> set PYTHON_VERSION = 3.10
479502
\endcode
480503
481504
When using the python sources, this will be something like:
482505
483506
\code
484-
> set PYTHON_PATH = c:\yourDir\Python-2.6.1\
485-
> set PYTHON_LIB = c:\yourDir\Python-2.6.1\PCbuild8\Win32
507+
> set PYTHON_PATH = c:\yourDir\Python-3.10.12\
508+
> set PYTHON_VERSION = 3.10
486509
\endcode
487510
488511
To build all, do the following (after setting the above variables):
@@ -522,7 +545,7 @@ the python2x.[lib | dll | so | dynlib].
522545
You should add PythonQt/lib to your LD_LIBRARY_PATH so that the runtime
523546
linker can find the *.so files.
524547
525-
\subsection MacOsX
548+
\subsection MacOS
526549
527550
On Mac, Python is installed as a Framework, so you should not need to install it.
528551
To build PythonQt, just do a:

0 commit comments

Comments
 (0)