Skip to content

Commit 4388dbf

Browse files
committed
Remove somewhat unnecessary listwalker argument.
1 parent cabf0e6 commit 4388dbf

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

bpython/urwid.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,12 @@ def render(self, size, focus=False):
215215
class URWIDRepl(repl.Repl):
216216

217217
# XXX this is getting silly, need to split this up somehow
218-
def __init__(self, main_loop, frame, listbox, listwalker, overlay,
219-
tooltip, interpreter, statusbar, config):
218+
def __init__(self, main_loop, frame, listbox, overlay, tooltip,
219+
interpreter, statusbar, config):
220220
repl.Repl.__init__(self, interpreter, config)
221221
self.main_loop = main_loop
222222
self.frame = frame
223223
self.listbox = listbox
224-
self.listwalker = listwalker
225224
self.overlay = overlay
226225
self.tooltip = tooltip
227226
self.edits = []
@@ -236,12 +235,12 @@ def echo(self, s):
236235
if s:
237236
text = urwid.Text(('output', s))
238237
if self.edit is None:
239-
self.listwalker.append(text)
238+
self.listbox.body.append(text)
240239
else:
241-
self.listwalker.insert(-1, text)
240+
self.listbox.body.insert(-1, text)
242241
# The edit widget should be focused and *stay* focused.
243242
# XXX TODO: make sure the cursor stays in the same spot.
244-
self.listbox.set_focus(len(self.listwalker) - 1)
243+
self.listbox.set_focus(len(self.listbox.body) - 1)
245244
# TODO: maybe do the redraw after a short delay
246245
# (for performance)
247246
self.main_loop.draw_screen()
@@ -324,8 +323,8 @@ def prompt(self, more):
324323

325324
urwid.connect_signal(self.edit, 'change', self.on_input_change)
326325
self.edits.append(self.edit)
327-
self.listwalker.append(self.edit)
328-
self.listbox.set_focus(len(self.listwalker) - 1)
326+
self.listbox.body.append(self.edit)
327+
self.listbox.set_focus(len(self.listbox.body) - 1)
329328
# Hide the tooltip
330329
self.frame.body = self.listbox
331330

@@ -423,8 +422,7 @@ def main(args=None, locals_=None, banner=None):
423422
event_loop = None
424423
# TODO: there is also a glib event loop. Do we want that one?
425424

426-
listwalker = urwid.SimpleListWalker([])
427-
listbox = urwid.ListBox(listwalker)
425+
listbox = urwid.ListBox(urwid.SimpleListWalker([]))
428426

429427
# String is straight from bpython.cli
430428
statusbar = Statusbar(
@@ -452,7 +450,7 @@ def main(args=None, locals_=None, banner=None):
452450
loop = urwid.MainLoop(frame, palette, event_loop=event_loop)
453451

454452
# TODO: hook up idle callbacks somewhere.
455-
myrepl = URWIDRepl(loop, frame, listbox, listwalker, overlay, tooltip,
453+
myrepl = URWIDRepl(loop, frame, listbox, overlay, tooltip,
456454
interpreter, statusbar, config)
457455

458456
# XXX HACK: circular dependency between the event loop and repl.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy