pilot_drive.services.settings package

Submodules

pilot_drive.services.settings.exceptions module

Exceptions of the Settings service

exception pilot_drive.services.settings.exceptions.FailedToReadSettingsException

Bases: Exception

Raised when the settings could not be read

exception pilot_drive.services.settings.exceptions.InvalidAttributeException

Bases: Exception

Raised when an invalid attribute is used in the set_setting or get_setting methods

pilot_drive.services.settings.settings module

Module doing the managing of the PILOT Drive settings

class pilot_drive.services.settings.settings.Settings(master_event_queue: MasterEventQueue, service_type: EventType, logger: MasterLogger)

Bases: AbstractService

The service that manages the settings of PILOT Drive, both web and overarching app wise.

static get_raw_settings() dict

Returns the settings.json in a full dict without any processing or validation. Not recommended for use unless you know what you’re doing.

get_setting(attribute: str, web: bool = False)

Get the value of a specific attribute from the settings

Parameters:
  • attribute – the intended attribute to get

  • web – get from web settings OR general

main()
A do-nothing main method. This will be utilized eventually to detect changes to the

settings.json file, but is just for abstract method purposes now.

refresh()

Push the web settings onto the bus again. When the UI is refreshed, it expects a new settings event on the bus.

set_setting(attribute: str, value, web: bool = False)

Set the value of a specific attribute from the settings

Parameters:
  • attribute – the intended attribute to get

  • value – the value to be set

  • web – set an attribute from web settings OR general

set_web_settings(web_settings: dict) None

Setter for web settings. Removes the unneccesary version info, updates the local web settings, and saves the new settings.json

Parameters:

web_settings – The web settings returned from the UI, in dict form (JSON parsed)

terminate()

A do-nothing method for the time being, nothing to cleanup!

property web_settings: dict

Gets the settings for the UI, and adds the version info.

write_settings() None

Writes the local settings to the settings.json file based on the path specified in constants.py

Module contents

The module that manages the settings of PILOT Drive