Add duplicate to connection view, and rename to "D".

This commit is contained in:
Aldo Cortesi 2012-02-19 00:32:20 +13:00
parent d32d6bc5e3
commit 0434988ade
3 changed files with 12 additions and 7 deletions

View File

@ -516,9 +516,7 @@ class ConsoleMaster(flow.FlowMaster):
def focus_current(self):
if self.currentflow:
try:
ids = [id(i) for i in self.state.view]
idx = ids.index(id(self.currentflow))
self.conn_list_view.set_focus(idx)
self.conn_list_view.set_focus(self.state.index(self.currentflow))
except (IndexError, ValueError):
pass

View File

@ -8,10 +8,10 @@ def _mkhelp():
("a", "accept this intercepted connection"),
("C", "clear connection list or eventlog"),
("d", "delete flow"),
("D", "duplicate flow"),
("e", "toggle eventlog"),
("l", "set limit filter pattern"),
("L", "load saved flows"),
("p", "duplicate flow"),
("r", "replay request"),
("R", "revert changes to request"),
("w", "save all flows matching current limit"),
@ -102,6 +102,10 @@ class ConnectionItem(common.WWrap):
self.flow.kill(self.master)
self.state.delete_flow(self.flow)
self.master.sync_list_view()
elif key == "D":
f = self.master.duplicate_flow(self.flow)
self.master.currentflow = f
self.master.focus_current()
elif key == "l":
self.master.prompt("Limit: ", self.state.limit_txt, self.master.set_limit)
self.master.sync_list_view()
@ -111,9 +115,6 @@ class ConnectionItem(common.WWrap):
self.state.last_saveload,
self.master.load_flows_callback
)
elif key == "p":
f = self.master.duplicate_flow(self.flow)
self.master.conn_list_view.set_focus(self.state.index(f))
elif key == "r":
r = self.master.replay_request(self.flow)
if r:

View File

@ -10,6 +10,7 @@ def _mkhelp():
("a", "accept this intercepted connection"),
("b", "save request/response body"),
("d", "delete flow"),
("D", "duplicate flow"),
("e", "edit request/response"),
("m", "change body display mode"),
(None,
@ -463,6 +464,11 @@ class ConnectionView(common.WWrap):
f = self.flow
f.kill(self.master)
self.state.delete_flow(f)
elif key == "D":
f = self.master.duplicate_flow(self.flow)
self.master.view_flow(f)
self.master.currentflow = f
self.master.statusbar.message("Duplicated.")
elif key == "e":
if self.state.view_flow_mode == common.VIEW_FLOW_REQUEST:
self.master.prompt_onekey(