From aacd8e671f4f3d3ddcd6be026e898997e15ee446 Mon Sep 17 00:00:00 2001 From: Tom Goddard Date: Tue, 21 Jan 2025 19:02:59 -0800 Subject: [PATCH] Handle bad number format in scalebar panel input fields. Bug #16649 --- src/bundles/label/src/scalebar_gui.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/bundles/label/src/scalebar_gui.py b/src/bundles/label/src/scalebar_gui.py index 9024bbb072..29ca8acfe0 100644 --- a/src/bundles/label/src/scalebar_gui.py +++ b/src/bundles/label/src/scalebar_gui.py @@ -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: @@ -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