+ detect from Python whether a document is modified, give option to suppress warning from SendMsgToActiveView

This commit is contained in:
wmayer
2014-02-24 11:30:27 +01:00
parent b0f61652f4
commit effedb5d1c
3 changed files with 18 additions and 4 deletions

View File

@@ -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) {