More details on Python doc involving class properties.

This commit is contained in:
Matthias Koefferlein 2025-01-16 20:42:14 +01:00
parent 629aef6d06
commit 07da5a3cf2
1 changed files with 10 additions and 2 deletions

View File

@ -426,7 +426,11 @@ public:
doc += "\n\n";
}
doc += (*m)->doc ();
mp_module->add_python_doc (*m, tl::sprintf (tl::to_string (tr ("The object exposes a readable attribute '%s'. This is the getter")), name));
if (! is_static) {
mp_module->add_python_doc (*m, tl::sprintf (tl::to_string (tr ("The object exposes a readable attribute '%s'. This is the getter")), name));
} else {
mp_module->add_python_doc (*m, tl::sprintf (tl::to_string (tr ("The class exposes a readable attribute '%s'. This is the getter")), name));
}
}
for (MethodTableEntry::method_iterator m = begin_setters; m != end_setters; ++m) {
@ -434,7 +438,11 @@ public:
doc += "\n\n";
}
doc += (*m)->doc ();
mp_module->add_python_doc (*m, tl::sprintf (tl::to_string (tr ("The object exposes a writable attribute '%s'. This is the setter")), name));
if (! is_static) {
mp_module->add_python_doc (*m, tl::sprintf (tl::to_string (tr ("The object exposes a writable attribute '%s'. This is the setter")), name));
} else {
mp_module->add_python_doc (*m, tl::sprintf (tl::to_string (tr ("The class exposes a writable attribute '%s'. This setter may not be available in Python")), name));
}
}
PythonRef attr;