diff --git a/src/Mod/TechDraw/App/DrawSVGTemplatePy.xml b/src/Mod/TechDraw/App/DrawSVGTemplatePy.xml
index fecd4aa60..befd68c3f 100644
--- a/src/Mod/TechDraw/App/DrawSVGTemplatePy.xml
+++ b/src/Mod/TechDraw/App/DrawSVGTemplatePy.xml
@@ -13,5 +13,15 @@
Feature for creating and manipulating Technical Drawing SVG Templates
+
+
+ getEditFieldContent(EditFieldName) - returns the content of a specific Editable Text Field
+
+
+
+
+ setEditFieldContent(EditFieldName, NewContent) - sets a specific Editable Text Field to a new value
+
+
diff --git a/src/Mod/TechDraw/App/DrawSVGTemplatePyImp.cpp b/src/Mod/TechDraw/App/DrawSVGTemplatePyImp.cpp
index 3a28a48e4..0d80b6aab 100644
--- a/src/Mod/TechDraw/App/DrawSVGTemplatePyImp.cpp
+++ b/src/Mod/TechDraw/App/DrawSVGTemplatePyImp.cpp
@@ -37,7 +37,40 @@ int DrawSVGTemplatePy::setCustomAttributes(const char* attr, PyObject* obj)
return 1;
}
- return 0;
+ return 0;
}
+PyObject* DrawSVGTemplatePy::getEditFieldContent(PyObject* args)
+{
+ PyObject* result = nullptr;
+ char* fieldName;
+ if (!PyArg_ParseTuple(args, "s",&fieldName)) {
+ Base::Console().Error("Error: DrawSVGTemplatePy::getEditFieldNames - Bad Arg\n");
+ return nullptr;
+ }
+ std::string content = getDrawSVGTemplatePtr()->EditableTexts[fieldName];
+ if (!content.empty()) {
+ result = PyString_FromString(content.c_str());
+ }
+ return result;
+}
+PyObject* DrawSVGTemplatePy::setEditFieldContent(PyObject* args)
+{
+ PyObject* result = Py_True;
+ char* fieldName;
+ char* newContent;
+ if (!PyArg_ParseTuple(args, "ss", &fieldName,&newContent)) {
+ Base::Console().Error("Error: DrawSVGTemplatePy::getEditFieldNames - Bad Args\n");
+ result = Py_False;
+ } else {
+ try {
+ getDrawSVGTemplatePtr()->EditableTexts.setValue(fieldName, newContent);
+ }
+ catch (...) {
+ result = Py_False;
+ }
+ }
+
+ return result;
+}
diff --git a/src/Mod/TechDraw/Gui/TemplateTextField.cpp b/src/Mod/TechDraw/Gui/TemplateTextField.cpp
index ed906e2e8..7379dfb74 100644
--- a/src/Mod/TechDraw/Gui/TemplateTextField.cpp
+++ b/src/Mod/TechDraw/Gui/TemplateTextField.cpp
@@ -48,8 +48,6 @@ TemplateTextField::~TemplateTextField()
void TemplateTextField::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- //TODO: Add a command to change template text, and call it from here
- // ...Interpreter....("App.ActiveDocument().%s.%s.setTextField(%s,%s)",pageName,templateName,fieldName,fieldValue)
DlgTemplateField* ui = new DlgTemplateField(nullptr);
ui->setFieldName(fieldNameStr);
ui->setFieldContent(tmplte->EditableTexts[fieldNameStr]);
@@ -57,7 +55,7 @@ void TemplateTextField::mousePressEvent(QGraphicsSceneMouseEvent *event)
std::string newContent = "";
if(uiCode == QDialog::Accepted) {
std::string newContent = ui->getFieldContent();
- tmplte->EditableTexts.setValue(fieldNameStr, newContent);
+ tmplte->EditableTexts.setValue(fieldNameStr, newContent);
}
ui->deleteLater();
}