aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console/options.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-04-03 14:47:55 +1300
committerAldo Cortesi <aldo@nullcube.com>2015-04-03 14:47:55 +1300
commit41a1a0bef3b40b744c232a1adba478f8ac0f2c6c (patch)
treead7ae044c4ceee7f5048d2c6034e7ebff3d22bae /libmproxy/console/options.py
parent57bdb893425058d03b1aaf28e1c774c81a8d9403 (diff)
downloadmitmproxy-41a1a0bef3b40b744c232a1adba478f8ac0f2c6c.tar.gz
mitmproxy-41a1a0bef3b40b744c232a1adba478f8ac0f2c6c.tar.bz2
mitmproxy-41a1a0bef3b40b744c232a1adba478f8ac0f2c6c.zip
console: C to clear all options, correct footer in options screen
Diffstat (limited to 'libmproxy/console/options.py')
-rw-r--r--libmproxy/console/options.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/libmproxy/console/options.py b/libmproxy/console/options.py
index bb6b6c09..db6cc151 100644
--- a/libmproxy/console/options.py
+++ b/libmproxy/console/options.py
@@ -3,6 +3,10 @@ import urwid
from . import common, signals
help_context = None
+footer = [
+ ('heading_key', "enter/space"), ":toggle ",
+ ('heading_key', "C"), ":clear all ",
+]
class OptionWidget(urwid.WidgetWrap):
@@ -12,6 +16,7 @@ class OptionWidget(urwid.WidgetWrap):
keyattr = "key"
if focus and active:
textattr = "option_active_selected"
+ keyattr = "option_selected_key"
elif focus:
textattr = "option_selected"
keyattr = "option_selected_key"
@@ -74,10 +79,10 @@ class OptionListBox(urwid.ListBox):
self.keymap[i.shortcut] = i
def keypress(self, size, key):
- key = common.shortcuts(key)
- if key == "enter":
+ if key == "enter" or key == " ":
self.get_focus()[0].option.activate()
return None
+ key = common.shortcuts(key)
if key in self.keymap:
self.keymap[key].activate()
self.set_focus(self.options.index(self.keymap[key]))
@@ -104,7 +109,7 @@ class Options(urwid.WidgetWrap):
[
Option(
"Anti-Cache",
- "C",
+ "a",
lambda: master.anticache,
self.toggle_anticache
),
@@ -156,6 +161,25 @@ class Options(urwid.WidgetWrap):
)
self.master.loop.widget.footer.update("")
+ def keypress(self, size, key):
+ if key == "C":
+ self.clearall()
+ return None
+ return super(self.__class__, self).keypress(size, key)
+
+ def clearall(self):
+ self.master.anticache = False
+ self.master.anticomp = False
+ self.master.killextra = False
+ self.master.showhost = False
+ self.master.refresh_server_playback = True
+ self.master.server.config.no_upstream_cert = False
+ signals.update_settings.send(self)
+ signals.status_message.send(
+ message = "All options cleared",
+ expire = 1
+ )
+
def toggle_anticache(self):
self.master.anticache = not self.master.anticache