Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions lib/python/gladevcp/tooledit_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def reload(self,widget):
print(_("Tooledit widget float error"))
else:
try:
array[offset]= locale.format_string("%10.4f", float(word.lstrip(i)))
array[offset]= f"{float(word.lstrip(i)):10.4f}"
except:
print(_("Tooledit widget float error"))
break
Expand All @@ -317,7 +317,6 @@ def reload(self,widget):
# add array line to liststore
self.add(None,array)

# Note we have to save the float info with a decimal even if the locale uses a comma
def save(self,widget):
if self.toolfile == None:return
liststore = self.model
Expand Down Expand Up @@ -350,9 +349,9 @@ def save(self,widget):
test = i.strip()
line = line + "%s%s "%(KEYWORDS[num],test)
else:
test = i.lstrip() # localized floats
test = i.lstrip()
try:
line = line + "%s%s "%(KEYWORDS[num], locale.atof(test))
line = line + "%s%s "%(KEYWORDS[num], float(test))
except ValueError:
raise ExceptionMessage("\n\n"+_("Error converting a float with the given localization setting. A backup file has been created: "
+ self.toolfile + ".bak"))
Expand Down Expand Up @@ -477,7 +476,7 @@ def col_editted(self, widget, path, new_text, col, filter):
# validate input for float columns
elif col in range(3,15):
try:
self.model[path][col] = locale.format("%10.4f",locale.atof(new_text))
self.model[path][col] = f"{float(new_text.replace(',', '.')):10.4f}"
except:
pass
# validate input for orientation: check if int and valid range
Expand Down