changeset b1a4c3ec3801 in tryton:5.4
details: https://hg.tryton.org/tryton?cmd=changeset;node=b1a4c3ec3801
description:
        Synchronize cell and editable content in treeview

        issue9227
        review289791002
        (grafted from 578a086e4b3da781bc73dce2ab0c382995904549)
diffstat:

 tryton/gui/window/view_form/view/list.py            |   1 +
 tryton/gui/window/view_form/view/list_gtk/widget.py |  13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diffs (41 lines):

diff -r 813f6e417d34 -r b1a4c3ec3801 tryton/gui/window/view_form/view/list.py
--- a/tryton/gui/window/view_form/view/list.py  Fri May 15 21:43:51 2020 +0200
+++ b/tryton/gui/window/view_form/view/list.py  Fri Jun 19 11:38:10 2020 +0200
@@ -1044,6 +1044,7 @@
             if not name:
                 continue
             widget = self.get_column_widget(column)
+            widget.set_editable(current_record)
             if decoder.decode(widget.attrs.get('tree_invisible', '0')):
                 column.set_visible(False)
             elif name == self.screen.exclude_field:
diff -r 813f6e417d34 -r b1a4c3ec3801 
tryton/gui/window/view_form/view/list_gtk/widget.py
--- a/tryton/gui/window/view_form/view/list_gtk/widget.py       Fri May 15 
21:43:51 2020 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/widget.py       Fri Jun 19 
11:38:10 2020 +0200
@@ -291,6 +291,11 @@
         if callback:
             callback()
 
+    def set_editable(self, record):
+        if not record or not self.editable:
+            return
+        self.editable.set_text(self.get_textual_value(record))
+
     def editing_started(self, cell, editable, path):
         def remove(editable):
             self.editable = None
@@ -969,6 +974,14 @@
         if callback:
             callback()
 
+    def set_editable(self, record):
+        if not record or not self.editable:
+            return
+        field = record[self.attrs['name']]
+        value = self.get_value(record, field)
+        self.update_selection(record, field)
+        self.set_popdown_value(self.editable, value)
+
     def editing_started(self, cell, editable, path):
         super(Selection, self).editing_started(cell, editable, path)
         record, field = self._get_record_field_from_path(path)

Reply via email to