mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Check if on main thread for call_on_qt_thread
CURA-6225
This commit is contained in:
parent
61b84bdcfc
commit
21099e30cb
1 changed files with 6 additions and 0 deletions
|
@ -31,4 +31,10 @@ def call_on_qt_thread(func):
|
||||||
CuraApplication.getInstance().callLater(_handle_call, *new_args, **kwargs)
|
CuraApplication.getInstance().callLater(_handle_call, *new_args, **kwargs)
|
||||||
inter_call_object.finish_event.wait()
|
inter_call_object.finish_event.wait()
|
||||||
return inter_call_object.result
|
return inter_call_object.result
|
||||||
|
|
||||||
|
# If the current thread is the main thread, which is the Qt thread, directly return the function.
|
||||||
|
current_thread = threading.current_thread()
|
||||||
|
if isinstance(current_thread, threading._MainThread):
|
||||||
|
return func
|
||||||
|
|
||||||
return _call_on_qt_thread_wrapper
|
return _call_on_qt_thread_wrapper
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue