From 76fc03e8a13a1d355046ac20899999b8df3aa1d0 Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 9 May 2019 20:17:24 -0400 Subject: [PATCH] Reorder ListItems --- harmonyqml/backend/client.py | 1 - harmonyqml/backend/model/items.py | 54 ++++++++++++++++--------------- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/harmonyqml/backend/client.py b/harmonyqml/backend/client.py index af59e35a..5677a91f 100644 --- a/harmonyqml/backend/client.py +++ b/harmonyqml/backend/client.py @@ -90,7 +90,6 @@ class Client(QObject): def queryE2EKeys(self) -> None: - print("query") self._on_query_e2e_keys(self.net.talk(self.nio.keys_query)) diff --git a/harmonyqml/backend/model/items.py b/harmonyqml/backend/model/items.py index 8342c8c8..7e9eae7f 100644 --- a/harmonyqml/backend/model/items.py +++ b/harmonyqml/backend/model/items.py @@ -7,14 +7,27 @@ from .list_item import ListItem from .list_model import ListModel -class RoomEvent(ListItem): - _required_init_values = {"type", "dict"} - _constant = {"type"} +class Account(ListItem): + _required_init_values = {"userId", "roomCategories"} + _constant = {"userId", "roomCategories"} - type: str = "" - dict: Dict[str, Any] = {} - dateTime: QDateTime = QDateTime.currentDateTime() - isLocalEcho: bool = False + userId: str = "" + roomCategories: ListModel = ListModel() + displayName: Optional[str] = None + avatarUrl: Optional[str] = None + statusMessage: Optional[str] = None + + +class RoomCategory(ListItem): + _required_init_values = {"name", "rooms", "sortedRooms"} + _constant = {"rooms", "sortedRooms"} + + name: str = "" + + # Must be provided at init, else it will be the same object + # for every RoomCategory + rooms: ListModel = ListModel() + sortedRooms: QSortFilterProxyModel = QSortFilterProxyModel() class Room(ListItem): @@ -31,17 +44,17 @@ class Room(ListItem): leftEvent: Optional[Dict[str, str]] = None -class RoomCategory(ListItem): - _required_init_values = {"name", "rooms", "sortedRooms"} - _constant = {"rooms", "sortedRooms"} +class RoomEvent(ListItem): + _required_init_values = {"type", "dict"} + _constant = {"type"} - name: str = "" + type: str = "" + dict: Dict[str, Any] = {} + dateTime: QDateTime = QDateTime.currentDateTime() + isLocalEcho: bool = False - # Must be provided at init, else it will be the same object - # for every RoomCategory - rooms: ListModel = ListModel() - sortedRooms: QSortFilterProxyModel = QSortFilterProxyModel() +# ---------- class Trust(Enum): blacklisted = -1 @@ -59,14 +72,3 @@ class Device(ListItem): trust: Trust = Trust.undecided lastSeenIp: Optional[str] = None lastSeenDate: Optional[QDateTime] = None - - -class Account(ListItem): - _required_init_values = {"userId", "roomCategories"} - _constant = {"userId", "roomCategories"} - - userId: str = "" - roomCategories: ListModel = ListModel() # same as RoomCategory.rooms - displayName: Optional[str] = None - avatarUrl: Optional[str] = None - statusMessage: Optional[str] = None