From e5251d23f158c7cc092121c3a7cc0438a73746ec Mon Sep 17 00:00:00 2001 From: Aylur Date: Mon, 15 Jul 2024 22:09:58 +0200 Subject: remove python and node I have no desire to work on the python version The node version has the issue of promises not working which makes it unusable but gjs works just as good if not better. Might look back into node later --- python/astal/widget.py | 78 -------------------------------------------------- 1 file changed, 78 deletions(-) delete mode 100644 python/astal/widget.py (limited to 'python/astal/widget.py') diff --git a/python/astal/widget.py b/python/astal/widget.py deleted file mode 100644 index 8f2285f..0000000 --- a/python/astal/widget.py +++ /dev/null @@ -1,78 +0,0 @@ -from gi.repository import Astal, Gtk -from .binding import Binding, kebabify - - -def set_child(self, child): - if isinstance(self, Gtk.Bin): - self.remove(self.get_child()) - if isinstance(self, Gtk.Container): - self.add(child) - - -def astalify(ctor): - ctor.set_css = Astal.widget_set_css - ctor.get_css = Astal.widget_get_css - - ctor.set_class_name = lambda self, names: Astal.widget_set_class_names(self, names.split()) - ctor.get_class_name = lambda self: " ".join(Astal.widget_set_class_names(self)) - - ctor.set_cursor = Astal.widget_set_cursor - ctor.get_cursor = Astal.widget_get_cursor - - def widget(**kwargs): - args = {} - bindings = {} - handlers = {} - setup = None - if not hasattr(kwargs, "visible"): - kwargs["visible"] = True - - for key, value in kwargs.items(): - if key == "setup": - setup = value - if isinstance(value, Binding): - bindings[key] = value - if key.startswith("on_"): - handlers[key] = value - else: - args[key] = value - - self = ctor(**args) - - for key, value in bindings.items(): - setter = getattr(self, f"set_{key}") - setter(value.get()) - unsub = value.subscribe(setter) - self.connect("destroy", lambda _: unsub()) - - for key, value in handlers.items(): - self.connect(kebabify(key.replace("on_", "")), value) - - if setup: - setup(self) - - return self - - return widget - - -Box = astalify(Astal.Box), -Button = astalify(Astal.Button), -CenterBox = astalify(Astal.CenterBox), -# TODO: CircularProgress -DrawingArea = astalify(Gtk.DrawingArea), -Entry = astalify(Gtk.Entry), -EventBox = astalify(Astal.EventBox), -# TODO: Fixed -# TODO: FlowBox -Icon = astalify(Astal.Icon), -Label = astalify(Gtk.Label), -LevelBar = astalify(Astal.LevelBar), -# TODO: ListBox -Overlay = astalify(Astal.Overlay), -Revealer = astalify(Gtk.Revealer), -Scrollable = astalify(Astal.Scrollable), -Slider = astalify(Astal.Slider), -# TODO: Stack -Switch = astalify(Gtk.Switch), -Window = astalify(Astal.Window), -- cgit v1.2.3