1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-19 12:28:08 +01:00

Fix small bug with the curses interface: translated buttons now work fine

This commit is contained in:
David Paleino
2012-05-06 14:34:45 +02:00
parent 5b5faa143d
commit 1f9f5596f9

View File

@@ -454,12 +454,15 @@ class Dialog2(urwid.WidgetWrap):
# buttons: tuple of name,exitcode
def add_buttons(self, buttons):
l = []
maxlen = 0
for name, exitcode in buttons:
b = urwid.Button( name, self.button_press )
b.exitcode = exitcode
b = urwid.AttrWrap( b, 'body','focus' )
l.append( b )
self.buttons = urwid.GridFlow(l, 10, 3, 1, 'center')
maxlen = max(len(name), maxlen)
maxlen += 4 # because of '< ... >'
self.buttons = urwid.GridFlow(l, maxlen, 3, 1, 'center')
self.frame.footer = urwid.Pile( [ urwid.Divider(),
self.buttons ], focus_item = 1)