mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #6008 from ynput/bugfix/refresh-thread-fix
This commit is contained in:
commit
080be7db73
1 changed files with 10 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ class RefreshThread(QtCore.QThread):
|
|||
self._callback = partial(func, *args, **kwargs)
|
||||
self._exception = None
|
||||
self._result = None
|
||||
self.finished.connect(self._on_finish_callback)
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
|
|
@ -29,11 +30,19 @@ class RefreshThread(QtCore.QThread):
|
|||
self._result = self._callback()
|
||||
except Exception as exc:
|
||||
self._exception = exc
|
||||
self.refresh_finished.emit(self.id)
|
||||
|
||||
def get_result(self):
|
||||
return self._result
|
||||
|
||||
def _on_finish_callback(self):
|
||||
"""Trigger custom signal with thread id.
|
||||
|
||||
Listening for 'finished' signal we make sure that execution of thread
|
||||
finished and QThread object can be safely deleted.
|
||||
"""
|
||||
|
||||
self.refresh_finished.emit(self.id)
|
||||
|
||||
|
||||
class _IconsCache:
|
||||
"""Cache for icons."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue