Rename ListModel.update() to updateItem()

This commit is contained in:
miruka 2019-05-14 19:06:59 -04:00
parent 2a687f8eee
commit 45c928ea17
2 changed files with 8 additions and 6 deletions

View File

@ -238,10 +238,10 @@ class ListModel(QAbstractListModel):
@pyqtSlot(int, "QVariantMap", "QStringList", result=int) @pyqtSlot(int, "QVariantMap", "QStringList", result=int)
@pyqtSlot(str, "QVariantMap", result=int) @pyqtSlot(str, "QVariantMap", result=int)
@pyqtSlot(str, "QVariantMap", "QStringList", result=int) @pyqtSlot(str, "QVariantMap", "QStringList", result=int)
def update(self, def updateItem(self,
index: Index, index: Index,
value: NewItem, value: NewItem,
ignore_roles: Sequence[str] = ()) -> int: ignore_roles: Sequence[str] = ()) -> int:
value = self._convert_new_value(value) value = self._convert_new_value(value)
i_index: int = self.indexWhere(index, _can_use_default_factory=False) \ i_index: int = self.indexWhere(index, _can_use_default_factory=False) \
@ -283,7 +283,9 @@ class ListModel(QAbstractListModel):
new_index_if_update: Optional[int] = None, new_index_if_update: Optional[int] = None,
ignore_roles: Sequence[str] = ()) -> None: ignore_roles: Sequence[str] = ()) -> None:
try: try:
index = self.update(where_main_key_is, update_with, ignore_roles) index = self.updateItem(
where_main_key_is, update_with, ignore_roles
)
except (IndexError, ValueError): except (IndexError, ValueError):
self.insert(new_index_if_insert or len(self), update_with) self.insert(new_index_if_insert or len(self), update_with)
else: else:

View File

@ -336,7 +336,7 @@ class SignalManager(QObject):
break break
if update_at is not None: if update_at is not None:
model.update(update_at, new_event) model.updateItem(update_at, new_event)
self._events_in_transfer -= 1 self._events_in_transfer -= 1
return new_event return new_event