aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console/__init__.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-04-01 09:25:50 +1300
committerAldo Cortesi <aldo@nullcube.com>2015-04-01 09:25:50 +1300
commit32ba6021b3c07efaa45a9223479151cd7e74ccbd (patch)
tree0ad364d4edcbed27c12535a8d142b690a34596c0 /libmproxy/console/__init__.py
parent44fb42185f0e177b775c5e4f11249a55390048f6 (diff)
downloadmitmproxy-32ba6021b3c07efaa45a9223479151cd7e74ccbd.tar.gz
mitmproxy-32ba6021b3c07efaa45a9223479151cd7e74ccbd.tar.bz2
mitmproxy-32ba6021b3c07efaa45a9223479151cd7e74ccbd.zip
console: improve handling of help contexts, fix key bindings in flow views
Diffstat (limited to 'libmproxy/console/__init__.py')
-rw-r--r--libmproxy/console/__init__.py34
1 files changed, 22 insertions, 12 deletions
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py
index 660024cc..a963924e 100644
--- a/libmproxy/console/__init__.py
+++ b/libmproxy/console/__init__.py
@@ -15,8 +15,8 @@ import urwid
import weakref
from .. import controller, flow, script
-from . import flowlist, flowview, help, common, window, signals
-from . import grideditor, palettes, contentview, flowdetailview, statusbar
+from . import flowlist, flowview, help, window, signals
+from . import grideditor, palettes, contentview, statusbar
EVENTLOG_SIZE = 500
@@ -227,6 +227,16 @@ class ConsoleMaster(flow.FlowMaster):
def sig_pop_view_state(self, sender):
if self.view_stack:
self.loop.widget = self.view_stack.pop()
+ else:
+ signals.status_prompt_onekey.send(
+ self,
+ prompt = "Quit",
+ keys = (
+ ("yes", "y"),
+ ("no", "n"),
+ ),
+ callback = self.quit,
+ )
def sig_push_view_state(self, sender):
self.view_stack.append(self.loop.widget)
@@ -393,7 +403,6 @@ class ConsoleMaster(flow.FlowMaster):
self.ui.set_terminal_properties(256)
self.ui.register_palette(self.palette.palette())
self.flow_list_walker = flowlist.FlowListWalker(self, self.state)
- self.help_context = None
self.loop = urwid.MainLoop(
urwid.SolidFill("x"),
screen = self.ui,
@@ -444,23 +453,24 @@ class ConsoleMaster(flow.FlowMaster):
sys.stderr.flush()
self.shutdown()
- def view_help(self):
+ def view_help(self, helpctx):
signals.push_view_state.send(self)
self.loop.widget = window.Window(
self,
- help.HelpView(self.help_context),
+ help.HelpView(helpctx),
None,
- statusbar.StatusBar(self, help.footer)
+ statusbar.StatusBar(self, help.footer),
+ None
)
def view_grideditor(self, ge):
signals.push_view_state.send(self)
- self.help_context = ge.make_help()
self.loop.widget = window.Window(
self,
ge,
None,
- statusbar.StatusBar(self, grideditor.FOOTER)
+ statusbar.StatusBar(self, grideditor.FOOTER),
+ ge.make_help()
)
def view_flowlist(self):
@@ -474,24 +484,24 @@ class ConsoleMaster(flow.FlowMaster):
else:
body = flowlist.FlowListBox(self)
- self.help_context = flowlist.help_context
self.loop.widget = window.Window(
self,
body,
None,
- statusbar.StatusBar(self, flowlist.footer)
+ statusbar.StatusBar(self, flowlist.footer),
+ flowlist.help_context
)
self.loop.draw_screen()
def view_flow(self, flow, tab_offset=0):
signals.push_view_state.send(self)
self.state.set_focus_flow(flow)
- self.help_context = flowview.help_context
self.loop.widget = window.Window(
self,
flowview.FlowView(self, self.state, flow, tab_offset),
flowview.FlowViewHeader(self, flow),
- statusbar.StatusBar(self, flowview.footer)
+ statusbar.StatusBar(self, flowview.footer),
+ flowview.help_context
)
def _write_flows(self, path, flows):