Skip to content

Commit

Permalink
Small documentation updates
Browse files Browse the repository at this point in the history
- changed default Python version from 2.6 to 3.10
  • Loading branch information
usiems authored and mrbean-bremen committed Dec 21, 2023
1 parent d059d72 commit bf9432e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 28 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@ jobs:
which python 2>/dev/null && export PYTHON_VERSION_SUFFIX= || export PYTHON_VERSION_SUFFIX=3
uname -a; gcc --version | grep "gcc"; python${PYTHON_VERSION_SUFFIX} --version; qmake-qt5 --version
echo ============================
export PYTHON_VERSION_SHORT=`python${PYTHON_VERSION_SUFFIX} --version | cut -d " " -f 2 | cut -d "." -f1,2`
if [[ `echo ${PYTHON_VERSION_SHORT} | wc -w` = 0 ]]; then export PYTHON_VERSION_SHORT=2.7; fi
export PYTHON_DIR=`which python${PYTHON_VERSION_SUFFIX} | xargs dirname | xargs dirname`
echo PYTHON_VERSION_SHORT=${PYTHON_VERSION_SHORT}
echo PYTHON_DIR=${PYTHON_DIR}
qmake-qt5 -r PythonQt.pro CONFIG+=${{ matrix.configuration }} \
PYTHON_VERSION=$(python${PYTHON_VERSION_SUFFIX} --version | cut -d " " -f 2 | cut -d "." -f1,2) \
PYTHON_DIR=$(which python${PYTHON_VERSION_SUFFIX} | xargs dirname | xargs dirname)
"PYTHON_VERSION=${PYTHON_VERSION_SHORT}" "PYTHON_DIR=${PYTHON_DIR}"
make -j $(nproc) && make check TESTARGS="-platform offscreen"
- name: Generate Wrappers
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ updating the typesystems as well.
## Building on Windows with MinGW

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

When using the prebuild Python installer, this will be:

```cmd
set PYTHON_PATH=c:\Python311
set PYTHON_LIB=c:\Python311\libs
set PYTHON_VERSION=3.11
set PYTHON_PATH=c:\Python310
set PYTHON_VERSION=3.10
```
14 changes: 5 additions & 9 deletions build/python.prf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# profile to include and link Python


# Change this variable to your python version (2.6, 2.7, 3.3, ...)
# Change this variable to your python version (3.7, 3.8, ...)
isEmpty( PYTHON_VERSION ) {
PYTHON_VERSION=$$(PYTHON_VERSION)
}
isEmpty( PYTHON_VERSION ) {
PYTHON_VERSION=2.7
PYTHON_VERSION=3.10
}

isEmpty( PYTHON_DIR ) {
Expand Down Expand Up @@ -36,7 +36,7 @@ equals(PYTHON_VERSION_MAJOR, 2) {
}

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

# check if debug or release
CONFIG(debug, debug|release) {
Expand Down
47 changes: 35 additions & 12 deletions src/PythonQtDoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ Qt framework</a>.
- QtCore
- QtGui
- QtNetwork
- QtOpenGL
- QtOpenGL (before Qt6)
- QtSql
- QtSvg
- QtWebKit
- QtWebEngineWidgets
- QtWebKit (when available)
- QtXml
- QtXmlPatterns
- QtXmlPatterns (before Qt6)
- QtMultimedia
- QtQml
- QtQuick
Expand Down Expand Up @@ -268,6 +269,27 @@ Qt framework</a>.
\endcode
And this example shows how you can define your own signals and slots:
\code
class MySender(QtCore.QObject):
emitProgress = QtCore.Signal(float) # this is actually a double argument in C++
class MyReceiver(QtCore.QObject):
@QtCore.Slot(float)
def progress(self, value):
print(f"progress: {value}")
sender = MySender()
receiver = MyReceiver()
# connecting with the effective signature:
sender.connect("emitProgress(double)", receiver, "progress(double)")
sender.emitProgress(2.0)
\endcode
\section CPP CPP Wrapping
You can create dedicated wrapper QObjects for any C++ class. This is done by deriving from PythonQtCppWrapperFactory
Expand Down Expand Up @@ -307,6 +329,8 @@ QtCore.QDate.currentDate()
# enum value
QtCore.QFont.UltraCondensed
# or, alternatively
QtCore.QFont.Stretch.UltraCondensed
\endcode
Expand Down Expand Up @@ -453,11 +477,11 @@ yourCpp = None
\page Building Building
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).
PythonQt requires at least Qt 5.0 and Python 2.7.x or Python 3.6 (or higher).
To compile PythonQt, you will need a python developer installation which includes Python's header files and
the python2x.[lib | dll | so | dynlib].
The recommended way to build PythonQt is to use the QMake-based *.pro file.
The build scripts a currently set to use Python 2.6.
The build scripts are currently set to use Python 3.10 by default.
You may need to tweak the \b build/python.prf file to set the correct Python includes and libs on your system.
\subsection Windows
Expand All @@ -468,21 +492,20 @@ the python2x.[lib | dll | so | dynlib].
Python yourself, using your compiler.
To build PythonQt, you need to set the environment variable \b PYTHON_PATH to point to the root
dir of the python installation and \b PYTHON_LIB to point to
the directory where the python lib file is located.
dir of the python installation and \b PYTHON_VERSION should state the used Python version.
When using the prebuild Python installer, this will be:
\code
> set PYTHON_PATH = c:\Python26
> set PYTHON_LIB = c:\Python26\libs
> set PYTHON_PATH = c:\Python310
> set PYTHON_VERSION = 3.10
\endcode
When using the python sources, this will be something like:
\code
> set PYTHON_PATH = c:\yourDir\Python-2.6.1\
> set PYTHON_LIB = c:\yourDir\Python-2.6.1\PCbuild8\Win32
> set PYTHON_PATH = c:\yourDir\Python-3.10.12\
> set PYTHON_VERSION = 3.10
\endcode
To build all, do the following (after setting the above variables):
Expand Down Expand Up @@ -522,7 +545,7 @@ the python2x.[lib | dll | so | dynlib].
You should add PythonQt/lib to your LD_LIBRARY_PATH so that the runtime
linker can find the *.so files.
\subsection MacOsX
\subsection MacOS
On Mac, Python is installed as a Framework, so you should not need to install it.
To build PythonQt, just do a:
Expand Down

0 comments on commit bf9432e

Please sign in to comment.