mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-02 00:05:27 +00:00
Bugs with console fixed. (#2746)
Clicking on a tab now focuses it. Fixes #2676.
This commit is contained in:
parent
d982dd98a0
commit
133dd1743d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user