-
Notifications
You must be signed in to change notification settings - Fork 0
Settings UI
The settings UI is built upon a SettingsUI.json file and should be found together with your _LSE.py files. Check the preinstalled script or find it here if deleted (probably). Here is the structure:
{
"name":"example test",
"path":"extensions\\example",
"scripts":["example.test_LSE"],
"event":"p-ExampleScriptSettingsUpdateEvent",
"settings":{
"NameOfVariable":{
"type":"range",
"min":0,
"max":10,
"tip":"Input a number"
},
"NameOfVariable2":{
"type":"text",
"tip":"Input some awesome text"
},
"NameOfVariable3":{
"type":"number",
"tip":"Input a number",
"max":10,
"min":-10
},
"NameOfVariable4":{
"type":"dropdown",
"tip":"Awesome dropdown menu",
"choices":["this", "is", "a", "dropdown"]
}
}
}
The key settings contains a dictionary of all variables and the values for the variables are different HTML attributes. Tip is the only key that is not a input attribute, this is a text that is displayed above the input itself. (All input types can be found here) You are as well able to create a dropdown menu, take a look at the example above where "type":"dropdown"
The key name is the settings name, the strings value does not really matter but is displayed on the main screen (http://localhost:port). Make sure to give it a name that can be connected to your script.
The key path is a string that contains the directory where you would like to save settings.js and settings.json. Make sure to use double-slash (\). Probably where your SettingsUI.json is but feel free to change it.
The key scripts is a list that contains all scripts that you would like to call on settings changes. The function gets passed the new data.
The key event is a string that have to start with p- and this event is called whenever new data is changed. The settings are passed thru the event.