add addModule() macro helper to the python interface of Application
This commit is contained in:
parent
8735f4b8a6
commit
e189c0b336
|
@ -232,6 +232,7 @@ public:
|
|||
PYFUNCDEF_S(sGetDocument);
|
||||
|
||||
PYFUNCDEF_S(sDoCommand);
|
||||
PYFUNCDEF_S(sAddModule);
|
||||
|
||||
static PyMethodDef Methods[];
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user