earwax.configuration module

Provides the Config class.

class earwax.configuration.EarwaxConfig

Bases: earwax.config.Config

The main earwax configuration.

An instance of this value will be loaded to earwax.Game.config.

It is advised to configure the game before calling earwax.Game.run().

editors = <earwax.configuration.EditorConfig object>
menus = <earwax.configuration.MenuConfig object>
sound = <earwax.configuration.SoundConfig object>
speech = <earwax.configuration.SpeechConfig object>
class earwax.configuration.EditorConfig

Bases: earwax.config.Config

Configure various things about editors.

Variables:hat_alphabet – The letters that can be entered by a controller’s hat.
hat_alphabet = ConfigValue(value=' abcdefghijklmnopqrstuvwxyz.,1234567890@ABCDEFGHIJKLMNOPQRSTUVWXYZ-#[]{}', name='Hat alphabet', type_=<class 'str'>, value_converters=None, default=' abcdefghijklmnopqrstuvwxyz.,1234567890@ABCDEFGHIJKLMNOPQRSTUVWXYZ-#[]{}', dump_func=None, load_func=None)
class earwax.configuration.MenuConfig

Bases: earwax.config.Config

The menu configuration section.

Variables:
  • default_item_select_sound

    The default sound to play when a menu item is selected.

    If this value is None, no sound will be played, unless specified by the selected menu item.

  • default_item_activate_sound

    The default sound to play when a menu item is activated.

    If this value is None, no sound will be played, unless specified by the activated menu item.

default_item_activate_sound = ConfigValue(value=None, name='The default sound that plays when activating items in menus', type_=typing.Union[pathlib.Path, NoneType], value_converters={<class 'NoneType'>: <function MenuConfig.<lambda>>}, default=None, dump_func=<function dump_path>, load_func=<function load_path>)
default_item_select_sound = ConfigValue(value=None, name='The default sound that plays when moving through menus', type_=typing.Union[pathlib.Path, NoneType], value_converters={<class 'NoneType'>: <function MenuConfig.<lambda>>}, default=None, dump_func=<function dump_path>, load_func=<function load_path>)
class earwax.configuration.SoundConfig

Bases: earwax.config.Config

Configure various aspects of the sound system.

Variables:
  • master_volume

    The volume of audio_context.

    This value acts as a master volume, and should be changed with either adjust_volume(), or set_volume().

  • max_volume – The maximum volume allowed by adjust_volume().
  • sound_volume

    The volume of general sounds.

    This volume is used by earwax to set the volume of interface_sound_manager values.

  • music_volume

    The volume of game music.

    Earwax uses this value to set the volume of the music_sound_manager sound manager.

  • ambiance_volume

    The volume of game ambiances.

    Earwax uses this value to set the volume of the ambiance_sound_manager sound manager.

  • default_cache_size – The default size (in bytes) for the default buffer_cache object.
ambiance_volume = ConfigValue(value=0.4, name='Ambiance volume', type_=<class 'float'>, value_converters=None, default=0.4, dump_func=None, load_func=None)
default_cache_size = ConfigValue(value=524288000, name='The size of the default sound cache in bytes', type_=<class 'int'>, value_converters=None, default=524288000, dump_func=None, load_func=None)
master_volume = ConfigValue(value=1.0, name='Master volume', type_=<class 'float'>, value_converters=None, default=1.0, dump_func=None, load_func=None)
max_volume = ConfigValue(value=1.0, name='Maximum volume', type_=<class 'float'>, value_converters=None, default=1.0, dump_func=None, load_func=None)
music_volume = ConfigValue(value=0.4, name='Music volume', type_=<class 'float'>, value_converters=None, default=0.4, dump_func=None, load_func=None)
sound_volume = ConfigValue(value=0.5, name='Sound volume', type_=<class 'float'>, value_converters=None, default=0.5, dump_func=None, load_func=None)
class earwax.configuration.SpeechConfig

Bases: earwax.config.Config

The speech configuration section.

Variables:
  • speak – Whether or not calls to output() will produce speech.
  • braille – Whether or not calls to output() will produce braille.
braille = ConfigValue(value=True, name='Braille', type_=<class 'bool'>, value_converters=None, default=True, dump_func=None, load_func=None)
speak = ConfigValue(value=True, name='Speech', type_=<class 'bool'>, value_converters=None, default=True, dump_func=None, load_func=None)
earwax.configuration.dump_path(value: Optional[pathlib.Path]) → Optional[str]

Return a path as a string.

Parameters:value – The path to convert.
earwax.configuration.load_path(value: Optional[str]) → Optional[pathlib.Path]

Load a path from a string.

Parameters:value – The string to convert to a path.