codekingpro/portable-devtools
114k
1import urwid2 3from mitmproxy.net.http import cookies4from mitmproxy.tools.console import signals5from mitmproxy.tools.console.grideditor import base6 7 8class Column(base.Column):9 def __init__(self, heading, subeditor):10 super().__init__(heading)11 self.subeditor = subeditor12 13 def Edit(self, data):14 raise RuntimeError("SubgridColumn should handle edits itself")15 16 def Display(self, data):17 return Display(data)18 19 def blank(self):20 return []21 22 def keypress(self, key: str, editor):23 if key in "rRe":24 signals.status_message.send(message="Press enter to edit this field.")25 return26 elif key == "m_select":27 self.subeditor.grideditor = editor28 editor.master.switch_view("edit_focus_setcookie_attrs")29 else:30 return key31 32 33class Display(base.Cell):34 def __init__(self, data):35 p = cookies._format_pairs(data, sep="\n")36 w = urwid.Text(p)37 super().__init__(w)38 39 def get_data(self):40 pass41 