diff options
author | Rob Wills <robwills@apple.com> | 2012-08-01 23:57:56 -0700 |
---|---|---|
committer | Rob Wills <robwills@apple.com> | 2012-08-01 23:57:56 -0700 |
commit | c985e2219663f6bf9159198aaf8eacd02e4ac674 (patch) | |
tree | 5c907e0b562cf5c41bd34089ef793afbacc86ef3 /libmproxy/console/__init__.py | |
parent | 87d05a95ffec6ec99c8f6401feb847fcf516353e (diff) | |
download | mitmproxy-c985e2219663f6bf9159198aaf8eacd02e4ac674.tar.gz mitmproxy-c985e2219663f6bf9159198aaf8eacd02e4ac674.tar.bz2 mitmproxy-c985e2219663f6bf9159198aaf8eacd02e4ac674.zip |
Press "F" to Follow
Following of the flow list
- ConsoleState now has a follow_focus property
-- when True it will cause focus to follow added flows
- ConsoleMaster implements toggle_follow_flows()
-- when enabling follow, also jumps to most recent flow
- StatusBar reports follow_focus state
-- adds "following" to option list when true
- Added "F" to FlowList keys
-- implementation requests ConsoleMaster to toggle_follow_flows()
Diffstat (limited to 'libmproxy/console/__init__.py')
-rw-r--r-- | libmproxy/console/__init__.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py index 482c762d..8ce91d73 100644 --- a/libmproxy/console/__init__.py +++ b/libmproxy/console/__init__.py @@ -175,6 +175,8 @@ class StatusBar(common.WWrap): opts.append("killextra") if self.master.server.config.no_upstream_cert: opts.append("no-upstream-cert") + if self.master.state.follow_focus: + opts.append("following") if opts: r.append("[%s]"%(":".join(opts))) @@ -252,6 +254,7 @@ class ConsoleState(flow.State): def __init__(self): flow.State.__init__(self) self.focus = None + self.follow_focus = None self.default_body_view = contentview.VIEW_AUTO self.view_flow_mode = common.VIEW_FLOW_REQUEST self.last_script = "" @@ -270,6 +273,8 @@ class ConsoleState(flow.State): f = flow.State.add_request(self, req) if self.focus is None: self.set_focus(0) + elif self.follow_focus: + self.set_focus(len(self.view) - 1) return f def add_response(self, resp): @@ -935,6 +940,14 @@ class ConsoleMaster(flow.FlowMaster): self.state.clear() self.sync_list_view() + def toggle_follow_flows(self): + # toggle flow follow + self.state.follow_focus = not self.state.follow_focus + # jump to most recent flow if follow is now on + if self.state.follow_focus: + self.state.set_focus(self.state.flow_count()) + self.sync_list_view() + def delete_flow(self, f): self.state.delete_flow(f) self.sync_list_view() |