Skip to content

Commit

Permalink
Gui: add Gui.updateCommands() for manual command status update
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder authored and wwmayer committed Sep 10, 2019
1 parent 69d124a commit c3fe336
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Gui/Application.h
Expand Up @@ -252,6 +252,7 @@ class GuiExport Application
static PyObject* sAddCommand (PyObject *self,PyObject *args);
static PyObject* sListCommands (PyObject *self,PyObject *args);
static PyObject* sIsCommandActive (PyObject *self,PyObject *args);
static PyObject* sUpdateCommands (PyObject *self,PyObject *args);

static PyObject* sHide (PyObject *self,PyObject *args); // deprecated
static PyObject* sShow (PyObject *self,PyObject *args); // deprecated
Expand Down
11 changes: 11 additions & 0 deletions src/Gui/ApplicationPy.cpp
Expand Up @@ -144,6 +144,9 @@ PyMethodDef Application::Methods[] = {
{"listCommands", (PyCFunction) Application::sListCommands, METH_VARARGS,
"listCommands() -> list of strings\n\n"
"Returns a list of all commands known to FreeCAD."},
{"updateCommands()", (PyCFunction) Application::sUpdateCommands, METH_VARARGS,
"updateCommands()\n\n"
"Update all command active status"},
{"SendMsgToActiveView", (PyCFunction) Application::sSendActiveView, METH_VARARGS,
"deprecated -- use class View"},
{"sendMsgToFocusView", (PyCFunction) Application::sSendFocusView, METH_VARARGS,
Expand Down Expand Up @@ -1246,6 +1249,14 @@ PyObject* Application::sIsCommandActive(PyObject * /*self*/, PyObject *args)
}PY_CATCH;
}

PyObject* Application::sUpdateCommands(PyObject * /*self*/, PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;

getMainWindow()->updateActions();
Py_Return;
}

PyObject* Application::sListCommands(PyObject * /*self*/, PyObject *args)
{
Expand Down

0 comments on commit c3fe336

Please sign in to comment.