From a5bcca399394ae470b01539fec1f5364b4bdfb4b Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 8 Sep 2016 09:40:03 +0200 Subject: [PATCH] support to pass optional item parameter to Gui.runCommand --- src/Gui/ApplicationPy.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Gui/ApplicationPy.cpp b/src/Gui/ApplicationPy.cpp index 8e2ca1fce4..b12cb9e45b 100644 --- a/src/Gui/ApplicationPy.cpp +++ b/src/Gui/ApplicationPy.cpp @@ -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; }