Skip to content

Commit d42b665

Browse files
authored
ENH: Added PipelineFilter.update_arg() to update args in place (#1619)
Added PipelineFilter.update_arg() to update args in place Signed-off-by: Jared Duffey <jared.duffey@bluequartz.net>
1 parent 87a8188 commit d42b665

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/Plugins/SimplnxCore/wrapping/python/simplnxpy.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,13 @@ PYBIND11_MODULE(simplnx, mod)
16601660
},
16611661
"Returns the human facing name of the filter");
16621662
pipelineFilter.def_property("comments", &PipelineFilter::getComments, &PipelineFilter::setComments);
1663+
pipelineFilter.def("update_arg", [internals](PipelineFilter& self, const std::string& key, py::handle value) {
1664+
Uuid paramUuid = self.getParameters().at(key)->uuid();
1665+
std::any convertedValue = internals->at(paramUuid).fromPyObjectFunc(value);
1666+
Arguments args = self.getArguments();
1667+
args.insertOrAssign(key, std::move(convertedValue));
1668+
self.setArguments(args);
1669+
});
16631670

16641671
py::class_<PyFilter, IFilter> pyFilter(mod, "PyFilter");
16651672
pyFilter.def(py::init<>([](py::object object) { return std::make_unique<PyFilter>(std::move(object)); }));

0 commit comments

Comments
 (0)