From: vzuevskiy Date: Mon, 8 Sep 2025 07:10:14 +0000 (+0300) Subject: bindings/python: Add support for SR_T_MQ in Python bindings X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=47bf0bed40cde1b47102c2d59751db85bbec799f;p=libsigrok.git bindings/python: Add support for SR_T_MQ in Python bindings --- diff --git a/bindings/python/sigrok/core/classes.i b/bindings/python/sigrok/core/classes.i index d22db1c1..2e273c47 100644 --- a/bindings/python/sigrok/core/classes.i +++ b/bindings/python/sigrok/core/classes.i @@ -350,6 +350,18 @@ Glib::VariantBase python_to_variant_by_key(PyObject *input, const sigrok::Config return Glib::Variant< std::vector >::create(v); } } + else if ((type == SR_T_MQ) && PyTuple_Check(input) && (PyTuple_Size(input) == 2)) { + PyObject *numObj = PyTuple_GetItem(input, 0); + PyObject *denomObj = PyTuple_GetItem(input, 1); + if ((PyInt_Check(numObj) || PyLong_Check(numObj)) && (PyInt_Check(denomObj) || PyLong_Check(denomObj))) { + return Glib::Variant>::create( + std::make_tuple( + (guint32)PyInt_AsLong(numObj), + (guint64)PyInt_AsLong(denomObj) + ) + ); + } + } throw sigrok::Error(SR_ERR_ARG); }