def _mkhelp(): text = [] keys = [ ("A", "accept all intercepted flows"), ("a", "accept this intercepted flow"), ("b", "save request/response body"), ("C", "export flow to clipboard"), ("D", "duplicate flow"), ("d", "delete flow"), ("e", "edit request/response"), ("f", "load full body data"), ("m", "change body display mode for this entity\n(default mode can be changed in the options)" ), (None, common.highlight_key("automatic", "a") + [("text", ": automatic detection")]), (None, common.highlight_key("hex", "e") + [("text", ": Hex")]), (None, common.highlight_key("html", "h") + [("text", ": HTML")]), (None, common.highlight_key("image", "i") + [("text", ": Image")]), (None, common.highlight_key("javascript", "j") + [("text", ": JavaScript")]), (None, common.highlight_key("json", "s") + [("text", ": JSON")]), (None, common.highlight_key("urlencoded", "u") + [("text", ": URL-encoded data")]), (None, common.highlight_key("raw", "r") + [("text", ": raw data")]), (None, common.highlight_key("xml", "x") + [("text", ": XML")]), ("E", "export flow to file"), ("r", "replay request"), ("V", "revert changes to request"), ("v", "view body in external viewer"), ("w", "save all flows matching current view filter"), ("W", "save this flow"), ("x", "delete body"), ("z", "encode/decode a request/response"), ("tab", "next tab"), ("h, l", "previous tab, next tab"), ("space", "next flow"), ("|", "run script on this flow"), ("/", "search (case sensitive)"), ("n", "repeat search forward"), ("N", "repeat search backwards"), ] text.extend(common.format_keyvals(keys, key="key", val="text", indent=4)) return text
def sig_prompt_onekey(self, sender, prompt, keys, callback, args=()): """ Keys are a set of (word, key) tuples. The appropriate key in the word is highlighted. """ signals.focus.send(self, section="footer") prompt = [prompt, " ("] mkup = [] for i, e in enumerate(keys): mkup.extend(common.highlight_key(e[0], e[1])) if i < len(keys) - 1: mkup.append(",") prompt.extend(mkup) prompt.append(")? ") self.onekey = set(i[1] for i in keys) self._w = urwid.Edit(prompt, "") self.prompting = PromptStub(callback, args)
def sig_prompt_onekey(self, sender, prompt, keys, callback, args=()): """ Keys are a set of (word, key) tuples. The appropriate key in the word is highlighted. """ signals.focus.send(self, section="footer") prompt = [prompt, " ("] mkup = [] for i, e in enumerate(keys): mkup.extend(common.highlight_key(e[0], e[1])) if i < len(keys) - 1: mkup.append(",") prompt.extend(mkup) prompt.append(")? ") self.onekey = set(i[1] for i in keys) self._w = urwid.Edit(prompt, "") self.prompting = (callback, args)
def __init__(self, option, text, shortcut, active, focus): self.option = option textattr = "text" keyattr = "key" if focus and active: textattr = "option_active_selected" keyattr = "option_selected_key" elif focus: textattr = "option_selected" keyattr = "option_selected_key" elif active: textattr = "option_active" if shortcut: text = common.highlight_key(text, shortcut, textattr=textattr, keyattr=keyattr) opt = urwid.Text(text, align="left") opt = urwid.AttrWrap(opt, textattr) opt = urwid.Padding(opt, align="center", width=40) urwid.WidgetWrap.__init__(self, opt)
def __init__(self, option, text, shortcut, active, focus): self.option = option textattr = "text" keyattr = "key" if focus and active: textattr = "option_active_selected" keyattr = "option_selected_key" elif focus: textattr = "option_selected" keyattr = "option_selected_key" elif active: textattr = "option_active" if shortcut: text = common.highlight_key( text, shortcut, textattr = textattr, keyattr = keyattr ) opt = urwid.Text(text, align="left") opt = urwid.AttrWrap(opt, textattr) opt = urwid.Padding(opt, align = "center", width = 40) urwid.WidgetWrap.__init__(self, opt)
def _mkhelp(): text = [] keys = [ ("A", "accept all intercepted flows"), ("a", "accept this intercepted flow"), ("b", "save request/response body"), ("C", "export flow to clipboard"), ("D", "duplicate flow"), ("d", "delete flow"), ("e", "edit request/response"), ("f", "load full body data"), ("m", "change body display mode for this entity\n(default mode can be changed in the options)"), (None, common.highlight_key("automatic", "a") + [("text", ": automatic detection")] ), (None, common.highlight_key("hex", "e") + [("text", ": Hex")] ), (None, common.highlight_key("html", "h") + [("text", ": HTML")] ), (None, common.highlight_key("image", "i") + [("text", ": Image")] ), (None, common.highlight_key("javascript", "j") + [("text", ": JavaScript")] ), (None, common.highlight_key("json", "s") + [("text", ": JSON")] ), (None, common.highlight_key("urlencoded", "u") + [("text", ": URL-encoded data")] ), (None, common.highlight_key("raw", "r") + [("text", ": raw data")] ), (None, common.highlight_key("xml", "x") + [("text", ": XML")] ), ("E", "export flow to file"), ("r", "replay request"), ("V", "revert changes to request"), ("v", "view body in external viewer"), ("w", "save all flows matching current view filter"), ("W", "save this flow"), ("x", "delete body"), ("z", "encode/decode a request/response"), ("tab", "next tab"), ("h, l", "previous tab, next tab"), ("space", "next flow"), ("|", "run script on this flow"), ("/", "search (case sensitive)"), ("n", "repeat search forward"), ("N", "repeat search backwards"), ] text.extend(common.format_keyvals(keys, key="key", val="text", indent=4)) return text