From 3704bd5a189241520e63c97f62f38d218aec9742 Mon Sep 17 00:00:00 2001 From: Dimitrios Theodorakis Date: Tue, 14 Jan 2025 14:51:37 +0000 Subject: [PATCH] Fixes repeat real array bug where numbers were turned into strings --- metomi/rose/config_editor/valuewidget/array/entry.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/metomi/rose/config_editor/valuewidget/array/entry.py b/metomi/rose/config_editor/valuewidget/array/entry.py index 78ffd97d7..faceb997c 100644 --- a/metomi/rose/config_editor/valuewidget/array/entry.py +++ b/metomi/rose/config_editor/valuewidget/array/entry.py @@ -462,9 +462,14 @@ def setter(self, widget): # Prevent str without "" breaking the underlying Python syntax for e in self.entries: v = e.get_text() + try: + float(v) + v_is_float = True + except: + v_is_float = False if v in ("False", "True"): # Boolean val_array.append(v) - elif (len(v) == 0) or (v[:1].isdigit()): # Empty or numeric + elif (len(v) == 0) or v_is_float: # Empty or numeric val_array.append(v) elif not v.startswith('"'): # Str - add in leading and trailing " val_array.append('"' + v + '"')