aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-04-09 10:05:13 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-04-09 10:05:13 +1200
commitd7748cea4f209d45af99e5ac03438faa3184bc64 (patch)
treebc05e4c3c4be394d62ea33fad4deb62783a40046
parent8fa96d1f3f961b4db67bc6c2edf2566f3d96a27f (diff)
downloadmitmproxy-d7748cea4f209d45af99e5ac03438faa3184bc64.tar.gz
mitmproxy-d7748cea4f209d45af99e5ac03438faa3184bc64.tar.bz2
mitmproxy-d7748cea4f209d45af99e5ac03438faa3184bc64.zip
Minor name refactoring, make flow list refresh after limit is applied.
-rw-r--r--libmproxy/console/__init__.py18
-rw-r--r--libmproxy/console/flowlist.py9
2 files changed, 13 insertions, 14 deletions
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py
index ee2ca408..3db188de 100644
--- a/libmproxy/console/__init__.py
+++ b/libmproxy/console/__init__.py
@@ -357,7 +357,7 @@ class ConsoleMaster(flow.FlowMaster):
for i in options.replacements:
self.replacehooks.add(*i)
- self.flow_list_view = None
+ self.flow_list_walker = None
self.set_palette()
r = self.set_intercept(options.intercept)
@@ -513,7 +513,7 @@ class ConsoleMaster(flow.FlowMaster):
self.ui = urwid.raw_display.Screen()
self.ui.set_terminal_properties(256)
self.ui.register_palette(self.palette)
- self.flow_list_view = flowlist.ConnectionListView(self, self.state)
+ self.flow_list_walker = flowlist.FlowListWalker(self, self.state)
self.view = None
self.statusbar = None
@@ -544,7 +544,7 @@ class ConsoleMaster(flow.FlowMaster):
def focus_current(self):
if self.currentflow:
try:
- self.flow_list_view.set_focus(self.state.index(self.currentflow))
+ self.flow_list_walker.set_focus(self.state.index(self.currentflow))
except (IndexError, ValueError):
pass
@@ -584,7 +584,7 @@ class ConsoleMaster(flow.FlowMaster):
if self.eventlog:
self.body = flowlist.BodyPile(self)
else:
- self.body = flowlist.ConnectionListBox(self)
+ self.body = flowlist.FlowListBox(self)
self.statusbar = StatusBar(self, flowlist.footer)
self.header = None
self.currentflow = None
@@ -640,7 +640,7 @@ class ConsoleMaster(flow.FlowMaster):
except flow.FlowReadError, v:
return v.strerror
f.close()
- if self.flow_list_view:
+ if self.flow_list_walker:
self.sync_list_view()
self.focus_current()
@@ -697,7 +697,9 @@ class ConsoleMaster(flow.FlowMaster):
self.state.accept_all()
def set_limit(self, txt):
- return self.state.set_limit(txt)
+ v = self.state.set_limit(txt)
+ self.sync_list_view()
+ return v
def set_intercept(self, txt):
return self.state.set_intercept(txt)
@@ -788,7 +790,6 @@ class ConsoleMaster(flow.FlowMaster):
self.state.intercept_txt,
self.set_intercept
)
- self.sync_list_view()
elif k == "Q":
raise Stop
elif k == "q":
@@ -816,7 +817,6 @@ class ConsoleMaster(flow.FlowMaster):
p,
self.set_reverse_proxy
)
- self.sync_list_view()
elif k == "R":
self.view_grideditor(
grideditor.ReplaceEditor(
@@ -907,7 +907,7 @@ class ConsoleMaster(flow.FlowMaster):
controller.Master.shutdown(self)
def sync_list_view(self):
- self.flow_list_view._modified()
+ self.flow_list_walker._modified()
def clear_flows(self):
self.state.clear()
diff --git a/libmproxy/console/flowlist.py b/libmproxy/console/flowlist.py
index e4c73740..daca6965 100644
--- a/libmproxy/console/flowlist.py
+++ b/libmproxy/console/flowlist.py
@@ -68,7 +68,7 @@ class BodyPile(urwid.Pile):
urwid.Pile.__init__(
self,
[
- ConnectionListBox(master),
+ FlowListBox(master),
urwid.Frame(EventListBox(master), header = self.inactive_header)
]
)
@@ -166,7 +166,7 @@ class ConnectionItem(common.WWrap):
return key
-class ConnectionListView(urwid.ListWalker):
+class FlowListWalker(urwid.ListWalker):
def __init__(self, master, state):
self.master, self.state = master, state
if self.state.flow_count():
@@ -192,10 +192,10 @@ class ConnectionListView(urwid.ListWalker):
return f, i
-class ConnectionListBox(urwid.ListBox):
+class FlowListBox(urwid.ListBox):
def __init__(self, master):
self.master = master
- urwid.ListBox.__init__(self, master.flow_list_view)
+ urwid.ListBox.__init__(self, master.flow_list_walker)
def keypress(self, size, key):
key = common.shortcuts(key)
@@ -208,7 +208,6 @@ class ConnectionListBox(urwid.ListBox):
self.master.toggle_eventlog()
elif key == "l":
self.master.prompt("Limit: ", self.master.state.limit_txt, self.master.set_limit)
- self.master.sync_list_view()
elif key == "L":
self.master.path_prompt(
"Load flows: ",