Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
dmui.dsl.Menu Class Reference
Inheritance diagram for dmui.dsl.Menu:

Public Member Functions

 __init__ (self, str clazz, str cpp_name, list[str] arg_template, Optional[str] description, Optional[str] name=None, Optional[str] title=None, Optional[str] available_when=None)
 
 template_args (self)
 
 visit (self, visitor)
 

Public Attributes

 cpp_name = cpp_name
 
 clazz = clazz
 
 title = name
 
 name = title
 
 arg_template = arg_template
 
 description = description
 
 available_when = None
 

Detailed Description

Base class for all menus descriptors.

You probably want a subclass of this class if the Menu on the C++ side has
any special behavior:

* If the menu contains others (it's a ``Submenu`` subclass in C++) then you
  probably want a :py:class:`Submenu` instead.
* If the menu appears only in a single submenu but can change its name and
  behavior depending on other system state, you want a
  :py:class:`MultiModeMenu`
* If the menu appears in multiple submenus but has a different meaning in
  each, you want to define a :py:class:`MultiContextMenu` somewhere and
  use :py:meth:`MultiContextMenu.with_context` to instantiate it when it's
  used.

TODO - Additional support is needed for capturing the following pieces of
documentaiton-relavant information:
  - Whether a given menu item supports MIDI mapping (this should also be
    integrated into codegen).
  - Whether a given menu item supports the kit "holding affect all"
    behavior (this would be nice to integrate into codegen but is harder).
  - Maybe some sort of stable identifier for linking purposes?

:param clazz: The C++ class to use for this menu item.
:param cpp_name: The variable name to use when emitting C++ code.
:param arg_template: A list of Python format strings which will be used to
    generate the C++ initializer arguments.
:param description: Path to the description of this menu, relative to
    ``docs/menu``. Can be None, for menus which expect their children to be
    rendered as siblings of themselves rather than rendering themselves.
:param name: The key in the langauge map for the string to be rendered when
    this menu item is presented for selection in a submenu. If None,
    inherited from ``title``. At least one of ``name`` or ``title`` must be
    provided.
:param title: The key in the language map for the header of this menu item
    when it's opened. If None, inherited from ``name``. At least one of
    ``name`` or ``title`` must be provided.
:param available_when: A human-readable description of when this menu item
    is available, if it's only available in certain contexts or when the
    system is in a particular state. A value of None (the default)
    indicates this menu item is always available.

The documentation for this class was generated from the following file: