Change ui from python scripts

Hello everyone!

I am using vision for some graphical interfaces.
I would like to ask you if anyone knows a way, or, if there is a possibility, of changing the layout of such pages from python scripts.
In particular, I would like to be able to access the ViewPage source, in order to generate or modify them, automatically, depending on some conditions.


That’s still pretty vague. What exactly would you like to do? Do you want to move objects around the page? Do you want to add and remove components from the page?
For the first, you could either use the system.gui.tranform function, or for first and second, you could use the template canvas, assuming your components are templates

As Nick notes, you don’t access the XML source. That is an undocumented format and there is no support for manipulating it, nor any jython support for import/export.

Instead you manipulate the components themselves. In the designer, components and their properties are saved in their last state, including any scripted changes.

Vision does not formally support runtime addition or removal of components, as it is a bit tricky with undocumented requirements. The supported way to vary the number of components is with the template repeater and/or template canvas.

{Edit: Sorry, missing “not”.}

Yes, I’m talking about something like an xml file that represents the graphical interface.
A bit like accessing the DOM in javascript, or an xml resource on android.

But will these files be allocated somewhere?
Ideally from jython i could access to read and modify them.

The problem is that through the gui.transform(), the page must be opened, or am i wrong? Otherwise i can’t get the page reference, is that correct?

They are compressed binary resources in an opaque disk format. You cannot edit them without opening them in the designer. Sorry. The XML is only for import and export, and only in the designer.


What Phil said. Perspective on the other hand is a different beast and does support what you’re trying to do. You can manipulate the json file that defines the Views which can add/remove/modify component config permanently. You’re out of luck for Vision though

1 Like