Merge pull request #24376 from pyro9/ReprFix

Improve the string representation of a few key FreeCAD Python objects.
This commit is contained in:
Chris Hennes
2025-10-02 20:58:52 -05:00
committed by GitHub
3 changed files with 5 additions and 3 deletions

View File

@@ -116,7 +116,7 @@ PyObject* DocumentPy::removeProperty(PyObject* args)
std::string DocumentPy::representation() const
{
std::stringstream str;
str << "<Document object at " << getDocumentPtr() << ">";
str << "<Document '" << getDocumentPtr()->getName() << "' (" << getDocumentPtr()->Label.getValue() << ") >";
return str.str();
}

View File

@@ -49,7 +49,7 @@ using namespace Gui;
std::string DocumentPy::representation() const
{
std::stringstream str;
str << "<GUI Document object at " << getDocumentPtr() << ">";
str << "<GUI Document object for " << getDocumentPtr()->getDocument()->getName() << ">";
return str.str();
}

View File

@@ -364,7 +364,9 @@ TaskDialogPy::~TaskDialogPy() = default;
Py::Object TaskDialogPy::repr()
{
return Py::String("Task Dialog");
std::stringstream str;
str << "<Task Dialog for '" << dialog->getDocumentName() << "' >";
return Py::String( str.str() );
}
Py::Object TaskDialogPy::getattr(const char * attr)