diff --git a/CHANGELOG b/CHANGELOG index d9faa37628..c142570c41 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Use italic labels for editable fields * Escape '_' in button string * Export selected records only * Use HTML for RichText widget diff --git a/tryton/gui/window/view_form/view/form_gtk/state_widget.py b/tryton/gui/window/view_form/view/form_gtk/state_widget.py index 59a8151557..67a731dfc4 100644 --- a/tryton/gui/window/view_form/view/form_gtk/state_widget.py +++ b/tryton/gui/window/view_form/view/form_gtk/state_widget.py @@ -44,8 +44,15 @@ class Label(StateMixin, gtk.Label): weight = pango.WEIGHT_BOLD else: weight = pango.WEIGHT_NORMAL + if ((field and field.attrs.get('readonly')) + or state_changes.get('readonly')): + style = pango.STYLE_NORMAL + weight = pango.WEIGHT_NORMAL + else: + style = pango.STYLE_ITALIC attrlist = pango.AttrList() attrlist.change(pango.AttrWeight(weight, 0, -1)) + attrlist.change(pango.AttrStyle(style, 0, -1)) self.set_attributes(attrlist) diff --git a/tryton/gui/window/view_form/view/list.py b/tryton/gui/window/view_form/view/list.py index 79f80094c1..8f35ca2253 100644 --- a/tryton/gui/window/view_form/view/list.py +++ b/tryton/gui/window/view_form/view/list.py @@ -451,15 +451,20 @@ class ViewTree(View): def get_widget(cls, name): return cls.WIDGETS[name] - @staticmethod - def set_column_widget(column, field, attributes, arrow=True): + def set_column_widget(self, column, field, attributes, arrow=True): tooltips = Tooltips() hbox = gtk.HBox(False, 2) label = gtk.Label(attributes['string']) - if field and field.attrs.get('required'): - attrlist = pango.AttrList() - attrlist.insert(pango.AttrWeight(pango.WEIGHT_BOLD, 0, -1)) - label.set_attributes(attrlist) + if field and self.editable: + required = field.attrs.get('required') + readonly = field.attrs.get('readonly') + if required or not readonly: + attrlist = pango.AttrList() + if required: + attrlist.insert(pango.AttrWeight(pango.WEIGHT_BOLD, 0, -1)) + if not readonly: + attrlist.change(pango.AttrStyle(pango.STYLE_ITALIC, 0, -1)) + label.set_attributes(attrlist) label.show() help = attributes['string'] if field and field.attrs.get('help'):