diff options
author | Noralf Trønnes <noralf@tronnes.org> | 2021-07-19 18:20:58 +0200 |
---|---|---|
committer | Noralf Trønnes <noralf@tronnes.org> | 2021-07-19 18:59:12 +0200 |
commit | 3d2cde2851e7631ad3454d8371f74e2bc2e7f206 (patch) | |
tree | ffa4b6142b0b56c57ea73259a4fc054894acd723 | |
parent | a85e41d3ca9b4db2271198a757059a3df6a3b32e (diff) |
py: Property: Add type, enums, values, and __repr__
Also add PropertyType which is used by the type property.
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
-rw-r--r-- | py/pykms/pykmsbase.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp index 53ea8c7..088d267 100644 --- a/py/pykms/pykmsbase.cpp +++ b/py/pykms/pykmsbase.cpp @@ -120,7 +120,20 @@ void init_pykmsbase(py::module& m) py::class_<Property, DrmObject, unique_ptr<Property, py::nodelete>>(m, "Property") .def_property_readonly("name", &Property::name) - .def_property_readonly("enums", &Property::get_enums); + .def_property_readonly("type", &Property::type) + .def_property_readonly("enums", &Property::get_enums) + .def_property_readonly("values", &Property::get_values) + .def("__repr__", [](const Property& o) { return "<pykms.Property " + to_string(o.id()) + " '" + o.name() + "'>"; }) + ; + + py::enum_<PropertyType>(m, "PropertyType") + .value("Range", PropertyType::Range) + .value("Enum", PropertyType::Enum) + .value("Blob", PropertyType::Blob) + .value("Bitmask", PropertyType::Bitmask) + .value("Object", PropertyType::Object) + .value("SignedRange", PropertyType::SignedRange) + ; py::class_<Blob>(m, "Blob") .def(py::init([](Card& card, py::buffer buf) { |