The XL and application menus¶
We have seen The application menu. You have already read about Lino Extensions Library, a library of shared plugins that are designed to work together. An important aspect of this collaboration is how to integrate the functionalities into the application menu.
This is a tested document. The following instructions are used for initialization:
The code snippets on this page use the
>>> from lino import startup >>> startup('lino_book.projects.min1.settings.doctests') >>> from lino.api.doctest import *
lino_book.projects.min1 has the following menu:
>>> rt.login('robin').show_menu() - Contacts : Persons, Organizations - Configure : - System : Site Parameters, Users - Contacts : Organization types, Functions - Places : Countries, Places - Explorer : - System : Authorities, User types, User roles - Contacts : Contact Persons, Partners - Site : About
This menu is not defined by overriding the
setup_menu method. It was automatically generated by the
installed plugins. Let's explore how this works.
The default implementation of
setup_menu uses a system of predefined top-level
menus that are filled by the different installed plugins.
These predefined top-level menus are themselves configurable in the
top_level_menus attribute of your
application. You might specify your own set of top-level menus.
But the Lino Extensions Library assumes that your application uses the default value, which is:
>>> settings.SITE.top_level_menus [('master', 'Master'), ('main', None), ('reports', 'Reports'), ('config', 'Configure'), ('explorer', 'Explorer'), ('site', 'Site')]
It is a list of tuples with 2 items each. Each tuple has an internal name and a display name. Only the main entry has no display name.
When a Lino application starts up, it loops over the installed plugins and, for
each of them, loops again over these top-level menus and checks whether the
plugin has a method called
setup_XXX_menu (where XXX is the top-level menu
The Configuration menu¶
The Explorer menu¶