Repair room filter, performance improvements

Chnaging delegate heights is a terrible idea that leads to graphic bugs.
Handle filtering (both room and accounts) and collapsing from a function
that sets the JsonListModel source.
This commit is contained in:
miruka
2019-08-19 10:28:49 -04:00
parent 2865d86d19
commit 165c1b797e
7 changed files with 75 additions and 22 deletions

View File

@@ -84,7 +84,6 @@ class App:
rl = self.run_in_loop # noqa
ba = self.backend # noqa
mo = self.backend.models # noqa
smo = self.backend.sidepane_model # noqa
cl = self.backend.clients
tcl = lambda user: cl[f"@test_{user}:matrix.org"] # noqa

View File

@@ -13,12 +13,17 @@ class Account(ModelItem):
display_name: str = ""
avatar_url: str = ""
profile_updated: datetime = field(default_factory=datetime.now)
filter_string: str = ""
def __lt__(self, other: "Account") -> bool:
name = self.display_name or self.user_id[1:]
other_name = other.display_name or other.user_id[1:]
return name < other_name
# @property
# def filter_string(self) -> str: # TODO: support serializing properties
# return " ".join((self.user_id, self.display_name))
@dataclass
class Room(ModelItem):