Settings

class Settings(main_settings: list[Setting], sound_settings: list[Setting], screen_settings: list[Setting], touchscreen_settings: list[Setting], telegram_settings: list[Setting], directory_settings: list[Setting], sync_settings: list[Setting], server_settings: list[Setting], device_settings: list[Setting], hourly_alarm_settings: list[Setting], cycle_alarm_settings: list[Setting], session_alarm_settings: list[Setting], cam_framerate_settings: list[Setting], corridor_settings: list[Setting], extra_settings: list[Setting], controller_settings: list[Setting], bpod_settings: list[Setting], camera_settings: list[Setting], motor_settings: list[Setting], visual_settings: list[Setting], hidden_settings: list[Setting])[source]

Bases: object

Manages system settings, including storage, retrieval, and grouping.

Settings are grouped by category (main, sound, screen, etc.) and backed by QSettings for persistent storage.

__init__(main_settings: list[Setting], sound_settings: list[Setting], screen_settings: list[Setting], touchscreen_settings: list[Setting], telegram_settings: list[Setting], directory_settings: list[Setting], sync_settings: list[Setting], server_settings: list[Setting], device_settings: list[Setting], hourly_alarm_settings: list[Setting], cycle_alarm_settings: list[Setting], session_alarm_settings: list[Setting], cam_framerate_settings: list[Setting], corridor_settings: list[Setting], extra_settings: list[Setting], controller_settings: list[Setting], bpod_settings: list[Setting], camera_settings: list[Setting], motor_settings: list[Setting], visual_settings: list[Setting], hidden_settings: list[Setting]) None[source]

Methods

__init__(main_settings, sound_settings, ...)

add_new_settings()

Add any missing settings to QSettings with their default values.

check_settings()

Ensure all required settings exist in storage.

create_factory_settings()

Initialize all settings with their factory defaults in QSettings.

get(key)

Retrieve the value of a setting.

get_description(key)

Get the description of a setting.

get_index(key)

Get the index of the value of a setting when it is a enum or list of enums

get_indices(key)

Get the index of the value of a setting when it is a enum or list of enums

get_text(key)

Get the string representation of the value of a setting.

get_type(key)

Get the type of a setting.

get_values(key)

Get the possible values of a setting when it is a enum or list of enums

print()

restore_directory_settings()

Reset directory settings to their factory default values.

restore_factory_settings()

Reset all restorable settings to their factory default values.

restore_visual_settings()

Reset visual settings to their factory default values.

set(key, value)

sync()

restore_factory_settings() None[source]

Reset all restorable settings to their factory default values.

restore_visual_settings() None[source]

Reset visual settings to their factory default values.

restore_directory_settings() None[source]

Reset directory settings to their factory default values.

create_factory_settings() None[source]

Initialize all settings with their factory defaults in QSettings.

add_new_settings() None[source]

Add any missing settings to QSettings with their default values.

check_settings() None[source]

Ensure all required settings exist in storage.

If it’s the first launch, creates all factory settings. Otherwise, adds any new settings that are missing.

get(key: str) Any[source]

Retrieve the value of a setting.

Parameters:

key (str) – The identifier of the setting.

Returns:

The value of the setting converted to its appropriate type, or None if the setting or value is invalid.

Return type:

Any

get_text(key: str) str[source]

Get the string representation of the value of a setting.

get_values(key: str) list[source]

Get the possible values of a setting when it is a enum or list of enums

get_index(key: str) int[source]

Get the index of the value of a setting when it is a enum or list of enums

get_indices(key: str) list[int][source]

Get the index of the value of a setting when it is a enum or list of enums

get_description(key: str) str[source]

Get the description of a setting.

get_type(key: str) type | None[source]

Get the type of a setting.

set(key: str, value: Any) None[source]
sync() None[source]
print() None[source]