GUI: Fix redundant signal calls, streamline path selections - #3395
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves DeepLabCut’s Qt GUI reliability around file selection, path normalization, and synchronized widget state updates, reducing redundant signals and avoiding feedback loops during UI state synchronization.
Changes:
- Added binding-safe
QFileDialoghelper wrappers and normalizedPath/string handling for selected files. - Prevented unnecessary state churn by blocking signals during widget synchronization (e.g., shuffle/videotype updates) and by early-returning on no-op updates.
- Made snapshot-selection UI logic more robust when pose configuration is temporarily unavailable.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| deeplabcut/gui/window.py | Lowers verbosity for frequent GUI state-change logs (video type / clearing files). |
| deeplabcut/gui/tabs/train_network.py | Guards against missing/None pose config when determining whether to show detector snapshot selection. |
| deeplabcut/gui/components.py | Introduces QFileDialog helpers, normalizes selected paths, and tightens signal-blocking to prevent sync feedback loops. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
deruyter92
left a comment
There was a problem hiding this comment.
Solid, well-scoped PR, thanks!
I've added one commit to change str() conversion to os.fspath which is a bit more type-safe and consistent with the other places.
LGTM
|
Caution
|
Sorry, wouldn't Path usage make more sense given recent efforts in e.g. #3350 ? Should I adapt this file? |
Change two MainWindow log calls in `deeplabcut/gui/window.py` from info to debug when setting the video type and clearing video files. This reduces routine GUI noise in normal logs while keeping the messages available for troubleshooting.
Hardened the GUI logic that toggles detector snapshot selection by safely handling missing `pose_cfg` or `method` values. The check now defaults to an empty dict/string before lowercasing, preventing runtime errors and preserving the intended Top-Down (`td`) behavior.
- Call QFileDialog positionally for PySide6 compatibility - Normalize Path values before passing them to Qt - Handle single-file and multi-file dialog results correctly - Preserve Path objects in GUI state - Prevent video type and shuffle signal feedback loops casing slow and redundant updates - Retain ConfigEditor instances after opening
ef05ba3 to
4c84692
Compare
Regarding I'm reverting my commit. |
str() conversions are clearer
deruyter92
left a comment
There was a problem hiding this comment.
Looks good. Ready to merge I think!
Scope
Improve GUI file selection and signal blocking, while preserving path types and workflows.
Changes
QFileDialoghelpers with consistentPath/string conversionGoal
File selection now works more reliably, selected paths remain consistent throughout the GUI, and synchronized controls no longer trigger repeated clearing, slow updates, or state sync exceptions