Merge pull request #526 from tekii/fix-522

fix for #522
This commit is contained in:
Aldo Cortesi 2015-03-19 11:40:53 +13:00
commit b77e511fca
3 changed files with 11 additions and 3 deletions

View File

@ -21,7 +21,7 @@ class FlowDetailsView(urwid.ListBox):
self.master.statusbar = self.state[0]
self.master.body = self.state[1]
self.master.header = self.state[2]
self.master.make_view()
self.master.loop.widget = self.master.make_view()
return None
elif key == "?":
key = None

View File

@ -183,7 +183,7 @@ class HelpView(urwid.ListBox):
self.master.statusbar = self.state[0]
self.master.body = self.state[1]
self.master.header = self.state[2]
self.master.make_view()
self.master.loop.widget = self.master.make_view()
return None
elif key == "?":
key = None

View File

@ -5,7 +5,14 @@ if os.name == "nt":
import libmproxy.console.help as help
class DummyLoop:
def __init__(self):
self.widget = None
class DummyMaster:
def __init__(self):
self.loop = DummyLoop()
def make_view(self):
pass
@ -16,7 +23,8 @@ class TestHelp:
assert h.helptext()
def test_keypress(self):
h = help.HelpView(DummyMaster(), "foo", [1, 2, 3])
master = DummyMaster()
h = help.HelpView(master, "foo", [1, 2, 3])
assert not h.keypress((0, 0), "q")
assert not h.keypress((0, 0), "?")
assert h.keypress((0, 0), "o") == "o"