mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
make sure only one loop is running
Make sure loop of '_next_publish_item_process' is in processor only once
This commit is contained in:
parent
4344b03230
commit
4632d22275
1 changed files with 12 additions and 4 deletions
|
|
@ -76,21 +76,27 @@ class QtPublisherController(PublisherController):
|
||||||
self.register_event_callback(
|
self.register_event_callback(
|
||||||
"publish.process.stopped", self._qt_on_publish_stop
|
"publish.process.stopped", self._qt_on_publish_stop
|
||||||
)
|
)
|
||||||
|
self._item_process_in_loop = False
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
self._main_thread_processor.clear()
|
self._main_thread_processor.clear()
|
||||||
|
self._item_process_in_loop = False
|
||||||
super().reset()
|
super().reset()
|
||||||
|
|
||||||
def _start_publish(self, up_validation):
|
def _start_publish(self, up_validation):
|
||||||
self._publish_model.set_publish_up_validation(up_validation)
|
self._publish_model.set_publish_up_validation(up_validation)
|
||||||
self._publish_model.start_publish(wait=False)
|
self._publish_model.start_publish(wait=False)
|
||||||
self._process_main_thread_item(
|
if not self._item_process_in_loop:
|
||||||
MainThreadItem(self._next_publish_item_process)
|
self._process_main_thread_item(
|
||||||
)
|
MainThreadItem(self._next_publish_item_process)
|
||||||
|
)
|
||||||
|
|
||||||
def _next_publish_item_process(self):
|
def _next_publish_item_process(self):
|
||||||
if not self._publish_model.is_running():
|
if not self._publish_model.is_running():
|
||||||
|
self._item_process_in_loop = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self._item_process_in_loop = True
|
||||||
func = self._publish_model.get_next_process_func()
|
func = self._publish_model.get_next_process_func()
|
||||||
self._process_main_thread_item(MainThreadItem(func))
|
self._process_main_thread_item(MainThreadItem(func))
|
||||||
self._process_main_thread_item(
|
self._process_main_thread_item(
|
||||||
|
|
@ -104,4 +110,6 @@ class QtPublisherController(PublisherController):
|
||||||
self._main_thread_processor.start()
|
self._main_thread_processor.start()
|
||||||
|
|
||||||
def _qt_on_publish_stop(self):
|
def _qt_on_publish_stop(self):
|
||||||
self._main_thread_processor.stop()
|
self._process_main_thread_item(
|
||||||
|
MainThreadItem(self._main_thread_processor.stop)
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue