pyapp-kit / superqt

Missing widgets and components for Qt-python
https://pyapp-kit.github.io/superqt/
BSD 3-Clause "New" or "Revised" License
215 stars 38 forks source link

Fix nested threadworker not starting #63

Closed tlambert03 closed 2 years ago

tlambert03 commented 2 years ago

fixes napari/superqt#64

Threadworkers started within another thread weren't getting started because of the QTimer.singleshot call in the QRunnable.start method. (because threads don't have event loops, and QTimer needs one). This checks to see if we're running in a thread that has an event loop before queuing with QTimer, otherwise it starts the runnable immediately)

codecov[bot] commented 2 years ago

Codecov Report

Merging #63 (3aa1e5e) into main (d0d67da) will decrease coverage by 0.07%. The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #63      +/-   ##
==========================================
- Coverage   84.03%   83.95%   -0.08%     
==========================================
  Files          24       24              
  Lines        2129     2131       +2     
==========================================
  Hits         1789     1789              
- Misses        340      342       +2     
Impacted Files Coverage Δ
src/superqt/utils/_qthreading.py 77.05% <50.00%> (-0.68%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d0d67da...3aa1e5e. Read the comment docs.