aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console/grideditor.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-03-22 13:32:24 +1300
committerAldo Cortesi <aldo@nullcube.com>2015-03-22 13:32:24 +1300
commit89383e9c138f68caf1cc394174250c133d21aa04 (patch)
tree2c5d2d3896038bba5e626c4e869eea0a906bda81 /libmproxy/console/grideditor.py
parent381a56306777900153939b1b46f20e63322944c2 (diff)
downloadmitmproxy-89383e9c138f68caf1cc394174250c133d21aa04.tar.gz
mitmproxy-89383e9c138f68caf1cc394174250c133d21aa04.tar.bz2
mitmproxy-89383e9c138f68caf1cc394174250c133d21aa04.zip
Refactor status bar prompting to use signal system
Diffstat (limited to 'libmproxy/console/grideditor.py')
-rw-r--r--libmproxy/console/grideditor.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/libmproxy/console/grideditor.py b/libmproxy/console/grideditor.py
index 0b563c52..eb66e59e 100644
--- a/libmproxy/console/grideditor.py
+++ b/libmproxy/console/grideditor.py
@@ -338,11 +338,20 @@ class GridEditor(urwid.WidgetWrap):
self.walker.delete_focus()
elif key == "r":
if self.walker.get_current_value() is not None:
- self.master.path_prompt("Read file: ", "", self.read_file)
+ signals.status_path_prompt.send(
+ self,
+ prompt = "Read file: ",
+ text = "",
+ callback = self.read_file
+ )
elif key == "R":
if self.walker.get_current_value() is not None:
- self.master.path_prompt(
- "Read unescaped file: ", "", self.read_file, True
+ signals.status_path_prompt.send(
+ self,
+ prompt = "Read unescaped file: ",
+ text = "",
+ callback = self.read_file,
+ args = (True,)
)
elif key == "e":
o = self.walker.get_current_value()
@@ -431,10 +440,10 @@ class HeaderEditor(GridEditor):
def handle_key(self, key):
if key == "U":
- self.master.prompt_onekey(
- "Add User-Agent header:",
- [(i[0], i[1]) for i in http_uastrings.UASTRINGS],
- self.set_user_agent,
+ signals.status_prompt_onekey.send(
+ prompt = "Add User-Agent header:",
+ keys = [(i[0], i[1]) for i in http_uastrings.UASTRINGS],
+ callback = self.set_user_agent,
)
return True
@@ -500,10 +509,10 @@ class SetHeadersEditor(GridEditor):
def handle_key(self, key):
if key == "U":
- self.master.prompt_onekey(
- "Add User-Agent header:",
- [(i[0], i[1]) for i in http_uastrings.UASTRINGS],
- self.set_user_agent,
+ signals.status_prompt_onekey.send(
+ prompt = "Add User-Agent header:",
+ keys = [(i[0], i[1]) for i in http_uastrings.UASTRINGS],
+ callback = self.set_user_agent,
)
return True