]> sigrok.org Git - libsigrok.git/commitdiff
bindings/python: Add __repr__() to 'ChannelGroup' class master github/master
authorMarc Schink <redacted>
Fri, 29 Mar 2024 12:41:45 +0000 (13:41 +0100)
committerSoeren Apel <redacted>
Thu, 20 Nov 2025 18:01:53 +0000 (19:01 +0100)
The following lines show the class string representation before and
after this patch:

<sigrok.core.classes.ChannelGroup; proxy of <Swig Object of type 'std::shared_ptr< sigrok::ChannelGroup > *' at 0x7fdf4b29f660> >
ChannelGroup (name='A0', channels=(Channel (type=ChannelType.ANALOG, name='A0', index=8, enabled=True),))

Signed-off-by: Marc Schink <redacted>
bindings/python/sigrok/core/classes.i

index 46672a3971feb9ef9bac8c144855722aa43d3365..90667f59c41a553876bbe94bb9ae3cb71b5be163 100644 (file)
@@ -623,4 +623,13 @@ std::map<std::string, Glib::VariantBase> dict_to_map_options(PyObject *dict,
 }
 }
 
+%extend sigrok::ChannelGroup
+{
+%pythoncode
+{
+    def __repr__(self):
+        return _class_attribute_repr(self, ['name', 'channels'])
+}
+}
+
 %include "doc_end.i"