Overlayed widget of GtkOverlay are cut off when used as label in GtkNotebook
Steps to reproduce
- Run the example program provided in this report
Current behavior
The GtkProgressBar is cut off in the tab label for the first tab (tab label == "S").
Expected outcome
The GtkOverlay (or tab) is resized to fully show all widgets added to GtkOverlay.
Version information
- gtk3-3.24.8-1.fc30.x86_64
- glib2-2.60.3-1.fc30.x86_64
Additional information
#!/usr/bin/python
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GLib, Gdk
class MyNotebook(Gtk.Notebook):
def do_insert_page(self, child, label, menu, position):
if self.props.tab_pos == Gtk.PositionType.LEFT:
label.set_angle(90)
tab_box = Gtk.VBox(2)
elif self.props.tab_pos == Gtk.PositionType.RIGHT:
label.set_angle(-90)
tab_box = Gtk.Vbox(2)
else:
tab_box = Gtk.HBox(2)
tab_box.set_homogeneous(False)
close_button = Gtk.Button.new_from_icon_name("window-close",
Gtk.IconSize.SMALL_TOOLBAR)
overlay = Gtk.Overlay()
overlay.add(label)
progress = Gtk.ProgressBar()
progress.set_fraction(0.2)
overlay.add_overlay(progress)
if self.props.tab_pos == Gtk.PositionType.LEFT:
tab_box.pack_start(close_button, False, False, 5)
tab_box.pack_end(overlay, True, True, 0)
else:
tab_box.pack_start(overlay, True, True, 0);
tab_box.pack_end(close_button, False, False, 5)
tab_box.show_all()
if not menu:
menu = Gtk.Label(label.get_text())
return Gtk.Notebook.do_insert_page(self, child, tab_box, menu, position)
class App:
def __init__(self):
window = Gtk.Window()
window.connect("destroy", self.on_window_destroy)
notebook = MyNotebook()
label = Gtk.Label("S")
button = Gtk.Button("Button 1")
notebook.append_page(button, label)
label = Gtk.Label("Short Label")
button = Gtk.Button("Button 2")
notebook.append_page(button, label)
window.add(notebook)
window.show_all()
def on_window_destroy(self, window):
Gtk.main_quit()
if __name__ == "__main__":
app = App()
Gtk.main()