Re-jigger flow view shortcuts so we don't over-ride global shortcuts.

This commit is contained in:
Aldo Cortesi 2011-01-31 10:57:33 +13:00
parent 74aa622fdd
commit 1619d164ff

View File

@ -358,6 +358,15 @@ class ConnectionView(WWrap):
key = None key = None
self.master.refresh_connection(self.flow) self.master.refresh_connection(self.flow)
def _changeview(self, v):
if v == "r":
self.state.view_body_mode = VIEW_BODY_RAW
elif v == "h":
self.state.view_body_mode = VIEW_BODY_BINARY
elif v == "i":
self.state.view_body_mode = VIEW_BODY_INDENT
self.master.refresh_connection(self.flow)
def keypress(self, size, key): def keypress(self, size, key):
if key == "tab": if key == "tab":
if self.state.view_flow_mode == VIEW_FLOW_REQUEST: if self.state.view_flow_mode == VIEW_FLOW_REQUEST:
@ -373,15 +382,17 @@ class ConnectionView(WWrap):
elif key == "A": elif key == "A":
self.master.accept_all() self.master.accept_all()
self.master.view_flow(self.flow) self.master.view_flow(self.flow)
elif key == "b": elif key == "m":
self.state.view_body_mode = VIEW_BODY_BINARY self.master.prompt_onekey(
self.master.refresh_connection(self.flow) "View",
elif key == "r": (
self.state.view_body_mode = VIEW_BODY_RAW ("raw", "r"),
self.master.refresh_connection(self.flow) ("indent", "i"),
elif key == "I": ("hex", "h"),
self.state.view_body_mode = VIEW_BODY_INDENT ),
self.master.refresh_connection(self.flow) self._changeview
)
key = None
elif key == "e": elif key == "e":
if self.state.view_flow_mode == VIEW_FLOW_REQUEST: if self.state.view_flow_mode == VIEW_FLOW_REQUEST:
self.master.prompt_onekey( self.master.prompt_onekey(
@ -931,18 +942,14 @@ class ConsoleMaster(controller.Master):
text.extend([("head", "\n\nConnection view keys:\n")]) text.extend([("head", "\n\nConnection view keys:\n")])
keys = [ keys = [
("b", "view hexdump"),
("r", "view raw"),
("I", "view indented"),
None,
("space", "next flow"),
("p", "previous flow"),
None,
("e", "edit response/request"), ("e", "edit response/request"),
("m", "change view mode (raw, indent, hex)"),
("p", "previous flow"),
("s", "save this flow"), ("s", "save this flow"),
("v", "view contents in external viewer"), ("v", "view contents in external viewer"),
("w", "save request or response body"), ("w", "save request or response body"),
("tab", "toggle response/request view"), ("tab", "toggle response/request view"),
("space", "next flow"),
] ]
text.extend(format_keyvals(keys, key="key", val="text", indent=4)) text.extend(format_keyvals(keys, key="key", val="text", indent=4))