[3/3] py: Add bindings for ControlId enum name
diff mbox series

Message ID 20240910204812.2581246-4-paul.elder@ideasonboard.com
State Superseded
Headers show
Series
  • libcamera: controls: Add enum information to ControlId
Related show

Commit Message

Paul Elder Sept. 10, 2024, 8:48 p.m. UTC
Add python bindings for quering enum value names from a ControlId.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>

---
New in v2
---
 src/py/libcamera/py_main.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Kieran Bingham Sept. 10, 2024, 9:31 p.m. UTC | #1
Quoting Paul Elder (2024-09-10 21:48:12)
> Add python bindings for quering enum value names from a ControlId.

s/quering/querying/

> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> 
> ---
> New in v2
> ---
>  src/py/libcamera/py_main.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
> index ab33f38a8..f6aff5005 100644
> --- a/src/py/libcamera/py_main.cpp
> +++ b/src/py/libcamera/py_main.cpp
> @@ -404,7 +404,8 @@ PYBIND11_MODULE(_libcamera, m)
>                 .def("__repr__", [](const ControlId &self) {
>                         return py::str("libcamera.ControlId({}, {}, {})")
>                                 .format(self.id(), self.name(), self.type());
> -               });
> +               })
> +               .def("enum_name", &ControlId::enumName);

Looks too easy ? ;-)


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

>  
>         pyControlInfo
>                 .def_property_readonly("min", [](const ControlInfo &self) {
> -- 
> 2.39.2
>

Patch
diff mbox series

diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
index ab33f38a8..f6aff5005 100644
--- a/src/py/libcamera/py_main.cpp
+++ b/src/py/libcamera/py_main.cpp
@@ -404,7 +404,8 @@  PYBIND11_MODULE(_libcamera, m)
 		.def("__repr__", [](const ControlId &self) {
 			return py::str("libcamera.ControlId({}, {}, {})")
 				.format(self.id(), self.name(), self.type());
-		});
+		})
+		.def("enum_name", &ControlId::enumName);
 
 	pyControlInfo
 		.def_property_readonly("min", [](const ControlInfo &self) {