aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-08-02 11:02:23 +1200
committerAldo Cortesi <aldo@nullcube.com>2011-08-02 11:02:23 +1200
commit73a7d893e3f0805381651dddd29eb7d689f81c4f (patch)
tree2d2830adf8f49435fe159d015322703e3c55425a
parent759f5d71a66732f2aa9ebc09513380867af2d2f2 (diff)
downloadmitmproxy-73a7d893e3f0805381651dddd29eb7d689f81c4f.tar.gz
mitmproxy-73a7d893e3f0805381651dddd29eb7d689f81c4f.tar.bz2
mitmproxy-73a7d893e3f0805381651dddd29eb7d689f81c4f.zip
Give a visual indication that the eventlog has focus.
-rw-r--r--libmproxy/console.py35
1 files changed, 20 insertions, 15 deletions
diff --git a/libmproxy/console.py b/libmproxy/console.py
index 2242a5d5..bf86f187 100644
--- a/libmproxy/console.py
+++ b/libmproxy/console.py
@@ -859,8 +859,20 @@ class Options(object):
class BodyPile(urwid.Pile):
- def __init__(self, master, lst):
- urwid.Pile.__init__(self, lst)
+ def __init__(self, master):
+ h = urwid.Text("Event log")
+ h = urwid.Padding(h, align="left", width=("relative", 100))
+
+ self.inactive_header = urwid.AttrWrap(h, "inactive_heading")
+ self.active_header = urwid.AttrWrap(h, "heading")
+
+ urwid.Pile.__init__(
+ self,
+ [
+ urwid.ListBox(master.conn_list_view),
+ urwid.Frame(urwid.ListBox(master.eventlist), header = self.inactive_header)
+ ]
+ )
self.master = master
self.focus = 0
@@ -868,6 +880,10 @@ class BodyPile(urwid.Pile):
if key == "tab":
self.focus = (self.focus + 1)%len(self.widget_list)
self.set_focus(self.focus)
+ if self.focus == 1:
+ self.widget_list[1].header = self.active_header
+ else:
+ self.widget_list[1].header = self.inactive_header
key = None
elif key == "v":
self.master.toggle_eventlog()
@@ -1170,6 +1186,7 @@ class ConsoleMaster(flow.FlowMaster):
('error', 'light red', 'default'),
('header', 'dark cyan', 'default'),
('heading', 'white,bold', 'dark blue'),
+ ('inactive_heading', 'white', 'dark gray'),
('highlight', 'white,bold', 'default'),
('inactive', 'dark gray', 'default'),
('ack', 'light red', 'default'),
@@ -1245,19 +1262,7 @@ class ConsoleMaster(flow.FlowMaster):
self.ui.clear()
self.focus_current()
if self.eventlog:
- h = urwid.Text("Event log")
- h = urwid.Padding(h, align="left", width=("relative", 100))
- h = urwid.AttrWrap(h, "heading")
- self.body = BodyPile(
- self,
- [
- urwid.ListBox(self.conn_list_view),
- urwid.Frame(
- urwid.ListBox(self.eventlist),
- header = h
- )
- ]
- )
+ self.body = BodyPile(self)
else:
self.body = urwid.ListBox(self.conn_list_view)
self.statusbar = StatusBar(self, self.footer_text_default)