settings.types module

Contains user setting types.

class settings.types.BoolSetting(name, default, text=None)[source]

Bases: settings.types.SettingsType

Class used to store boolean value settings.

_type

alias of bool

__init__(name, default, text=None)[source]
_is_valid_setting(value)[source]

Return whether the given value is a valid boolean value.

_typecast_value(value)[source]

Cast the given value to a boolean.

class settings.types.IntegerSetting(name, default, text=None, min_value=None, max_value=None)[source]

Bases: settings.types.SettingsType

Class used to store integer value settings.

_type

alias of int

__init__(name, default, text=None, min_value=None, max_value=None)[source]

Store the base attributes on instantiation.

_add_option(choice_index, value)[source]

Add the value to the menu.

_chosen_value(menu, index, option)[source]

Store the player’s chosen value for the setting.

_create_menu()[source]
_is_valid_setting(value)[source]

Return whether the given value is a valid value for the setting.

_menu_build(menu, index)[source]

Build the menu.

class settings.types.SettingsType(name, default, text=None)[source]

Bases: object

Class used to store settings with possible values.

__init__(name, default, text=None)[source]

Store the base attributes and create the menu.

_chosen_value(menu, index, option)[source]

Store the player’s chosen value for the setting.

_create_menu()[source]
_get_default_value()[source]
_is_valid_setting(value)[source]

Return whether or not the given value is valid.

_menu_build(menu, index)[source]

Set the default value in the menu description.

_send_chosen_message(index, value)[source]

Send message about choice made for setting change.

_typecast_default_convar()[source]

Return the type-casted value of the default ConVar.

_typecast_value(value)[source]

Cast the value to the proper type.

get_setting(index)[source]

Return the setting value for the given player index.

_type

The type of object to cast values to for the class.

convar

Return the convar name of the setting.

Return type:str
prefix = ''
class settings.types.StringSetting(name, default, text=None)[source]

Bases: settings.types.SettingsType

Class used to store string value settings with available options.

_type

alias of str

__init__(name, default, text=None)[source]

Store the base attributes on instatiation.

_is_valid_setting(value)[source]

Return whether the given value is a valid value for the setting.

_send_chosen_message(index, value)[source]

Send message about choice made for setting change.

add_option(name, text=None)[source]

Add an option to the setting’s dictionary.

remove_option(name)[source]

Remove an option from the settings.