MCPcopy Create free account
hub / github.com/DeepLabCut/DeepLabCut / update_videos

Method update_videos

deeplabcut/gui/components.py:346–373  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

344 self.select_video_button.setText("Select videos")
345
346 def update_videos(self):
347 directory_to_open = self.root.project_folder
348 video_filter = self._build_video_filter()
349
350 filenames = QtWidgets.QFileDialog.getOpenFileNames(
351 parent=self,
352 caption="Select video(s) to analyze",
353 dir=directory_to_open,
354 filter=video_filter,
355 )
356
357 if filenames[0]:
358 abs_files = [os.path.abspath(vid) for vid in filenames[0]]
359 self.root.add_video_files(abs_files)
360
361 # Optional safety: sync dropdown to selected file suffix
362 if self.sync_videotype_with_selection:
363 suffixes = {Path(v).suffix.lower().lstrip(".") for v in abs_files if Path(v).suffix}
364
365 if len(suffixes) == 1:
366 inferred = next(iter(suffixes))
367 self._set_videotype_silently(inferred)
368 self.root.logger.info(f"Inferred videotype '{inferred}' from selected file(s)")
369 elif len(suffixes) > 1:
370 self.root.logger.warning(
371 f"Selected videos have mixed suffixes {sorted(suffixes)}; "
372 "keeping current videotype dropdown unchanged."
373 )
374
375 def clear_selected_videos(self):
376 self.root.clear_video_files()

Callers

nothing calls this directly

Calls 3

_build_video_filterMethod · 0.95
add_video_filesMethod · 0.80

Tested by

no test coverage detected