Repository navigation
Switch the Qt binding from PyQt6 to PySide6 - #258
Merged
Merged
Conversation
PySide6 is LGPL where PyQt6 is GPL, which keeps a closed-source GLIDER possible. Imports move to PySide6, pyqtSignal/pyqtSlot become Signal/Slot, sip.isdeleted becomes shiboken6.isValid, and QWIDGETSIZE_MAX (not exported by PySide6) is defined locally. glider/__init__ sets QT_API and PYQTGRAPH_QT_LIB so pyqtgraph, matplotlib and qasync cannot pick up a leftover PyQt6. The pc and rpi extras depend on PySide6-Essentials>=6.8.0.2, the newest with a wheel for Raspberry Pi OS Bookworm; the Pi installer, image and update script install the rpi extra and libxcb-cursor0 instead of apt's python3-pyqt6. pytest-qt runs with qt_api = pyside6.
Commit the file (it was gitignored) so cloud sessions, which clone fresh, follow the rule too.
PyQt6 accepted drawPolygon/drawPolyline with the points as separate arguments; PySide6 takes a single polygon and raised mid-paint, which left the canvas half-drawn and later crashed pyqtgraph during garbage collection.
PySide6 ignores QMenu.exec patched onto the class (exec has static and instance overloads, and an instance call bypasses the class attribute), so the real modal menu opened and the hardware-panel test hung. The new capture_menu_exec fixture swaps the module's QMenu for a subclass whose exec does the capturing.
- QPen takes no cap=/join= keywords: build round pens with setters. - The camera panel's status message goes to the window's own status bar; findChild returned a replaced bar not yet deleted. - Tests: QTest's modifier is positional (PySide6 calls it stateKey), QAction.disconnect() needs a signal, QImage.bits() is a sized memoryview, font().family() is the requested face (use fontInfo), and waitSignal on a worker's signal returns before the main-thread slot runs.
Under PySide6 a lambda, closure or partial connected to a signal emitted on a worker thread runs on that thread, even with QueuedConnection; only a bound method of a GUI-thread QObject is queued to the GUI thread. PyQt6 queued lambdas too, so these were safe before and are not now: - Behavior Analysis Apply: finished/failed tore the thread down, updated widgets and started the next video from the worker thread. - Behavior Analysis cohort speed: progress bar, message box and buttons. - The annotator's speed-worker bookkeeping raced its stop path. - retire_thread's release runs on the finishing thread; guard its list. - The flow engine's node-active callback goes through a signal, since it fires on the flow loop thread when that setting is on. Also corrects the flow_loop docstring, and makes a qthreads test wait for its worker to start and not time out while the GUI thread is busy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes LL-72.
Why
PyQt6 is GPL; PySide6 is LGPL. Switching keeps a closed-source, sold GLIDER possible, as long as PySide6 stays a separate, replaceable library and its licence ships with GLIDER.
What changes
PyQt6becomesPySide6,pyqtSignal/pyqtSlotbecomeSignal/Slot, andsip.isdeletedbecomesshiboken6.isValid.QWIDGETSIZE_MAXis defined locally because PySide6 doesn't export it.QPainter.drawPolygon/drawPolylinetake oneQPolygonF, not separate points. In Session Review this raised mid-paint and later crashed pyqtgraph.QPentakes nocap=/join=keywords (affected the progress bar).findChildreturned a replaced bar that Qt hadn't deleted yet.partialconnected to a signal from a worker thread runs on that thread, even withQueuedConnection; only a bound method of a GUI-thread QObject is queued. A full audit found the risky ones in Behavior Analysis: Apply's finished/failed handlers and the cohort-speed run touched widgets, showed dialogs and started the next thread off the GUI thread. They now use bound methods. The annotator's worker list andretire_thread's parked list are fixed too, the second with a lock. About 57 other connections were already bound methods and are unaffected.glider/__init__.pysetsQT_APIandPYQTGRAPH_QT_LIB, so pyqtgraph, matplotlib and qasync can't pick up a leftover PyQt6. An older Pi image has one from apt.PySide6-Essentials>=6.8.0.2goes in bothpcandrpi.python3-pyqt6. On Bookworm (glibc 2.36), 6.8.0.2 is the newest PySide6 with a Pi wheel, on Qt 6.8 LTS; later versions need Trixie.install.sh, the Pi image stage andglider-update.shinstall therpiextra andlibxcb-cursor0, and the image'spip installnow includes[rpi].qt_api = "pyside6". A newcapture_menu_execfixture is needed because PySide6 ignoresQMenu.execpatched onto the class. A few tests were adjusted for PySide6 argument and keyword differences.AGENTS.md. The install docs no longer mention apt's PyQt6.AGENTS.mdis no longer gitignored and says never to credit or commit as an AI agent.Testing
gliderand the plugins imports under PySide6.Compatibility
uv sync --extra pc. On a Pi, re-runinstall.shor the update script.