| 10 | |
| 11 | |
| 12 | class KeyItem(urwid.WidgetWrap): |
| 13 | def __init__(self, walker, binding, focused): |
| 14 | self.walker, self.binding, self.focused = walker, binding, focused |
| 15 | super().__init__(self.get_widget()) |
| 16 | |
| 17 | def get_widget(self): |
| 18 | cmd = textwrap.dedent(self.binding.command).strip() |
| 19 | parts = [ |
| 20 | (4, urwid.Text([("focus", ">> " if self.focused else " ")])), |
| 21 | (10, urwid.Text([("title", self.binding.key)])), |
| 22 | (12, urwid.Text([("highlight", "\n".join(self.binding.contexts))])), |
| 23 | urwid.Text([("text", cmd)]), |
| 24 | ] |
| 25 | return urwid.Columns(parts) |
| 26 | |
| 27 | def get_edit_text(self): |
| 28 | return self._w[1].get_edit_text() |
| 29 | |
| 30 | def selectable(self): |
| 31 | return True |
| 32 | |
| 33 | def keypress(self, size, key): |
| 34 | return key |
| 35 | |
| 36 | |
| 37 | class KeyListWalker(urwid.ListWalker): |
no outgoing calls
no test coverage detected
searching dependent graphs…