X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/blobdiff_plain/cc1bff4e61c615fdd155a8d82ea9c737f994c4d4..3f230a0faea72cc8d079204bc73197a742390dc8:/mon/tripemon.in diff --git a/mon/tripemon.in b/mon/tripemon.in index 1e62f03e..360d44d4 100644 --- a/mon/tripemon.in +++ b/mon/tripemon.in @@ -1256,6 +1256,10 @@ statsxlate = \ ('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. @@ -1362,7 +1366,7 @@ class PeerWindow (TrivialWindow): 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