set __gtype_name__ on astalified widgets; cleaner means of setting visible=true

This commit is contained in:
gnat 2025-02-14 18:37:03 -08:00
parent 2ddb8a05cd
commit a41dd49fa3

View File

@ -14,6 +14,7 @@ from gi.repository import Astal, Gtk, GObject
def astalify(widget: Gtk.Widget): def astalify(widget: Gtk.Widget):
class Widget(widget): class Widget(widget):
__gtype_name__ = "AstalPy" + widget.__name__
class_name = '' class_name = ''
def hook(self, object: GObject.Object, signal_or_callback: str | Callable, callback: Callable = lambda _, x: x): def hook(self, object: GObject.Object, signal_or_callback: str | Callable, callback: Callable = lambda _, x: x):
@ -83,12 +84,7 @@ def astalify(widget: Gtk.Widget):
def __init__(self, **props): def __init__(self, **props):
super().__init__() super().__init__()
if not 'show' in props: self.set_visible(props.get("visible", True))
self.show()
else:
if props['show']:
self.show()
for prop, value in props.items(): for prop, value in props.items():
if isinstance(value, Binding): if isinstance(value, Binding):