From a4833a5bbf6552c255be416c5ff3d4b8f7e7780b Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 11 Jun 2017 11:57:44 +1200 Subject: 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. --- mitmproxy/tools/console/grideditor/base.py | 3 ++- 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" -- cgit v1.2.3