Don't display time deltas < 1s in messages.

This commit is contained in:
Florian Bruhin 2015-03-22 23:50:12 +01:00
parent c13e09b706
commit 97b678d8c7

View File

@ -95,7 +95,11 @@ def on_focus_changed():
log.misc.debug("Handling queued {} for window {}, delta {}".format(
msg.method_name, msg.win_id, delta))
bridge = _get_bridge(msg.win_id)
text = '[{} ago] {}'.format(utils.format_timedelta(delta), msg.text)
if delta.total_seconds() < 1:
text = msg.text
else:
text = '[{} ago] {}'.format(utils.format_timedelta(delta),
msg.text)
getattr(bridge, msg.method_name)(text, *msg.args, **msg.kwargs)