Working python proxy/filter for room list

This commit is contained in:
miruka
2020-05-06 01:49:25 -04:00
parent eee198b238
commit 5432958121
7 changed files with 101 additions and 61 deletions

View File

@@ -42,19 +42,23 @@ class ModelItem:
super().__setattr__(name, value)
model = self.parent_model
parent = self.parent_model
if not model.sync_id:
if not parent.sync_id:
return
with model._write_lock:
index_then = model._sorted_data.index(self)
model._sorted_data.sort()
index_now = model._sorted_data.index(self)
fields = {name: self.serialize_field(name)}
fields = {name: self.serialize_field(name)}
with parent._write_lock:
index_then = parent._sorted_data.index(self)
parent._sorted_data.sort()
index_now = parent._sorted_data.index(self)
ModelItemSet(model.sync_id, index_then, index_now, fields)
ModelItemSet(parent.sync_id, index_then, index_now, fields)
for sync_id, proxy in parent.proxies.items():
if sync_id != parent.sync_id:
proxy.source_item_set(parent, self.id, self, fields)
def __delattr__(self, name: str) -> None: