Debian Codegraph @

tests/android/webview/menu.py

raw
1 from __future__ import annotations
2
3 from collections.abc import Callable
4 from typing import Any
5
6
7 class Menu:
8 def __init__(self, title: str, items: list[Menu | MenuAction | MenuSeparator] = []) -> None:
9 """
10 Args:
11 title: the menu or submenu title
12 items: the contents of the menu (can consist of Menu, MenuAction, or MenuSeparator instances)
13 """
14 self.title = title
15 self.items = items
16
17
18 class MenuAction:
19 def __init__(self, title: str, function: Callable[[], Any]) -> None:
20 self.title = title
21 self.function = function
22 # TODO: support platform-agnostic shortcut
23 # self.shortcut = shortcut
24
25
26 class MenuSeparator:
27 pass