From 07da5a3cf21ee3cf655f0477af23e9c67c77ee0b Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 16 Jan 2025 20:42:14 +0100 Subject: [PATCH] More details on Python doc involving class properties. --- src/pya/pya/pyaModule.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pya/pya/pyaModule.cc b/src/pya/pya/pyaModule.cc index c5e8f5a7b..9e4251fe3 100644 --- a/src/pya/pya/pyaModule.cc +++ b/src/pya/pya/pyaModule.cc @@ -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;