Skip to content

fontlabapp.qt.menus.OwnedMenus

OwnedMenus

Own menu actions and tool windows; tear them down outside dispatch.

The first add_action that finds no FontLab menu with the requested title creates one menu, titled owned_title. close removes that menu.

Attributes (read-only after construction): qt: the PythonQt module that was passed in. fl: the FontLab module that was passed in. sink: the error_sink callable. owned_title: title of the owned fallback menu.

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
__init__ function (self, qt: Any, fontlab: Any, *, error_sink: Callable[[Exception, object], object], owned_title: str=OWNED_ME… Store the modules and the policy; create no Qt object yet.
action function (self, token: int) -> Any Return the live QAction of <code>token</code><code>, or </code><code>None</code> once removed.
add_action function (self, menu_title: Any, text: str, callback: Callable[[], object], *, index: int | None=None, checkable: bool… Add an action to the menu titled <code>menu&#95;title</code>; return its token.
add_menu function (self, menu_title: str, text: str) -> int Append a submenu titled <code>text</code><code> to </code><code>menu&#95;title</code>; return its token.
close function (self) -> None Remove every item newest first, run queued teardown, drop the menu.
dispatching attribute (self) -> bool Return True while a slot connected by this owner runs.
has_items attribute (self) -> bool Return True if this owner has an action or tool window to remove.
main_window function (self) -> Any Return FontLab's main window (cached); see <code>qtsafe.main&#95;window</code>.
menu function (self, token: int) -> Any Return the live QMenu of an <code>add&#95;menu</code><code> token, or </code><code>None</code> once removed.
own_menu function (self) -> Any Return this owner's own menu, creating it on first use.
remove function (self, token: int) -> None Undo one item; unknown or repeated tokens do nothing.
tool_window function (self, widget: Any, title: str, *, on_close: Callable[[], object] | None=None) -> tuple[int, Any] Show <code>widget</code><code> in a tool window; return </code><code>(token, window)</code>.