diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-07-28 11:01:32 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-07-28 11:01:32 +1200 |
commit | d6e4ef4cedb6e45e9890f44cc152cd8e90aedb01 (patch) | |
tree | dfd9fb3ed391a3d4173361baeb0bad68a4341f88 /mitmproxy | |
parent | 297cf5d565a1f86e7ffd0cabd2174c41925626e9 (diff) | |
download | mitmproxy-d6e4ef4cedb6e45e9890f44cc152cd8e90aedb01.tar.gz mitmproxy-d6e4ef4cedb6e45e9890f44cc152cd8e90aedb01.tar.bz2 mitmproxy-d6e4ef4cedb6e45e9890f44cc152cd8e90aedb01.zip |
console: add replace_view_state, fix statusbar issues
Fixes #1394
Diffstat (limited to 'mitmproxy')
-rw-r--r-- | mitmproxy/console/master.py | 18 | ||||
-rw-r--r-- | mitmproxy/console/signals.py | 1 |
2 files changed, 18 insertions, 1 deletions
diff --git a/mitmproxy/console/master.py b/mitmproxy/console/master.py index ad46cbb4..87c2cbf2 100644 --- a/mitmproxy/console/master.py +++ b/mitmproxy/console/master.py @@ -257,6 +257,7 @@ class ConsoleMaster(flow.FlowMaster): signals.call_in.connect(self.sig_call_in) signals.pop_view_state.connect(self.sig_pop_view_state) + signals.replace_view_state.connect(self.sig_replace_view_state) signals.push_view_state.connect(self.sig_push_view_state) signals.sig_add_log.connect(self.sig_add_log) self.addons.add(options, *builtins.default_addons()) @@ -295,7 +296,19 @@ class ConsoleMaster(flow.FlowMaster): return callback(*args) self.loop.set_alarm_in(seconds, cb) + def sig_replace_view_state(self, sender): + """ + A view has been pushed onto the stack, and is intended to replace + the current view rather tha creating a new stack entry. + """ + if len(self.view_stack) > 1: + del self.view_stack[1] + def sig_pop_view_state(self, sender): + """ + Pop the top view off the view stack. If no more views will be left + after this, prompt for exit. + """ if len(self.view_stack) > 1: self.view_stack.pop() self.loop.widget = self.view_stack[-1] @@ -311,6 +324,9 @@ class ConsoleMaster(flow.FlowMaster): ) def sig_push_view_state(self, sender, window): + """ + Push a new view onto the view stack. + """ self.view_stack.append(window) self.loop.widget = window self.loop.draw_screen() @@ -351,8 +367,8 @@ class ConsoleMaster(flow.FlowMaster): def toggle_eventlog(self): self.options.eventlog = not self.options.eventlog - signals.pop_view_state.send(self) self.view_flowlist() + signals.replace_view_state.send(self) def _readflows(self, path): """ diff --git a/mitmproxy/console/signals.py b/mitmproxy/console/signals.py index 97507834..93eb399f 100644 --- a/mitmproxy/console/signals.py +++ b/mitmproxy/console/signals.py @@ -43,3 +43,4 @@ flowlist_change = blinker.Signal() # Pop and push view state onto a stack pop_view_state = blinker.Signal() push_view_state = blinker.Signal() +replace_view_state = blinker.Signal() |