Have id field on ModelItem base class

This commit is contained in:
miruka 2020-05-02 13:03:44 -04:00
parent 5b2c131fd1
commit 592a9fe8e7
2 changed files with 9 additions and 5 deletions

View File

@ -3,6 +3,7 @@
- add account number binds
- rename goto*account → scrollto*account
- fix opacity
- fix python error
- fix back/front buttons in small window
- fix message delegate too tall
@ -17,6 +18,9 @@
- if last room event is a membership change, it won't be visible in timeline
- use uiState instead of open_room
- clicking on a room with unread counter to see it move right away is weird
- rooms without messages on first sync
- avatar loading performance problem?
## Refactoring
@ -35,8 +39,6 @@
- Drag-scrolling in room pane a tiny bit activates the delegates
- When zooming in enough, "Mirage <version>" label overflows
- Catch server 5xx errors when sending message and retry
- Popups and room settings can't be scrolled when not enough height to show all
@ -44,9 +46,6 @@
- Handle cases where a known account's access token is invalid
- If an account is gone from the user's config, discard UI state last page
- First sent message in E2E room is sometimes undecryptable
(can be fixed by logging out and in again) (still valid?)
- After forgetting a room, it comes back because of the "you left" event
- `code` and links in quote ("> http://example.com") aren't properly colored

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, Dict
from ..pyotherside_events import ModelItemSet
@ -10,6 +11,7 @@ if TYPE_CHECKING:
from .model import Model
@dataclass
class ModelItem:
"""Base class for items stored inside a `Model`.
@ -21,6 +23,9 @@ class ModelItem:
and thus allow a `Model` to keep its data sorted.
"""
id: Any = field()
def __new__(cls, *_args, **_kwargs) -> "ModelItem":
cls.parent_models: Dict[SyncId, Model] = {}
return super().__new__(cls)