Skip to content

Commit a2fa6f9

Browse files
authored
Merge pull request #3086 from zz912/patch-29
tooledit_widget - decimal point = dot
2 parents 9eb94c3 + f6f83e1 commit a2fa6f9

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

lib/python/gladevcp/tooledit_widget.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def reload(self,widget):
308308
print(_("Tooledit widget float error"))
309309
else:
310310
try:
311-
array[offset]= locale.format_string("%10.4f", float(word.lstrip(i)))
311+
array[offset]= f"{float(word.lstrip(i)):10.4f}"
312312
except:
313313
print(_("Tooledit widget float error"))
314314
break
@@ -317,7 +317,6 @@ def reload(self,widget):
317317
# add array line to liststore
318318
self.add(None,array)
319319

320-
# Note we have to save the float info with a decimal even if the locale uses a comma
321320
def save(self,widget):
322321
if self.toolfile == None:return
323322
liststore = self.model
@@ -350,9 +349,9 @@ def save(self,widget):
350349
test = i.strip()
351350
line = line + "%s%s "%(KEYWORDS[num],test)
352351
else:
353-
test = i.lstrip() # localized floats
352+
test = i.lstrip()
354353
try:
355-
line = line + "%s%s "%(KEYWORDS[num], locale.atof(test))
354+
line = line + "%s%s "%(KEYWORDS[num], float(test))
356355
except ValueError:
357356
raise ExceptionMessage("\n\n"+_("Error converting a float with the given localization setting. A backup file has been created: "
358357
+ self.toolfile + ".bak"))
@@ -477,7 +476,7 @@ def col_editted(self, widget, path, new_text, col, filter):
477476
# validate input for float columns
478477
elif col in range(3,15):
479478
try:
480-
self.model[path][col] = locale.format("%10.4f",locale.atof(new_text))
479+
self.model[path][col] = f"{float(new_text.replace(',', '.')):10.4f}"
481480
except:
482481
pass
483482
# validate input for orientation: check if int and valid range

0 commit comments

Comments
 (0)