From 9ff4a40bc246c581e620d7c8a7b1eafa91acc596 Mon Sep 17 00:00:00 2001 From: Steven James Date: Wed, 1 Oct 2025 13:57:06 -0400 Subject: [PATCH 1/2] Fixing repr for App/Document and Gui/Document --- src/App/DocumentPyImp.cpp | 2 +- src/Gui/DocumentPyImp.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App/DocumentPyImp.cpp b/src/App/DocumentPyImp.cpp index ca119fecde..cd1ace8152 100644 --- a/src/App/DocumentPyImp.cpp +++ b/src/App/DocumentPyImp.cpp @@ -116,7 +116,7 @@ PyObject* DocumentPy::removeProperty(PyObject* args) std::string DocumentPy::representation() const { std::stringstream str; - str << ""; + str << "getName() << "' (" << getDocumentPtr()->Label.getValue() << ") >"; return str.str(); } diff --git a/src/Gui/DocumentPyImp.cpp b/src/Gui/DocumentPyImp.cpp index 7f20f09710..c57aeeeb5b 100644 --- a/src/Gui/DocumentPyImp.cpp +++ b/src/Gui/DocumentPyImp.cpp @@ -49,7 +49,7 @@ using namespace Gui; std::string DocumentPy::representation() const { std::stringstream str; - str << ""; + str << "getDocument()->getName() << ">"; return str.str(); } From 17e80926436f116f12c5857d4421bfc6d72af45c Mon Sep 17 00:00:00 2001 From: Steven James Date: Wed, 1 Oct 2025 16:31:52 -0400 Subject: [PATCH 2/2] Make repr for a TaskDialog indicate the associated document. --- src/Gui/TaskView/TaskDialogPython.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Gui/TaskView/TaskDialogPython.cpp b/src/Gui/TaskView/TaskDialogPython.cpp index 73980d06cc..98db82de1a 100644 --- a/src/Gui/TaskView/TaskDialogPython.cpp +++ b/src/Gui/TaskView/TaskDialogPython.cpp @@ -364,7 +364,9 @@ TaskDialogPy::~TaskDialogPy() = default; Py::Object TaskDialogPy::repr() { - return Py::String("Task Dialog"); + std::stringstream str; + str << "getDocumentName() << "' >"; + return Py::String( str.str() ); } Py::Object TaskDialogPy::getattr(const char * attr)