From 60d2e14cb9617d98d24cb3278f2f7245bef91a29 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 15 Jul 2016 00:07:32 -0700 Subject: [PATCH] fix #1358 --- mitmproxy/console/flowlist.py | 14 ++++++-------- mitmproxy/console/statusbar.py | 8 +++++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mitmproxy/console/flowlist.py b/mitmproxy/console/flowlist.py index 8c20c4b65..2f167a4d4 100644 --- a/mitmproxy/console/flowlist.py +++ b/mitmproxy/console/flowlist.py @@ -317,11 +317,9 @@ class FlowListWalker(urwid.ListWalker): class FlowListBox(urwid.ListBox): def __init__(self, master): + # type: (mitmproxy.console.master.ConsoleMaster) -> None self.master = master - urwid.ListBox.__init__( - self, - FlowListWalker(master, master.state) - ) + super(FlowListBox, self).__init__(FlowListWalker(master, master.state)) def get_method_raw(self, k): if k: @@ -395,13 +393,13 @@ class FlowListBox(urwid.ListBox): elif key == "F": self.master.toggle_follow_flows() elif key == "W": - if self.master.stream: - self.master.stop_stream() + if self.master.options.outfile: + self.master.options.outfile = None else: signals.status_prompt_path.send( self, - prompt = "Stream flows to", - callback = self.master.start_stream_to_path + prompt="Stream flows to", + callback= lambda path: self.master.options.update(outfile=(path, "ab")) ) else: return urwid.ListBox.keypress(self, size, key) diff --git a/mitmproxy/console/statusbar.py b/mitmproxy/console/statusbar.py index e7a700a6e..040ea26dd 100644 --- a/mitmproxy/console/statusbar.py +++ b/mitmproxy/console/statusbar.py @@ -116,10 +116,12 @@ class ActionBar(urwid.WidgetWrap): class StatusBar(urwid.WidgetWrap): def __init__(self, master, helptext): - self.master, self.helptext = master, helptext + # type: (mitmproxy.console.master.ConsoleMaster, object) -> None + self.master = master + self.helptext = helptext self.ab = ActionBar() self.ib = urwid.WidgetWrap(urwid.Text("")) - self._w = urwid.Pile([self.ib, self.ab]) + super(StatusBar, self).__init__(urwid.Pile([self.ib, self.ab])) signals.update_settings.connect(self.sig_update_settings) signals.flowlist_change.connect(self.sig_update_settings) master.options.changed.connect(self.sig_update_settings) @@ -224,7 +226,7 @@ class StatusBar(urwid.WidgetWrap): r.append("cripts:%s]" % len(self.master.options.scripts)) if self.master.options.outfile: - r.append("[W:%s]" % self.master.outfile[0]) + r.append("[W:%s]" % self.master.options.outfile[0]) return r