Preferences

From sfx
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:

<source lang="python">

  1. query a preference value

value = fx.prefs[pref_id]

  1. set a preference value

fx.prefs[pref_id] = value </source>

Scripts can add new preferences to the system and get notified when the preference is changed.

Methods[edit]

Name Description
add(id, value, min=None, max=None, hidden=False, items=None) 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. If value is of type Integer and items points to a list of strings, the preference will be displayed as a list popup. The preference can be hidden from the Preferences dialog by setting hidden=True. Supported values are Bool, Int, Float, and String.
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.