MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / WindowStack

Class WindowStack

mitmproxy/tools/console/window.py:52–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50
51
52class WindowStack:
53 def __init__(self, master, base):
54 self.master = master
55 self.windows = dict(
56 flowlist=flowlist.FlowListBox(master),
57 flowview=flowview.FlowView(master),
58 commands=commands.Commands(master),
59 keybindings=keybindings.KeyBindings(master),
60 options=options.Options(master),
61 help=help.HelpView(master),
62 eventlog=eventlog.EventLog(master),
63 edit_focus_query=grideditor.QueryEditor(master),
64 edit_focus_comment=grideditor.CommentEditor(master),
65 edit_focus_cookies=grideditor.CookieEditor(master),
66 edit_focus_setcookies=grideditor.SetCookieEditor(master),
67 edit_focus_setcookie_attrs=grideditor.CookieAttributeEditor(master),
68 edit_focus_multipart_form=grideditor.RequestMultipartEditor(master),
69 edit_focus_urlencoded_form=grideditor.RequestUrlEncodedEditor(master),
70 edit_focus_path=grideditor.PathEditor(master),
71 edit_focus_request_headers=grideditor.RequestHeaderEditor(master),
72 edit_focus_response_headers=grideditor.ResponseHeaderEditor(master),
73 )
74 self.stack = [base]
75 self.overlay = None
76
77 def set_overlay(self, o, **kwargs):
78 self.overlay = overlay.SimpleOverlay(
79 self,
80 o,
81 self.top_widget(),
82 o.width,
83 **kwargs,
84 )
85
86 def top_window(self):
87 """
88 The current top window, ignoring overlays.
89 """
90 return self.windows[self.stack[-1]]
91
92 def top_widget(self):
93 """
94 The current top widget - either a window or the active overlay.
95 """
96 if self.overlay:
97 return self.overlay
98 return self.top_window()
99
100 def push(self, wname):
101 if self.stack[-1] == wname:
102 return
103 prev = self.top_window()
104 self.stack.append(wname)
105 self.call("layout_pushed", prev)
106
107 def pop(self, *args, **kwargs):
108 """
109 Pop off the stack, return True if we're already at the top.

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…