Possible to get default value(s) for custom menu?
Posted: Fri Jul 15, 2016 5:00 pm
If I'm calling a custom menu the one thing that drives me nuts is not having a default value returned with the list of options. I can't find anything in the docs that let you return more than the list of options for that field, is there a way to let Indigo know to use one of the returned values as a default?
For instance:
I want to be able to return that list and say "defaultValue = 1" along with it.
For instance:
- Code: Select all
# THIS FIELD IN DEVICES.XML:
<Field type="menu" id="customList">
<Label>Custom List:</Label>
<List class="self" filter="" method="getCustomList" dynamicReload="true"/>
</Field>
# CALLS THIS FUNCTION IN PLUGIN.PY:
def getCustomList(filter, valuesDict, typeId, targetId):
ret = [("default", "No items found")]
try:
listRet = []
# Loop over options
listRet.append((0, "First Option"))
listRet.append((1, "Second Option"))
# Return custom list to Indigo
return listRet
except:
return ret
I want to be able to return that list and say "defaultValue = 1" along with it.