mirror of
https://github.com/aclist/dztui.git
synced 2026-10-31 23:22:44 +01:00
fix: defer propagation until size allocation
This commit is contained in:
1 parent
0f59d92bc3
commit
9f8b760c79
1 file changed
+8
-10
@@ -221,19 +221,19 @@ class DebugDialog(TextBufferDialog):
|
|||||||
text=debug,
|
text=debug,
|
||||||
)
|
)
|
||||||
scrollable = Gtk.ScrolledWindow(
|
scrollable = Gtk.ScrolledWindow(
|
||||||
propagate_natural_height=True, max_content_height=500
|
propagate_natural_height=False,
|
||||||
|
min_content_height=200,
|
||||||
|
max_content_height=200,
|
||||||
|
margin_bottom=10,
|
||||||
)
|
)
|
||||||
box = Gtk.Box(hexpand=True, vexpand=True, orientation=Gtk.Orientation.VERTICAL)
|
|
||||||
textview = Gtk.TextView(
|
textview = Gtk.TextView(
|
||||||
wrap_mode=Gtk.WrapMode.WORD, editable=False, left_margin=10, right_margin=10
|
wrap_mode=Gtk.WrapMode.CHAR, editable=False, left_margin=10, right_margin=10
|
||||||
)
|
)
|
||||||
textview.set_buffer(Gtk.TextBuffer(text=debug))
|
textview.set_buffer(Gtk.TextBuffer(text=debug))
|
||||||
box.pack_start(textview, EXPAND, FILL, 10)
|
scrollable.add(textview)
|
||||||
scrollable.add(box)
|
|
||||||
content = self.get_content_area()
|
content = self.get_content_area()
|
||||||
content.set_spacing(0)
|
content.set_spacing(0)
|
||||||
content.add(scrollable)
|
content.add(scrollable)
|
||||||
self.show_all()
|
|
||||||
|
|
||||||
|
|
||||||
class ExceptionDialog(TextBufferDialog):
|
class ExceptionDialog(TextBufferDialog):
|
||||||
@@ -308,15 +308,13 @@ class ExceptionDialog(TextBufferDialog):
|
|||||||
content.set_spacing(0)
|
content.set_spacing(0)
|
||||||
content.add(scrollable)
|
content.add(scrollable)
|
||||||
|
|
||||||
self.show_all()
|
|
||||||
|
|
||||||
def _on_page_changed(
|
def _on_page_changed(
|
||||||
self, notebook: Gtk.Notebook, child: Gtk.Box | Gtk.ScrolledWindow, index: int
|
self, notebook: Gtk.Notebook, child: Gtk.Box | Gtk.ScrolledWindow, index: int
|
||||||
) -> None:
|
) -> None:
|
||||||
if child == self.error_details:
|
if child == self.error_details:
|
||||||
self.error_details.set_propagate_natural_height(True)
|
GLib.idle_add(self.error_details.set_propagate_natural_height, True)
|
||||||
else:
|
else:
|
||||||
self.error_details.set_propagate_natural_height(False)
|
GLib.idle_add(self.error_details.set_propagate_natural_height, False)
|
||||||
|
|
||||||
def set_secondary_text(self, text: str) -> None:
|
def set_secondary_text(self, text: str) -> None:
|
||||||
self.details_buffer.set_text(text)
|
self.details_buffer.set_text(text)
|
||||||
|
|||||||
Reference in new issue
Block a user