Working with menus

class hoverset.ui.menu.EnableIf(predicate, *templates)

Built in manipulator that displays only a set of menu items if a condition is met at runtime. If condition is nt met, the menu items are displayed but are disabled

manipulated()

Generate templates to be rendered when menu is displayed

Returns:

manipulated templates menu

class hoverset.ui.menu.LoadLater(loader)

A built in manipulator that generates templates at runtime using a loader function passed in its constructor

manipulated()

Generate templates to be rendered when menu is displayed

Returns:

manipulated templates menu

class hoverset.ui.menu.Manipulator(*templates)

Enables simplification of creation of dynamic menus allowing menu items to be easily manipulated at runtime

manipulated()

Generate templates to be rendered when menu is displayed

Returns:

manipulated templates menu

class hoverset.ui.menu.ShowIf(predicate, *templates)

Builtin manipulator that displays a set of menu items only if a certain condition is met at runtime

manipulated()

Generate templates to be rendered when menu is displayed

Returns:

manipulated templates menu

hoverset.ui.menu.dynamic_menu(func)

Generate a dynamic menu from a class method

Parameters:

func – An instance method taking one positional argument menu. This method wil be called every time the menu needs to be posted. Note that the menu will always be cleared before the method is called

Returns:

the wrapped method returns a dynamic menu