lucia.ui package

Submodules

lucia.ui.menu module

class lucia.ui.menu.Menu(scroll_sound='', enter_sound='', open_sound='', border_sound='', music='')

Bases: object

audiogame virtual menu

This object functions as an audiogame menu, where up/down/enter can be used to interact and choose an option. Sounds such as the movement sound, selection sound, etc may be specified. This is an almost direct conversion of bgt’s dynamic_menu class, though it contains some enhancements found in other extensions such as m_pro.

Parameters
  • scroll_sound (str, optional) – File name of the sound that will be played when the cursor moves within the menu because an arrow key was pressed.

  • enter_sound (str, optional) – File name of the sound that will be played when enter is pressed to choose an option.

  • open_sound (str, optional) – File name of the sound that will be played when the menu is presented to the user.

  • border_sound (str, optional) – File name of the sound played when you hit the edge of the menu when trying to move.

  • music (str, optional) – File name of the background music that will be played while this menu is running.

add_item_tts(item, internal_name='')

adds a spoken item to the menu.

Parameters
  • item (str) – The text of the item to be added. This is the text you will here when you come across it in the menu.

  • internal_name (str, optional) – The internal name of this item. when you retrieve the selected item by name this will be returned. Defaults to the spoken text of the item.

add_speech_method(method, shouldInterrupt=True)

selects the speech method and interrupt flag

Parameters
  • method (obj) – The method to use. This method should be either a module or a class and provide the necessary output functions, see lucia.output for an example.

  • shouldInterrupt (bool, optional) – determines if this speech method should interrupt already existing speech when speaking something new. Default is True.

run(intro='select an option', interrupt=True)

presents this menu to the user.

This function blocks until the menu is closed, either by selecting an item or pressing escape. Available controls are up/down arrows, enter, and escape. Wrapping is not supported.

Parameters
  • intro (str, optional) – The text that will be spoken when the menu is presented, this will occur at the same time as the open sound. Default is ‘select an option’

  • interrupt (bool, optional) – Determines if speech is interrupted when it is queued to be spoken. For your sanity, this should always be True. Defaults to True.

Returns

str if an option was selected, containing the option’s internal name. -1 if escape was pressed.

set_callback(callback)

Sets the menus callback. The callback will be called every iteration of the loop.

Parameters

callback (obj) – The method to use as callback. This method should be either a module or a class and provide the necessary output functions, see lucia.output for an example.

Raises

ValueError if callback is not callable

class lucia.ui.menu.YesNoMenu

Bases: lucia.ui.menu.Menu

lucia.ui.menu2 module

advance menu for advance use

this menu module provides highly flexible menu items with different events and an advance menu handling

class lucia.ui.menu2.Menu(items, clicksound='', edgesound='', wrapsound='', entersound='', opensound='', itempos=0, title='menu', fpscap=120, on_index_change=None, callback_function=None)

Bases: object

loop()
run()

when this function is called, menu loop starts. If the user make the menu return such as pressing enter on an item that has can_return attribute set to true the loop ends and it usually returns results as a list of dictionaries

class lucia.ui.menu2.MenuItem(name, can_return=False, has_value=False, value='', value_mode='plaintext', can_be_toggled=False, toggle_value=False, can_activate=True, item_function=None, on_focus=None, event=None)

Bases: object

lucia.ui.menu2.getinput(title, message, multiline=False, value='', mode='plaintext')

lucia.ui.virtualinput module

class lucia.ui.virtualinput.VirtualInput(message='', password=False, whitelist=['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\', ']', '^', '_', '`', '{', '|', '}', '~', ' ', 't', 'n', 'x0b', 'x0c'], value='', callback=None)

Bases: object

run()

Module contents