UI improvements and fixes - #93
Draft
C-Achard wants to merge 10 commits into
Draft
Conversation
4 tasks
C-Achard
force-pushed
the
cy/ui-tweaks
branch
2 times, most recently
from
August 13, 2026 09:52
6287d65 to
e75dbd6
Compare
This was
linked to
issues
Aug 14, 2026
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.
Adds a dedicated QSettings key for the recording filename and wires it through the settings store. The main window now restores a previously saved filename on startup, saves it when filename editing finishes, and persists it again on close to avoid losing the value between sessions.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the GUI’s camera/processor selection UX and persistence by expanding the QSettings-backed preference store, refining inference camera selection behavior, and adjusting the controls panel layout to be scrollable with a fixed footer.
Changes:
- Expanded
DLCLiveGUISettingsStoreto persist additional GUI preferences (inference camera ID, processor selection/control, recording filename, etc.) with added unit tests. - Updated
MainWindowto restore/persist camera + processor UI state and to use a scrollable controls panel with fixed preview/stop controls. - Improved OpenCV backend camera naming logic and updated related tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utils/test_settings_store.py | Adds tests and a richer in-memory QSettings stand-in for new persisted preferences. |
| tests/cameras/backends/test_opencv_backend.py | Updates expectations for OpenCV backend device naming. |
| dlclivegui/utils/settings_store.py | Refactors/extends QSettings-backed preference storage (new keys + helpers). |
| dlclivegui/gui/misc/layouts.py | Introduces a vertical-only scroll wrapper with a fixed footer helper. |
| dlclivegui/gui/main_window.py | Implements persistence + runtime behavior changes for camera/processor UI and layout updates. |
| dlclivegui/cameras/backends/opencv_backend.py | Improves device naming to prefer user/config names before backend-derived names. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1544
to
+1548
| display_id = self._multi_camera_display_ids.get(cam_id) | ||
| if display_id: | ||
| return display_id | ||
|
|
||
| return "Unknown camera" |
Comment on lines
890
to
+894
| self.output_directory_edit.setText(recording.directory) | ||
| self.filename_edit.setText(recording.filename) | ||
| persisted_filename = self._settings_store.get_rec_filename() | ||
| if persisted_filename: | ||
| self.filename_edit.setText(persisted_filename) |
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.