apptools.preferences.preferences module

The default implementation of a node in a preferences hierarchy.

class apptools.preferences.preferences.Preferences(**traits)[source]

Bases: traits.has_traits.HasTraits

The default implementation of a node in a preferences hierarchy.

add_preferences_listener(listener, path='')[source]

Add a listener for changes to a node’s preferences.

clear(path='')[source]

Remove all preferences from the node at the specified path.

dump(indent='')[source]

Dump the preferences hierarchy to stdout.

flush()[source]

Force any changes in the node to the backing store.

This includes any changes to the node’s descendants.

get(path, default=None, inherit=False)[source]

Get the value of the preference at the specified path.

keys(path='')[source]

Return the preference keys of the node at the specified path.

load(file_or_filename=None)[source]

Load preferences from a file.

This is a merge operation i.e. the contents of the file are added to the node.

This implementation uses ‘ConfigObj’ files.

node(path='')[source]

Return the node at the specified path.

node_exists(path='')[source]

Return True if the node at the specified path exists.

node_names(path='')[source]

Return the names of the children of the node at the specified path.

remove(path)[source]

Remove the preference at the specified path.

remove_preferences_listener(listener, path='')[source]

Remove a listener for changes to a node’s preferences.

save(file_or_filename=None)[source]

Save the node’s preferences to a file.

This implementation uses ‘ConfigObj’ files.

set(path, value)[source]

Set the value of the preference at the specified path.