! * \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
| 252 | * command to the toolbar where Std_New is part of. |
| 253 | */ |
| 254 | void 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 |
| 275 | void WorkbenchManipulatorPython::tryModifyToolBar(const Py::Dict& dict, ToolBarItem* toolBar) |
nothing calls this directly
no test coverage detected