[libcamera-devel] [PATCH v2 16/19] py: Re-structure the controls API
Tomi Valkeinen
tomi.valkeinen at ideasonboard.com
Fri May 27 15:16:55 CEST 2022
On 27/05/2022 13:52, Laurent Pinchart wrote:
>> @@ -464,7 +440,34 @@ PYBIND11_MODULE(_libcamera, m)
>> pyControlId
>> .def_property_readonly("id", &ControlId::id)
>> .def_property_readonly("name", &ControlId::name)
>> - .def_property_readonly("type", &ControlId::type);
>> + .def_property_readonly("type", &ControlId::type)
>> + .def("__str__", [](const ControlId &self) { return self.name(); })
>> + .def("__repr__", [](const ControlId &self) {
>> + return py::str("libcamera.ControlId({}, {}, {})")
>> + .format(self.id(), self.name(), self.type());
>
> Should this be py::str("libcamera.controls.{}").format(self.name()) ?
> That may not work for draft controls though.
Doesn't work for properties either.
Generally speaking, I'm not quite sure what to do with __repr__ in cases
where you can't create the object yourself.
Tomi
More information about the libcamera-devel
mailing list