Skip to content

Commit

Permalink
Display an alert for invalid input videos.
Browse files Browse the repository at this point in the history
  • Loading branch information
healthonrails committed Dec 21, 2023
1 parent 27b4feb commit 099815c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion annolid/gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def __init__(self,
self.highlighted_mark = None
self.step_size = 1
self.stepSizeWidget = StepSizeWidget()
self.prev_shapes = None

self.canvas = self.labelList.canvas = Canvas(
epsilon=self._config["epsilon"],
Expand Down Expand Up @@ -1503,7 +1504,13 @@ def openVideo(self, _value=False):
)
self.annotation_dir = self.video_results_folder
self.video_file = video_filename
self.video_loader = videos.CV2Video(video_filename)
try:
self.video_loader = videos.CV2Video(video_filename)
except Exception:
QtWidgets.QMessageBox.about(self,
"Not a valid video file",
f"Please check and open a correct video file.")
return
self.fps = self.video_loader.get_fps()

self.num_frames = self.video_loader.total_frames()
Expand Down

0 comments on commit 099815c

Please sign in to comment.