MCPcopy
hub / github.com/mitmproxy/mitmproxy / focus_changed

Method focus_changed

mitmproxy/tools/console/flowview.py:68–108  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

66 self.show()
67
68 def focus_changed(self):
69 f = self.flow
70 if f:
71 if isinstance(f, http.HTTPFlow):
72 if f.websocket:
73 self.tabs = [
74 (self.tab_http_request, self.view_request),
75 (self.tab_http_response, self.view_response),
76 (self.tab_websocket_messages, self.view_websocket_messages),
77 (self.tab_details, self.view_details),
78 ]
79 else:
80 self.tabs = [
81 (self.tab_http_request, self.view_request),
82 (self.tab_http_response, self.view_response),
83 (self.tab_details, self.view_details),
84 ]
85 elif isinstance(f, tcp.TCPFlow):
86 self.tabs = [
87 (self.tab_tcp_stream, self.view_message_stream),
88 (self.tab_details, self.view_details),
89 ]
90 elif isinstance(f, udp.UDPFlow):
91 self.tabs = [
92 (self.tab_udp_stream, self.view_message_stream),
93 (self.tab_details, self.view_details),
94 ]
95 elif isinstance(f, dns.DNSFlow):
96 self.tabs = [
97 (self.tab_dns_request, self.view_dns_request),
98 (self.tab_dns_response, self.view_dns_response),
99 (self.tab_details, self.view_details),
100 ]
101 self.show()
102 else:
103 # Get the top window from the focus stack (the currently active view).
104 # If it's NOT the "flowlist", it's safe to pop back to the previous view.
105 if self.master.window.focus_stack().stack[-1] != "flowlist":
106 self.master.window.pop()
107 # If it is the "flowlist", we’re already at the main view with no flows to show.
108 # Popping now would close the last window and prompt app exit, so we remain on the empty flow list screen instead.
109
110 def tab_http_request(self):
111 flow = self.flow

Callers

nothing calls this directly

Calls 3

showMethod · 0.80
focus_stackMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected