+ detect from Python whether a document is modified, give option to suppress warning from SendMsgToActiveView
This commit is contained in:
parent
49ba4de6b8
commit
83caf9d67b
|
@ -405,12 +405,15 @@ PyObject* Application::sExport(PyObject * /*self*/, PyObject *args,PyObject * /*
|
|||
PyObject* Application::sSendActiveView(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
|
||||
{
|
||||
char *psCommandStr;
|
||||
if (!PyArg_ParseTuple(args, "s",&psCommandStr)) // convert args: Python->C
|
||||
PyObject *suppress=Py_False;
|
||||
if (!PyArg_ParseTuple(args, "s|O!",&psCommandStr,&PyBool_Type,&suppress)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
const char* ppReturn=0;
|
||||
if (!Instance->sendMsgToActiveView(psCommandStr,&ppReturn))
|
||||
Base::Console().Warning("Unknown view command: %s\n",psCommandStr);
|
||||
if (!Instance->sendMsgToActiveView(psCommandStr,&ppReturn)) {
|
||||
if (!PyObject_IsTrue(suppress))
|
||||
Base::Console().Warning("Unknown view command: %s\n",psCommandStr);
|
||||
}
|
||||
|
||||
// Print the return value to the output
|
||||
if (ppReturn) {
|
||||
|
|
|
@ -106,5 +106,11 @@
|
|||
</Documentation>
|
||||
<Parameter Name="Document" Type="Object" />
|
||||
</Attribute>
|
||||
</PythonExport>
|
||||
<Attribute Name="Modified" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns True if the document is marked as modified, and False otherwse</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Modified" Type="Boolean" />
|
||||
</Attribute>
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
|
|
|
@ -321,6 +321,11 @@ Py::Object DocumentPy::getDocument(void) const
|
|||
}
|
||||
}
|
||||
|
||||
Py::Boolean DocumentPy::getModified(void) const
|
||||
{
|
||||
return Py::Boolean(getDocumentPtr()->isModified());
|
||||
}
|
||||
|
||||
PyObject *DocumentPy::getCustomAttributes(const char* attr) const
|
||||
{
|
||||
// Note: Here we want to return only a document object if its
|
||||
|
|
Loading…
Reference in New Issue
Block a user