diff --git a/tryton/common/datetime_.py b/tryton/common/datetime_.py index 8552ad4500..96189db9dc 100644 --- a/tryton/common/datetime_.py +++ b/tryton/common/datetime_.py @@ -435,6 +435,22 @@ class DateTime(gtk.HBox): elif prop.name == 'time-format': return self.__time.props.format + def modify_bg(self, state, color): + self.__date.modify_bg(state, color) + self.__time.child.modify_bg(state, color) + + def modify_base(self, state, color): + self.__date.modify_base(state, color) + self.__time.child.modify_base(state, color) + + def modify_fg(self, state, color): + self.__date.modify_fg(state, color) + self.__time.child.modify_fg(state, color) + + def modify_text(self, state, color): + self.__date.modify_text(state, color) + self.__time.child.modify_text(state, color) + gobject.type_register(DateTime) diff --git a/tryton/gui/window/view_form/view/form_gtk/calendar.py b/tryton/gui/window/view_form/view/form_gtk/calendar.py index 246880efbe..dac644beb9 100644 --- a/tryton/gui/window/view_form/view/form_gtk/calendar.py +++ b/tryton/gui/window/view_form/view/form_gtk/calendar.py @@ -33,7 +33,8 @@ class Date(Widget): return self.entry def _set_editable(self, value): - self.real_entry.set_editable(value) + self.entry.set_editable(value) + self.entry.set_icon_sensitive(gtk.ENTRY_ICON_SECONDARY, value) def _readonly_set(self, value): self._set_editable(not value) @@ -79,6 +80,12 @@ class Time(Date): super(Time, self).__init__(view, attrs, _entry=TimeEntry) self.entry.set_focus_chain([self.entry.get_child()]) + def _color_widget(self): + return self.entry.child + + def _set_editable(self, value): + self.entry.set_sensitive(value) + @property def real_entry(self): return self.entry.get_child() @@ -112,14 +119,13 @@ class DateTime(Date): child.connect('focus-out-event', lambda x, y: self._focus_out()) self.widget.pack_start(self.entry, expand=False, fill=False) - def _color_widget(self): - return self.entry.get_children()[0] # XXX not always sure to have Date - def _set_editable(self, value): for child in self.entry.get_children(): - if not hasattr(child, 'set_editable'): - child = child.child - child.set_editable(value) + if isinstance(child, gtk.Entry): + child.set_editable(value) + child.set_icon_sensitive(gtk.ENTRY_ICON_SECONDARY, value) + elif isinstance(child, gtk.ComboBoxEntry): + child.set_sensitive(value) def set_format(self, record, field): if field and record: