Alright, i am having an issue with some properties nto passing through in a jython scripts. Non dynamic properties, such as name work. But in my case, dynamic properties, such as Tag, do not.
Here is my code
[code]def tx(event):
import fpmi
from app.nav import showFiles, openWiki
from app.ctg import addGraphPoint, deleteGraphPoint,clearGraphPoints
print event,event.source.Tag
roles = fpmi.security.getRoles()
if “Operator” in roles or “Programmer” in roles or “Engineer” in roles:
if event.button == event.BUTTON1:
fpmi.nav.openWindow(‘Transmitter’, {‘Tag’ : event.source.Tag})
fpmi.nav.centerWindow(‘Transmitter’)
if event.button == event.BUTTON3:
menuNames = []
menuFunctions = []
menuNames.append("<html>Wiki")
menuFunctions.append(openWiki)
menuNames.append("<html>Files")
menuFunctions.append(showFiles)
cid = fpmi.system.getClientId()
add_del = fpmi.db.runScalarQuery("select 1 from ctg_active_client where pointID='%s' and client_ID='%s'"%(event.source.Tag,cid))
if add_del:
def delFromGraph(event):
import app
app.ctg.deleteGraphPoint(event.source.Tag)
menuNames.append("<html>(-) Delete to Graph")
menuFunctions.append(delFromGraph)
else:
def addToGraph(event):
import app
print event, event.source.name
print event.source.Tag
app.ctg.addGraphPoint(event.source.Tag)
menuNames.append("<html>(+) Add to Graph")
menuFunctions.append(addToGraph)
active = fpmi.db.runScalarQuery("select 1 from ctg_active_client where client_ID = '%s'" %cid)
if active:
menuNames.append("sep")
menuFunctions.append(None)
def clearGraph(event):
import app
app.ctg.clearGraphPoints()
menuNames.append("Clear Current Graph")
menuFunctions.append(clearGraph)
print event,event.source.Tag
def showPopup(event = event, menuNames = menuNames, menuFunctions = menuFunctions):
import fpmi
menu = fpmi.gui.createPopupMenu(menuNames, menuFunctions)
menu.show(event,event.x,event.y)
fpmi.system.invokeLater(showPopup)[/code]
All “print” calls return the event.source.Tag properly, but the print inside the addToGraph function return the event, and event,source.name correctly, but errors out on event.source.Tag. Any ideas why?
Also, the event.srouce.Tag under the if event…button == event.BUTTON1 pert works.