Uranium
Application Framework
Loading...
Searching...
No Matches
UM.Preferences.Preferences Class Reference

Public Member Functions

None __init__ (self)
None indicateUntrustedPreference (self, str group, str key, Callable[[str], bool] eval_func)
None addPreference (self, str key, Any default_value)
None removePreference (self, str key)
None setDefault (self, str key, Any default_value)
None setValue (self, str key, Any value)
Any getValue (self, str key)
None resetPreference (self, str key)
None readFromFile (self, Union[str, IO[str]] file)
None writeToFile (self, Union[str, IO[str]] file)
None deserialize (self, str serialized)

Static Public Attributes

int Version = 7
 preferenceChanged = Signal(Signal.Queued)

Protected Member Functions

Tuple[str, str] _splitKey (self, str key)
Optional[Any] _findPreference (self, str key)
None _loadFile (self, Union[str, IO[str]] file)

Protected Attributes

 _parser = None
dict _preferences = {}
dict _untrusted_preferences = {}

Detailed Description

Preferences are application based settings that are saved for future use.

Typical preferences would be window size, standard machine, etc.
The application preferences can be gotten from the getPreferences() function in Application

Member Function Documentation

◆ addPreference()

None UM.Preferences.Preferences.addPreference ( self,
str key,
Any default_value )
Add a new preference to the list.

If the preference was already added, it's default is set to whatever is provided

◆ deserialize()

None UM.Preferences.Preferences.deserialize ( self,
str serialized )
Extract data from string and store it in the Configuration parser.

◆ indicateUntrustedPreference()

None UM.Preferences.Preferences.indicateUntrustedPreference ( self,
str group,
str key,
Callable[[str], bool] eval_func )
Indicates that the value of this setting should be evaluated before acceptance, and otherwise not loaded.

◆ setDefault()

None UM.Preferences.Preferences.setDefault ( self,
str key,
Any default_value )
Changes the default value of a preference.

If the preference is currently set to the old default, the value of the
preference will be set to the new default.

:param key: The key of the preference to set the default of.
:param default_value: The new default value of the preference.

The documentation for this class was generated from the following file:
  • UM/Preferences.py