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.
This commit is contained in:
Aldo Cortesi 2017-06-11 11:57:44 +12:00
parent d7cc7e62a2
commit a4833a5bbf
2 changed files with 2 additions and 21 deletions

View File

@ -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()

View File

@ -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"