Change Progressbar to work with float between 0 and 1

issue4929
review16561002
This commit is contained in:
Cédric Krier
2015-08-28 10:57:15 +02:00
parent c071f0b338
commit ae520344dc
2 changed files with 11 additions and 4 deletions
+1
View File
@@ -1,3 +1,4 @@
* Change Progressbar to work with float between 0 and 1
* Add Fast Tabbing option
* Remove colors on widgets
* Bold label of required fields
@@ -1,9 +1,13 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import gtk
from .widget import Widget
import gettext
import locale
from .widget import Widget
_ = gettext.gettext
class ProgressBar(Widget):
'Progress Bar'
@@ -27,7 +31,9 @@ class ProgressBar(Widget):
self.widget.set_text('')
self.widget.set_fraction(0.0)
return False
value = float(field.get_client(record, factor=100) or 0.0)
digits = field.digits(record, factor=100)
self.widget.set_text(_('%s%%') %
locale.format('%.*f', (digits[1], value), True))
value = float(field.get(record) or 0.0)
digits = field.digits(record)
self.widget.set_text(locale.format('%.*f', (digits[1], value), True))
self.widget.set_fraction(value / 100.0)
self.widget.set_fraction(value)