I have an old script that I used in FPMI days that I’d like to revive, and am having a problem. The script allowed me to have a dialog-like window of numeric entries, drop-downs, etc, all with one-way bindings to various tags. With the one-way bindings, nothing would get written to the server until clicking a ‘Save’ button. The save button would execute a script that looked up all of the tag bindings in the window, and for the typical value properties, trigger a writeback for each. (And then close the window).
Here’s the script:
def tagWriteBack(event):
import fpmi
pa = fpmi.gui.getParentWindow(event).propertyAdapters
for k in pa.keySet():
if k.propertyName in ('controlValue','date','dateValue','doubleValue','endDate','floatValue','intValue','latchedDate','longValue','selected','selectedIndex','selectedValue','selectedStringValue','startDate','text','value'):
v = pa[k]
if v.class.simpleName in ('SimpleBoundTagAdapter','IndirectTagBindingAdapter'):
try:
k.component.dataQuality = 700
except:
pass
val = k.component.getPropertyValue(k.propertyName)
m = v.class.getDeclaredMethod('getCurrentTagPath', [])
m.setAccessible(1)
fpmi.tag.writeToTag(m.invoke(v, []), val)
The problem is that window.propertyAdapters is write-only in ignition. I haven’t found a work-around. Ideas?