From 5975cc8301f307ddf1c9b2bf4639d9e214080c74 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 30 Oct 2016 18:25:33 +1300 Subject: [PATCH 1/2] console: status bar improvements - Arrow to show flow order - Hook statusbar up to focus change to fix some update issues --- mitmproxy/tools/console/common.py | 4 ++++ mitmproxy/tools/console/statusbar.py | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/mitmproxy/tools/console/common.py b/mitmproxy/tools/console/common.py index 08bf0b67f..cfc69bfcc 100644 --- a/mitmproxy/tools/console/common.py +++ b/mitmproxy/tools/console/common.py @@ -123,10 +123,14 @@ if urwid.util.detected_encoding: SYMBOL_REPLAY = u"\u21ba" SYMBOL_RETURN = u"\u2190" SYMBOL_MARK = u"\u25cf" + SYMBOL_UP = u"\u21E7" + SYMBOL_DOWN = u"\u21E9" else: SYMBOL_REPLAY = u"[r]" SYMBOL_RETURN = u"<-" SYMBOL_MARK = "[m]" + SYMBOL_UP = "^" + SYMBOL_DOWN = " " # Save file to disk diff --git a/mitmproxy/tools/console/statusbar.py b/mitmproxy/tools/console/statusbar.py index 7d019f53a..a1ac42987 100644 --- a/mitmproxy/tools/console/statusbar.py +++ b/mitmproxy/tools/console/statusbar.py @@ -119,12 +119,13 @@ class StatusBar(urwid.WidgetWrap): self.helptext = helptext self.ib = urwid.WidgetWrap(urwid.Text("")) super().__init__(urwid.Pile([self.ib, self.master.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) + signals.update_settings.connect(self.sig_update) + signals.flowlist_change.connect(self.sig_update) + master.options.changed.connect(self.sig_update) + master.view.focus.sig_change.connect(self.sig_update) self.redraw() - def sig_update_settings(self, sender, updated=None): + def sig_update(self, sender, updated=None): self.redraw() def keypress(self, *args, **kwargs): @@ -229,8 +230,14 @@ class StatusBar(urwid.WidgetWrap): offset = 0 else: offset = self.master.view.focus.index + 1 + + if self.master.options.order_reversed: + arrow = common.SYMBOL_UP + else: + arrow = common.SYMBOL_DOWN + t = [ - ('heading', ("[%s/%s]" % (offset, fc)).ljust(9)) + ('heading', ("%s [%s/%s]" % (arrow, offset, fc)).ljust(11)), ] if self.master.server.bound: From 9322167eeb4ca7b8455f3f223e7fc185c05eaca8 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 30 Oct 2016 18:33:51 +1300 Subject: [PATCH 2/2] console: show order option in status bar --- mitmproxy/tools/console/statusbar.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mitmproxy/tools/console/statusbar.py b/mitmproxy/tools/console/statusbar.py index a1ac42987..b358f7111 100644 --- a/mitmproxy/tools/console/statusbar.py +++ b/mitmproxy/tools/console/statusbar.py @@ -181,6 +181,10 @@ class StatusBar(urwid.WidgetWrap): r.append("[") r.append(("heading_key", "M")) r.append(":%s]" % self.master.options.default_contentview) + if self.master.options.order: + r.append("[") + r.append(("heading_key", "o")) + r.append(":%s]" % self.master.options.order) opts = [] if self.master.options.anticache: