Amalgamte saving "this flow" and "all flows" into a single keyboard shortcut.

This commit is contained in:
Aldo Cortesi 2012-07-06 14:10:58 +12:00
parent 40d63c9e7a
commit de294da2a7

View File

@ -20,7 +20,7 @@ def _mkhelp():
text = [] text = []
keys = [ keys = [
("A", "accept all intercepted flows"), ("A", "accept all intercepted flows"),
("a", "accept this intercepted flows"), ("a", "accept this intercepted flow"),
("C", "clear flow list or eventlog"), ("C", "clear flow list or eventlog"),
("d", "delete flow"), ("d", "delete flow"),
("D", "duplicate flow"), ("D", "duplicate flow"),
@ -111,6 +111,21 @@ class ConnectionItem(common.WWrap):
def selectable(self): def selectable(self):
return True 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): def keypress(self, (maxcol,), key):
key = common.shortcuts(key) key = common.shortcuts(key)
if key == "a": if key == "a":
@ -138,18 +153,16 @@ class ConnectionItem(common.WWrap):
self.master.sync_list_view() self.master.sync_list_view()
self.master.statusbar.message("Reverted.") self.master.statusbar.message("Reverted.")
elif key == "w": elif key == "w":
self.master.path_prompt( self.master.prompt_onekey(
"Save flows: ", "Save",
self.state.last_saveload, (
self.master.save_flows ("all flows", "a"),
("this flow", "t"),
),
self.save_flows_prompt,
) )
elif key == "W": elif key == "W":
self.master.path_prompt( pass
"Save this flow: ",
self.state.last_saveload,
self.master.save_one_flow,
self.flow
)
elif key == "X": elif key == "X":
self.flow.kill(self.master) self.flow.kill(self.master)
elif key == "enter": elif key == "enter":