support to pass optional item parameter to Gui.runCommand

This commit is contained in:
wmayer
2016-09-08 09:40:03 +02:00
parent 2977392bbe
commit a5bcca3993

View File

@@ -1005,13 +1005,14 @@ PyObject* Application::sAddCommand(PyObject * /*self*/, PyObject *args,PyObject
PyObject* Application::sRunCommand(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
char* pName;
if (!PyArg_ParseTuple(args, "s", &pName)) // convert args: Python->C
return NULL; // NULL triggers exception
char* pName;
int item = 0;
if (!PyArg_ParseTuple(args, "s|i", &pName, &item))
return NULL;
Command* cmd = Application::Instance->commandManager().getCommandByName(pName);
if (cmd) {
cmd->invoke(0);
cmd->invoke(item);
Py_INCREF(Py_None);
return Py_None;
}