NavItem
One entry a plugin contributes to a core menu.
from plexora.api import NavItemAlso available as plexora.api.plugin.NavItem.
NavItem(
menu: str,
label: str,
path: str = '',
order: int = 0,
icon: str = '',
shortcut: str = '',
)Data, not markup: core renders each entry as a plain link with its own
classes, so a plugin cannot style, script or restructure a core menu by
contributing to it. Passed as one of Plugin.nav_items.
Fields
labelstrrequiredText shown for this entry.
pathstrdefault ''Appended to this plugin's own url_prefix. A plugin can only ever link into its own namespace, which is what stops a nav entry becoming a way to point a core menu at an arbitrary URL.
orderintdefault 0Sort key within the menu. Ties break on label, so the order is stable whatever sequence plugins were discovered in.
iconstrdefault ''A Font Awesome name without the fa- prefix, e.g. "images". Core renders
it into the menu's icon gutter; a plugin still cannot supply markup, only
name a glyph, so this stays as much data as label is.
shortcutstrdefault ''Keystroke that follows this link, written as in normalize_shortcut.
Optional -- an entry with no shortcut simply prints none, and the gutter
stays aligned either way.
Examples
from plexora.api.plugin import NavItem
nav_items = (
NavItem(menu="file", label="Open My Plugin…", path="/library"),
)