From my designer-scoped custom module, I'm able to get a reference to the FPMIWindow instance of my vision windows (see method below from my ResourceEditor class). From there I can do all sorts of mutations.
Is there a similar way to mutate vision template definitions? Trying to avoid parsing the saved XML and mutating that, 'cause it's a huge headache.
private void test_debug2(){
var script_manager = context.getScriptManager();
PyStringMap locals = script_manager.createLocalsMap();
String code = """
system.vision.openWindow("%s")
w = system.vision.getWindow("%s")
""".formatted("test_3", "test_3");
try {
script_manager.runCode(code, locals, "<test_debug2>");
} catch (JythonExecException e) {
throw new RuntimeException(e);
}
PyObject py_win = locals.__finditem__("w");
if (py_win == null) {System.out.println("Fetching w from code locals returned null"); return;}
Object win = py_win.__tojava__(FPMIWindow.class);
System.out.println("Check it: " + win.getClass());
}