Reorder ListItems

This commit is contained in:
miruka 2019-05-09 20:17:24 -04:00
parent dcdf165c4f
commit 76fc03e8a1
2 changed files with 28 additions and 27 deletions

View File

@ -90,7 +90,6 @@ class Client(QObject):
def queryE2EKeys(self) -> None: def queryE2EKeys(self) -> None:
print("query")
self._on_query_e2e_keys(self.net.talk(self.nio.keys_query)) self._on_query_e2e_keys(self.net.talk(self.nio.keys_query))

View File

@ -7,14 +7,27 @@ from .list_item import ListItem
from .list_model import ListModel from .list_model import ListModel
class RoomEvent(ListItem): class Account(ListItem):
_required_init_values = {"type", "dict"} _required_init_values = {"userId", "roomCategories"}
_constant = {"type"} _constant = {"userId", "roomCategories"}
type: str = "" userId: str = ""
dict: Dict[str, Any] = {} roomCategories: ListModel = ListModel()
dateTime: QDateTime = QDateTime.currentDateTime() displayName: Optional[str] = None
isLocalEcho: bool = False 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): class Room(ListItem):
@ -31,17 +44,17 @@ class Room(ListItem):
leftEvent: Optional[Dict[str, str]] = None leftEvent: Optional[Dict[str, str]] = None
class RoomCategory(ListItem): class RoomEvent(ListItem):
_required_init_values = {"name", "rooms", "sortedRooms"} _required_init_values = {"type", "dict"}
_constant = {"rooms", "sortedRooms"} _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): class Trust(Enum):
blacklisted = -1 blacklisted = -1
@ -59,14 +72,3 @@ class Device(ListItem):
trust: Trust = Trust.undecided trust: Trust = Trust.undecided
lastSeenIp: Optional[str] = None lastSeenIp: Optional[str] = None
lastSeenDate: Optional[QDateTime] = 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