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/binding.py | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 python/astal/binding.py (limited to 'python/astal/binding.py') diff --git a/python/astal/binding.py b/python/astal/binding.py deleted file mode 100644 index 0fe1b6c..0000000 --- a/python/astal/binding.py +++ /dev/null @@ -1,33 +0,0 @@ -import re - - -def kebabify(string): - return re.sub(r"([a-z])([A-Z])", r"\1-\2", string).replace("_", "-").lower() - - -class Binding: - def __init__(self, emitter, prop=None): - self.emitter = emitter - self.prop = kebabify(prop) if prop else None - self.transform_fn = lambda v: v - - def __str__(self): - return f"Binding<{self.emitter}{', ' + self.prop if self.prop else ''}>" - - def as_(self, fn): - bind = Binding(self.emitter, self.prop) - bind.transform_fn = lambda v: fn(self.transform_fn(v)) - return bind - - def get(self): - if hasattr(self.emitter, "get") and callable(self.emitter.get): - return self.transform_fn(self.emitter.get()) - - return self.transform_fn(self.emitter[f"get_{self.prop}"]()) - - def subscribe(self, callback): - if hasattr(self.emitter, "subscribe") and callable(self.emitter.subscribe): - return self.emitter.subscribe(lambda _: callback(self.get())) - - i = self.emitter.connect(f"notify::{self.prop}", lambda: callback(self.get())) - return lambda: self.emitter.disconnect(i) -- cgit v1.2.3