menus.queue module

Contains menu queues for individual players.

Bases: menus.queue._UserQueue

Represents a queue for ESC menus.

Initialize the ESC queue.

Parameters:index (int) – See _UserQueue.__init__().

Bases: dict

Creates a _UserQueue object for every missing key.

Initialize the queue holder.

Parameters:

Remove and return the given key’s value.

Bases: collections.deque

Controls the user’s menu queue.

Handles selections and decides which menu should be displayed.

Initialize the queue.

Parameters:index (int) – A valid player index.

Re-send the current active menu.

If there is no active menu, nothing will be done.

Handle a menu selection.

Removes the current active menu from the queue and forwards the selection to that menu.

If the selection callback returns a menu, it will be appended to the left side of the queue. After that the queue will be refreshed, so the next menu will be displayed.

Parameters:choice (int) – The choice that was made.

Add a menu to the end of the queue.

Parameters:menu (_BaseMenu) – The menu to add.

Add a menu to the beginning of the queue.

Parameters:menu (_BaseMenu) – The menu to add.

Add all menus in the given iterable to the end of the queue.

Parameters:menus (iterable) – The menus to add.

Add all menus in the given iterable to the beginning of the queue.

Parameters:menus (iterable) – The menus to add.

Return the first menu instance in this queue.

If there is no menu, None will be returned.

Forward the selection to the proper user queue.

Forward the selection to the proper user queue.

Validate a selection command.

Parameters:
  • index (int) – The command from client command callback.
  • index – The player index that issued the command.
  • valid_choices (iterable) – All valid choices.