('ip-bytes-in', xlate_bytes),
('ip-bytes-out', xlate_bytes)]
+def format_stat(format, dict):
+ if callable(format): return format(dict)
+ else: return format % dict
+
## How to lay out the stats dialog. Format is (LABEL, FORMAT): LABEL is
## the label to give the entry box; FORMAT is the format string to write into
## the entry.
stat[s] = trans(stat[s])
stat.update(me.peer.__dict__)
for label, format in statslayout:
- me.e[label].set_text(format % stat)
+ me.e[label].set_text(format_stat(format, stat))
GL.timeout_add(1000, lambda: me.cr.switch() and False)
me.cr.parent.switch()
me.cr = None