Skip to content

Commit

Permalink
Fix: Handle empty captions
Browse files Browse the repository at this point in the history
This commit addresses an issue where empty captions were causing unexpected behavior. The logic for loading and displaying captions has been updated to check if the caption is both not None and has a length greater than 0. This prevents attempting to set empty captions, which could lead to unnecessary dock widget creation
  • Loading branch information
healthonrails committed Dec 18, 2024
1 parent b3d1905 commit 590b950
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions annolid/gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2477,7 +2477,7 @@ def loadShapes(self, shapes, replace=True):
caption = self.labelFile.get_caption() if self.labelFile else None
except AttributeError:
caption = None
if caption is not None:
if caption is not None and len(caption) > 0:
if self.caption_widget is None:
self.openCaption()
self.caption_widget.set_caption(
Expand Down Expand Up @@ -2527,7 +2527,7 @@ def loadPredictShapes(self, frame_number, filename):
if self.labelFile:
self.loadLabels(self.labelFile.shapes)
caption = self.labelFile.get_caption()
if caption is not None:
if caption is not None and len(caption) > 0:
if self.caption_widget is None:
self.openCaption()
self.caption_widget.set_caption(caption)
Expand Down

0 comments on commit 590b950

Please sign in to comment.