diff --git a/src/Gui/Workbench.cpp b/src/Gui/Workbench.cpp index a1eead34c..f29ce1e67 100644 --- a/src/Gui/Workbench.cpp +++ b/src/Gui/Workbench.cpp @@ -277,16 +277,28 @@ void Workbench::setupCustomToolbars(ToolBarItem* root, const Base::Referencefirst.c_str()); if (!pCmd) { // unknown command - // try to find out the appropriate module name - std::string pyMod = it2->second + "Gui"; + // first try the module name as is + std::string pyMod = it2->second; try { Base::Interpreter().loadModule(pyMod.c_str()); + // Try again + pCmd = rMgr.getCommandByName(it2->first.c_str()); } catch(const Base::Exception&) { } + } - // Try again - pCmd = rMgr.getCommandByName(it2->first.c_str()); + // still not there? + if (!pCmd) { + // add the 'Gui' suffix + std::string pyMod = it2->second + "Gui"; + try { + Base::Interpreter().loadModule(pyMod.c_str()); + // Try again + pCmd = rMgr.getCommandByName(it2->first.c_str()); + } + catch(const Base::Exception&) { + } } if (pCmd) {