diff --git a/docs/index.rst b/docs/index.rst index e7c1735..a0a8cbe 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -289,6 +289,14 @@ These constants are used in the return value of a `image provider`_ function: **pyotherside.format_data** Encoded image file data (e.g. PNG/JPEG data). +.. versionadded:: 1.3.0 + +The following constants have been added in PyOtherSide 1.3: + +**pyotherside.version** + Version of PyOtherSide as string. + + Data Type Mapping ================= @@ -800,6 +808,7 @@ Version 1.3.0 (UNRELEASED) * Access to the `Qt Resource System`_ from Python (see `Qt Resource Access`_). * QML API 1.3: Import from Qt Resources (:func:`addImportPath` with ``qrc:/``). +* Add ``pyotherside.version`` constant to access version from Python as string. Version 1.2.0 (2014-02-16) -------------------------- diff --git a/examples/events_example.py b/examples/events_example.py index 3fa14c3..01978b8 100644 --- a/examples/events_example.py +++ b/examples/events_example.py @@ -5,6 +5,8 @@ import pyotherside import threading import time +print('Using PyOtherSide version', pyotherside.version) + COLORS = ['red', 'green', 'blue'] def thread_func(): diff --git a/src/qpython_priv.cpp b/src/qpython_priv.cpp index 641449c..de61d9c 100644 --- a/src/qpython_priv.cpp +++ b/src/qpython_priv.cpp @@ -189,6 +189,9 @@ PyOtherSide_init() // Custom constant - pixels are to be interpreted as encoded image file data PyModule_AddIntConstant(pyotherside, "format_data", -1); + // Version of PyOtherSide (new in 1.3) + PyModule_AddStringConstant(pyotherside, "version", PYOTHERSIDE_VERSION); + return pyotherside; }