diff --git a/src/Mod/Ship/shipCreateShip/TaskPanel.py b/src/Mod/Ship/shipCreateShip/TaskPanel.py index 3cfa1c1fd..6b5652f66 100644 --- a/src/Mod/Ship/shipCreateShip/TaskPanel.py +++ b/src/Mod/Ship/shipCreateShip/TaskPanel.py @@ -266,17 +266,17 @@ class TaskPanel: form.breadth = self.widget(QtGui.QLineEdit, "Breadth") 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_max = self.bounds[0] / Units.Metre.Value val = qty.getValueAs('m').Value 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_max = self.bounds[1] / Units.Metre.Value val = qty.getValueAs('m').Value 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_max = self.bounds[2] / Units.Metre.Value val = qty.getValueAs('m').Value diff --git a/src/Mod/Ship/shipUtils/Locale.py b/src/Mod/Ship/shipUtils/Locale.py index b19c75b54..3fb7fea7d 100644 --- a/src/Mod/Ship/shipUtils/Locale.py +++ b/src/Mod/Ship/shipUtils/Locale.py @@ -29,3 +29,9 @@ def toString(valueStr): conveniently transforming a value string""" dec_sep = QtCore.QLocale.system().decimalPoint() 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, "")