MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / KeyItem

Class KeyItem

mitmproxy/tools/console/keybindings.py:12–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11
12class 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
37class KeyListWalker(urwid.ListWalker):

Callers 1

_getMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…