diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index c7f70e49..ab1b0ba3 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -96,7 +96,7 @@ jobs: database: ${{ env.BUILD_DIR }} verbosity: 'info' files-changed-only: true - ignore-tidy: '^(PythonQt|mlx90640-library)$' + ignore-tidy: 'PythonQt/**|mlx90640-library/**|**/generated_cpp/**' - name: Clang-tidy exit if: ${{ steps.linter.outputs.checks-failed > 0 }} @@ -113,4 +113,4 @@ jobs: ignore-dirs: '^(PythonQt|mlx90640-library)$' root-dir: ${{ github.workspace }} ignore-header-deps: true - ignore-external-files: true \ No newline at end of file + ignore-external-files: true diff --git a/PythonQt/mjb_rejected_classes.log b/PythonQt/mjb_rejected_classes.log index 95576998..c85a01d9 100644 --- a/PythonQt/mjb_rejected_classes.log +++ b/PythonQt/mjb_rejected_classes.log @@ -1,14 +1,30 @@ ************************************************************************ Not in type system + + + + + + + + + + + + + + + + - + @@ -22,6 +38,8 @@ Not in type system + + @@ -38,30 +56,53 @@ Not in type system ************************************************************************ Generation disabled by type system + + + + + + + + + + + + + + + + + + - + + + + + + - + @@ -75,16 +116,27 @@ Generation disabled by type system + + + + + + + + + + - + + @@ -92,10 +144,12 @@ Generation disabled by type system + + + - @@ -104,15 +158,18 @@ Generation disabled by type system + + + + - diff --git a/PythonQt/mjb_rejected_enums.log b/PythonQt/mjb_rejected_enums.log index 203d66b4..a094f57c 100644 --- a/PythonQt/mjb_rejected_enums.log +++ b/PythonQt/mjb_rejected_enums.log @@ -1,19 +1,22 @@ ************************************************************************ Not in type system + + ************************************************************************ ************************************************************************ Generation disabled by type system - + + ************************************************************************ ************************************************************************ diff --git a/PythonQt/mjb_rejected_fields.log b/PythonQt/mjb_rejected_fields.log index 08785b44..0c696b09 100644 --- a/PythonQt/mjb_rejected_fields.log +++ b/PythonQt/mjb_rejected_fields.log @@ -4,8 +4,10 @@ Not in type system ************************************************************************ Generation disabled by type system +QEvent::d QMetaObject::d QObject::d_ptr +QTabletEvent::mExtra ************************************************************************ ************************************************************************ diff --git a/PythonQt/mjb_rejected_functions.log b/PythonQt/mjb_rejected_functions.log index 88fc7184..52258093 100644 --- a/PythonQt/mjb_rejected_functions.log +++ b/PythonQt/mjb_rejected_functions.log @@ -4,21 +4,18 @@ Not in type system ************************************************************************ Generation disabled by type system -QBrush:: -QBrush::cleanUp -QBrush::data_ptr -QBrush::detach -QBrush::isDetached QByteArray:: QByteArray::data_ptr QByteArray::detach QByteArray::isDetached QColor:: -QCursor:: +QCoreApplication::compressEvent +QCoreApplication::d_func +QEventLoop::d_func +QFile::d_func +QFileDevice::d_func QFont:: QFont::detach -QGradient::interpolationMode -QGradient::setInterpolationMode QIODevice::d_func QImage:: QImage::data_ptr @@ -55,24 +52,25 @@ QObject::receivers QObject::registerUserData QObject::setUserData QObject::userData -QPalette:: -QPalette::detach -QPixmap:: -QPixmap::data_ptr -QPixmap::detach -QPixmap::fromImageInPlace -QPixmap::isDetached QPolygon:: QPolygon::point QPolygon::putPoints QPolygon::setPoint QPolygon::setPoints QPolygonF:: +QQuickItem::d_func +QQuickItem::transform +QQuickPaintedItem::d_func +QQuickTransform::d_func QRegion:: QRegion::cleanUp QRegion::detach -QSizePolicy:: +QTextStream::d_func QTransform:: +QUrl::data_ptr +QUrl::detach +QUrl::isDetached +QVector2D:: QVector::back QVector::begin QVector::cbegin @@ -90,10 +88,6 @@ QVector::isDetached QVector::operator+= QVector::rbegin QVector::rend -QWidget::create -QWidget::d_func -QWidget::find -QWidget::internalWinId Qt::qt_getEnumMetaObject Qt::qt_getEnumName ************************************************************************ @@ -104,6 +98,7 @@ Type redefined to not be a class ************************************************************************ Unmatched argument type +QAccessibleEvent::QAccessibleEvent QAccessibleInterface* QBasicMutex::fastTryLock QMutexData*& QBasicMutex::fastTryUnlock QMutexData*& QByteArray::QByteArray QByteArrayDataPtr @@ -111,14 +106,23 @@ QByteArray::QByteArray Qt::Initialization QByteArray::fromBase64Encoding QByteArray&& QByteArray::fromStdString std::string const& QByteArray::reallocData Data::AllocationOptions -QCursor::bitmap Qt::ReturnByValueConstant -QCursor::mask Qt::ReturnByValueConstant +QCoreApplication::installNativeEventFilter QAbstractNativeEventFilter* +QCoreApplication::qt_metacall QMetaObject::Call +QCoreApplication::qt_static_metacall QMetaObject::Call +QCoreApplication::removeNativeEventFilter QAbstractNativeEventFilter* QDataStream::__lshift__ qfloat16 QDataStream::__lshift__ std::nullptr_t QDataStream::__rshift__ qfloat16& QDataStream::__rshift__ std::nullptr_t& +QEvent::qt_static_metacall QMetaObject::Call +QEventLoop::qt_metacall QMetaObject::Call +QEventLoop::qt_static_metacall QMetaObject::Call +QFile::open FILE* +QFile::qt_metacall QMetaObject::Call +QFile::qt_static_metacall QMetaObject::Call +QFileDevice::qt_metacall QMetaObject::Call +QFileDevice::qt_static_metacall QMetaObject::Call QFont::qt_static_metacall QMetaObject::Call -QGradient::qt_static_metacall QMetaObject::Call QIODevice::qt_metacall QMetaObject::Call QIODevice::qt_static_metacall QMetaObject::Call QImage::QImage QImageCleanupFunction @@ -134,7 +138,13 @@ QList::fromStdList std::list const& QList::isValidIterator iterator const& QList::op_eq_impl QListData::ArrayCompatibleLayout QList::op_eq_impl QListData::NotArrayCompatibleLayout +QLocale::formattedDataSize QLocale::DataSizeFormats +QLocale::qt_static_metacall QMetaObject::Call QMatrix::QMatrix Qt::Initialization +QMetaMethod::invoke QGenericArgument +QMetaMethod::invoke QGenericReturnArgument +QMetaMethod::invokeOnGadget QGenericArgument +QMetaMethod::invokeOnGadget QGenericReturnArgument QMetaObject::invokeMethod QGenericArgument QMetaObject::invokeMethod QGenericReturnArgument QMetaObject::metacall QMetaObject::Call @@ -154,16 +164,32 @@ QObject::qt_metacall QMetaObject::Call QObject::qt_static_metacall QMetaObject::Call QPair::QPair QPair const& QPair::operator_assign QPair const& -QPalette::qt_static_metacall QMetaObject::Call QPixelFormat::get QPixelFormat::Field QPixelFormat::set QPixelFormat::Field -QPixmap::QPixmap QPlatformPixmap* +QQuickItem::grabToImage QJSValue const& +QQuickItem::itemChange QQuickItem::ItemChangeData const& +QQuickItem::mapFromGlobal QQmlV4Function* +QQuickItem::mapFromItem QQmlV4Function* +QQuickItem::mapToGlobal QQmlV4Function* +QQuickItem::mapToItem QQmlV4Function* +QQuickItem::qt_metacall QMetaObject::Call +QQuickItem::qt_static_metacall QMetaObject::Call +QQuickItem::setFlags QQuickItem::Flags +QQuickPaintedItem::itemChange QQuickItem::ItemChangeData const& +QQuickPaintedItem::qt_metacall QMetaObject::Call +QQuickPaintedItem::qt_static_metacall QMetaObject::Call +QQuickPaintedItem::setPerformanceHints QQuickPaintedItem::PerformanceHints +QQuickTransform::qt_metacall QMetaObject::Call +QQuickTransform::qt_static_metacall QMetaObject::Call QSignalBlocker::QSignalBlocker QSignalBlocker&& QSignalBlocker::operator_assign QSignalBlocker&& -QSizePolicy::QSizePolicy Bits -QSizePolicy::qt_static_metacall QMetaObject::Call QStringList::QStringList std::initializer_list +QTabletEvent::qt_static_metacall QMetaObject::Call +QTextStream::QTextStream FILE* +QTouchDevice::qt_static_metacall QMetaObject::Call QTransform::QTransform Qt::Initialization +QUrl::fromUserInput QUrl::UserInputResolutionOptions +QVector2D::QVector2D Qt::Initialization QVector::QVector QArrayDataPointerRef QVector::QVector std::initializer_list QVector::append T&& @@ -175,8 +201,6 @@ QVector::operator_assign std::initializer_list QVector::prepend T&& QVector::realloc QArrayData::AllocationOptions QVector::reallocData QArrayData::AllocationOptions -QWidget::qt_metacall QMetaObject::Call -QWidget::qt_static_metacall QMetaObject::Call trikControl::BatteryInterface::qt_metacall QMetaObject::Call trikControl::BatteryInterface::qt_static_metacall QMetaObject::Call trikControl::BrickFactory::create trikHal::HardwareAbstractionInterface& @@ -204,6 +228,10 @@ trikControl::GyroSensorInterface::qt_metacall QMetaObject::Call trikControl::GyroSensorInterface::qt_static_metacall QMetaObject::Call trikControl::I2cDeviceInterface::qt_metacall QMetaObject::Call trikControl::I2cDeviceInterface::qt_static_metacall QMetaObject::Call +trikControl::InternalBrickInterface::qt_metacall QMetaObject::Call +trikControl::InternalBrickInterface::qt_static_metacall QMetaObject::Call +trikControl::InternalDisplayInterface::qt_metacall QMetaObject::Call +trikControl::InternalDisplayInterface::qt_static_metacall QMetaObject::Call trikControl::IrCameraInterface::qt_metacall QMetaObject::Call trikControl::IrCameraInterface::qt_static_metacall QMetaObject::Call trikControl::KeysInterface::qt_metacall QMetaObject::Call @@ -232,6 +260,8 @@ trikControl::VectorSensorInterface::qt_static_metacall QMetaObject::Call ************************************************************************ Unmatched return type +QAccessibleEvent::accessibleInterface QAccessibleInterface* +QAccessibleEvent::uniqueId QAccessible::Id QBasicMutex::dummyLocked QMutexData* QByteArray::crbegin QByteArray::const_reverse_iterator QByteArray::crend QByteArray::const_reverse_iterator @@ -255,13 +285,16 @@ QMessageLogger::noDebug QNoDebug QMessageLogger::warning QDebug QMetaObject::connect Connection QObject::connectImpl QMetaObject::Connection -QPixmap::handle QPlatformPixmap* +QQuickItem::flags QQuickItem::Flags +QQuickItem::grabToImage QSharedPointer +QQuickPaintedItem::performanceHints QQuickPaintedItem::PerformanceHints QRegion::crbegin QRegion::const_reverse_iterator QRegion::crend QRegion::const_reverse_iterator QRegion::rbegin QRegion::const_reverse_iterator QRegion::rend QRegion::const_reverse_iterator QSysInfo::macVersion QSysInfo::MacVersion QSysInfo::windowsVersion QSysInfo::WinVersion +QTouchEvent::TouchPoint::uniqueId QPointingDeviceUniqueId QVector::toStdVector std::vector Qt::__or__ QFlags Qt::__or__ QFlags diff --git a/PythonQt/runme.sh b/PythonQt/runme.sh index b768fd8d..52cc5000 100755 --- a/PythonQt/runme.sh +++ b/PythonQt/runme.sh @@ -1,13 +1,23 @@ -#!/bin/sh +#!/usr/bin/env bash +set -xeuo # Usage: # QTDIR - Root directory of Qt. # GENERATORPATH - Path to the built PythonQt generator . +SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" +RUNTIME_ROOT="$SCRIPT_DIR"/../ # Build generator with correct qmake and run this than check diffs - QTDIR="$QTDIR" "$GENERATORPATH" \ +QTDIR="$QTDIR" "$GENERATORPATH" \ --no-suppress-warnings \ - --output-directory=../trikScriptRunner/ \ - --include-paths=../trikControl/include:../trikKernel/include:../trikHal/include \ - ../PythonQt/trikControl_export.h \ - typesystem_trikControl.xml > pyqt_generator.log 2>&1 + --output-directory="$RUNTIME_ROOT"/trikScriptRunner/ \ + --include-paths="$RUNTIME_ROOT"/trikControl/include:"$RUNTIME_ROOT"/trikKernel/include:"$RUNTIME_ROOT"/trikHal/include \ + "$SCRIPT_DIR"/trikControl_export.h \ + "$SCRIPT_DIR"/typesystem_trikControl.xml > pyqt_generator.log 2>&1 + +QTDIR="$QTDIR" "$GENERATORPATH" \ + --no-suppress-warnings \ + --output-directory="$RUNTIME_ROOT"/trikScriptRunner/ \ + --include-paths="$SCRIPT_DIR":"$RUNTIME_ROOT"/trikControl/src:"$RUNTIME_ROOT"/trikControl/include \ + "$SCRIPT_DIR"/trikControlInternal_export.h \ + "$SCRIPT_DIR"/typesystem_trikControlInternal.xml > pyqt_generator_internal.log 2>&1 diff --git a/PythonQt/trikControlInternal_export.h b/PythonQt/trikControlInternal_export.h new file mode 100644 index 00000000..43be63ff --- /dev/null +++ b/PythonQt/trikControlInternal_export.h @@ -0,0 +1,5 @@ +#include "trikControl/displayWidgetInterface.h" +#include "trikControl/brickFactory.h" +#include "trikControl_export.h" +#include "internalBrickInterface.h" +#include "internalDisplayInterface.h" diff --git a/PythonQt/trikControl_export.h b/PythonQt/trikControl_export.h index cdbf41b0..59580783 100644 --- a/PythonQt/trikControl_export.h +++ b/PythonQt/trikControl_export.h @@ -1,13 +1,11 @@ #include #include "trikControl/batteryInterface.h" -#include "trikControl/brickFactory.h" #include "trikControl/brickInterface.h" #include "trikControl/cameraDeviceInterface.h" #include "trikControl/colorSensorInterface.h" #include "trikControl/declSpec.h" #include "trikControl/deviceInterface.h" #include "trikControl/displayInterface.h" -#include "trikControl/displayWidgetInterface.h" #include "trikControl/encoderInterface.h" #include "trikControl/eventCodeInterface.h" #include "trikControl/eventDeviceInterface.h" diff --git a/PythonQt/typesystem_quick.xml b/PythonQt/typesystem_quick.xml new file mode 120000 index 00000000..88b49145 --- /dev/null +++ b/PythonQt/typesystem_quick.xml @@ -0,0 +1 @@ +./PythonQt/generator/typesystem_quick.xml \ No newline at end of file diff --git a/PythonQt/typesystem_trikControl.xml b/PythonQt/typesystem_trikControl.xml index 775ed47d..a3571b24 100644 --- a/PythonQt/typesystem_trikControl.xml +++ b/PythonQt/typesystem_trikControl.xml @@ -11,7 +11,6 @@ - @@ -56,6 +55,5 @@ --> - diff --git a/PythonQt/typesystem_trikControlInternal.xml b/PythonQt/typesystem_trikControlInternal.xml new file mode 100644 index 00000000..5a39d0d8 --- /dev/null +++ b/PythonQt/typesystem_trikControlInternal.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/run-clang-format.sh b/run-clang-format.sh index 8d4d29af..93fb40db 100755 --- a/run-clang-format.sh +++ b/run-clang-format.sh @@ -6,6 +6,7 @@ which -a clang-format-15 > /dev/null \ IGNORED_DIRS=( "./trikScriptRunner/generated_cpp/pytrikcontrol" + "./trikScriptRunner/generated_cpp/pytrikcontrolinternal" "./trikHal/src/trik/usbMsp" ) diff --git a/tests/trikJsRunnerTests/trikJsRunnerTest.cpp b/tests/trikJsRunnerTests/trikJsRunnerTest.cpp index 934913cb..08653290 100644 --- a/tests/trikJsRunnerTests/trikJsRunnerTest.cpp +++ b/tests/trikJsRunnerTests/trikJsRunnerTest.cpp @@ -196,6 +196,8 @@ TEST_F(TrikJsRunnerTest, brickInterfaceAccess) ASSERT_TRUE(knownMethodNames.contains("setPower")); auto errCode = run("brick.sensor(A1).read()", "_.js"); ASSERT_EQ(errCode, EXIT_SCRIPT_SUCCESS); + errCode = run("brick.graphicsWidget()", "_.js"); + ASSERT_EQ(errCode, EXIT_SCRIPT_SUCCESS); } TEST_F(TrikJsRunnerTest, fileTestJs) diff --git a/tests/trikPyRunnerTests/trikPyRunnerTest.cpp b/tests/trikPyRunnerTests/trikPyRunnerTest.cpp index 7420f97c..dbae8f61 100644 --- a/tests/trikPyRunnerTests/trikPyRunnerTest.cpp +++ b/tests/trikPyRunnerTests/trikPyRunnerTest.cpp @@ -188,6 +188,12 @@ TEST_F(TrikPyRunnerTest, propertyAndMethodWithSimpleType) ASSERT_EQ(exitCode, EXIT_SCRIPT_SUCCESS); } +TEST_F(TrikPyRunnerTest, methodsIsAccessible) +{ + auto exitCode = run("brick.graphicsWidget()"); + ASSERT_EQ(exitCode, EXIT_SCRIPT_SUCCESS); +} + TEST_F(TrikPyRunnerTest, brickMethodWithNonTrivialReturnTypeConversion) { auto exitCode = run("brick.getStillImage()"); diff --git a/trikControl/include/trikControl/brickInterface.h b/trikControl/include/trikControl/brickInterface.h index cce4fb85..89b19ebe 100644 --- a/trikControl/include/trikControl/brickInterface.h +++ b/trikControl/include/trikControl/brickInterface.h @@ -59,9 +59,6 @@ class TRIKCONTROL_EXPORT BrickInterface : public QObject /// Must emit resetCompleted signal virtual void reset() = 0; - /// Returns a widget on which display output is drawn. - virtual DisplayWidgetInterface *graphicsWidget() = 0; - /// Returns version of system configuration file. virtual QString configVersion() const = 0; @@ -133,6 +130,8 @@ public Q_SLOTS: Q_INVOKABLE virtual trikControl::I2cDeviceInterface *smBusI2c(int bus, int address) = 0; /// Returns i2c device object + // TODO: The default parameter is part of the public API. Consider backward compatibility + // NOLINTNEXTLINE(google-default-arguments) Q_INVOKABLE virtual trikControl::I2cDeviceInterface *i2c(int bus, int address, int regSize = 1) = 0; /// Returns QVector with image using camera on given port (video0 or video1). diff --git a/trikControl/include/trikControl/displayInterface.h b/trikControl/include/trikControl/displayInterface.h index 6df83640..4d090098 100644 --- a/trikControl/include/trikControl/displayInterface.h +++ b/trikControl/include/trikControl/displayInterface.h @@ -18,21 +18,17 @@ #include #include -#include "displayWidgetInterface.h" - #include namespace trikControl { +// TODO: The default parameter is part of the public API. Consider backward compatibility +// NOLINTBEGIN(google-default-arguments) + /// Provides ability to draw something on robot display. class TRIKCONTROL_EXPORT DisplayInterface : public QObject { Q_OBJECT - -public: - /// Returns widget on which everything is drawn. - virtual DisplayWidgetInterface &graphicsWidget() = 0; - public Q_SLOTS: /// Shows given image on a display. /// @param fileName - file name (with path) of an image to show. Refer to Qt documentation for @@ -120,5 +116,5 @@ public Q_SLOTS: }; } - +// NOLINTEND(google-default-arguments) Q_DECLARE_METATYPE(trikControl::DisplayInterface *) diff --git a/trikControl/include/trikControl/displayWidgetInterface.h b/trikControl/include/trikControl/displayWidgetInterface.h index 9a4765a3..75934206 100644 --- a/trikControl/include/trikControl/displayWidgetInterface.h +++ b/trikControl/include/trikControl/displayWidgetInterface.h @@ -43,3 +43,5 @@ class TRIKCONTROL_EXPORT DisplayWidgetInterface : public QQuickPaintedItem }; } + +Q_DECLARE_METATYPE(trikControl::DisplayWidgetInterface *) diff --git a/trikControl/src/brick.h b/trikControl/src/brick.h index 99573e3a..12a3f2b7 100644 --- a/trikControl/src/brick.h +++ b/trikControl/src/brick.h @@ -20,7 +20,7 @@ #include #include #include -#include "brickInterface.h" +#include "internalBrickInterface.h" namespace trikHal { class HardwareAbstractionInterface; @@ -60,7 +60,7 @@ class IrCameraInterface; /// Class representing TRIK controller board and devices installed on it, also provides access /// to peripherals like motors and sensors. /// Is NOT thread-safe. -class /* TRIKCONTROL_EXPORT for ScriptRunner/PythonQt */ TRIKCONTROL_EXPORT Brick : public BrickInterface +class /* TRIKCONTROL_EXPORT for ScriptRunner/PythonQt */ TRIKCONTROL_EXPORT Brick : public InternalBrickInterface { Q_OBJECT @@ -83,7 +83,7 @@ class /* TRIKCONTROL_EXPORT for ScriptRunner/PythonQt */ TRIKCONTROL_EXPORT Bric void reset() override; - DisplayWidgetInterface *graphicsWidget() override; + trikControl::DisplayWidgetInterface *graphicsWidget() override; QString configVersion() const override; @@ -124,7 +124,7 @@ public Q_SLOTS: ObjectSensorInterface *objectSensor(const QString &port) override; - I2cDeviceInterface *i2c(int bus, int address, int regSize = 1) override; + I2cDeviceInterface *i2c(int bus, int address, int regSize) override; I2cDeviceInterface *smBusI2c(int bus, int address) override; diff --git a/trikControl/src/display.h b/trikControl/src/display.h index 70ee5a63..86361723 100644 --- a/trikControl/src/display.h +++ b/trikControl/src/display.h @@ -18,14 +18,14 @@ #include #include -#include "displayInterface.h" +#include "internalDisplayInterface.h" namespace trikControl { class GuiWorker; /// Implementation of display interface for real robot. -class /* TRIKCONTROL_EXPORT for ScriptRunner/PythonQt */ TRIKCONTROL_EXPORT Display : public DisplayInterface +class /* TRIKCONTROL_EXPORT for ScriptRunner/PythonQt */ TRIKCONTROL_EXPORT Display : public InternalDisplayInterface { Q_OBJECT @@ -45,7 +45,7 @@ public Q_SLOTS: void show(const QVector &array, int width, int height, const QString &format) override; - void addLabel(const QString &text, int x, int y, int fontSize = -1) override; + void addLabel(const QString &text, int x, int y, int fontSize) override; void removeLabels() override; void setPainterColor(const QString &color) override; @@ -53,8 +53,8 @@ public Q_SLOTS: void drawLine(int x1, int y1, int x2, int y2) override; void drawPoint(int x, int y) override; - void drawRect(int x, int y, int width, int height, bool filled = false) override; - void drawEllipse(int x, int y, int width, int height, bool filled = false) override; + void drawRect(int x, int y, int width, int height, bool filled) override; + void drawEllipse(int x, int y, int width, int height, bool filled) override; void drawArc(int x, int y, int width, int height, int startAngle, int spanAngle) override; void hide() override; diff --git a/trikControl/src/internalBrickInterface.h b/trikControl/src/internalBrickInterface.h new file mode 100644 index 00000000..d8ad4056 --- /dev/null +++ b/trikControl/src/internalBrickInterface.h @@ -0,0 +1,33 @@ +#pragma once + +/* Copyright 2026 CyberTech Labs Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ + +#include "brickInterface.h" +#include "displayWidgetInterface.h" + +namespace trikControl { + +/// An interface for accessing internal infrastructure. +class TRIKCONTROL_EXPORT InternalBrickInterface: public BrickInterface +{ + Q_OBJECT +public: + /// Returns a widget on which display output is drawn. + Q_INVOKABLE virtual trikControl::DisplayWidgetInterface *graphicsWidget() = 0; +}; + +} + +Q_DECLARE_METATYPE(trikControl::InternalBrickInterface *) diff --git a/trikControl/src/internalDisplayInterface.h b/trikControl/src/internalDisplayInterface.h new file mode 100644 index 00000000..609e0f72 --- /dev/null +++ b/trikControl/src/internalDisplayInterface.h @@ -0,0 +1,33 @@ +#pragma once + +/* Copyright 2026 CyberTech Labs Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ + +#include "displayInterface.h" +#include "displayWidgetInterface.h" + +namespace trikControl { + +/// An interface for accessing internal infrastructure. +class TRIKCONTROL_EXPORT InternalDisplayInterface: public DisplayInterface +{ + Q_OBJECT +public: + /// Returns a widget on which display output is drawn. + Q_INVOKABLE virtual trikControl::DisplayWidgetInterface &graphicsWidget() = 0; +}; + +} + +Q_DECLARE_METATYPE(trikControl::InternalDisplayInterface *) diff --git a/trikControl/trikControl.pro b/trikControl/trikControl.pro index 26cbd0de..b629d07c 100644 --- a/trikControl/trikControl.pro +++ b/trikControl/trikControl.pro @@ -72,6 +72,8 @@ HEADERS += \ $$PWD/src/gamepad.h \ $$PWD/src/graphicsWidget.h \ $$PWD/src/guiWorker.h \ + $$PWD/src/internalBrickInterface.h \ + $$PWD/src/internalDisplayInterface.h \ $$PWD/src/keys.h \ $$PWD/src/keysWorker.h \ $$PWD/src/led.h \ diff --git a/trikScriptRunner/generated_cpp/pytrikcontrol/pytrikcontrol0.cpp b/trikScriptRunner/generated_cpp/pytrikcontrol/pytrikcontrol0.cpp index 6d4ae443..6eef0065 100644 --- a/trikScriptRunner/generated_cpp/pytrikcontrol/pytrikcontrol0.cpp +++ b/trikScriptRunner/generated_cpp/pytrikcontrol/pytrikcontrol0.cpp @@ -1,46 +1,42 @@ #include "pytrikcontrol0.h" -#include <../trikControl/include/trikControl/batteryInterface.h> -#include <../trikControl/include/trikControl/brickFactory.h> -#include <../trikControl/include/trikControl/brickInterface.h> -#include <../trikControl/include/trikControl/cameraDeviceInterface.h> -#include <../trikControl/include/trikControl/colorSensorInterface.h> -#include <../trikControl/include/trikControl/deviceInterface.h> -#include <../trikControl/include/trikControl/displayInterface.h> -#include <../trikControl/include/trikControl/displayWidgetInterface.h> -#include <../trikControl/include/trikControl/encoderInterface.h> -#include <../trikControl/include/trikControl/eventCodeInterface.h> -#include <../trikControl/include/trikControl/eventDeviceInterface.h> -#include <../trikControl/include/trikControl/eventInterface.h> -#include <../trikControl/include/trikControl/fifoInterface.h> -#include <../trikControl/include/trikControl/gamepadInterface.h> -#include <../trikControl/include/trikControl/gyroSensorInterface.h> -#include <../trikControl/include/trikControl/i2cDeviceInterface.h> -#include <../trikControl/include/trikControl/irCameraInterface.h> -#include <../trikControl/include/trikControl/keysInterface.h> -#include <../trikControl/include/trikControl/ledInterface.h> -#include <../trikControl/include/trikControl/lidarInterface.h> -#include <../trikControl/include/trikControl/lineSensorInterface.h> -#include <../trikControl/include/trikControl/markerInterface.h> -#include <../trikControl/include/trikControl/motorInterface.h> -#include <../trikControl/include/trikControl/objectSensorInterface.h> -#include <../trikControl/include/trikControl/pwmCaptureInterface.h> -#include <../trikControl/include/trikControl/sensorInterface.h> -#include <../trikControl/include/trikControl/soundSensorInterface.h> -#include <../trikControl/include/trikControl/vectorSensorInterface.h> -#include <../trikKernel/include/trikKernel/timeVal.h> #include #include #include #include #include -#include #include #include -#include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include @@ -76,22 +72,6 @@ QString PythonQtWrapper_trikControl__BatteryInterface::static_trikControl__Batt -trikControl::BrickFactory* PythonQtWrapper_trikControl__BrickFactory::new_trikControl__BrickFactory() -{ -return new trikControl::BrickFactory(); } - -trikControl::BrickInterface* PythonQtWrapper_trikControl__BrickFactory::static_trikControl__BrickFactory_create(const QString& configFilesPath, const QString& mediaPath) -{ - return (trikControl::BrickFactory::create(configFilesPath, mediaPath)); -} - -trikControl::BrickInterface* PythonQtWrapper_trikControl__BrickFactory::static_trikControl__BrickFactory_create(const QString& systemConfig, const QString& modelConfig, const QString& mediaPath) -{ - return (trikControl::BrickFactory::create(systemConfig, modelConfig, mediaPath)); -} - - - trikControl::VectorSensorInterface* PythonQtWrapper_trikControl__BrickInterface::accelerometer(trikControl::BrickInterface* theWrappedObject) { return ( theWrappedObject->accelerometer()); @@ -152,11 +132,6 @@ QVector PythonQtWrapper_trikControl__BrickInterface::getStillImage(tr return ( theWrappedObject->getStillImage()); } -trikControl::DisplayWidgetInterface* PythonQtWrapper_trikControl__BrickInterface::graphicsWidget(trikControl::BrickInterface* theWrappedObject) -{ - return ( theWrappedObject->graphicsWidget()); -} - trikControl::GyroSensorInterface* PythonQtWrapper_trikControl__BrickInterface::gyroscope(trikControl::BrickInterface* theWrappedObject) { return ( theWrappedObject->gyroscope()); @@ -405,11 +380,6 @@ void PythonQtWrapper_trikControl__DisplayInterface::drawRect(trikControl::Displa ( theWrappedObject->drawRect(x, y, width, height, filled)); } -trikControl::DisplayWidgetInterface* PythonQtWrapper_trikControl__DisplayInterface::graphicsWidget(trikControl::DisplayInterface* theWrappedObject) -{ - return &( theWrappedObject->graphicsWidget()); -} - void PythonQtWrapper_trikControl__DisplayInterface::hide(trikControl::DisplayInterface* theWrappedObject) { ( theWrappedObject->hide()); @@ -477,38 +447,6 @@ QString PythonQtWrapper_trikControl__DisplayInterface::static_trikControl__Disp -void PythonQtWrapper_trikControl__DisplayWidgetInterface::hidden(trikControl::DisplayWidgetInterface* theWrappedObject) -{ - ( theWrappedObject->hidden()); -} - -const QMetaObject* PythonQtWrapper_trikControl__DisplayWidgetInterface::metaObject(trikControl::DisplayWidgetInterface* theWrappedObject) const -{ - return ( theWrappedObject->metaObject()); -} - -void* PythonQtWrapper_trikControl__DisplayWidgetInterface::qt_metacast(trikControl::DisplayWidgetInterface* theWrappedObject, const char* arg__1) -{ - return ( theWrappedObject->qt_metacast(arg__1)); -} - -void PythonQtWrapper_trikControl__DisplayWidgetInterface::shown(trikControl::DisplayWidgetInterface* theWrappedObject) -{ - ( theWrappedObject->shown()); -} - -QString PythonQtWrapper_trikControl__DisplayWidgetInterface::static_trikControl__DisplayWidgetInterface_tr(const char* s, const char* c, int n) -{ - return (trikControl::DisplayWidgetInterface::tr(s, c, n)); -} - -QString PythonQtWrapper_trikControl__DisplayWidgetInterface::static_trikControl__DisplayWidgetInterface_trUtf8(const char* s, const char* c, int n) -{ - return (trikControl::DisplayWidgetInterface::trUtf8(s, c, n)); -} - - - const QMetaObject* PythonQtWrapper_trikControl__EncoderInterface::metaObject(trikControl::EncoderInterface* theWrappedObject) const { return ( theWrappedObject->metaObject()); diff --git a/trikScriptRunner/generated_cpp/pytrikcontrol/pytrikcontrol0.h b/trikScriptRunner/generated_cpp/pytrikcontrol/pytrikcontrol0.h index 840fca95..a8a2d76b 100644 --- a/trikScriptRunner/generated_cpp/pytrikcontrol/pytrikcontrol0.h +++ b/trikScriptRunner/generated_cpp/pytrikcontrol/pytrikcontrol0.h @@ -1,44 +1,40 @@ -#include <../trikControl/include/trikControl/batteryInterface.h> -#include <../trikControl/include/trikControl/brickFactory.h> -#include <../trikControl/include/trikControl/brickInterface.h> -#include <../trikControl/include/trikControl/cameraDeviceInterface.h> -#include <../trikControl/include/trikControl/colorSensorInterface.h> -#include <../trikControl/include/trikControl/deviceInterface.h> -#include <../trikControl/include/trikControl/displayInterface.h> -#include <../trikControl/include/trikControl/displayWidgetInterface.h> -#include <../trikControl/include/trikControl/encoderInterface.h> -#include <../trikControl/include/trikControl/eventCodeInterface.h> -#include <../trikControl/include/trikControl/eventDeviceInterface.h> -#include <../trikControl/include/trikControl/eventInterface.h> -#include <../trikControl/include/trikControl/fifoInterface.h> -#include <../trikControl/include/trikControl/gamepadInterface.h> -#include <../trikControl/include/trikControl/gyroSensorInterface.h> -#include <../trikControl/include/trikControl/i2cDeviceInterface.h> -#include <../trikControl/include/trikControl/irCameraInterface.h> -#include <../trikControl/include/trikControl/keysInterface.h> -#include <../trikControl/include/trikControl/ledInterface.h> -#include <../trikControl/include/trikControl/lidarInterface.h> -#include <../trikControl/include/trikControl/lineSensorInterface.h> -#include <../trikControl/include/trikControl/markerInterface.h> -#include <../trikControl/include/trikControl/motorInterface.h> -#include <../trikControl/include/trikControl/objectSensorInterface.h> -#include <../trikControl/include/trikControl/pwmCaptureInterface.h> -#include <../trikControl/include/trikControl/sensorInterface.h> -#include <../trikControl/include/trikControl/soundSensorInterface.h> -#include <../trikControl/include/trikControl/vectorSensorInterface.h> -#include <../trikKernel/include/trikKernel/timeVal.h> #include #include #include #include -#include #include #include -#include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include @@ -81,20 +77,6 @@ void delete_trikControl__BatteryInterface(trikControl::BatteryInterface* obj) { -class PythonQtWrapper_trikControl__BrickFactory : public QObject -{ Q_OBJECT -public: -public Q_SLOTS: -trikControl::BrickFactory* new_trikControl__BrickFactory(); -void delete_trikControl__BrickFactory(trikControl::BrickFactory* obj) { delete obj; } - trikControl::BrickInterface* static_trikControl__BrickFactory_create(const QString& configFilesPath = ".", const QString& mediaPath = "."); - trikControl::BrickInterface* static_trikControl__BrickFactory_create(const QString& systemConfig, const QString& modelConfig, const QString& mediaPath); -}; - - - - - class PythonQtPublicPromoter_trikControl__BrickInterface : public trikControl::BrickInterface { public: inline trikControl::VectorSensorInterface* py_q_accelerometer() { return this->accelerometer(); } @@ -109,7 +91,6 @@ inline trikControl::EventDeviceInterface* py_q_eventDevice(const QString& devi inline trikControl::FifoInterface* py_q_fifo(const QString& port) { return this->fifo(port); } inline trikControl::GamepadInterface* py_q_gamepad() { return this->gamepad(); } inline QVector py_q_getStillImage() { return this->getStillImage(); } -inline trikControl::DisplayWidgetInterface* py_q_graphicsWidget() { return this->graphicsWidget(); } inline trikControl::GyroSensorInterface* py_q_gyroscope() { return this->gyroscope(); } inline trikControl::I2cDeviceInterface* py_q_i2c(int bus, int address, int regSize = 1) { return this->i2c(bus, address, regSize); } inline trikControl::IrCameraInterface* py_q_irCamera() { return this->irCamera(); } @@ -166,8 +147,6 @@ void delete_trikControl__BrickInterface(trikControl::BrickInterface* obj) { dele trikControl::GamepadInterface* py_q_gamepad(trikControl::BrickInterface* theWrappedObject){ return (((PythonQtPublicPromoter_trikControl__BrickInterface*)theWrappedObject)->py_q_gamepad());} QVector getStillImage(trikControl::BrickInterface* theWrappedObject); QVector py_q_getStillImage(trikControl::BrickInterface* theWrappedObject){ return (((PythonQtPublicPromoter_trikControl__BrickInterface*)theWrappedObject)->py_q_getStillImage());} - trikControl::DisplayWidgetInterface* graphicsWidget(trikControl::BrickInterface* theWrappedObject); - trikControl::DisplayWidgetInterface* py_q_graphicsWidget(trikControl::BrickInterface* theWrappedObject){ return (((PythonQtPublicPromoter_trikControl__BrickInterface*)theWrappedObject)->py_q_graphicsWidget());} trikControl::GyroSensorInterface* gyroscope(trikControl::BrickInterface* theWrappedObject); trikControl::GyroSensorInterface* py_q_gyroscope(trikControl::BrickInterface* theWrappedObject){ return (((PythonQtPublicPromoter_trikControl__BrickInterface*)theWrappedObject)->py_q_gyroscope());} trikControl::I2cDeviceInterface* i2c(trikControl::BrickInterface* theWrappedObject, int bus, int address, int regSize = 1); @@ -311,7 +290,6 @@ inline void py_q_drawEllipse(int x, int y, int width, int height, bool fill inline void py_q_drawLine(int x1, int y1, int x2, int y2) { this->drawLine(x1, y1, x2, y2); } inline void py_q_drawPoint(int x, int y) { this->drawPoint(x, y); } inline void py_q_drawRect(int x, int y, int width, int height, bool filled = false) { this->drawRect(x, y, width, height, filled); } -inline trikControl::DisplayWidgetInterface& py_q_graphicsWidget() { return this->graphicsWidget(); } inline void py_q_hide() { this->hide(); } inline const QMetaObject* py_q_metaObject() const { return trikControl::DisplayInterface::metaObject(); } inline void* py_q_qt_metacast(const char* arg__1) { return trikControl::DisplayInterface::qt_metacast(arg__1); } @@ -344,8 +322,6 @@ void delete_trikControl__DisplayInterface(trikControl::DisplayInterface* obj) { void py_q_drawPoint(trikControl::DisplayInterface* theWrappedObject, int x, int y){ (((PythonQtPublicPromoter_trikControl__DisplayInterface*)theWrappedObject)->py_q_drawPoint(x, y));} void drawRect(trikControl::DisplayInterface* theWrappedObject, int x, int y, int width, int height, bool filled = false); void py_q_drawRect(trikControl::DisplayInterface* theWrappedObject, int x, int y, int width, int height, bool filled = false){ (((PythonQtPublicPromoter_trikControl__DisplayInterface*)theWrappedObject)->py_q_drawRect(x, y, width, height, filled));} - trikControl::DisplayWidgetInterface* graphicsWidget(trikControl::DisplayInterface* theWrappedObject); - trikControl::DisplayWidgetInterface* py_q_graphicsWidget(trikControl::DisplayInterface* theWrappedObject){ return &(((PythonQtPublicPromoter_trikControl__DisplayInterface*)theWrappedObject)->py_q_graphicsWidget());} void hide(trikControl::DisplayInterface* theWrappedObject); void py_q_hide(trikControl::DisplayInterface* theWrappedObject){ (((PythonQtPublicPromoter_trikControl__DisplayInterface*)theWrappedObject)->py_q_hide());} const QMetaObject* metaObject(trikControl::DisplayInterface* theWrappedObject) const; @@ -376,31 +352,6 @@ void delete_trikControl__DisplayInterface(trikControl::DisplayInterface* obj) { -class PythonQtPublicPromoter_trikControl__DisplayWidgetInterface : public trikControl::DisplayWidgetInterface -{ public: -inline const QMetaObject* py_q_metaObject() const { return trikControl::DisplayWidgetInterface::metaObject(); } -inline void* py_q_qt_metacast(const char* arg__1) { return trikControl::DisplayWidgetInterface::qt_metacast(arg__1); } -}; - -class PythonQtWrapper_trikControl__DisplayWidgetInterface : public QObject -{ Q_OBJECT -public: -public Q_SLOTS: -void delete_trikControl__DisplayWidgetInterface(trikControl::DisplayWidgetInterface* obj) { delete obj; } - void hidden(trikControl::DisplayWidgetInterface* theWrappedObject); - const QMetaObject* metaObject(trikControl::DisplayWidgetInterface* theWrappedObject) const; - const QMetaObject* py_q_metaObject(trikControl::DisplayWidgetInterface* theWrappedObject) const{ return (((PythonQtPublicPromoter_trikControl__DisplayWidgetInterface*)theWrappedObject)->py_q_metaObject());} - void* qt_metacast(trikControl::DisplayWidgetInterface* theWrappedObject, const char* arg__1); - void* py_q_qt_metacast(trikControl::DisplayWidgetInterface* theWrappedObject, const char* arg__1){ return (((PythonQtPublicPromoter_trikControl__DisplayWidgetInterface*)theWrappedObject)->py_q_qt_metacast(arg__1));} - void shown(trikControl::DisplayWidgetInterface* theWrappedObject); - QString static_trikControl__DisplayWidgetInterface_tr(const char* s, const char* c = nullptr, int n = -1); - QString static_trikControl__DisplayWidgetInterface_trUtf8(const char* s, const char* c = nullptr, int n = -1); -}; - - - - - class PythonQtPublicPromoter_trikControl__EncoderInterface : public trikControl::EncoderInterface { public: inline const QMetaObject* py_q_metaObject() const { return trikControl::EncoderInterface::metaObject(); } diff --git a/trikScriptRunner/generated_cpp/pytrikcontrol/pytrikcontrol_init.cpp b/trikScriptRunner/generated_cpp/pytrikcontrol/pytrikcontrol_init.cpp index 2c17bd36..8d27d6b8 100644 --- a/trikScriptRunner/generated_cpp/pytrikcontrol/pytrikcontrol_init.cpp +++ b/trikScriptRunner/generated_cpp/pytrikcontrol/pytrikcontrol_init.cpp @@ -8,7 +8,6 @@ void PythonQt_init_PyTrikControl(PyObject* module) { PythonQt::priv()->registerCPPClass("trikControl", "", "PyTrikControl", PythonQtCreateObject, nullptr, module, 0); PythonQt::priv()->registerClass(&trikControl::BatteryInterface::staticMetaObject, "PyTrikControl", PythonQtCreateObject, nullptr, module, 0); PythonQt::self()->addParentClass("trikControl::BatteryInterface", "trikControl::DeviceInterface",PythonQtUpcastingOffset()); -PythonQt::priv()->registerCPPClass("trikControl::BrickFactory", "", "PyTrikControl", PythonQtCreateObject, nullptr, module, 0); PythonQt::priv()->registerClass(&trikControl::BrickInterface::staticMetaObject, "PyTrikControl", PythonQtCreateObject, nullptr, module, 0); PythonQt::priv()->registerCPPClass("trikControl::CameraDeviceInterface", "", "PyTrikControl", PythonQtCreateObject, nullptr, module, 0); PythonQt::self()->addParentClass("trikControl::CameraDeviceInterface", "trikControl::DeviceInterface",PythonQtUpcastingOffset()); @@ -16,7 +15,6 @@ PythonQt::priv()->registerClass(&trikControl::ColorSensorInterface::staticMetaOb PythonQt::self()->addParentClass("trikControl::ColorSensorInterface", "trikControl::DeviceInterface",PythonQtUpcastingOffset()); PythonQt::priv()->registerCPPClass("trikControl::DeviceInterface", "", "PyTrikControl", PythonQtCreateObject, nullptr, module, 0); PythonQt::priv()->registerClass(&trikControl::DisplayInterface::staticMetaObject, "PyTrikControl", PythonQtCreateObject, nullptr, module, 0); -PythonQt::priv()->registerClass(&trikControl::DisplayWidgetInterface::staticMetaObject, "PyTrikControl", PythonQtCreateObject, nullptr, module, 0); PythonQt::priv()->registerClass(&trikControl::EncoderInterface::staticMetaObject, "PyTrikControl", PythonQtCreateObject, nullptr, module, 0); PythonQt::self()->addParentClass("trikControl::EncoderInterface", "trikControl::DeviceInterface",PythonQtUpcastingOffset()); PythonQt::priv()->registerClass(&trikControl::EventCodeInterface::staticMetaObject, "PyTrikControl", PythonQtCreateObject, nullptr, module, 0); diff --git a/trikScriptRunner/generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal.pri b/trikScriptRunner/generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal.pri new file mode 100644 index 00000000..ee4d09e0 --- /dev/null +++ b/trikScriptRunner/generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal.pri @@ -0,0 +1,6 @@ +HEADERS += \ + $$PWD/pytrikcontrolinternal0.h \ + +SOURCES += \ + $$PWD/pytrikcontrolinternal0.cpp \ + $$PWD/pytrikcontrolinternal_init.cpp diff --git a/trikScriptRunner/generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal0.cpp b/trikScriptRunner/generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal0.cpp new file mode 100644 index 00000000..b243f590 --- /dev/null +++ b/trikScriptRunner/generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal0.cpp @@ -0,0 +1,125 @@ +#include "pytrikcontrolinternal0.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +trikControl::BrickFactory* PythonQtWrapper_trikControl__BrickFactory::new_trikControl__BrickFactory() +{ +return new trikControl::BrickFactory(); } + +trikControl::BrickInterface* PythonQtWrapper_trikControl__BrickFactory::static_trikControl__BrickFactory_create(const QString& configFilesPath, const QString& mediaPath) +{ + return (trikControl::BrickFactory::create(configFilesPath, mediaPath)); +} + +trikControl::BrickInterface* PythonQtWrapper_trikControl__BrickFactory::static_trikControl__BrickFactory_create(const QString& systemConfig, const QString& modelConfig, const QString& mediaPath) +{ + return (trikControl::BrickFactory::create(systemConfig, modelConfig, mediaPath)); +} + + + +void PythonQtWrapper_trikControl__DisplayWidgetInterface::hidden(trikControl::DisplayWidgetInterface* theWrappedObject) +{ + ( theWrappedObject->hidden()); +} + +const QMetaObject* PythonQtWrapper_trikControl__DisplayWidgetInterface::metaObject(trikControl::DisplayWidgetInterface* theWrappedObject) const +{ + return ( theWrappedObject->metaObject()); +} + +void* PythonQtWrapper_trikControl__DisplayWidgetInterface::qt_metacast(trikControl::DisplayWidgetInterface* theWrappedObject, const char* arg__1) +{ + return ( theWrappedObject->qt_metacast(arg__1)); +} + +void PythonQtWrapper_trikControl__DisplayWidgetInterface::shown(trikControl::DisplayWidgetInterface* theWrappedObject) +{ + ( theWrappedObject->shown()); +} + +QString PythonQtWrapper_trikControl__DisplayWidgetInterface::static_trikControl__DisplayWidgetInterface_tr(const char* s, const char* c, int n) +{ + return (trikControl::DisplayWidgetInterface::tr(s, c, n)); +} + +QString PythonQtWrapper_trikControl__DisplayWidgetInterface::static_trikControl__DisplayWidgetInterface_trUtf8(const char* s, const char* c, int n) +{ + return (trikControl::DisplayWidgetInterface::trUtf8(s, c, n)); +} + + + +trikControl::DisplayWidgetInterface* PythonQtWrapper_trikControl__InternalBrickInterface::graphicsWidget(trikControl::InternalBrickInterface* theWrappedObject) +{ + return ( theWrappedObject->graphicsWidget()); +} + +QString PythonQtWrapper_trikControl__InternalBrickInterface::static_trikControl__InternalBrickInterface_tr(const char* s, const char* c, int n) +{ + return (trikControl::InternalBrickInterface::tr(s, c, n)); +} + +QString PythonQtWrapper_trikControl__InternalBrickInterface::static_trikControl__InternalBrickInterface_trUtf8(const char* s, const char* c, int n) +{ + return (trikControl::InternalBrickInterface::trUtf8(s, c, n)); +} + + + +trikControl::DisplayWidgetInterface* PythonQtWrapper_trikControl__InternalDisplayInterface::graphicsWidget(trikControl::InternalDisplayInterface* theWrappedObject) +{ + return &( theWrappedObject->graphicsWidget()); +} + +QString PythonQtWrapper_trikControl__InternalDisplayInterface::static_trikControl__InternalDisplayInterface_tr(const char* s, const char* c, int n) +{ + return (trikControl::InternalDisplayInterface::tr(s, c, n)); +} + +QString PythonQtWrapper_trikControl__InternalDisplayInterface::static_trikControl__InternalDisplayInterface_trUtf8(const char* s, const char* c, int n) +{ + return (trikControl::InternalDisplayInterface::trUtf8(s, c, n)); +} + + diff --git a/trikScriptRunner/generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal0.h b/trikScriptRunner/generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal0.h new file mode 100644 index 00000000..dd9747ad --- /dev/null +++ b/trikScriptRunner/generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal0.h @@ -0,0 +1,131 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +class PythonQtWrapper_trikControl__BrickFactory : public QObject +{ Q_OBJECT +public: +public Q_SLOTS: +trikControl::BrickFactory* new_trikControl__BrickFactory(); +void delete_trikControl__BrickFactory(trikControl::BrickFactory* obj) { delete obj; } + trikControl::BrickInterface* static_trikControl__BrickFactory_create(const QString& configFilesPath = ".", const QString& mediaPath = "."); + trikControl::BrickInterface* static_trikControl__BrickFactory_create(const QString& systemConfig, const QString& modelConfig, const QString& mediaPath); +}; + + + + + +class PythonQtPublicPromoter_trikControl__DisplayWidgetInterface : public trikControl::DisplayWidgetInterface +{ public: +inline const QMetaObject* py_q_metaObject() const { return trikControl::DisplayWidgetInterface::metaObject(); } +inline void* py_q_qt_metacast(const char* arg__1) { return trikControl::DisplayWidgetInterface::qt_metacast(arg__1); } +}; + +class PythonQtWrapper_trikControl__DisplayWidgetInterface : public QObject +{ Q_OBJECT +public: +public Q_SLOTS: +void delete_trikControl__DisplayWidgetInterface(trikControl::DisplayWidgetInterface* obj) { delete obj; } + void hidden(trikControl::DisplayWidgetInterface* theWrappedObject); + const QMetaObject* metaObject(trikControl::DisplayWidgetInterface* theWrappedObject) const; + const QMetaObject* py_q_metaObject(trikControl::DisplayWidgetInterface* theWrappedObject) const{ return (((PythonQtPublicPromoter_trikControl__DisplayWidgetInterface*)theWrappedObject)->py_q_metaObject());} + void* qt_metacast(trikControl::DisplayWidgetInterface* theWrappedObject, const char* arg__1); + void* py_q_qt_metacast(trikControl::DisplayWidgetInterface* theWrappedObject, const char* arg__1){ return (((PythonQtPublicPromoter_trikControl__DisplayWidgetInterface*)theWrappedObject)->py_q_qt_metacast(arg__1));} + void shown(trikControl::DisplayWidgetInterface* theWrappedObject); + QString static_trikControl__DisplayWidgetInterface_tr(const char* s, const char* c = nullptr, int n = -1); + QString static_trikControl__DisplayWidgetInterface_trUtf8(const char* s, const char* c = nullptr, int n = -1); +}; + + + + + +class PythonQtPublicPromoter_trikControl__InternalBrickInterface : public trikControl::InternalBrickInterface +{ public: +inline trikControl::DisplayWidgetInterface* py_q_graphicsWidget() { return this->graphicsWidget(); } +inline const QMetaObject* py_q_metaObject() const { return trikControl::InternalBrickInterface::metaObject(); } +inline void* py_q_qt_metacast(const char* arg__1) { return trikControl::InternalBrickInterface::qt_metacast(arg__1); } +}; + +class PythonQtWrapper_trikControl__InternalBrickInterface : public QObject +{ Q_OBJECT +public: +public Q_SLOTS: +void delete_trikControl__InternalBrickInterface(trikControl::InternalBrickInterface* obj) { delete obj; } + trikControl::DisplayWidgetInterface* graphicsWidget(trikControl::InternalBrickInterface* theWrappedObject); + trikControl::DisplayWidgetInterface* py_q_graphicsWidget(trikControl::InternalBrickInterface* theWrappedObject){ return (((PythonQtPublicPromoter_trikControl__InternalBrickInterface*)theWrappedObject)->py_q_graphicsWidget());} + const QMetaObject* py_q_metaObject(trikControl::InternalBrickInterface* theWrappedObject) const{ return (((PythonQtPublicPromoter_trikControl__InternalBrickInterface*)theWrappedObject)->py_q_metaObject());} + void* py_q_qt_metacast(trikControl::InternalBrickInterface* theWrappedObject, const char* arg__1){ return (((PythonQtPublicPromoter_trikControl__InternalBrickInterface*)theWrappedObject)->py_q_qt_metacast(arg__1));} + QString static_trikControl__InternalBrickInterface_tr(const char* s, const char* c = nullptr, int n = -1); + QString static_trikControl__InternalBrickInterface_trUtf8(const char* s, const char* c = nullptr, int n = -1); +}; + + + + + +class PythonQtPublicPromoter_trikControl__InternalDisplayInterface : public trikControl::InternalDisplayInterface +{ public: +inline trikControl::DisplayWidgetInterface& py_q_graphicsWidget() { return this->graphicsWidget(); } +inline const QMetaObject* py_q_metaObject() const { return trikControl::InternalDisplayInterface::metaObject(); } +inline void* py_q_qt_metacast(const char* arg__1) { return trikControl::InternalDisplayInterface::qt_metacast(arg__1); } +}; + +class PythonQtWrapper_trikControl__InternalDisplayInterface : public QObject +{ Q_OBJECT +public: +public Q_SLOTS: +void delete_trikControl__InternalDisplayInterface(trikControl::InternalDisplayInterface* obj) { delete obj; } + trikControl::DisplayWidgetInterface* graphicsWidget(trikControl::InternalDisplayInterface* theWrappedObject); + trikControl::DisplayWidgetInterface* py_q_graphicsWidget(trikControl::InternalDisplayInterface* theWrappedObject){ return &(((PythonQtPublicPromoter_trikControl__InternalDisplayInterface*)theWrappedObject)->py_q_graphicsWidget());} + const QMetaObject* py_q_metaObject(trikControl::InternalDisplayInterface* theWrappedObject) const{ return (((PythonQtPublicPromoter_trikControl__InternalDisplayInterface*)theWrappedObject)->py_q_metaObject());} + void* py_q_qt_metacast(trikControl::InternalDisplayInterface* theWrappedObject, const char* arg__1){ return (((PythonQtPublicPromoter_trikControl__InternalDisplayInterface*)theWrappedObject)->py_q_qt_metacast(arg__1));} + QString static_trikControl__InternalDisplayInterface_tr(const char* s, const char* c = nullptr, int n = -1); + QString static_trikControl__InternalDisplayInterface_trUtf8(const char* s, const char* c = nullptr, int n = -1); +}; + + diff --git a/trikScriptRunner/generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal_init.cpp b/trikScriptRunner/generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal_init.cpp new file mode 100644 index 00000000..47b52842 --- /dev/null +++ b/trikScriptRunner/generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal_init.cpp @@ -0,0 +1,16 @@ +#include +#include +#include "pytrikcontrolinternal0.h" + + + +void PythonQt_init_PyTrikControlInternal(PyObject* module) { +PythonQt::priv()->registerCPPClass("trikControl::BrickFactory", "", "PyTrikControlInternal", PythonQtCreateObject, nullptr, module, 0); +PythonQt::priv()->registerClass(&trikControl::DisplayWidgetInterface::staticMetaObject, "PyTrikControlInternal", PythonQtCreateObject, nullptr, module, 0); +PythonQt::priv()->registerClass(&trikControl::InternalBrickInterface::staticMetaObject, "PyTrikControlInternal", PythonQtCreateObject, nullptr, module, 0); +PythonQt::self()->addParentClass("trikControl::InternalBrickInterface", "trikControl::BrickInterface",PythonQtUpcastingOffset()); +PythonQt::priv()->registerClass(&trikControl::InternalDisplayInterface::staticMetaObject, "PyTrikControlInternal", PythonQtCreateObject, nullptr, module, 0); +PythonQt::self()->addParentClass("trikControl::InternalDisplayInterface", "trikControl::DisplayInterface",PythonQtUpcastingOffset()); + + +} diff --git a/trikScriptRunner/include/trikScriptRunner/trikScriptRunnerInterface.h b/trikScriptRunner/include/trikScriptRunner/trikScriptRunnerInterface.h index 361dde77..50a5f8e8 100644 --- a/trikScriptRunner/include/trikScriptRunner/trikScriptRunnerInterface.h +++ b/trikScriptRunner/include/trikScriptRunner/trikScriptRunnerInterface.h @@ -48,6 +48,14 @@ #include "trikScriptControlInterface.h" +#ifdef ENGINES_INIT_INTERNAL_TYPES +#include +#define OPTIONAL_DEVICES(TEMPLATE) \ + TEMPLATE(trikControl::DisplayWidgetInterface) +#else + #define OPTIONAL_DEVICES(TEMPLATE) +#endif + #define REGISTER_METATYPE(TYPE) \ qRegisterMetaType(TYPE::staticMetaObject.className()); @@ -57,6 +65,7 @@ /// that uses devices. /// ATTENTION: do not forget to append newly created device to this list! #define REGISTER_DEVICES_WITH_TEMPLATE(TEMPLATE) \ + OPTIONAL_DEVICES(TEMPLATE) \ TEMPLATE(trikControl::BatteryInterface) \ TEMPLATE(trikControl::ColorSensorInterface) \ TEMPLATE(trikControl::FifoInterface) \ @@ -138,6 +147,8 @@ public Q_SLOTS: /// and thus to have an opportunity to start concrete function from the given file. But QScriptEngine API /// has no such possibility so we should append function call to the end of the script. So if script will /// run some actions in the global context they will be invoked on each thread start. + // TODO: The default parameter is part of the public API. Consider backward compatibility + // NOLINTNEXTLINE(google-default-arguments) virtual void run(const QString &script, const QString &fileName = "") = 0; diff --git a/trikScriptRunner/src/pythonEngineWorker.cpp b/trikScriptRunner/src/pythonEngineWorker.cpp index 5c63cf83..994c99cc 100644 --- a/trikScriptRunner/src/pythonEngineWorker.cpp +++ b/trikScriptRunner/src/pythonEngineWorker.cpp @@ -79,6 +79,9 @@ LibraryLoadStatus find_loaded_library(const std::string& libraryName) { #endif void PythonQt_init_PyTrikControl(PyObject* module); +#ifdef ENGINES_INIT_INTERNAL_TYPES +void PythonQt_init_PyTrikControlInternal(PyObject* module); +#endif using namespace trikScriptRunner; QAtomicInt PythonEngineWorker::initCounter = 0; @@ -324,6 +327,9 @@ void PythonEngineWorker::init() PythonQtRegisterListTemplateConverter(QVector, uint8_t) PythonQt_QtAll::init(); PythonQt_init_PyTrikControl(mMainContext); + #ifdef ENGINES_INIT_INTERNAL_TYPES + PythonQt_init_PyTrikControlInternal(mMainContext); + #endif } if (!mMainContext) { mMainContext = PythonQt::self()->getMainModule(); diff --git a/trikScriptRunner/trikScriptRunner.pro b/trikScriptRunner/trikScriptRunner.pro index beb12af4..561a79ca 100644 --- a/trikScriptRunner/trikScriptRunner.pro +++ b/trikScriptRunner/trikScriptRunner.pro @@ -23,14 +23,24 @@ QMAKE_CXXFLAGS *= -Wno-error=cast-qual -Wno-error=redundant-decls QMAKE_CXXFLAGS -= -Werror -Werror=pedantic -pedantic-errors -Werror=write-strings QT += widgets +!contains(CONFIG, exclude_init_internal_types) { + DEFINES += ENGINES_INIT_INTERNAL_TYPES +} + !trik_nopython { #PythonQt generated files have problems INCLUDEPATH *= $$PWD/../trikControl/include/trikControl \ $$PWD/../trikKernel/include/trikKernel \ $$PWD/generated_cpp/pytrikcontrol \ + $$PWD/generated_cpp/pytrikcontrolinternal include($$PWD/../PythonQt/PythonQt/build/PythonQt_QtAll.prf) include(./generated_cpp/pytrikcontrol/pytrikcontrol.pri) + !contains(CONFIG, exclude_init_internal_types) { + include(./generated_cpp/pytrikcontrolinternal/pytrikcontrolinternal.pri) + INCLUDEPATH *= \ + $$PWD/generated_cpp/pytrikcontrolinternal + } } !macx:enableFlagIfCan(-Wno-error=cast-function-type)