This commit is contained in:
Maximilian Hils 2016-07-15 00:07:32 -07:00
parent 64e16f5112
commit 60d2e14cb9
2 changed files with 11 additions and 11 deletions

View File

@ -317,11 +317,9 @@ class FlowListWalker(urwid.ListWalker):
class FlowListBox(urwid.ListBox): class FlowListBox(urwid.ListBox):
def __init__(self, master): def __init__(self, master):
# type: (mitmproxy.console.master.ConsoleMaster) -> None
self.master = master self.master = master
urwid.ListBox.__init__( super(FlowListBox, self).__init__(FlowListWalker(master, master.state))
self,
FlowListWalker(master, master.state)
)
def get_method_raw(self, k): def get_method_raw(self, k):
if k: if k:
@ -395,13 +393,13 @@ class FlowListBox(urwid.ListBox):
elif key == "F": elif key == "F":
self.master.toggle_follow_flows() self.master.toggle_follow_flows()
elif key == "W": elif key == "W":
if self.master.stream: if self.master.options.outfile:
self.master.stop_stream() self.master.options.outfile = None
else: else:
signals.status_prompt_path.send( signals.status_prompt_path.send(
self, self,
prompt = "Stream flows to", prompt="Stream flows to",
callback = self.master.start_stream_to_path callback= lambda path: self.master.options.update(outfile=(path, "ab"))
) )
else: else:
return urwid.ListBox.keypress(self, size, key) return urwid.ListBox.keypress(self, size, key)

View File

@ -116,10 +116,12 @@ class ActionBar(urwid.WidgetWrap):
class StatusBar(urwid.WidgetWrap): class StatusBar(urwid.WidgetWrap):
def __init__(self, master, helptext): 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.ab = ActionBar()
self.ib = urwid.WidgetWrap(urwid.Text("")) 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.update_settings.connect(self.sig_update_settings)
signals.flowlist_change.connect(self.sig_update_settings) signals.flowlist_change.connect(self.sig_update_settings)
master.options.changed.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)) r.append("cripts:%s]" % len(self.master.options.scripts))
if self.master.options.outfile: if self.master.options.outfile:
r.append("[W:%s]" % self.master.outfile[0]) r.append("[W:%s]" % self.master.options.outfile[0])
return r return r