Merge pull request #24376 from pyro9/ReprFix
Improve the string representation of a few key FreeCAD Python objects.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user