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

lino.core.layouts

See Introduction to layouts.

Functions

DEBUG_LAYOUTS(lo)

Classes

ActionParamsLayout([main, datasource, ...])

A Layout description for an action parameter panel.

BaseLayout([main, datasource, hidden_elements])

Base class for all Layouts (FormLayout, ColumnsLayout and ParamsLayout).

ColumnsLayout([main, datasource, ...])

A layout for describing the columns of a table.

DetailLayout([main, datasource, hidden_elements])

DummyPanel()

A layout panel which does not exist in the current configuration but might exist as a real panel in some other configuration.

FieldLayout([main, datasource, hidden_elements])

FormLayout([main, datasource, hidden_elements])

Base class for layout descriptions of detail and insert windows.

InsertLayout([main, datasource, hidden_elements])

LayoutHandle(layout, ui)

A layout handle analyzes a layout (an instance of BaseLayout or a some subclass thereof) and holds the resulting metadata, especially the layout elements and panels provided by the renderer.

Panel(desc[, label])

To be used when a panel cannot be expressed using a simple template string because it requires one or more options.

ParamsLayout([main, datasource, hidden_elements])

A Layout description for a table parameter panel.

Exceptions

LayoutError

class lino.core.layouts.DummyPanel

Bases: object

A layout panel which does not exist in the current configuration but might exist as a real panel in some other configuration.

class lino.core.layouts.Panel(desc, label=None, **options)

Bases: object

To be used when a panel cannot be expressed using a simple template string because it requires one or more options. These options parameters can be:

  • label

  • required_roles

  • window_size

  • label_align

Unlike a BaseLayout it cannot have any child panels and cannot become a tabbed panel.

replace(*args, **kw)

Calls the standard string.replace() method on this Panel's template.

class lino.core.layouts.LayoutHandle(layout, ui)

Bases: object

A layout handle analyzes a layout (an instance of BaseLayout or a some subclass thereof) and holds the resulting metadata, especially the layout elements and panels provided by the renderer.

The implementation of layout elements is delegated to the front end. So there is one layout handle per layout per front end.

We differentiate panels from atomic elements. A panel is a group of elements and is either vertical or horizontal.

LayoutHandle is not meant to be subclassed. The same class is used for all kinds of BaseLayout instances.

main

The main element.

splitdesc(picture, **options)

Parse the given element descriptor and return a tuple (name, options) where name is the element name and options is a dict with widget options (keyword arguments to be forwarded to the widget constructor (LayoutElement)).

class lino.core.layouts.BaseLayout(main=None, datasource=None, hidden_elements=None, **kw)

Bases: object

Base class for all Layouts (FormLayout, ColumnsLayout and ParamsLayout).

A Layout instance just holds the string templates. It is designed to be subclassed by applications programmers.

In some cases we still use the (deprecated) methods set_detail_layout, set_insert_layout, add_detail_panel and add_detail_tab on the Actor.

window_size = None

A tuple (width, height) that specifies the size of the window to be used for this layout.

For example, specifying window_size=(50, 30) means "50 characters wide and 30 lines high". The height value can also be the string 'auto'.

main = None

The description of the main element of this layout.

For a ColumnsLayout this is the same as column_names.

remove_element(*args)

Removes specified element names from this layout's main template.

update(**kw)

Update the template of one or more panels.

add_panel(name, tpl, label=None, **options)

Adds a new panel to this layout.

Arguments:

  • name is the internal name of the panel

  • tpl the template string

  • label an optional label

  • any further keyword are passed as options to the new panel

add_tabpanel(name, tpl=None, label=None, **options)

Add a tab panel to an existing layout. Arguments: see BaseLayout.add_panel(). The difference with BaseLayout.add_panel() is that this potentially turns the existing main panel to a tabbed panel.

Arguments:

  • name is the internal name of the panel

  • tpl the template string

  • label an optional label

get_layout_handle(front_end=None)

Return the LayoutHandle for this layout. Create a LayoutHandle instance if this is the first call.

20230217: Removed ui argument because we no longer have Lino sites with several front ends.

20230407: Restored ui argument, now named front_end because I changed my mind.

class lino.core.layouts.FormLayout(main=None, datasource=None, hidden_elements=None, **kw)

Bases: FieldLayout

Base class for layout descriptions of detail and insert windows.

Lino instantiates this for every detail_layout and for every insert_layout.

class lino.core.layouts.ColumnsLayout(main=None, datasource=None, hidden_elements=None, **kw)

Bases: FieldLayout

A layout for describing the columns of a table.

Lino automatically creates one instance of this for every table using the string specified in that table's column_names attribute.

class lino.core.layouts.ParamsLayout(main=None, datasource=None, hidden_elements=None, **kw)

Bases: BaseLayout

A Layout description for a table parameter panel.

Lino instantiates this for every actor with parameters, based on that actor's params_layout.

class lino.core.layouts.ActionParamsLayout(main=None, datasource=None, hidden_elements=None, **kw)

Bases: ParamsLayout

A Layout description for an action parameter panel.

Lino instantiates this for every params_layout of a custom action.

A subclass of ParamsLayout.