diff options
Diffstat (limited to 'sources')
-rw-r--r-- | sources/pyside2/CMakeLists.txt | 2 | ||||
-rw-r--r-- | sources/pyside2/PySide2/QtSensors/CMakeLists.txt | 106 | ||||
-rw-r--r-- | sources/pyside2/PySide2/QtSensors/typesystem_sensors.xml | 127 | ||||
-rw-r--r-- | sources/pyside2/tests/QtSensors/CMakeLists.txt | 1 | ||||
-rw-r--r-- | sources/pyside2/tests/QtSensors/sensors.py | 55 |
5 files changed, 290 insertions, 1 deletions
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt index 243beabcc..5bd22d62c 100644 --- a/sources/pyside2/CMakeLists.txt +++ b/sources/pyside2/CMakeLists.txt @@ -330,7 +330,7 @@ if(APPLE) endif() # Collect all optional modules. -set(ALL_OPTIONAL_MODULES Xml XmlPatterns Help Multimedia MultimediaWidgets OpenGL Qml Quick QuickWidgets Script ScriptTools TextToSpeech Charts Svg DataVisualization) +set(ALL_OPTIONAL_MODULES Xml XmlPatterns Help Multimedia MultimediaWidgets OpenGL Qml Quick QuickWidgets Script ScriptTools Sensors TextToSpeech Charts Svg DataVisualization) find_package(Qt5UiTools) if(Qt5UiTools_FOUND) list(APPEND ALL_OPTIONAL_MODULES UiTools) diff --git a/sources/pyside2/PySide2/QtSensors/CMakeLists.txt b/sources/pyside2/PySide2/QtSensors/CMakeLists.txt new file mode 100644 index 000000000..226625443 --- /dev/null +++ b/sources/pyside2/PySide2/QtSensors/CMakeLists.txt @@ -0,0 +1,106 @@ +project(QtSensors) + +set(QtSensors_OPTIONAL_SRC ) +set(QtSensors_DROPPED_ENTRIES ) + +set(QtSensors_SRC +# overrides QObject::metaObject() by private method +# ${QtSensors_GEN_DIR}/qsensorgesture_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorgesturemanager_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorgestureplugininterface_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorgesturerecognizer_wrapper.cpp + ${QtSensors_GEN_DIR}/qaccelerometer_wrapper.cpp + ${QtSensors_GEN_DIR}/qaccelerometerfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qaccelerometerreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qaltimeter_wrapper.cpp + ${QtSensors_GEN_DIR}/qaltimeterfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qaltimeterreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qambientlightfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qambientlightreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qambientlightsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qambienttemperaturefilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qambienttemperaturereading_wrapper.cpp + ${QtSensors_GEN_DIR}/qambienttemperaturesensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qcompass_wrapper.cpp + ${QtSensors_GEN_DIR}/qcompassfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qcompassreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qdistancefilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qdistancereading_wrapper.cpp + ${QtSensors_GEN_DIR}/qdistancesensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qgyroscope_wrapper.cpp + ${QtSensors_GEN_DIR}/qgyroscopefilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qgyroscopereading_wrapper.cpp + ${QtSensors_GEN_DIR}/qholsterfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qholsterreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qholstersensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qhumidityfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qhumidityreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qhumiditysensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qirproximityfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qirproximityreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qirproximitysensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qlidfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qlidreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qlidsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qlightfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qlightreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qlightsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qmagnetometer_wrapper.cpp + ${QtSensors_GEN_DIR}/qmagnetometerfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qmagnetometerreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qorientationfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qorientationreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qorientationsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qpressurefilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qpressurereading_wrapper.cpp + ${QtSensors_GEN_DIR}/qpressuresensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qproximityfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qproximityreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qproximitysensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qrotationfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qrotationreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qrotationsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qoutputrange_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorbackend_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorbackendfactory_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensormanager_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorchangesinterface_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorplugininterface_wrapper.cpp + ${QtSensors_GEN_DIR}/qtapfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qtapreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qtapsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qtiltfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qtiltreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qtiltsensor_wrapper.cpp +# module is always needed + ${QtSensors_GEN_DIR}/qtsensors_module_wrapper.cpp +) + +set(QtSensors_include_dirs ${QtSensors_SOURCE_DIR} + ${QtSensors_BINARY_DIR} + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Sensors_INCLUDE_DIRS} + ${SHIBOKEN_INCLUDE_DIR} + ${libpyside_SOURCE_DIR} + ${SHIBOKEN_PYTHON_INCLUDE_DIR} + ${QtCore_GEN_DIR}) + +set(QtSensors_libraries pyside2 + ${SHIBOKEN_PYTHON_LIBRARIES} + ${SHIBOKEN_LIBRARY} + ${Qt5Sensors_LIBRARIES}) + +set(QtSensors_deps QtCore) + +create_pyside_module(QtSensors + QtSensors_include_dirs + QtSensors_libraries + QtSensors_deps + QtSensors_SOURCE_DIR + QtSensors_SRC + "" + "" + QtSensors_DROPPED_ENTRIES) diff --git a/sources/pyside2/PySide2/QtSensors/typesystem_sensors.xml b/sources/pyside2/PySide2/QtSensors/typesystem_sensors.xml new file mode 100644 index 000000000..45d64e0a2 --- /dev/null +++ b/sources/pyside2/PySide2/QtSensors/typesystem_sensors.xml @@ -0,0 +1,127 @@ +<?xml version="1.0"?> +<!-- +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of PySide2. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +--> +<typesystem package="PySide2.QtSensors"> + <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/> +<!-- overrides QObject::metaObject() by private method + <object-type name="QSensorGesture"/> +--> + <object-type name="QSensorGestureManager"/> + <object-type name="QSensorGesturePluginInterface"/> + <object-type name="QSensorGestureRecognizer"/> + <object-type name="QAccelerometer"> + <enum-type name="AccelerationMode"/> + </object-type> + <object-type name="QAccelerometerFilter"/> + <object-type name="QAccelerometerReading"/> + <object-type name="QAltimeter"/> + <object-type name="QAltimeterFilter"/> + <object-type name="QAltimeterReading"/> + <object-type name="QAmbientLightFilter"/> + <object-type name="QAmbientLightReading"> + <enum-type name="LightLevel"/> + </object-type> + <object-type name="QAmbientLightSensor"/> + <object-type name="QAmbientTemperatureFilter"/> + <object-type name="QAmbientTemperatureReading"/> + <object-type name="QAmbientTemperatureSensor"/> + <object-type name="QCompass"/> + <object-type name="QCompassFilter"/> + <object-type name="QCompassReading"/> + <object-type name="QDistanceFilter"/> + <object-type name="QDistanceReading"/> + <object-type name="QDistanceSensor"/> + <object-type name="QGyroscope"/> + <object-type name="QGyroscopeFilter"/> + <object-type name="QGyroscopeReading"/> + <object-type name="QHolsterFilter"/> + <object-type name="QHolsterReading"/> + <object-type name="QHolsterSensor"/> + <object-type name="QHumidityFilter"/> + <object-type name="QHumidityReading"/> + <object-type name="QHumiditySensor"/> + <object-type name="QIRProximityFilter"/> + <object-type name="QIRProximityReading"/> + <object-type name="QIRProximitySensor"/> + <object-type name="QLidFilter"/> + <object-type name="QLidReading"/> + <object-type name="QLidSensor"/> + <object-type name="QLightFilter"/> + <object-type name="QLightReading"/> + <object-type name="QLightSensor"/> + <object-type name="QMagnetometer"/> + <object-type name="QMagnetometerFilter"/> + <object-type name="QMagnetometerReading"/> + <object-type name="QOrientationFilter"/> + <object-type name="QOrientationReading"> + <enum-type name="Orientation"/> + </object-type> + <object-type name="QOrientationSensor"/> + <object-type name="QPressureFilter"/> + <object-type name="QPressureReading"/> + <object-type name="QPressureSensor"/> + <object-type name="QProximityFilter"/> + <object-type name="QProximityReading"/> + <object-type name="QProximitySensor"/> + <object-type name="QRotationFilter"/> + <object-type name="QRotationReading"/> + <object-type name="QRotationSensor"/> + <object-type name="QSensor"> + <enum-type name="Feature"/> + <enum-type name="AxesOrientationMode"/> + </object-type> + <object-type name="QSensorFilter"/> + <object-type name="QSensorReading"/> + <value-type name="qoutputrange"/> + <object-type name="QSensorBackend"/> + <object-type name="QSensorBackendFactory"/> + <object-type name="QSensorManager"/> + <object-type name="QSensorChangesInterface"/> + <object-type name="QSensorPluginInterface"/> + <object-type name="QTapFilter"/> + <object-type name="QTapReading"> + <enum-type name="TapDirection"/> + </object-type> + <object-type name="QTapSensor"/> + <object-type name="QTiltFilter"/> + <object-type name="QTiltReading"/> + <object-type name="QTiltSensor"/> +</typesystem> diff --git a/sources/pyside2/tests/QtSensors/CMakeLists.txt b/sources/pyside2/tests/QtSensors/CMakeLists.txt new file mode 100644 index 000000000..87e548f87 --- /dev/null +++ b/sources/pyside2/tests/QtSensors/CMakeLists.txt @@ -0,0 +1 @@ +PYSIDE_TEST(sensors.py) diff --git a/sources/pyside2/tests/QtSensors/sensors.py b/sources/pyside2/tests/QtSensors/sensors.py new file mode 100644 index 000000000..5b41ac63d --- /dev/null +++ b/sources/pyside2/tests/QtSensors/sensors.py @@ -0,0 +1,55 @@ +#!/usr/bin/python + +############################################################################# +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +'''Test cases for QSensor''' + +from PySide2.QtSensors import QSensor, QSensorReading +import unittest + +class QSensorTest(unittest.TestCase): + def test(self): + for sensorType in QSensor.sensorTypes(): + identifiers = QSensor.sensorsForType(sensorType) + values = [] + usedIdentifier = None + for identifier in identifiers: + sensor = QSensor(sensorType, None); + sensor.setIdentifier(identifier) + if sensor.connectToBackend(): + usedIdentifier = identifier + reading = sensor.reading() + for i in range(0, reading.valueCount()): + values.append(reading.value(i)) + break + if usedIdentifier: + print('Sensor ', sensorType, usedIdentifier, values) + +if __name__ == '__main__': + unittest.main() |