@@ -215,13 +215,12 @@ def render(self, size, focus=False):
215
215
class URWIDRepl (repl .Repl ):
216
216
217
217
# 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 ):
220
220
repl .Repl .__init__ (self , interpreter , config )
221
221
self .main_loop = main_loop
222
222
self .frame = frame
223
223
self .listbox = listbox
224
- self .listwalker = listwalker
225
224
self .overlay = overlay
226
225
self .tooltip = tooltip
227
226
self .edits = []
@@ -236,12 +235,12 @@ def echo(self, s):
236
235
if s :
237
236
text = urwid .Text (('output' , s ))
238
237
if self .edit is None :
239
- self .listwalker .append (text )
238
+ self .listbox . body .append (text )
240
239
else :
241
- self .listwalker .insert (- 1 , text )
240
+ self .listbox . body .insert (- 1 , text )
242
241
# The edit widget should be focused and *stay* focused.
243
242
# 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 )
245
244
# TODO: maybe do the redraw after a short delay
246
245
# (for performance)
247
246
self .main_loop .draw_screen ()
@@ -324,8 +323,8 @@ def prompt(self, more):
324
323
325
324
urwid .connect_signal (self .edit , 'change' , self .on_input_change )
326
325
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 )
329
328
# Hide the tooltip
330
329
self .frame .body = self .listbox
331
330
@@ -423,8 +422,7 @@ def main(args=None, locals_=None, banner=None):
423
422
event_loop = None
424
423
# TODO: there is also a glib event loop. Do we want that one?
425
424
426
- listwalker = urwid .SimpleListWalker ([])
427
- listbox = urwid .ListBox (listwalker )
425
+ listbox = urwid .ListBox (urwid .SimpleListWalker ([]))
428
426
429
427
# String is straight from bpython.cli
430
428
statusbar = Statusbar (
@@ -452,7 +450,7 @@ def main(args=None, locals_=None, banner=None):
452
450
loop = urwid .MainLoop (frame , palette , event_loop = event_loop )
453
451
454
452
# TODO: hook up idle callbacks somewhere.
455
- myrepl = URWIDRepl (loop , frame , listbox , listwalker , overlay , tooltip ,
453
+ myrepl = URWIDRepl (loop , frame , listbox , overlay , tooltip ,
456
454
interpreter , statusbar , config )
457
455
458
456
# XXX HACK: circular dependency between the event loop and repl.
0 commit comments