From de294da2a738e54729d59c6f83ec15abab8a5e5b Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 6 Jul 2012 14:10:58 +1200 Subject: [PATCH] Amalgamte saving "this flow" and "all flows" into a single keyboard shortcut. --- libmproxy/console/flowlist.py | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/libmproxy/console/flowlist.py b/libmproxy/console/flowlist.py index daca6965e..d80849e17 100644 --- a/libmproxy/console/flowlist.py +++ b/libmproxy/console/flowlist.py @@ -20,7 +20,7 @@ def _mkhelp(): text = [] keys = [ ("A", "accept all intercepted flows"), - ("a", "accept this intercepted flows"), + ("a", "accept this intercepted flow"), ("C", "clear flow list or eventlog"), ("d", "delete flow"), ("D", "duplicate flow"), @@ -111,6 +111,21 @@ class ConnectionItem(common.WWrap): def selectable(self): return True + def save_flows_prompt(self, k): + if k == "a": + self.master.path_prompt( + "Save all flows to: ", + self.state.last_saveload, + self.master.save_flows + ) + else: + self.master.path_prompt( + "Save this flow to: ", + self.state.last_saveload, + self.master.save_one_flow, + self.flow + ) + def keypress(self, (maxcol,), key): key = common.shortcuts(key) if key == "a": @@ -138,18 +153,16 @@ class ConnectionItem(common.WWrap): self.master.sync_list_view() self.master.statusbar.message("Reverted.") elif key == "w": - self.master.path_prompt( - "Save flows: ", - self.state.last_saveload, - self.master.save_flows + self.master.prompt_onekey( + "Save", + ( + ("all flows", "a"), + ("this flow", "t"), + ), + self.save_flows_prompt, ) elif key == "W": - self.master.path_prompt( - "Save this flow: ", - self.state.last_saveload, - self.master.save_one_flow, - self.flow - ) + pass elif key == "X": self.flow.kill(self.master) elif key == "enter":