Preferences
Jump to navigation
Jump to search
The Preferences object (accessed through the fx.prefs attribute) provides access to the Silhouette preferences map.
Preferences are accessed using the map key syntax, where pref_id is a string:
# query a preference value
value = fx.prefs[pref_id]
# set a preference value
fx.prefs[pref_id] = value
Scripts can add new preferences to the system and get notified when the preference is changed.
Methods
Name | Description |
---|---|
add(id, value, min=None, max=None, hidden=False) | Add a preference with the specified id and default value. If the value is of type Integer or Float, min and max can be specified to define a supported range. In this case, the preference will be displayed as a slider. The preference can be hidden from the Preferences dialog by setting hidden=True. |
addHandler(id, function) | Adds a new preference handler for the preference with the specified id. When the preference is changed, the function will be called, with no arguments. |
keys() | Returns a List of all of the registered preference ids/keys. |