| 49 | |
| 50 | |
| 51 | class Binding: |
| 52 | def __init__(self, key, command, contexts, help): |
| 53 | self.key, self.command, self.contexts = key, command, sorted(contexts) |
| 54 | self.help = help |
| 55 | |
| 56 | def keyspec(self): |
| 57 | """ |
| 58 | Translate the key spec from a convenient user specification to one |
| 59 | Urwid understands. |
| 60 | """ |
| 61 | return self.key.replace("space", " ") |
| 62 | |
| 63 | def key_short(self) -> str: |
| 64 | return ( |
| 65 | self.key.replace("enter", "⏎").replace("right", "→").replace("space", "␣") |
| 66 | ) |
| 67 | |
| 68 | def sortkey(self): |
| 69 | return self.key + ",".join(self.contexts) |
| 70 | |
| 71 | |
| 72 | class Keymap: |
no outgoing calls
no test coverage detected
searching dependent graphs…