GtkLabel max-width-chars with ellipsize broken?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

GtkLabel max-width-chars with ellipsize broken?

infirit
Hi, I have been trying to use "max-width-chars" with ellipsize on a
label that acts as a page label for a notebook with zero success. It
appears it is completely ignored as whatever I use, -1 to 200 nothing
ever changes how it looks. How it looks is either we only see a single
character with ellipses or just ellipses.

Am I missing something? is this the correct way to force a certain width
on the label?

Thx
~infirit

from gi.repository import Gtk, Pango

class MyWindow(Gtk.Window):
    def __init__(self, *args, **kwargs):
        super().__init__(default_width=400, default_height=300,
                         *args, **kwargs)
        self.connect("delete-event", Gtk.main_quit)

        self.notebook = Gtk.Notebook()
        self.add(self.notebook)
        for n in (1,2,3):
            # We should see the first 20 then ellipse
            label_text = "012345678901234567890"
            page_label = Gtk.Label(
                label_text,
                max_width_chars=20,
                ellipsize=Pango.EllipsizeMode.END,
                halign=Gtk.Align.CENTER)
            page_label.set_tooltip_text(label_text)
            page_content = Gtk.Image.new_from_icon_name("go-home",
Gtk.IconSize.DIALOG)
            self.notebook.insert_page(page_content, page_label, n)

window = MyWindow()
window.show_all()

Gtk.main()

_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: GtkLabel max-width-chars with ellipsize broken?

Gtk+ - Apps Dev mailing list

 
Hi infirit,

Give the hexpand a try and see if that works. It works for me on Python3.5 and GTK3.18

Eric

...
                halign=Gtk.Align.CENTER,
                hexpand=True)
..


_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: GtkLabel max-width-chars with ellipsize broken?

infirit
On 10/06/17 19:39, [hidden email] wrote:
> Hi infirit,

Hi

> Give the hexpand a try and see if that works. It works for me on Python3.5 and GTK3.18

Define works :) Does it limit to what was set as maximum width chars?
When resizing does it use the available space to show more or less
characters? Nope :(

It indeed does expand the label but it expands to the complete width of
the notebook (ugly). While this appears to have the effect to fix the
problem is really doesn't as max-width-chars is still not properly used.
Its behaviour is very inconsistent imo and appears very broken.

Thanks for the response though.

~infirit

_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: GtkLabel max-width-chars with ellipsize broken?

Gtk+ - Apps Dev mailing list

 
What version of GTK are you using?

It does work on my computer. The label expands and shrinks as the window expands and shrinks and the label stops expanding at 012345678901234567... I take that to be 20 chars if you start at 0 and include the three dots. The tooltip shows the full string.

Eric

 



_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list