aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmproxy/console/__init__.py2
-rw-r--r--libmproxy/console/options.py30
2 files changed, 28 insertions, 4 deletions
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py
index e7776fdf..3b3f2df2 100644
--- a/libmproxy/console/__init__.py
+++ b/libmproxy/console/__init__.py
@@ -471,7 +471,7 @@ class ConsoleMaster(flow.FlowMaster):
self,
options.Options(self),
None,
- statusbar.StatusBar(self, help.footer),
+ statusbar.StatusBar(self, options.footer),
None
)
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