[gnome-tweak-tool] Show text in tooltip when label is ellipsized
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] Show text in tooltip when label is ellipsized
- Date: Sat, 13 Jul 2013 17:12:52 +0000 (UTC)
commit 7532ffc2289bc1fde91729e1f4cfa710cec0908d
Author: Robin Stocker <robin nibor org>
Date: Sat Jul 13 14:29:24 2013 +0200
Show text in tooltip when label is ellipsized
This is the case for the long texts in the "Typing" section.
https://bugzilla.gnome.org/show_bug.cgi?id=704149
gtweak/widgets.py | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gtweak/widgets.py b/gtweak/widgets.py
index 072081e..df44027 100644
--- a/gtweak/widgets.py
+++ b/gtweak/widgets.py
@@ -43,6 +43,14 @@ def build_label_beside_widget(txt, *widget, **kwargs):
image.set_tooltip_text(tip)
return image
+ def show_tooltip_when_ellipsized(label, x, y, keyboard_mode, tooltip):
+ layout = label.get_layout()
+ if layout.is_ellipsized():
+ tooltip.set_text(label.get_text())
+ return True
+ else:
+ return False
+
if kwargs.get("hbox"):
hbox = kwargs.get("hbox")
else:
@@ -52,6 +60,8 @@ def build_label_beside_widget(txt, *widget, **kwargs):
lbl = Gtk.Label(txt)
lbl.props.ellipsize = Pango.EllipsizeMode.END
lbl.props.xalign = 0.0
+ lbl.set_has_tooltip(True)
+ lbl.connect("query-tooltip", show_tooltip_when_ellipsized)
hbox.pack_start(lbl, True, True, 0)
if kwargs.get("info"):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]