Skip to content

Fix qt warnings - #473

Open
jenshnielsen wants to merge 2 commits into
toolsforexperiments:masterfrom
jenshnielsen:fix_qt_warnings
Open

jenshnielsen wants to merge 2 commits into
toolsforexperiments:masterfrom
jenshnielsen:fix_qt_warnings

Conversation

@jenshnielsen

@jenshnielsen jenshnielsen commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Clean up warnings raised during tests

Recent PySide6 emits a RuntimeWarning instead of raising TypeError when
disconnecting a slot that is not connected, so the try/except TypeError
guards no longer keep this quiet.

- PlotWithColorbar: connect colorbar.sigLevelsChanged to
  _colorScatterPoints once in __init__ (it is a no-op without a scatter
  plot) instead of disconnecting on every clearPlot.
- FittingGui: only connect the freshly built param-option signals when
  live update is on, rather than disconnecting never-connected signals.
  Also drive live update from QCheckBox.toggled(bool): with PySide6,
  stateChanged emits an int that never equals Qt.Checked, so checking
  the box disabled live update (and disconnected unconnected slots).
Forking the multi-threaded (Qt) pytest process raises "This process is
multi-threaded, use of fork() may lead to deadlocks in the child"
DeprecationWarning on Linux with Python >= 3.12. Use the spawn start
method on all platforms (Windows already used it).
@jenshnielsen
jenshnielsen marked this pull request as ready for review October 6, 2026 06:54
Comment thread plottr/node/fitter.py
liveUpdateCheck.stateChanged.connect(setLiveUpdate)
# use toggled(bool) rather than stateChanged: depending on the Qt
# binding, stateChanged emits an int that does not compare equal to
# the Qt.CheckState enum.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to manually validate if this is true.

Comment thread test/pytest/test_ddh5.py
class _Writer(Process):
# Use 'spawn' on all platforms: forking the multi-threaded (Qt) test process is
# unsafe and raises a DeprecationWarning on Linux with Python >= 3.12.
_mp_context = multiprocessing.get_context("spawn")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using fork in the real app? is that an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants