Reviewers: ,
Please review this at http://codereview.tryton.org/632002/
Affected files:
M tryton/common/domain_parser.py
M tryton/gui/window/view_form/model/field.py
M tryton/gui/window/view_form/view/form_gtk/progressbar.py
M tryton/gui/window/view_form/view/list.py
M tryton/gui/window/view_form/view/list_gtk/parser.py
Index: tryton/common/domain_parser.py
===================================================================
--- a/tryton/common/domain_parser.py
+++ b/tryton/common/domain_parser.py
@@ -396,7 +396,7 @@
digit = int(field.get('digits', (16, 2))[1])
except ValueError:
digit = 2
- return locale.format('%.' + str(digit) + 'f', value or 0.0, True)
+ return locale.format('%*f', (digit, value or 0.0), True)
def format_selection():
selections = dict(field['selection'])
Index: tryton/gui/window/view_form/model/field.py
===================================================================
--- a/tryton/gui/window/view_form/model/field.py
+++ b/tryton/gui/window/view_form/model/field.py
@@ -306,7 +306,7 @@
value = record.value.get(self.name)
if value is not None:
digits = self.digits(record)
- return locale.format('%.' + str(digits[1]) + 'f', value, True)
+ return locale.format('%*f', (digits[1], value), True)
else:
return ''
@@ -326,7 +326,7 @@
value = record.value.get(self.name)
if value is not None:
digits = self.digits(record)
- return locale.format('%.' + str(digits[1]) + 'f', value, True)
+ return locale.format('%*f', (digits[1], value), True)
else:
return ''
Index: tryton/gui/window/view_form/view/form_gtk/progressbar.py
===================================================================
--- a/tryton/gui/window/view_form/view/form_gtk/progressbar.py
+++ b/tryton/gui/window/view_form/view/form_gtk/progressbar.py
@@ -29,6 +29,5 @@
return False
value = float(field.get(record) or 0.0)
digits = field.digits(record)
- self.widget.set_text(locale.format('%.' + str(digits[1]) + 'f',
- value, True))
+ self.widget.set_text(locale.format('%*f', (digits[1], value),
True))
self.widget.set_fraction(value / 100.0)
Index: tryton/gui/window/view_form/view/list.py
===================================================================
--- a/tryton/gui/window/view_form/view/list.py
+++ b/tryton/gui/window/view_form/view/list.py
@@ -844,12 +844,11 @@
value_selected += field_value
if loaded:
- label_str = locale.format(
- '%.' + str(self.children[child][3]) + 'f',
value_selected,
- True)
+ label_str = locale.format('%*f',
+ (self.children[child][3], value_selected), True)
label_str += ' / '
- label_str += locale.format(
- '%.' + str(self.children[child][3]) + 'f', value, True)
+ label_str += locale.format('%*f',
+ (self.children[child][3], value), True)
else:
label_str = '-'
self.children[child][2].set_text(label_str)
Index: tryton/gui/window/view_form/view/list_gtk/parser.py
===================================================================
--- a/tryton/gui/window/view_form/view/list_gtk/parser.py
+++ b/tryton/gui/window/view_form/view/list_gtk/parser.py
@@ -994,7 +994,7 @@
value = float(self.get_textual_value(record) or 0.0)
cell.set_property('value', value)
digit = field.digits(record)[1]
- text = locale.format('%.' + str(digit) + 'f', value, True)
+ text = locale.format('%*f', (digit, value), True)
cell.set_property('text', text + '%')
def open_remote(self, record, create, changed=False, text=None,
--
--
[email protected] mailing list