Skip to content

Mnemonics for select tag #36

@e3rd

Description

@e3rd

We add mnemonics, underlined letters. Here, hitting Alt+o automatically jumps at 'foo2' etc. If no letter is available, it creates one (here, 'foo3', 'foo4', and 'foo5' have a, b,c).

#!/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)
Image

Do a mechanism that adds mnemonics to select tag options.

Here, option 'one' would use 'n' (because 'o' is taken by 'foo2'), 'two' would take 't', and 'three' would take 'h'. If no letter is available, do not create one.

Here we set mnemonics for forms:

def _determine_mnemonic(self, form: TagDict, also_nones=False):

Here we register mnemonics in GUI:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions