diff options
author | Aldo Cortesi <aldo@corte.si> | 2017-06-11 11:57:44 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2017-06-11 11:57:44 +1200 |
commit | a4833a5bbf6552c255be416c5ff3d4b8f7e7780b (patch) | |
tree | 9a1bde1cc856a395a8451163f6bb84cff0e86997 | |
parent | d7cc7e62a28378436dafde91b646da9852d8e5dc (diff) | |
download | mitmproxy-a4833a5bbf6552c255be416c5ff3d4b8f7e7780b.tar.gz mitmproxy-a4833a5bbf6552c255be416c5ff3d4b8f7e7780b.tar.bz2 mitmproxy-a4833a5bbf6552c255be416c5ff3d4b8f7e7780b.zip |
console: grideditor - re-add column headers
Also remove special-case shortcut for user-agent. This is awkward in the new
structure. Down the track we can come up with a more regular mechanism like
snippets.
-rw-r--r-- | mitmproxy/tools/console/grideditor/base.py | 3 | ||||
-rw-r--r-- | mitmproxy/tools/console/grideditor/editors.py | 20 |
2 files changed, 2 insertions, 21 deletions
diff --git a/mitmproxy/tools/console/grideditor/base.py b/mitmproxy/tools/console/grideditor/base.py index b956e59d..38538449 100644 --- a/mitmproxy/tools/console/grideditor/base.py +++ b/mitmproxy/tools/console/grideditor/base.py @@ -309,7 +309,8 @@ class BaseGridEditor(urwid.WidgetWrap): self.walker = GridWalker(self.value, self) self.lb = GridListBox(self.walker) - w = urwid.Frame(self.lb) + w = urwid.Frame(self.lb, header=h) + super().__init__(w) signals.footer_help.send(self, helptext="") self.show_empty_msg() diff --git a/mitmproxy/tools/console/grideditor/editors.py b/mitmproxy/tools/console/grideditor/editors.py index 4a38eb78..511e246e 100644 --- a/mitmproxy/tools/console/grideditor/editors.py +++ b/mitmproxy/tools/console/grideditor/editors.py @@ -39,7 +39,6 @@ class HeaderEditor(base.FocusEditor): urwid.Text([("text", "Special keys:\n")]) ] keys = [ - ("U", "add User-Agent header"), ] text.extend( common.format_keyvals(keys, key="key", val="text", indent=4) @@ -48,25 +47,6 @@ class HeaderEditor(base.FocusEditor): text.extend(h) return text - def set_user_agent(self, k): - ua = user_agents.get_by_shortcut(k) - if ua: - self.walker.add_value( - [ - b"User-Agent", - ua[2].encode() - ] - ) - - def handle_key(self, key): - if key == "U": - signals.status_prompt_onekey.send( - prompt="Add User-Agent header:", - keys=[(i[0], i[1]) for i in user_agents.UASTRINGS], - callback=self.set_user_agent, - ) - return True - class RequestHeaderEditor(HeaderEditor): title = "Edit Request Headers" |