aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamoilenko Roman <ttahabatt@gmail.com>2018-01-04 18:02:39 +0200
committerMaximilian Hils <git@maximilianhils.com>2018-01-04 17:02:39 +0100
commit133dd1743db59d013d6839c9dff0846e95041675 (patch)
tree2de44e2c816f035166ff70d59638064ff48e044c
parentd982dd98a04b3ec2f21e709cc2cd82fb9a7db70b (diff)
downloadmitmproxy-133dd1743db59d013d6839c9dff0846e95041675.tar.gz
mitmproxy-133dd1743db59d013d6839c9dff0846e95041675.tar.bz2
mitmproxy-133dd1743db59d013d6839c9dff0846e95041675.zip
Bugs with console fixed. (#2746)
Clicking on a tab now focuses it. Fixes #2676.
-rw-r--r--mitmproxy/tools/console/window.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/mitmproxy/tools/console/window.py b/mitmproxy/tools/console/window.py
index 6d49e8b1..c7bce7d3 100644
--- a/mitmproxy/tools/console/window.py
+++ b/mitmproxy/tools/console/window.py
@@ -16,7 +16,10 @@ from mitmproxy.tools.console import eventlog
class StackWidget(urwid.Frame):
- def __init__(self, widget, title, focus):
+ def __init__(self, window, widget, title, focus):
+ self.is_focused = focus
+ self.window = window
+
if title:
header = urwid.AttrWrap(
urwid.Text(title),
@@ -29,6 +32,11 @@ class StackWidget(urwid.Frame):
header=header
)
+ def mouse_event(self, size, event, button, col, row, focus):
+ if event == "mouse press" and button == 1 and not self.is_focused:
+ self.window.switch()
+ return super().mouse_event(size, event, button, col, row, focus)
+
def keypress(self, size, key):
# Make sure that we don't propagate cursor events outside of the widget.
# Otherwise, in a horizontal layout, urwid's Pile would change the focused widget
@@ -162,6 +170,7 @@ class Window(urwid.Frame):
else:
title = None
return StackWidget(
+ self,
widget,
title,
self.pane == idx