KlippyGtk: Enable word wrap on buttons
This commit is contained in:
1 parent
0efdd2ca06
commit
0bfe649882
2 files changed
+10
-9
No files matched your search
@@ -119,7 +119,7 @@ class KlippyGtk:
|
||||
return b
|
||||
|
||||
def ButtonImage(self, image_name, label=None, style=None, width_scale=1, height_scale=1,
|
||||
position=Gtk.PositionType.TOP):
|
||||
position=Gtk.PositionType.TOP, word_wrap=True):
|
||||
filename = "%s/styles/z-bolt/images/%s.svg" % (klipperscreendir, str(image_name))
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
||||
filename,
|
||||
@@ -139,13 +139,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 word_wrap is True:
|
||||
try:
|
||||
# Get the label object
|
||||
child = b.get_children()[0].get_children()[0].get_children()[1]
|
||||
child.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
|
||||
child.set_line_wrap(True)
|
||||
except:
|
||||
pass
|
||||
|
||||
if style != None:
|
||||
b.get_style_context().add_class(style)
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ class BedMeshPanel(ScreenPanel):
|
||||
|
||||
|
||||
addprofile = self._gtk.ButtonImage("increase"," %s" % _("Add bed mesh profile"),
|
||||
"color1", .5, .5, Gtk.PositionType.LEFT)
|
||||
"color1", .5, .5, Gtk.PositionType.LEFT, False)
|
||||
addprofile.connect("clicked", self.show_create_profile)
|
||||
addprofile.set_size_request(60,0)
|
||||
addprofile.set_hexpand(False)
|
||||
|
||||
Reference in new issue
Block a user