Exposed doCommand (Gui version) to python - fixes #1564

This commit is contained in:
Yorik van Havre
2014-08-05 19:28:36 -03:00
parent f4dfea182b
commit d43d389b02
2 changed files with 13 additions and 0 deletions

View File

@@ -136,6 +136,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"},
{"doCommandGui", (PyCFunction) Application::sDoCommandGui, 1,
"doCommandGui(string) -> None\n\n"
"Prints the given string in the python console and runs it but doesn't record it in macros"},
{"addModule", (PyCFunction) Application::sAddModule, 1,
"addModule(string) -> None\n\n"
"Prints the given module import only once in the macro recording"},
@@ -845,6 +848,15 @@ PyObject* Application::sDoCommand(PyObject * /*self*/, PyObject *args,PyObject *
return Py_None;
}
PyObject* Application::sDoCommandGui(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::doCommand(Command::Gui,pstr);
return Py_None;
}
PyObject* Application::sAddModule(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char *pstr=0;