From f5a2d9784241d0a2d5c152f771b9df34725a3ed6 Mon Sep 17 00:00:00 2001 From: Jordan Ruthe Date: Fri, 29 Jan 2021 22:37:39 -0500 Subject: [PATCH] KlippyGtk: Add word wrapping to buttons --- ks_includes/KlippyGtk.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ks_includes/KlippyGtk.py b/ks_includes/KlippyGtk.py index 2440222d..f937c303 100644 --- a/ks_includes/KlippyGtk.py +++ b/ks_includes/KlippyGtk.py @@ -3,7 +3,7 @@ import gi import logging gi.require_version("Gtk", "3.0") -from gi.repository import Gtk, Gdk, GdkPixbuf, GLib +from gi.repository import Gtk, Gdk, GdkPixbuf, GLib, Pango import os klipperscreendir = os.getcwd() @@ -129,6 +129,14 @@ class KlippyGtk: b.set_always_show_image(True) b.props.relief = Gtk.ReliefStyle.NONE + try: + # Get the label object + child = b.get_children()[0].get_children()[0].get_children()[1] + child.set_line_wrap(True) + child.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR) + except: + pass + if style != None: b.get_style_context().add_class(style)