Skip to content

Commit

Permalink
Handle bad number format in scalebar panel input fields. Bug #16649
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgoddard committed Jan 22, 2025
1 parent de30a47 commit aacd8e6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/bundles/label/src/scalebar_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,15 @@ def _scalebar_shown(self):
def _changed_options(self):
cur_length, cur_color, cur_xpos, cur_ypos, cur_thickness = self._scalebar_settings()

length = self._length.value
try:
length = self._length.value
xpos, ypos = self._xpos.value, self._ypos.value
thickness = self._thickness.value
except ValueError:
self.session.logger.error('Bad number format in Scale Bar panel length, x, y, or thickness')
return

color = self._color.color # rgba8
xpos, ypos = self._xpos.value, self._ypos.value
thickness = self._thickness.value

options = []
if length != cur_length:
Expand All @@ -113,4 +118,4 @@ def _scalebar_settings(self):
s = _scalebar_label(self.session)
if s:
return s.scalebar_width, s.color, s.xpos, s.ypos, s.scalebar_height
return 100, None, 0.1, 0.1, 10
return 100.0, None, 0.1, 0.1, 10.0

0 comments on commit aacd8e6

Please sign in to comment.