Rooms and threads fixes

- Fix roomList height again, now based on model.count().
  All delegates are assumed to be the same height

- Properly update room list when a room is joined or left

- Catch exceptions happening in threads (futures), which previously
  passed silently

- Show "Empty room?" as "<i>Empty Room</i>" + gray [?] avatar
This commit is contained in:
miruka
2019-04-13 08:59:10 -04:00
parent d8c6ffefe0
commit 13fca98838
8 changed files with 58 additions and 36 deletions

View File

@@ -17,7 +17,7 @@ class User(NamedTuple):
class Room(NamedTuple):
room_id: str
display_name: str
display_name: Optional[str]
description: str = ""
unread_messages: int = 0
presence: Presence = Presence.none

View File

@@ -129,7 +129,7 @@ class ListModel(QAbstractListModel):
@pyqtSlot(int, list)
def set(self, index: int, value: NewValue) -> None:
qidx = QAbstractListModel.index(index, 0)
qidx = QAbstractListModel.index(self, index, 0)
value = self._convert_new_value(value)
self._list[index] = value
self.dataChanged.emit(qidx, qidx, self.roleNames())
@@ -139,7 +139,7 @@ class ListModel(QAbstractListModel):
@pyqtSlot(int, str, "QVariant")
def setProperty(self, index: int, prop: str, value: Any) -> None:
self._list[index][self._roles.index(prop)] = value
qidx = QAbstractListModel.index(index, 0)
qidx = QAbstractListModel.index(self, index, 0)
self.dataChanged.emit(qidx, qidx, self.roleNames())
self._update_count += 1