Reviewers: ,


Please review this at http://codereview.tryton.org/598005/

Affected files:
  M tryton/gui/window/view_form/view/form_gtk/char.py
  M tryton/gui/window/view_form/view/form_gtk/interface.py
  M tryton/gui/window/view_form/view/form_gtk/selection.py


Index: tryton/gui/window/view_form/view/form_gtk/char.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/char.py
+++ b/tryton/gui/window/view_form/view/form_gtk/char.py
@@ -89,6 +89,9 @@
         value = entry.get_text() or self._default_value
         return field.set_client(record, value)

+    def get_value(self):
+        return self.entry.get_text()
+
     def display(self, record, field):
         super(Char, self).display(record, field)
         if record and self.autocomplete:

Index: tryton/gui/window/view_form/view/form_gtk/interface.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/interface.py
+++ b/tryton/gui/window/view_form/view/form_gtk/interface.py
@@ -65,10 +65,10 @@
         return False

     def send_modified(self, *args):
-        def send():
-            if self.record:
+        def send(value):
+            if self.record and self.get_value() == value:
                 self.record.signal('record-modified')
-        gobject.idle_add(send)
+        gobject.timeout_add(300, send, self.get_value())
         return False

     def color_set(self, name):

Index: tryton/gui/window/view_form/view/form_gtk/selection.py
===================================================================

--- a/tryton/gui/window/view_form/view/form_gtk/selection.py
+++ b/tryton/gui/window/view_form/view/form_gtk/selection.py
@@ -115,7 +115,7 @@
     def _color_widget(self):
         return self.entry.child

-    def value_get(self):
+    def get_value(self):
         text = self.entry.child.get_text()
         value = None
         if text:
@@ -138,16 +138,16 @@
     def sig_activate(self, widget, event=None):
         if not self.field:
             return
-        self.field.set_client(self.record, self.value_get())
+        self.field.set_client(self.record, self.get_value())

     @property
     def modified(self):
         if self.record and self.field:
-            return self.field.get(self.record) != self.value_get()
+            return self.field.get(self.record) != self.get_value()
         return False

     def set_value(self, record, field):
-        field.set_client(record, self.value_get())
+        field.set_client(record, self.get_value())

     def _menu_sig_default_set(self, reset=False):
         self.set_value(self.record, self.field)



--
--
[email protected] mailing list



Reply via email to