def change(me):
"""Update the display in response to a notification."""
me.e['Interface'].set_text(me.peer.ifname)
+ me.e['Address'].set_text(me.peer.addr)
def _update(me):
"""
me.add(table)
crypto = conn.algs()
- table.info('Diffie-Hellman group',
- '%s (%d-bit order, %d-bit elements)' %
- (crypto['kx-group'],
- int(crypto['kx-group-order-bits']),
- int(crypto['kx-group-elt-bits'])),
- len = 32)
- table.info('Data encryption',
- '%s (%d-bit key; %s)' %
- (crypto['cipher'],
- int(crypto['cipher-keysz']) * 8,
- crypto['cipher-blksz'] == '0'
- and 'stream cipher'
- or '%d-bit block' % (int(crypto['cipher-blksz']) * 8)),
- newlinep = True)
- table.info('Message authentication',
- '%s (%d-bit key; %d-bit tag)' %
- (crypto['mac'],
- int(crypto['mac-keysz']) * 8,
- int(crypto['mac-tagsz']) * 8),
- newlinep = True)
- table.info('Hash function',
- '%s (%d-bit output)' %
- (crypto['hash'],
- int(crypto['hash-sz']) * 8),
- newlinep = True)
+ firstp = True
+ for label, format in cryptolayout:
+ table.info(label, format_stat(format, crypto),
+ len = 42, newlinep = not firstp)
+ firstp = False
me.show_all()
'???', 'green', '???', 'green'])
peer.win = WindowSlot(lambda: PeerWindow(peer))
me.hook(peer.pinghook, me._ping)
+ me.hook(peer.changehook, lambda: me._change(peer))
me.apchange()
def delpeer(me, peer):
me.listmodel[p.i][textcol] = '%.1f ms' % ps.tlast
me.listmodel[p.i][colourcol] = 'black'
+ def _change(me, p):
+ """Hook: notified when the peer changes state."""
+ me.listmodel[p.i][1] = p.addr
+
def setstatus(me, status):
"""Update the message in the status bar."""
me.status.pop(0)