From e8546b4a7652f941dbf977dd037493b4ca4f5d15 Mon Sep 17 00:00:00 2001 From: gen2brain Date: Sat, 6 Apr 2013 11:17:29 +0200 Subject: [PATCH] format tooltip --- src/m64py/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/m64py/utils.py b/src/m64py/utils.py index b556e93..7879b0d 100644 --- a/src/m64py/utils.py +++ b/src/m64py/utils.py @@ -58,6 +58,16 @@ def sl(mot): ((mot & 0x00FF0000) >> 8) |\ ((mot & 0xFF000000) >> 24) +def format_tooltip(tooltip): + if len(tooltip) > 80: + lines = tooltip.split(". ") + tooltip = "" + for line in lines: + tooltip += "%s. " % line.lstrip() + if len(line) > 40: + tooltip += "\n" + return tooltip + def format_label(label): words = label.split("_") if len(words) > 1: