diff --git a/src/Gui/CommandPy.xml b/src/Gui/CommandPy.xml
index 93619d5ac1c3..84f655020028 100644
--- a/src/Gui/CommandPy.xml
+++ b/src/Gui/CommandPy.xml
@@ -75,6 +75,14 @@ Returns string representing shortcut key accelerator for command.
setShortcut(string) -> bool
Sets shortcut for given command, returns bool True for success.
+
+
+
+
+
+ resetShortcut() -> bool
+
+Resets shortcut for given command back to the default, returns bool True for success.
diff --git a/src/Gui/CommandPyImp.cpp b/src/Gui/CommandPyImp.cpp
index 9b3ce09efdcd..2597680a49a8 100644
--- a/src/Gui/CommandPyImp.cpp
+++ b/src/Gui/CommandPyImp.cpp
@@ -232,6 +232,38 @@ PyObject* CommandPy::setShortcut(PyObject *args)
}
}
+PyObject* CommandPy::resetShortcut(PyObject *args)
+{
+
+ if (!PyArg_ParseTuple(args, ""))
+ return nullptr;
+
+ Command* cmd = this->getCommandPtr();
+ if (cmd) {
+ Action* action = cmd->getAction();
+ if (action){
+ QString default_shortcut = QString::fromLatin1(cmd->getAccel());
+ action->setShortcut(default_shortcut);
+ ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Shortcut");
+ hGrp->RemoveASCII(cmd->getName());
+ /** test to see if we successfully reset the shortcut by loading it back and comparing */
+ QString spc = QString::fromLatin1(" ");
+ QString new_shortcut = action->shortcut().toString();
+ if (default_shortcut.remove(spc).toUpper() == new_shortcut.remove(spc).toUpper()){
+ return Py::new_reference_to(Py::Boolean(true));
+ } else {
+ return Py::new_reference_to(Py::Boolean(false));
+ }
+ } else {
+ return Py::new_reference_to(Py::Boolean(false));
+ }
+
+ } else {
+ PyErr_Format(Base::BaseExceptionFreeCADError, "No such command");
+ return nullptr;
+ }
+}
+
PyObject* CommandPy::getInfo(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))