Added functionality to write marked flows to file

w (write) -> m (marked)
This commit is contained in:
Jake Drahos 2015-06-11 16:15:24 -05:00
parent 122ee88021
commit 486177edc7
2 changed files with 13 additions and 0 deletions

View File

@ -595,6 +595,13 @@ class ConsoleMaster(flow.FlowMaster):
def save_flows(self, path):
return self._write_flows(path, self.state.view)
def save_marked_flows(self, path):
marked_flows = []
for f in self.state.view:
if f.marked:
marked_flows.append(f)
return self._write_flows(path, marked_flows)
def load_flows_callback(self, path):
if not path:
return

View File

@ -121,6 +121,11 @@ class ConnectionItem(urwid.WidgetWrap):
prompt = "Save all flows to",
callback = self.master.save_flows
)
elif k == "m":
signals.status_prompt_path.send(
prompt = "Save marked flows to",
callback = self.master.save_marked_flows
)
else:
signals.status_prompt_path.send(
prompt = "Save this flow to",
@ -220,6 +225,7 @@ class ConnectionItem(urwid.WidgetWrap):
keys = (
("all flows", "a"),
("this flow", "t"),
("marked flows", "m"),
),
callback = self.save_flows_prompt,
)