Fix tray visibility and message reception issues
Some checks failed
build / build-win64 (push) Waiting to run
build / build-macos (push) Waiting to run
build / build-pip (push) Failing after 16s

- Disable sound initialization to prevent hanging
- Add missing import re in utils.py
- Fix settings loading for QSettings
- Update file paths to use PROJECT_ROOT
- Revert to working API paths and listener from commit efdc63e
This commit is contained in:
kdusek
2025-12-07 22:39:07 +01:00
parent 7b695d7b7f
commit 5138303016
4060 changed files with 579123 additions and 23 deletions

View File

@@ -0,0 +1,6 @@
# Automatically generated configuration for PyQt6.QtNfc.
sip-version = "6.14.0"
sip-abi-version = "13.8"
module-tags = ["Qt_6_10_0", "Linux"]
module-disabled-features = []

View File

@@ -0,0 +1,55 @@
// QtNfcmod.sip generated by MetaSIP
//
// This file is part of the QtNfc Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%Module(name=PyQt6.QtNfc, keyword_arguments="Optional", use_limited_api=True)
%Import QtCore/QtCoremod.sip
%Copying
Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
This file is part of PyQt6.
This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and appearing in
the file LICENSE included in the packaging of this file. Please review the
following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you do not wish to use this file under the terms of the GPL version 3.0
then you may purchase a commercial license. For more information contact
info@riverbankcomputing.com.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%End
%DefaultSupertype PyQt6.sip.simplewrapper
%Include qndeffilter.sip
%Include qndefmessage.sip
%Include qndefnfcsmartposterrecord.sip
%Include qndefnfctextrecord.sip
%Include qndefnfcurirecord.sip
%Include qndefrecord.sip
%Include qnearfieldmanager.sip
%Include qnearfieldtarget.sip

View File

@@ -0,0 +1,58 @@
// qndeffilter.sip generated by MetaSIP
//
// This file is part of the QtNfc Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QNdefFilter
{
%TypeHeaderCode
#include <qndeffilter.h>
%End
public:
QNdefFilter();
QNdefFilter(const QNdefFilter &other);
~QNdefFilter();
void clear();
void setOrderMatch(bool on);
bool orderMatch() const;
struct Record
{
%TypeHeaderCode
#include <qndeffilter.h>
%End
QNdefRecord::TypeNameFormat typeNameFormat;
QByteArray type;
unsigned int minimum;
unsigned int maximum;
};
bool appendRecord(const QNdefFilter::Record &record);
bool appendRecord(QNdefRecord::TypeNameFormat typeNameFormat, const QByteArray &type, unsigned int min = 1, unsigned int max = 1);
qsizetype recordCount() const /__len__/;
QNdefFilter::Record recordAt(qsizetype i) const;
bool match(const QNdefMessage &message) const;
};
%End

View File

@@ -0,0 +1,74 @@
// qndefmessage.sip generated by MetaSIP
//
// This file is part of the QtNfc Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QNdefMessage
{
%TypeHeaderCode
#include <qndefmessage.h>
%End
public:
QNdefMessage();
explicit QNdefMessage(const QNdefRecord &record);
QNdefMessage(const QNdefMessage &message);
QNdefMessage(const QList<QNdefRecord> &records);
bool operator==(const QNdefMessage &other) const;
QByteArray toByteArray() const;
Py_ssize_t __len__() const;
%MethodCode
sipRes = sipCpp->count();
%End
QNdefRecord __getitem__(int i) const;
%MethodCode
Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
if (idx < 0)
sipIsErr = 1;
else
sipRes = new QNdefRecord(sipCpp->at((int)idx));
%End
void __setitem__(int i, const QNdefRecord &value);
%MethodCode
int len = sipCpp->count();
if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0)
sipIsErr = 1;
else
(*sipCpp)[a0] = *a1;
%End
void __delitem__(int i);
%MethodCode
if ((a0 = (int)sipConvertFromSequenceIndex(a0, sipCpp->count())) < 0)
sipIsErr = 1;
else
sipCpp->removeAt(a0);
%End
static QNdefMessage fromByteArray(const QByteArray &message);
};
%End

View File

@@ -0,0 +1,96 @@
// qndefnfcsmartposterrecord.sip generated by MetaSIP
//
// This file is part of the QtNfc Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QNdefNfcIconRecord : public QNdefRecord
{
%TypeHeaderCode
#include <qndefnfcsmartposterrecord.h>
%End
public:
QNdefNfcIconRecord();
QNdefNfcIconRecord(const QNdefRecord &other);
void setData(const QByteArray &data);
QByteArray data() const;
};
%End
%If (Qt_6_2_0 -)
class QNdefNfcSmartPosterRecord : public QNdefRecord
{
%TypeHeaderCode
#include <qndefnfcsmartposterrecord.h>
%End
public:
enum Action
{
UnspecifiedAction,
DoAction,
SaveAction,
EditAction,
};
QNdefNfcSmartPosterRecord();
QNdefNfcSmartPosterRecord(const QNdefNfcSmartPosterRecord &other);
QNdefNfcSmartPosterRecord(const QNdefRecord &other);
~QNdefNfcSmartPosterRecord();
void setPayload(const QByteArray &payload);
bool hasTitle(const QString &locale = QString()) const;
bool hasAction() const;
bool hasIcon(const QByteArray &mimetype = QByteArray()) const;
bool hasSize() const;
bool hasTypeInfo() const;
qsizetype titleCount() const;
QString title(const QString &locale = QString()) const;
QNdefNfcTextRecord titleRecord(qsizetype index) const;
QList<QNdefNfcTextRecord> titleRecords() const;
bool addTitle(const QNdefNfcTextRecord &text);
bool addTitle(const QString &text, const QString &locale, QNdefNfcTextRecord::Encoding encoding);
bool removeTitle(const QNdefNfcTextRecord &text);
bool removeTitle(const QString &locale);
void setTitles(const QList<QNdefNfcTextRecord> &titles);
QUrl uri() const;
QNdefNfcUriRecord uriRecord() const;
void setUri(const QNdefNfcUriRecord &url);
void setUri(const QUrl &url);
QNdefNfcSmartPosterRecord::Action action() const;
void setAction(QNdefNfcSmartPosterRecord::Action act);
qsizetype iconCount() const;
QByteArray icon(const QByteArray &mimetype = QByteArray()) const;
QNdefNfcIconRecord iconRecord(qsizetype index) const;
QList<QNdefNfcIconRecord> iconRecords() const;
void addIcon(const QNdefNfcIconRecord &icon);
void addIcon(const QByteArray &type, const QByteArray &data);
bool removeIcon(const QNdefNfcIconRecord &icon);
bool removeIcon(const QByteArray &type);
void setIcons(const QList<QNdefNfcIconRecord> &icons);
quint32 size() const;
void setSize(quint32 size);
QString typeInfo() const;
void setTypeInfo(const QString &type);
};
%End

View File

@@ -0,0 +1,49 @@
// qndefnfctextrecord.sip generated by MetaSIP
//
// This file is part of the QtNfc Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QNdefNfcTextRecord : public QNdefRecord
{
%TypeHeaderCode
#include <qndefnfctextrecord.h>
%End
public:
QNdefNfcTextRecord();
QNdefNfcTextRecord(const QNdefRecord &other);
QString locale() const;
void setLocale(const QString &locale);
QString text() const;
void setText(const QString text);
enum Encoding
{
Utf8,
Utf16,
};
QNdefNfcTextRecord::Encoding encoding() const;
void setEncoding(QNdefNfcTextRecord::Encoding encoding);
};
%End

View File

@@ -0,0 +1,38 @@
// qndefnfcurirecord.sip generated by MetaSIP
//
// This file is part of the QtNfc Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QNdefNfcUriRecord : public QNdefRecord
{
%TypeHeaderCode
#include <qndefnfcurirecord.h>
%End
public:
QNdefNfcUriRecord();
QNdefNfcUriRecord(const QNdefRecord &other);
QUrl uri() const;
void setUri(const QUrl &uri);
};
%End

View File

@@ -0,0 +1,93 @@
// qndefrecord.sip generated by MetaSIP
//
// This file is part of the QtNfc Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QNdefRecord
{
%TypeHeaderCode
#include <qndefrecord.h>
%End
%ConvertToSubClassCode
QByteArray ndef_type = sipCpp->type();
switch (sipCpp->typeNameFormat())
{
case QNdefRecord::NfcRtd:
if (ndef_type == "Sp")
sipType = sipType_QNdefNfcSmartPosterRecord;
else if (ndef_type == "T")
sipType = sipType_QNdefNfcTextRecord;
else if (ndef_type == "U")
sipType = sipType_QNdefNfcUriRecord;
else
sipType = 0;
break;
case QNdefRecord::Mime:
if (ndef_type == "")
sipType = sipType_QNdefNfcIconRecord;
else
sipType = 0;
break;
default:
sipType = 0;
}
%End
public:
enum TypeNameFormat
{
Empty,
NfcRtd,
Mime,
Uri,
ExternalRtd,
Unknown,
};
QNdefRecord();
QNdefRecord(const QNdefRecord &other);
~QNdefRecord();
void setTypeNameFormat(QNdefRecord::TypeNameFormat typeNameFormat);
QNdefRecord::TypeNameFormat typeNameFormat() const;
void setType(const QByteArray &type);
QByteArray type() const;
void setId(const QByteArray &id);
QByteArray id() const;
void setPayload(const QByteArray &payload);
QByteArray payload() const;
bool isEmpty() const;
void clear();
bool operator==(const QNdefRecord &other) const;
bool operator!=(const QNdefRecord &other) const;
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
};
%End

View File

@@ -0,0 +1,107 @@
// qnearfieldmanager.sip generated by MetaSIP
//
// This file is part of the QtNfc Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QNearFieldManager : public QObject
{
%TypeHeaderCode
#include <qnearfieldmanager.h>
%End
%ConvertToSubClassCode
static struct class_graph {
const char *name;
sipTypeDef **type;
int yes, no;
} graph[] = {
{sipName_QNearFieldManager, &sipType_QNearFieldManager, -1, 1},
{sipName_QNearFieldTarget, &sipType_QNearFieldTarget, -1, -1},
};
int i = 0;
sipType = NULL;
do
{
struct class_graph *cg = &graph[i];
if (cg->name != NULL && sipCpp->inherits(cg->name))
{
sipType = *cg->type;
i = cg->yes;
}
else
i = cg->no;
}
while (i >= 0);
%End
public:
explicit QNearFieldManager(QObject *parent /TransferThis/ = 0);
virtual ~QNearFieldManager();
bool startTargetDetection(QNearFieldTarget::AccessMethod accessMethod);
void stopTargetDetection(const QString &errorMessage = QString());
signals:
void targetDetected(QNearFieldTarget *target);
void targetLost(QNearFieldTarget *target);
void targetDetectionStopped();
public:
enum class AdapterState
{
Offline,
TurningOn,
Online,
TurningOff,
};
bool isSupported(QNearFieldTarget::AccessMethod accessMethod = QNearFieldTarget::AnyAccess) const;
signals:
void adapterStateChanged(QNearFieldManager::AdapterState state);
public:
bool isEnabled() const;
void setUserInformation(const QString &message);
};
%End
%ModuleHeaderCode
// Imports from QtCore.
typedef sipErrorState (*pyqt6_qtnfc_get_pyqtslot_parts_t)(PyObject *, QObject **, QByteArray &);
extern pyqt6_qtnfc_get_pyqtslot_parts_t pyqt6_qtnfc_get_pyqtslot_parts;
%End
%ModuleCode
// Imports from QtCore.
pyqt6_qtnfc_get_pyqtslot_parts_t pyqt6_qtnfc_get_pyqtslot_parts;
%End
%PostInitialisationCode
// Imports from QtCore.
pyqt6_qtnfc_get_pyqtslot_parts = (pyqt6_qtnfc_get_pyqtslot_parts_t)sipImportSymbol("pyqt6_get_pyqtslot_parts");
Q_ASSERT(pyqt6_qtnfc_get_pyqtslot_parts);
%End

View File

@@ -0,0 +1,113 @@
// qnearfieldtarget.sip generated by MetaSIP
//
// This file is part of the QtNfc Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QNearFieldTarget : public QObject
{
%TypeHeaderCode
#include <qnearfieldtarget.h>
%End
public:
enum Type
{
ProprietaryTag,
NfcTagType1,
NfcTagType2,
NfcTagType3,
NfcTagType4,
NfcTagType4A,
NfcTagType4B,
MifareTag,
};
enum AccessMethod /BaseType=Flag/
{
UnknownAccess,
NdefAccess,
TagTypeSpecificAccess,
AnyAccess,
};
typedef QFlags<QNearFieldTarget::AccessMethod> AccessMethods;
enum Error
{
NoError,
UnknownError,
UnsupportedError,
TargetOutOfRangeError,
NoResponseError,
ChecksumMismatchError,
InvalidParametersError,
NdefReadError,
NdefWriteError,
CommandError,
ConnectionError,
TimeoutError,
%If (Qt_6_8_0 -)
UnsupportedTargetError,
%End
};
class RequestId
{
%TypeHeaderCode
#include <qnearfieldtarget.h>
%End
public:
RequestId();
RequestId(const QNearFieldTarget::RequestId &other);
~RequestId();
bool isValid() const;
int refCount() const;
bool operator<(const QNearFieldTarget::RequestId &other) const;
bool operator==(const QNearFieldTarget::RequestId &other) const;
bool operator!=(const QNearFieldTarget::RequestId &other) const;
};
explicit QNearFieldTarget(QObject *parent /TransferThis/ = 0);
virtual ~QNearFieldTarget();
QByteArray uid() const;
QNearFieldTarget::Type type() const;
QNearFieldTarget::AccessMethods accessMethods() const;
bool hasNdefMessage();
QNearFieldTarget::RequestId readNdefMessages();
QNearFieldTarget::RequestId writeNdefMessages(const QList<QNdefMessage> &messages);
QNearFieldTarget::RequestId sendCommand(const QByteArray &command);
bool waitForRequestCompleted(const QNearFieldTarget::RequestId &id, int msecs = 5000) /ReleaseGIL/;
QVariant requestResponse(const QNearFieldTarget::RequestId &id) const;
signals:
void disconnected();
void ndefMessageRead(const QNdefMessage &message);
void requestCompleted(const QNearFieldTarget::RequestId &id);
void error(QNearFieldTarget::Error error, const QNearFieldTarget::RequestId &id);
public:
bool disconnect();
int maxCommandLength() const;
};
%End