Skip to content

Commit db3698c

Browse files
committed
Improve recording UI layout and remove bbox_color
Prevent the recording path preview from being squished and refactor the container/codec/CRF controls into a single responsive grid row with explicit labels, tooltips, size policies, column stretches, spacing and minimum content lengths. Set CRF spinbox range/value and tooltip, keep platform-specific codec lists, and move the "Open recording folder" button below the recording controls to avoid layout shifting. Also remove the unused bbox_color argument from the drawing call in _build_bbox_group.
1 parent b72b052 commit db3698c

File tree

1 file changed

+57
-22
lines changed

1 file changed

+57
-22
lines changed

dlclivegui/gui/main_window.py

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -463,39 +463,75 @@ def _build_recording_group(self) -> QGroupBox:
463463

464464
# Show recording path preview
465465
self.recording_path_preview = QLabel("")
466+
# Ensure it never gets squished vertically
467+
self.recording_path_preview.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
466468
self.recording_path_preview.setWordWrap(True)
467469
self.recording_path_preview.setTextInteractionFlags(Qt.TextSelectableByMouse)
468470
form.addRow("Will save to", self.recording_path_preview)
469471

470472
self.filename_edit = QLineEdit()
471473
form.addRow("Filename", self.filename_edit)
472474

473-
container_codec_layout = QHBoxLayout()
474-
container_codec_layout.setContentsMargins(0, 0, 0, 0)
475-
container_codec_layout.setSpacing(8)
475+
# Container + codec + CRF in a single row
476+
grid = QGridLayout()
477+
grid.setContentsMargins(0, 2, 0, 2)
478+
grid.setHorizontalSpacing(8)
479+
480+
grid.setColumnStretch(0, 0)
481+
grid.setColumnStretch(1, 3)
482+
grid.setColumnStretch(2, 0)
483+
grid.setColumnStretch(3, 3)
484+
grid.setColumnStretch(4, 0)
485+
grid.setColumnStretch(5, 2)
486+
487+
## Container
488+
container_label = QLabel("Container")
489+
container_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
490+
grid.addWidget(container_label, 0, 0)
491+
476492
self.container_combo = QComboBox()
493+
self.container_combo.setToolTip("Select the video container/format")
494+
self.container_combo.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred)
477495
self.container_combo.setEditable(True)
478496
self.container_combo.addItems(["mp4", "avi", "mov"])
479-
container_codec_layout.addWidget(self.container_combo)
480-
# form.addRow("Container", self.container_combo)
497+
# Ensure it never becomes unreadable:
498+
self.container_combo.setMinimumContentsLength(8)
499+
self.container_combo.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
500+
grid.addWidget(self.container_combo, 0, 1)
501+
502+
## Codec
503+
codec_label = QLabel("Codec")
504+
codec_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
505+
grid.addWidget(codec_label, 0, 2)
506+
481507
self.codec_combo = QComboBox()
508+
self.codec_combo.setToolTip("Select the video codec to use for recording")
509+
self.codec_combo.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred)
510+
482511
if os.sys.platform == "darwin":
483512
self.codec_combo.addItems(["h264_videotoolbox", "libx264", "hevc_videotoolbox"])
484513
else:
485514
self.codec_combo.addItems(["h264_nvenc", "libx264", "hevc_nvenc"])
515+
486516
self.codec_combo.setCurrentText("libx264")
487-
# form.addRow("Codec", self.codec_combo)
488-
container_codec_layout.addWidget(self.codec_combo)
489-
form.addRow("Container/Codec", container_codec_layout)
517+
# Optional: a modest minimum content length helps prevent jitter
518+
self.codec_combo.setMinimumContentsLength(6)
519+
self.codec_combo.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
520+
grid.addWidget(self.codec_combo, 0, 3)
521+
522+
## CRF
523+
crf_label = QLabel("CRF")
524+
crf_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
525+
grid.addWidget(crf_label, 0, 4)
490526

491527
self.crf_spin = QSpinBox()
492-
dflt_crf = RecordingSettings().crf
493-
self.crf_spin.setToolTip(
494-
f"Constant Rate Factor (CRF) for video quality (lower is better quality, {dflt_crf} is default)"
495-
)
496-
self.crf_spin.setRange(0, 51)
497-
self.crf_spin.setValue(dflt_crf)
498-
form.addRow("CRF", self.crf_spin)
528+
self.crf_spin.setRange(0, 51) # FFmpeg CRF range for x264/x265
529+
self.crf_spin.setValue(RecordingSettings().crf)
530+
self.crf_spin.setToolTip("Constant Rate Factor (0 = lossless, 51 = worst)")
531+
self.crf_spin.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred)
532+
grid.addWidget(self.crf_spin, 0, 5)
533+
534+
form.addRow(grid)
499535

500536
# Record with overlays
501537
self.record_with_overlays_checkbox = QCheckBox("Record video with overlays")
@@ -505,12 +541,6 @@ def _build_recording_group(self) -> QGroupBox:
505541
self.record_with_overlays_checkbox.setChecked(False)
506542
form.addRow(self.record_with_overlays_checkbox)
507543

508-
# Add "Open folder" button
509-
self.open_rec_folder_button = QPushButton("Open recording folder")
510-
self.open_rec_folder_button.setIcon(self.style().standardIcon(QStyle.StandardPixmap.SP_DirOpenIcon))
511-
self.open_rec_folder_button.clicked.connect(self._action_open_recording_folder)
512-
form.addRow(self.open_rec_folder_button)
513-
514544
# Wrap recording buttons in a widget to prevent shifting
515545
recording_button_widget = QWidget()
516546
buttons = QHBoxLayout(recording_button_widget)
@@ -526,6 +556,12 @@ def _build_recording_group(self) -> QGroupBox:
526556
buttons.addWidget(self.stop_record_button)
527557
form.addRow(recording_button_widget)
528558

559+
# Add "Open folder" button
560+
self.open_rec_folder_button = QPushButton("Open recording folder")
561+
self.open_rec_folder_button.setIcon(self.style().standardIcon(QStyle.StandardPixmap.SP_DirOpenIcon))
562+
self.open_rec_folder_button.clicked.connect(self._action_open_recording_folder)
563+
form.addRow(self.open_rec_folder_button)
564+
529565
return group
530566

531567
def _build_bbox_group(self) -> QGroupBox:
@@ -1063,7 +1099,6 @@ def _render_overlays_for_recording(self, cam_id, frame):
10631099
self._last_pose.pose,
10641100
p_cutoff=self._p_cutoff,
10651101
colormap=self._colormap,
1066-
bbox_color=self._bbox_color,
10671102
offset=offset,
10681103
scale=scale,
10691104
)

0 commit comments

Comments
 (0)