Fixed the problems with the group separator in some locales
This commit is contained in:
parent
5c79b2f762
commit
f867db6f71
|
@ -266,17 +266,17 @@ class TaskPanel:
|
||||||
form.breadth = self.widget(QtGui.QLineEdit, "Breadth")
|
form.breadth = self.widget(QtGui.QLineEdit, "Breadth")
|
||||||
form.draft = self.widget(QtGui.QLineEdit, "Draft")
|
form.draft = self.widget(QtGui.QLineEdit, "Draft")
|
||||||
|
|
||||||
qty = Units.Quantity(form.length.text())
|
qty = Units.Quantity(Locale.fromString(form.length.text()))
|
||||||
val_min = 0.001
|
val_min = 0.001
|
||||||
val_max = self.bounds[0] / Units.Metre.Value
|
val_max = self.bounds[0] / Units.Metre.Value
|
||||||
val = qty.getValueAs('m').Value
|
val = qty.getValueAs('m').Value
|
||||||
self.L = self.clampVal(form.length, val_min, val_max, val)
|
self.L = self.clampVal(form.length, val_min, val_max, val)
|
||||||
qty = Units.Quantity(form.breadth.text())
|
qty = Units.Quantity(Locale.fromString(form.breadth.text()))
|
||||||
val_min = 0.001
|
val_min = 0.001
|
||||||
val_max = self.bounds[1] / Units.Metre.Value
|
val_max = self.bounds[1] / Units.Metre.Value
|
||||||
val = qty.getValueAs('m').Value
|
val = qty.getValueAs('m').Value
|
||||||
self.B = self.clampVal(form.breadth, val_min, val_max, val)
|
self.B = self.clampVal(form.breadth, val_min, val_max, val)
|
||||||
qty = Units.Quantity(form.draft.text())
|
qty = Units.Quantity(Locale.fromString(form.draft.text()))
|
||||||
val_min = 0.001
|
val_min = 0.001
|
||||||
val_max = self.bounds[2] / Units.Metre.Value
|
val_max = self.bounds[2] / Units.Metre.Value
|
||||||
val = qty.getValueAs('m').Value
|
val = qty.getValueAs('m').Value
|
||||||
|
|
|
@ -29,3 +29,9 @@ def toString(valueStr):
|
||||||
conveniently transforming a value string"""
|
conveniently transforming a value string"""
|
||||||
dec_sep = QtCore.QLocale.system().decimalPoint()
|
dec_sep = QtCore.QLocale.system().decimalPoint()
|
||||||
return valueStr.replace(".", dec_sep)
|
return valueStr.replace(".", dec_sep)
|
||||||
|
|
||||||
|
def fromString(valueStr):
|
||||||
|
"""Natural extension of QtCore.QLocale.toFloat method, in this case
|
||||||
|
conveniently transforming a value string"""
|
||||||
|
grp_sep = QtCore.QLocale.system().groupSeparator()
|
||||||
|
return valueStr.replace(grp_sep, "")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user