Display GUI component In Ignition dynamically using Python/Jython Script

994 views Asked by At

Currently I am showing a number of user-defined GUI components (templates) (let's give it a name: signal) in some of my main windows. Those GUI components are spread around the windows and are quite a lot in number (>50 per window) and I have multiple of such windows.

enter image description here

I have created all those windows using Ignition GUI and so far they are done... but... Now, there is a requirement to make whatever signal is displayed in the GUI window to be shown in a list of GUI.

enter image description here

My questions are:

  1. How to obtain list of GUI component (template) of the same type (signal) using Ignition Python/Jython Script?
  2. How to get its custom properties (such as customDisplayName)
  3. How to draw the GUI component (template) dynamically?

As of now, it is possible for me to drag and drop components (making exact copy of the displayed signals) in the container list I use to display the signal template. But since it is possible for new signal to be added in the GUI, I am looking for a more automated solution (if there is any).

1

There are 1 answers

0
Ian On

Ignition supports obtaining of the GUI components by .components from the container type component using Jython script.

So in the end, the implementation of my solution for this question was:

for comp in rootcontainer.components: #looping through every component in the root container
    if 'MySignal' in comp.name: #check the name of the component, see if it matches
        #do the logic here