MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / tryModifyToolBar

Method tryModifyToolBar

src/Gui/WorkbenchManipulatorPython.cpp:254–272  ·  view source on GitHub ↗

! * \brief WorkbenchManipulatorPython::tryModifyToolBar * \param toolBar * The Python manipulator can be implemented as * \code * class Manipulator: * def modifyToolBars(self): return [{"remove" : "Macro"}, {"append" : "Std_Quit", "toolBar" : "File"}, * {"insert" : "Std_Cut", "toolItem" : "Std_New"}] * * manip = Manipulator() * Gui.addWorkbenchManipula

Source from the content-addressed store, hash-verified

252 * command to the toolbar where Std_New is part of.
253 */
254void WorkbenchManipulatorPython::tryModifyToolBar(ToolBarItem* toolBar)
255{
256 if (object.hasAttr(std::string("modifyToolBars"))) {
257 Py::Callable method(object.getAttr(std::string("modifyToolBars")));
258 Py::Tuple args;
259 Py::Object result = method.apply(args);
260 if (result.isDict()) {
261 tryModifyToolBar(Py::Dict(result), toolBar);
262 }
263 else if (result.isSequence()) {
264 Py::Sequence list(result);
265 for (const auto& it : list) {
266 if (it.isDict()) {
267 tryModifyToolBar(Py::Dict(it), toolBar);
268 }
269 }
270 }
271 }
272}
273
274// NOLINTNEXTLINE
275void WorkbenchManipulatorPython::tryModifyToolBar(const Py::Dict& dict, ToolBarItem* toolBar)

Callers

nothing calls this directly

Calls 9

StringClass · 0.70
applyMethod · 0.45
getItemMethod · 0.45
getItemsMethod · 0.45
findItemMethod · 0.45
setCommandMethod · 0.45
insertItemMethod · 0.45
appendItemMethod · 0.45
removeItemMethod · 0.45

Tested by

no test coverage detected