add addModule() macro helper to the python interface of Application

This commit is contained in:
jriegel
2013-06-09 16:24:07 +02:00
parent bc9a63540d
commit a8caab4117
2 changed files with 13 additions and 0 deletions

View File

@@ -131,6 +131,9 @@ PyMethodDef Application::Methods[] = {
{"doCommand", (PyCFunction) Application::sDoCommand, 1,
"doCommand(string) -> None\n\n"
"Prints the given string in the python console and runs it"},
{"addModule", (PyCFunction) Application::sAddModule, 1,
"addModule(string) -> None\n\n"
"Prints the given module import only once in the macro recording"},
{NULL, NULL} /* Sentinel */
};
@@ -795,3 +798,12 @@ PyObject* Application::sDoCommand(PyObject * /*self*/, PyObject *args,PyObject *
Command::doCommand(Command::Doc,pstr);
return Py_None;
}
PyObject* Application::sAddModule(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char *pstr=0;
if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C
return NULL; // NULL triggers exception
Command::addModule(Command::Doc,pstr);
return Py_None;
}