aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console/grideditor.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-03-19 10:12:06 +1300
committerAldo Cortesi <aldo@nullcube.com>2012-03-19 10:12:06 +1300
commit65e88f49d44a373dac82d040532589657d3ae8be (patch)
tree3bf40dd7226f9677707007a0697e5f41b22036d4 /libmproxy/console/grideditor.py
parent5690e7c39942e7ed1e3b2986408e3003e65c1391 (diff)
downloadmitmproxy-65e88f49d44a373dac82d040532589657d3ae8be.tar.gz
mitmproxy-65e88f49d44a373dac82d040532589657d3ae8be.tar.bz2
mitmproxy-65e88f49d44a373dac82d040532589657d3ae8be.zip
Specialize GridEditor into a number of subclasses.
Diffstat (limited to 'libmproxy/console/grideditor.py')
-rw-r--r--libmproxy/console/grideditor.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/libmproxy/console/grideditor.py b/libmproxy/console/grideditor.py
index 19fa4374..120a9ce1 100644
--- a/libmproxy/console/grideditor.py
+++ b/libmproxy/console/grideditor.py
@@ -81,7 +81,7 @@ class GridItem(common.WWrap):
)
fspecs = self.fields[:]
- fspecs[0] = ("fixed", maxk + 2, fspecs[0])
+ fspecs[0] = ("fixed", maxk + 2, fspecs[0])
w = urwid.Columns(
fspecs,
@@ -205,12 +205,11 @@ class GridListBox(urwid.ListBox):
class GridEditor(common.WWrap):
- def __init__(self, master, title, columns, value, callback, *cb_args, **cb_kwargs):
+ def __init__(self, master, value, callback, *cb_args, **cb_kwargs):
value = copy.deepcopy(value)
- self.master, self.title, self.value, self.callback = master, title, value, callback
- self.columns = columns
+ self.master, self.value, self.callback = master, value, callback
self.cb_args, self.cb_kwargs = cb_args, cb_kwargs
- p = urwid.Text(title)
+ p = urwid.Text(self.title)
p = urwid.Padding(p, align="left", width=("relative", 100))
p = urwid.AttrWrap(p, "heading")
self.walker = GridWalker(self.value, self)
@@ -273,3 +272,24 @@ class GridEditor(common.WWrap):
self.walker.start_edit()
else:
return self.w.keypress(size, key)
+
+
+class QueryEditor(GridEditor):
+ title = "Editing query"
+ columns = 2
+
+
+class HeaderEditor(GridEditor):
+ title = "Editing headers"
+ columns = 2
+
+
+class URLEncodedFormEditor(GridEditor):
+ title = "Editing URL-encoded form"
+ columns = 2
+
+
+class ReplaceEditor(GridEditor):
+ title = "Editing replacement patterns"
+ columns = 3
+