Commits

Anonymous committed e76cecb

FIX: If the tooltip was too long, it wasn’t shown at all. Now only the first 100 chars are shown.

Comments (0)

Files changed (1)

 #: The keys for accessing pyrad element via the keyboard
 SELECTION_KEYS_ORDERED = "0123456789abcdefghijklmnopqrstuvwxyz"
 
+#: The maximum length of the shown tooltips (avoids missing tooltips when the tip is too long).
+MAX_TOOL_TIP_LENGTH = 100
+
 ### Window ###
 
 class ItemEditWidget(QWidget):
             if SELECTION_KEYS_ORDERED[len(circle):]: 
                 key = SELECTION_KEYS_ORDERED[len(circle)]
                 if action is not None and action.startswith("["):
-                    toolTip =  key + " - " + "(" + ", ".join([act for ico,act in eval(action) if act]) + ")"
+                    toolTip =  key + " - " + "(" + ", ".join([str(act) for ico,act in eval(action) if act]) + ")"
                 else: 
                     toolTip =  key + " - " + str(action)
             else:
                 toolTip = str(action)
-            label.setToolTip(toolTip)
+            # toolTip = toolTip.replace('"', "")
+            # print(toolTip)
+            if toolTip[MAX_TOOL_TIP_LENGTH:]: 
+                label.setToolTip(toolTip[:MAX_TOOL_TIP_LENGTH]+"...")
+            else:
+                label.setToolTip(toolTip)
             circle.append(label)
 
         return circle