Gui: add Gui.updateCommands() for manual command status update

This commit is contained in:
Zheng, Lei
2019-09-04 16:57:45 +08:00
committed by wmayer
parent 6d770d85dc
commit b69a31c5b5
2 changed files with 12 additions and 0 deletions

View File

@@ -252,6 +252,7 @@ public:
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

View File

@@ -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,
@@ -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)
{