mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
it is possible to clear model before refresh thread
This commit is contained in:
parent
973730ec87
commit
7a9b0eb368
1 changed files with 10 additions and 2 deletions
|
|
@ -347,14 +347,22 @@ class AssetModel(QtGui.QStandardItemModel):
|
|||
|
||||
return self.get_indexes_by_asset_ids(asset_ids)
|
||||
|
||||
def refresh(self, force=False):
|
||||
"""Refresh the data for the model."""
|
||||
def refresh(self, force=False, clear=False):
|
||||
"""Refresh the data for the model.
|
||||
|
||||
Args:
|
||||
force (bool): Stop currently running refresh start new refresh.
|
||||
clear (bool): Clear model before refresh thread starts.
|
||||
"""
|
||||
# Skip fetch if there is already other thread fetching documents
|
||||
if self._refreshing:
|
||||
if not force:
|
||||
return
|
||||
self.stop_refresh()
|
||||
|
||||
if clear:
|
||||
self._clear_items()
|
||||
|
||||
# Fetch documents from mongo
|
||||
# Restart payload
|
||||
self._refreshing = True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue