python: Provide sensible __str__ and __repr__ functions for enum values.
This fixes bug #668.
This commit is contained in:
parent
f014a8fd4c
commit
c61e208d26
|
@ -426,6 +426,16 @@ std::map<std::string, Glib::VariantBase> dict_to_map_options(PyObject *dict,
|
||||||
return (long) $self;
|
return (long) $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string __str__()
|
||||||
|
{
|
||||||
|
return $self->name();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string __repr__()
|
||||||
|
{
|
||||||
|
return "Class." + $self->name();
|
||||||
|
}
|
||||||
|
|
||||||
%pythoncode
|
%pythoncode
|
||||||
{
|
{
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
|
|
Loading…
Reference in New Issue