2019-04-30 13:51:37 +10:00
|
|
|
from typing import Any, Dict, List, Optional
|
2019-04-12 18:33:09 +10:00
|
|
|
|
2019-04-30 13:51:37 +10:00
|
|
|
from PyQt5.QtCore import QDateTime
|
2019-04-12 18:33:09 +10:00
|
|
|
|
2019-04-30 13:51:37 +10:00
|
|
|
from .list_item import ListItem
|
2019-05-03 04:20:21 +10:00
|
|
|
from .list_model import ListModel
|
2019-04-21 07:36:21 +10:00
|
|
|
|
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
class RoomEvent(ListItem):
|
|
|
|
_required_init_values = {"type", "dict"}
|
|
|
|
_constant = {"type"}
|
2019-04-21 07:36:21 +10:00
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
type: str = ""
|
|
|
|
dict: Dict[str, Any] = {}
|
|
|
|
dateTime: QDateTime = QDateTime.currentDateTime()
|
|
|
|
isLocalEcho: bool = False
|
2019-04-21 07:36:21 +10:00
|
|
|
|
|
|
|
|
|
|
|
class Room(ListItem):
|
2019-04-30 13:51:37 +10:00
|
|
|
_required_init_values = {"roomId", "displayName"}
|
|
|
|
_constant = {"roomId"}
|
2019-04-21 07:36:21 +10:00
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
roomId: str = ""
|
|
|
|
displayName: str = ""
|
|
|
|
topic: Optional[str] = None
|
|
|
|
typingUsers: List[str] = []
|
2019-04-21 07:36:21 +10:00
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
inviter: Optional[Dict[str, str]] = None
|
|
|
|
leftEvent: Optional[Dict[str, str]] = None
|
2019-04-21 07:36:21 +10:00
|
|
|
|
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
class RoomCategory(ListItem):
|
|
|
|
_required_init_values = {"name", "rooms"}
|
|
|
|
_constant = {"rooms"}
|
|
|
|
|
|
|
|
name: str = ""
|
|
|
|
|
|
|
|
# Must be provided at init, else it will be the same object
|
|
|
|
# for every RoomCategory
|
|
|
|
rooms: ListModel = ListModel()
|
|
|
|
|
|
|
|
|
|
|
|
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
|