diff options
author | Aldo Cortesi <aldo@corte.si> | 2017-06-11 11:17:19 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2017-06-11 11:17:19 +1200 |
commit | f804495fd84a689bd397b0f4b1ccc2346385dbd9 (patch) | |
tree | 4a3ee14ca2d6b9fb63a8fa5a9544bd4e693a9ffb | |
parent | 8427c2c4c7e4dac79d51a10a63d38fe06dbfae4c (diff) | |
download | mitmproxy-f804495fd84a689bd397b0f4b1ccc2346385dbd9.tar.gz mitmproxy-f804495fd84a689bd397b0f4b1ccc2346385dbd9.tar.bz2 mitmproxy-f804495fd84a689bd397b0f4b1ccc2346385dbd9.zip |
console: overlays shouldn't clear window titles
-rw-r--r-- | mitmproxy/tools/console/layoutwidget.py | 2 | ||||
-rw-r--r-- | mitmproxy/tools/console/window.py | 16 |
2 files changed, 11 insertions, 7 deletions
diff --git a/mitmproxy/tools/console/layoutwidget.py b/mitmproxy/tools/console/layoutwidget.py index 689be3c0..27e270a0 100644 --- a/mitmproxy/tools/console/layoutwidget.py +++ b/mitmproxy/tools/console/layoutwidget.py @@ -5,6 +5,8 @@ class LayoutWidget: All top-level layout widgets and all widgets that may be set in an overlay must comply with this API. """ + # Title is only required for windows, not overlay components + title = None keyctx = "" def key_responder(self): diff --git a/mitmproxy/tools/console/window.py b/mitmproxy/tools/console/window.py index 51f36c78..d021bf35 100644 --- a/mitmproxy/tools/console/window.py +++ b/mitmproxy/tools/console/window.py @@ -135,24 +135,26 @@ class Window(urwid.Frame): if c == "single": self.pane = 0 - def wrap(w, idx): - if self.master.options.console_layout_headers and hasattr(w, "title"): - return Header(w, w.title, self.pane == idx) + def wrapped(idx): + window = self.stacks[idx].top_window() + widget = self.stacks[idx].top_widget() + if self.master.options.console_layout_headers and window.title: + return Header(widget, window.title, self.pane == idx) else: - return w + return widget w = None if c == "single": - w = wrap(self.stacks[0].top_widget(), 0) + w = wrapped(0) elif c == "vertical": w = urwid.Pile( [ - wrap(s.top_widget(), i) for i, s in enumerate(self.stacks) + wrapped(i) for i, s in enumerate(self.stacks) ] ) else: w = urwid.Columns( - [wrap(s.top_widget(), i) for i, s in enumerate(self.stacks)], + [wrapped(i) for i, s in enumerate(self.stacks)], dividechars=1 ) |