UI improvements and fixes#93
Draft
C-Achard wants to merge 8 commits into
Draft
Conversation
Update `OpenCVCameraBackend.device_name()` to prefer explicit naming sources before generating a default label. It now returns `device_name` from parsed options first, then `settings.name`, and only falls back to an OpenCV-derived backend label (or generic OpenCV label) when no custom name is provided.
Normalize camera labeling in the main window by using `get_display_id()` for active-camera text and DLC camera dropdown entries. This also improves fallback behavior in `_label_for_cam_id` by checking cached display IDs and returning "Unknown camera" instead of raw internal IDs.
Refactors the main window controls panel to use a new reusable layout helper that keeps the content vertically scrollable while pinning the Preview/Stop buttons in a fixed footer. The new `_VerticalOnlyScrollArea` avoids horizontal clipping/scrollbars by enforcing natural content width and updating constraints on layout/style changes. Also tightens preview shutdown cleanup by resetting running camera/display state and refreshing active camera + DLC camera UI after stopping multi-camera preview.
Reorganize `DLCLiveGUISettingsStore` with explicit key constants, shared bool/string helpers, and clearer sections/docstrings. Add persisted DLC preference accessors for inference camera ID, processor key, and processor-control state, and tighten processor folder persistence behavior. Also improve `ModelPathStore` readability and diagnostics by clarifying path/model handling logic and adding `exc_info=True` to debug logs for better troubleshooting.
Restore and save processor choice, processor-control toggle, and inference camera preference through settings so user selections survive restarts. The camera handling now separates preferred vs active inference camera IDs, using temporary runtime fallback cameras without overwriting the saved preference, and updates overlay/inference routing accordingly. It also improves processor list refresh behavior by restoring the previous selection when available and syncing settings on close.
Add broad tests for `DLCLiveGUISettingsStore` behavior, including inference camera ID, processor folder/key persistence, and processor control toggles. The in-memory `QSettings` test double now supports `remove` and `sync`, and new parametrized cases verify robust boolean parsing for processor control plus recording `use_timestamp` and `fast_encoding` settings.
This updates configuration load/save flow to keep a valid associated config file path when restoring from QSettings snapshots, and to use a smarter default path for file dialogs (current config, last valid config, or derived parent path). It also makes saves return success/failure so `_config_path` is only updated on successful writes, and syncs settings immediately after loading a config to persist metadata reliably.
4 tasks
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.
Scope
Automated summary
This pull request introduces significant improvements to the camera selection and processor configuration experience in the GUI, with a focus on persisting user preferences, improving UI layout, and enhancing the robustness of camera and processor state management. The most important changes are grouped below:
Camera selection and persistence improvements:
The inference camera selection now persists across sessions and is restored on startup, using
_inference_camera_idand_active_inference_camera_idto distinguish between user preference and runtime fallback. The preferred camera is only updated when explicitly changed by the user, and temporary runtime switches (e.g., due to camera disconnects) are not persisted. The camera dropdown UI is updated to reflect these changes, and the display label uses a newget_display_idhelper for clarity. (dlclivegui/gui/main_window.py) [1] [2] [3] [4] [5] [6] [7]The
device_namemethod in the OpenCV backend now provides more descriptive camera names by checking for user-specified names, settings, and backend API names in order of preference. (dlclivegui/cameras/backends/opencv_backend.py)Processor selection and persistence:
dlclivegui/gui/main_window.py) [1] [2] [3] [4] [5] [6]UI and layout enhancements:
make_scrollable_with_fixed_footerhelper. This prevents UI shifting and improves usability. (dlclivegui/gui/main_window.py,dlclivegui/gui/misc/layouts.py) [1] [2]General cleanup and robustness:
dlclivegui/gui/main_window.py)These changes collectively make the application's camera and processor configuration more user-friendly, persistent, and reliable.