Fixes compatibility with Urwid >0.9.9

This commit is contained in:
Thomas Roth 2010-02-24 18:25:24 +01:00
parent 8eb8814387
commit 22b77e32cd

View File

@ -66,7 +66,7 @@ class ConnectionItem(urwid.WidgetWrap):
def intercept(self): def intercept(self):
self.intercepting = True self.intercepting = True
self.w = self.get_text() self._w = self.get_text()
def get_text(self, nofocus=False): def get_text(self, nofocus=False):
return urwid.Text(self.flow.get_text(nofocus)) return urwid.Text(self.flow.get_text(nofocus))
@ -126,11 +126,11 @@ class ConnectionListView(urwid.ListWalker):
class ConnectionViewHeader(urwid.WidgetWrap): class ConnectionViewHeader(urwid.WidgetWrap):
def __init__(self, flow): def __init__(self, flow):
self.flow = flow self.flow = flow
self.w = urwid.Text(flow.get_text(nofocus=True, padding=0)) self._w = urwid.Text(flow.get_text(nofocus=True, padding=0))
def refresh_connection(self, f): def refresh_connection(self, f):
if f == self.flow: if f == self.flow:
self.w = urwid.Text(f.get_text(nofocus=True, padding=0)) self._w = urwid.Text(f.get_text(nofocus=True, padding=0))
class ConnectionView(urwid.WidgetWrap): class ConnectionView(urwid.WidgetWrap):
@ -224,13 +224,13 @@ class ConnectionView(urwid.WidgetWrap):
def view_request(self): def view_request(self):
self.viewing = self.REQ self.viewing = self.REQ
body = self._conn_text(self.flow.request) body = self._conn_text(self.flow.request)
self.w = self.wrap_body(self.REQ, body) self._w = self.wrap_body(self.REQ, body)
def view_response(self): def view_response(self):
if self.flow.response: if self.flow.response:
self.viewing = self.RESP self.viewing = self.RESP
body = self._conn_text(self.flow.response) body = self._conn_text(self.flow.response)
self.w = self.wrap_body(self.RESP, body) self._w = self.wrap_body(self.RESP, body)
def refresh_connection(self, c=None): def refresh_connection(self, c=None):
if c == self.flow: if c == self.flow:
@ -307,7 +307,7 @@ class ConnectionView(urwid.WidgetWrap):
self.view_request() self.view_request()
elif key in ("up", "down", "page up", "page down"): elif key in ("up", "down", "page up", "page down"):
# Why doesn't this just work?? # Why doesn't this just work??
self.w.body.keypress(size, key) self._w.body.keypress(size, key)
elif key == "a": elif key == "a":
self.flow.accept_intercept() self.flow.accept_intercept()
self.master.view_connection(self.flow) self.master.view_connection(self.flow)
@ -395,10 +395,10 @@ class ActionBar(urwid.WidgetWrap):
return True return True
def prompt(self, prompt): def prompt(self, prompt):
self.w = urwid.Edit(prompt) self._w = urwid.Edit(prompt)
def message(self, message): def message(self, message):
self.w = urwid.Text(message) self._w = urwid.Text(message)
class StatusBar(urwid.WidgetWrap): class StatusBar(urwid.WidgetWrap):
@ -406,7 +406,7 @@ class StatusBar(urwid.WidgetWrap):
self.master, self.text = master, text self.master, self.text = master, text
self.ab = ActionBar() self.ab = ActionBar()
self.ib = urwid.AttrWrap(urwid.Text(""), 'foot') self.ib = urwid.AttrWrap(urwid.Text(""), 'foot')
self.w = urwid.Pile([self.ib, self.ab]) self._w = urwid.Pile([self.ib, self.ab])
self.redraw() self.redraw()
def redraw(self): def redraw(self):