earwax.conversation_level module

Provides the CallResponseLevel class, and various supporting classes.

class earwax.conversation_level.CallResponseSettings

Bases: earwax.config.Config

Configuration for a conversation session.

output_audio = ConfigValue(value=True, name='Play audio', type_=<class 'bool'>, value_converters=None, default=True, dump_func=None, load_func=None)
output_braille = ConfigValue(value=True, name='Output in braille', type_=<class 'bool'>, value_converters=None, default=True, dump_func=None, load_func=None)
output_speech = ConfigValue(value=True, name='Speak text', type_=<class 'bool'>, value_converters=None, default=True, dump_func=None, load_func=None)
class earwax.conversation_level.ConversationBase(id: str = NOTHING, text: Optional[str] = None, sound: Optional[str] = None)

Bases: earwax.mixins.DumpLoadMixin

A base for conversations and finishers.

class earwax.conversation_level.ConversationEditor(game: Game, tree: earwax.conversation_level.ConversationTree = NOTHING, filename: pathlib.Path = NOTHING, items: List[Union[earwax.conversation_level.ConversationSection, earwax.conversation_level.Finisher]] = NOTHING, stack: List[earwax.conversation_level.ItemsStack] = NOTHING, at_home: bool = False, current_position: int = 0)

Bases: earwax.level.Level

Used for editing a conversation tree.

collapse_item() → None

Move up to the previous level of items.

current_item

Get the currently focused entry.

expand_item() → None

Move into the next level of items.

finisher_menu() → Optional[Generator[None, None, None]]

Show a menu of finishers for the current item.

home(silent: bool = False) → None

Populate the items list with all items.

Parameters:silent – If True, the selected item will not be output.
new_finisher() → None

Create a new finisher.

new_section() → None

Create a new conversation section.

next_item() → None

Move down in the items list.

output_item() → None

Output the current item.

previous_item() → None

Move up in the current list.

response_menu() → Optional[Generator[None, None, None]]

Show a response menu for the current item.

save() → None

Save this tree.

set_initial_id() → None

Set the initial conversation section.

set_sound() → Optional[Generator[None, None, None]]

Set the sound for the current item.

set_text() → Optional[Generator[None, None, None]]

Set the text for the currently focused item.

sort_items() → None

Sort items by ID.

switch_item(direction: int) → None

Switch items.

class earwax.conversation_level.ConversationSection(id: str = NOTHING, text: Optional[str] = None, sound: Optional[str] = None, before_wait: Union[float, Tuple[float, float], None] = None, after_wait: Union[float, Tuple[float, float], None] = None, response_ids: List[str] = NOTHING, finisher_ids: List[str] = NOTHING)

Bases: earwax.conversation_level.ConversationBase

A part of a conversation.

class earwax.conversation_level.ConversationTree(sections: Dict[str, earwax.conversation_level.ConversationSection] = NOTHING, finishers: Dict[str, earwax.conversation_level.Finisher] = NOTHING, initial_section_id: Optional[str] = None, winning_section_ids: List[str] = NOTHING)

Bases: earwax.mixins.DumpLoadMixin

A structure for holding conversation sections and finishers.

class earwax.conversation_level.Finisher(id: str = NOTHING, text: Optional[str] = None, sound: Optional[str] = None)

Bases: earwax.conversation_level.ConversationBase

Do something after a response has been selected.

class earwax.conversation_level.ItemsStack(items: List[Union[earwax.conversation_level.ConversationSection, earwax.conversation_level.Finisher]], position: int)

Bases: object

Store items.