1d0cce402e
For any name not found in rooms data, rely on new nio.HttpClient.get_displayname() function to get and cache it, e.g. for our own name if no room is joined and past events from users who left the room. @futurize now returns PyQtFuture objects, wrapper for the concurrent.futures.Future objects that can be used from QML, to ensure name retrieval does not block the GUI.
30 lines
666 B
Python
30 lines
666 B
Python
# Copyright 2019 miruka
|
|
# This file is part of harmonyqml, licensed under GPLv3.
|
|
|
|
from typing import Dict, List, NamedTuple, Optional
|
|
|
|
from PyQt5.QtCore import QDateTime
|
|
|
|
from ..pyqt_future import PyQtFuture
|
|
|
|
|
|
class User(NamedTuple):
|
|
user_id: str
|
|
display_name: PyQtFuture
|
|
avatar_url: Optional[str] = None
|
|
status_message: Optional[str] = None
|
|
|
|
|
|
class Room(NamedTuple):
|
|
room_id: str
|
|
display_name: Optional[str]
|
|
description: str = ""
|
|
typing_users: List[str] = []
|
|
|
|
|
|
class RoomEvent(NamedTuple):
|
|
type: str
|
|
date_time: QDateTime
|
|
dict: Dict[str, str]
|
|
is_local_echo: bool = False
|