Hello, I am working to display specific views based off of a computer/HMI IP address on session startup.
The Session startup script is:
def onStartup(session):
ip = session.props.address
view = nav.handleStartup(ip)
system.perspective.navigate(view=view)
With corresponding scripts:
# IPMapping
IP_TO_HMI_MAPPING = {
"192.168.57.234":1,
# 2-12 here...,
"192.168.57.250":13 #this is the main computer
}
def handleStartup(ip):
import system.perspective
hmiNumber = IPMapping.IP_TO_HMI_MAPPING.get(ip, 'Unknown')
if hmiNumber in range(1,13):
return "HMI_Screens/Main_Screen"
elif hmiNumber == 13:
return "Main/Main"
else:
return "Unknown_View"
When I launched a session on my localhost, I expected to see my "Unknown_View" view, but I just see a blank screen.
I get the following error in my logs on the gateway:
java.lang.IllegalArgumentException: No perspective page attached to this thread.
Should there be a change script on the session property instead? Open to any suggestions.