Welcome | Get started | Dive into Lino | Contribute | Reference


Defines the classes MenuItem and Menu


create_item(unused, spec[, action, help_text])

Create a menu item according to the specified arguments.



Menu(user_type, name[, label, parent])

Represents a menu.

MenuItem([name, label, doc, enabled, ...])

A menu item.


Toolbar(user_type, name[, label, parent])

A top-level menu.

class lino.core.menus.MenuItem(name=None, label=None, doc=None, enabled=True, action=None, hotkey=None, params=None, help_text=None, instance=None, javascript=None, href=None)

Bases: object

A menu item. Note that this is subclassed by Menu: a menu is also a menu item.

as_rst(ar, level=None)

Render this menu item as an rst string. Currently used only for writing test cases.

lino.core.menus.create_item(unused, spec, action=None, help_text=None, **kw)

Create a menu item according to the specified arguments.

TODO: explain the arguments and their meaning.

class lino.core.menus.Menu(user_type, name, label=None, parent=None, **kw)

Bases: MenuItem

Represents a menu. A menu is a MenuItem that contains other menu items.

avoid_lonely_items = False

If set to True, avoid lonely menu items by lifting them up one level. This is not done for top-level menus

For example the following menu:

Foo           Bar         Baz
|Foobar       |BarBaz
 | Insert

would become:

Foo           BarBaz        Baz

Dynamically removes empty menu entries and useless separators. Collapses menu with only one item into their parent.

add_action(*args, **kw)

Add a menu item to this menu. All arguments are forwarded to create_item().

add_instance_action(obj, **kw)

Add an action that displays the given database object instance in a detail form for editing.

Used e.g. for the :menuselection`Configure --> System --> Site configuration` command. Or for the [My settings] quicklink in Lino Care.


Adds the specified MenuItem to this menu after checking whether it has view permission.

class lino.core.menus.Toolbar(user_type, name, label=None, parent=None, **kw)

Bases: Menu

A top-level menu.