|
26 | 26 | ] |
27 | 27 |
|
28 | 28 |
|
| 29 | +# Shortcut, key binding function, footer description, help description |
| 30 | +HELP: dict[str, list[tuple[str, ...]]] = { |
| 31 | + "Navigation": [ |
| 32 | + ("↑ / ↓", "Move selection"), |
| 33 | + ("Enter / Click", "View node attributes"), |
| 34 | + ("Space / Double Click", "Expand or collapse node"), |
| 35 | + ], |
| 36 | + "Editing": [ |
| 37 | + ("a", "add_node", "Add Child", "Add child node"), |
| 38 | + ("A", "add_sibling", "Add Sibling", "Add sibling node"), |
| 39 | + ("r", "rename_node", "Rename", "Rename selected node"), |
| 40 | + ("d", "delete_node", "Delete", "Delete selected node"), |
| 41 | + ("t", "edit_attr", "Edit Attributes", "Edit attributes"), |
| 42 | + ], |
| 43 | + "Search": [ |
| 44 | + ("/", "search", "Search", "Search"), |
| 45 | + ("n", "next_match", "Next", "Next search result"), |
| 46 | + ("N", "prev_match", "Prev", "Previous search result"), |
| 47 | + ], |
| 48 | + "View": [ |
| 49 | + ("e", "toggle_expand", "Expand", "Toggle expand"), |
| 50 | + ("E", "expand_all", "Expand All", "Expand all"), |
| 51 | + ("z", "collapse_all", "Collapse All", "Collapse all"), |
| 52 | + ], |
| 53 | + "File": [ |
| 54 | + ("S", "save_as", "Save As", "Save As"), |
| 55 | + ("q", "quit", "Quit", "Quit Studio"), |
| 56 | + ], |
| 57 | +} |
| 58 | + |
| 59 | +BINDINGS = [ |
| 60 | + # enter / single click: View attribute |
| 61 | + # space / double click: Expand or collapse |
| 62 | + *( |
| 63 | + (item[0], item[1], item[2]) |
| 64 | + for section, items in HELP.items() |
| 65 | + if section in ["Editing", "Search", "View", "File"] |
| 66 | + for item in items |
| 67 | + ), |
| 68 | + ("?", "help", "Help"), |
| 69 | +] |
| 70 | + |
| 71 | + |
29 | 72 | SEARCH_EXAMPLES = """[b]Examples[/] |
30 | 73 | [cyan]alice[/] Exact name |
31 | 74 | [cyan]name:^ali.*[/] Regex name |
|
0 commit comments