Hello everyone
I’m having trouble switching from a binding to a script
Let me explain, first I created a map with markers, according to their alarm levels the marker flashes, so far everything works
I wanted to automate the system because we enter all the markers by hand, so now it’s a script that enters the marker data according to my folders in [default], only I can’t manage to implement the binding as a script
I copy binding and put it in my script but it doesn’t work
If anyone has a solution, or an indication
Thanks
My binding on the marker :
Now my script
Method that will run whenever the selected event fires.
Arguments:
self: A reference to the component that is invoking this function.
"""
Centrales = system.tag.browse("[default]")
centrale= []
paths = []
liste = []
lat = []
lon = []
for Centrale in Centrales.getResults():
centrale.append(str(Centrale['name']))
## informationtag = system.tag.getConfiguration(Centrale, True)
for i in range(len(centrale)):
paths.append('[default]' + centrale[i] + '/INFORMATION')
for k in range(len(paths)):
lat.append(str(paths[k]) + '/Latitude')
for l in range(len(paths)):
lon.append(str(paths[l]) + '/Longitude')
valuelat = system.tag.readBlocking(lat)
valuelon = system.tag.readBlocking(lon)
for m in range(len(centrale)):
name = centrale[m]
texte = centrale[m].title()
latitude = valuelat[m].value
longitude = valuelon[m].value
liste.append({
'name': name,
'enabled': True,
'lat': latitude,
'lng': longitude,
'opacity': "1",
'icon': {
'path': "material/location_on",
'color': "#4190F7",
'size': {
'width': 20,
'height': 20
},
'style': {
'classes':
{
"type": "expr",
"config": {
"expression": "runScript(\"Color.Color\", 10, {this.props.layers.ui.marker[1].name}) "
},
"transforms": [
{
"fallback": "",
"inputType": "scalar",
"mappings": [
{
"input": 1,
"output": "blink"
},
{
"input": 2,
"output": "blink"
},
{
"input": 3,
"output": ""
},
{
"input": 4,
"output": ""
},
{
"input": 5,
"output": ""
}
],
"outputType": "style-list",
"type": "map"
}
]
}
}
},
'event': {
'stopPropagation': False
},
'tooltip': {
'content': {
'text': texte,
'view': {
'path': "",
'params': {}
}
},
'direction': "auto",
'permanent': False,
'sticky': False,
'opacity': 1
},
'popup': {
'enabled': False,
'content': {
'text': texte,
'view': {
'path': "",
'params': {}
}
},
'width': {
'max': 300,
'min': 50
},
'height': {
'max': ''
},
'pan': {
'auto': True
},
'closeButton': True,
'autoClose': True,
'closeOnEscapeKey': True,
'closeOnClick': ''
}
})
self.props.layers.ui.marker = liste