Processor-related fixes#89
Draft
C-Achard wants to merge 2 commits into
Draft
Conversation
Wire the processor-control checkbox to refresh DLC control availability and processor status immediately when toggled. Also refresh DLC control enablement when multi-camera preview starts or stops, so the GUI consistently reflects current camera/processor state.
Disable all DLC and processor configuration widgets consistently while inference is active, including the processor-control checkbox. Refactor processor discovery into shared helpers that detect direct and indirect `dlclive.Processor` subclasses, standardize metadata extraction, and reuse the same fallback logic for package scans and file-based loading.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses two processor-related UX/plug-in discovery issues in DeepLabCut-live-GUI: (1) ensuring DLC/processor controls correctly re-enable after preview stop, and (2) improving processor class discovery so indirect dlclive.Processor subclasses can be surfaced in the GUI.
Changes:
- Adds a shared
discover_processor_classes()helper to finddlclive.Processorsubclasses (including indirect subclasses) and reuses it for both package and file-based processor loading. - Hooks
allow_processor_ctrl_checkboxchanges into UI update routines, and refreshes DLC control enabled-state on multi-camera preview start/stop. - Simplifies DLC control enabling logic so processor-related widgets re-enable based on inference state.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| dlclivegui/processors/processor_utils.py | Refactors processor discovery into reusable helpers and uses them for package/file scanning. |
| dlclivegui/gui/main_window.py | Updates signal wiring and control enable/disable logic to restore processor/DLC UI states after preview transitions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
124
to
+126
| else: | ||
| # Fallback: scan for dlclive.Processor subclasses | ||
| from dlclive import Processor | ||
|
|
||
| processors = {} | ||
| for attr_name in dir(mod): | ||
| obj = getattr(mod, attr_name) | ||
| try: | ||
| if isinstance(obj, type) and obj is not Processor and issubclass(obj, Processor): | ||
| processors[attr_name] = { | ||
| "class": obj, | ||
| "name": getattr(obj, "PROCESSOR_NAME", attr_name), | ||
| "description": getattr(obj, "PROCESSOR_DESCRIPTION", ""), | ||
| "params": getattr(obj, "PROCESSOR_PARAMS", {}), | ||
| } | ||
| except Exception: | ||
| # Non-class or weird metaclass; ignore | ||
| pass | ||
| processors = discover_processor_classes(mod) |
Comment on lines
175
to
+177
|
|
||
| # Fallback path: discover subclasses of dlclive.Processor | ||
| from dlclive import Processor | ||
|
|
||
| processors: dict[str, dict] = {} | ||
| for name, obj in inspect.getmembers(module, inspect.isclass): | ||
| if obj is Processor: | ||
| continue | ||
| # Guard: module might define other classes; only include Processor subclasses | ||
| try: | ||
| if issubclass(obj, Processor): | ||
| processors[name] = { | ||
| "class": obj, | ||
| "name": getattr(obj, "PROCESSOR_NAME", name), | ||
| "description": getattr(obj, "PROCESSOR_DESCRIPTION", ""), | ||
| "params": getattr(obj, "PROCESSOR_PARAMS", {}), | ||
| } | ||
| except Exception: | ||
| # Some "classes" can fail issubclass checks; ignore safely | ||
| continue | ||
|
|
||
| return processors | ||
| return discover_processor_classes(module) |
Comment on lines
+37
to
+42
| try: | ||
| if obj is processor_base: | ||
| return bool(include_base) | ||
| return issubclass(obj, processor_base) | ||
| except TypeError: | ||
| return False |
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.
Closes #87 and closes #88