-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
We create a form
#!/usr/bin/env python3
from dataclasses import dataclass
from typing import Literal
from mininterface import run
@dataclass
class Env:
foo1: str
foo2: int
foo3: float
foo4: bool
foo5: Literal["one", "two", "three"]
m = run(Env)
print(m.env)
Make it work so that if a select form is focused, hitting numbers would select the corresponding element, here hitting '1' would select 'one', and '2' would select 'two'.
Here, we bind shortcuts for mnemonics:
| adaptor.bind_shortcut(f"<Alt-{char}>", taking_focus) |
When done, add the shortcuts to this manager:
| self.shortcuts = set(["F1: Show this help", "Enter: Submit form", "Escape: Cancel"]) |
We might need to turn the set into a class and add a 'remove' method or something so that the shortcut appear and disappear on de/focusing the select tag.
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers