opsoro.preferences

This module defines the interface for communicating with the settings of the robot.

class opsoro.preferences._Preferences[source]

Bases: object

__init__()[source]

Preferences class to store and retrieve settings.

apply_prefs(update_audio=False, update_wireless=False, restart_wireless=False, update_dns=False)[source]

Apply preferences to the system.

Parameters:
  • update_audio (bool) – True if audio settings have changed and needs to update.
  • update_wireless (bool) – True if wireless settings have changed and the wireless interface needs to update.
  • restart_wireless (bool) – True if wireless settings have changed and the wireless interface needs to restart.
  • update_dns (bool) – True if DNS settings have changed and needs to update.
get(section, item, default)[source]

Retrieve preference value.

Parameters:
  • section (string) – category in which the item is defined.
  • item (string) – item to retrieve.
  • default – default value to return if the value is not available.
Returns:

preference value

load_prefs()[source]

Load preferences into data.

save_prefs()[source]

Saves preferences to yaml file.

set(section, item, value)[source]

Set preference value.

Parameters:
  • section (string) – category in which the item is defined.
  • item (string) – item to set.
  • value – value to set.
opsoro.preferences.constrain(n, minn, maxn)