/usr/share/pyshared/tryton/gui/window/view_form/view/form_gtk/progressbar.py is in tryton-client 2.2.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #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 interface import WidgetInterface
import locale
class ProgressBar(WidgetInterface):
'Progress Bar'
orientations = {
'left_to_right': gtk.PROGRESS_LEFT_TO_RIGHT,
'right_to_left': gtk.PROGRESS_RIGHT_TO_LEFT,
'bottom_to_top': gtk.PROGRESS_BOTTOM_TO_TOP,
'top_to_bottom': gtk.PROGRESS_TOP_TO_BOTTOM,
}
def __init__(self, field_name, model_name, attrs=None):
super(ProgressBar, self).__init__(field_name, model_name, attrs=attrs)
self.widget = gtk.ProgressBar()
orientation = self.orientations.get(attrs.get('orientation',
'left_to_right'), gtk.PROGRESS_LEFT_TO_RIGHT)
self.widget.set_orientation(orientation)
def display(self, record, field):
super(ProgressBar, self).display(record, field)
if not field:
self.widget.set_text('')
self.widget.set_fraction(0.0)
return False
value = float(field.get(record) or 0.0)
digits = record.expr_eval(field.attrs.get('digits', (16, 2)))
self.widget.set_text(locale.format('%.' + str(digits[1]) + 'f',
value, True))
self.widget.set_fraction(value / 100.0)
|