msa.builtins.command_registry package

Submodules

msa.builtins.command_registry.events module

class msa.builtins.command_registry.events.CommandEvent(priority)[source]

Bases: msa.core.event.Event

The base class for all command based events. All event constructors registered with the CommandRegistry must be as subclass of this class.

class msa.builtins.command_registry.events.HelpCommandEvent[source]

Bases: msa.builtins.command_registry.events.CommandEvent

A command event handled by the HelpCommandHandler, prompting it to print help text based on parameters provided.

class msa.builtins.command_registry.events.RegisterCommandEvent[source]

Bases: msa.core.event.Event

Used for registering a new command type with the Command Registry.

msa.builtins.command_registry.handlers module

class msa.builtins.command_registry.handlers.CommandRegistryHandler(loop, event_queue, logger, config=None)[source]

Bases: msa.core.event_handler.EventHandler

Registers and dispatches commands.

When creating a new command, it must create a RegisterCommandEvent. When the user enters text, the command registry handler attempts to parse the text as commands and dispatches command events appropriately. All command events should subclass the CommandEvent type.

handle()[source]

An abstract method which must be overwritten. Once the system is started, the handle method will be called repeatedly until the system shuts down. The handler must be non-blocking.

parse_text_input(event)[source]

Attempts to parse text as a command, an dispatches a new command event appropriately.

register_command(data)[source]

Registers a new command

class msa.builtins.command_registry.handlers.HelpCommandHandler(loop, event_queue, logger, config=None)[source]

Bases: msa.core.event_handler.EventHandler

This handler listens for RegiserCommandEvents and records registered commands. When a help command is issued, it prints the appropriate help text.

display_help(event)[source]

Displays help text overview or specific help text if a command is specified.

handle()[source]

An abstract method which must be overwritten. Once the system is started, the handle method will be called repeatedly until the system shuts down. The handler must be non-blocking.

init()[source]

An optional initialization hook, may be used for executing setup code before all handlers have benn fully started.

print(msg)[source]

Submits a TextOutputEvent

register_command(event)[source]

Registers a new command, registered commands are used for resolving help information.

Module contents