changeset 42b72616c498 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=42b72616c498
description:
        Use TreePath and update set_cursor call to set cell

        Since the removal of pygtkcompat, set_cursor needs to get a real 
TreePath and
        no more a tuple.
        Also we added a cell argument to set_cursor, so it must be filled or use
        keyword arguments.

        issue8290
        review271351002
diffstat:

 tryton/gui/window/view_form/view/list_gtk/editabletree.py |  18 +++++++-------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (58 lines):

diff -r 1b3c6557b7f9 -r 42b72616c498 
tryton/gui/window/view_form/view/list_gtk/editabletree.py
--- a/tryton/gui/window/view_form/view/list_gtk/editabletree.py Fri Apr 26 
12:04:10 2019 +0200
+++ b/tryton/gui/window/view_form/view/list_gtk/editabletree.py Fri Apr 26 
12:05:31 2019 +0200
@@ -214,14 +214,14 @@
                         for col in self.get_columns():
                             if col.name in invalid_fields:
                                 break
-                        GLib.idle_add(self.set_cursor, path, col, True)
+                        GLib.idle_add(self.set_cursor, path, col, None, True)
                         return
                     if ((self.view.screen.pre_validate
                                 and not record.pre_validate())
                             or (not self.view.screen.parent
                                 and not record.save())):
-                        GLib.idle_add(self.set_cursor, path, column,
-                            True)
+                        GLib.idle_add(
+                            self.set_cursor, path, column, None, True)
                         return
                     entry.handler_block(entry.editing_done_id)
                     if keyval == Gdk.KEY_Up:
@@ -237,7 +237,7 @@
                             *self.next_column(new_path), True)
                     entry.handler_unblock(entry.editing_done_id)
                 else:
-                    GLib.idle_add(self.set_cursor, path, column, True)
+                    GLib.idle_add(self.set_cursor, path, column, None, True)
             self.on_quit_cell(record, column, renderer, txt, callback=callback)
             return True
         elif event.keyval in [Gdk.KEY_F3, Gdk.KEY_F2]:
@@ -278,22 +278,22 @@
     def _key_down(self, path, model, column=None):
         if path[0] == len(model) - 1 and self.editable == 'bottom':
             self.on_create_line()
-        new_path = (path[0] + 1) % len(model)
+        new_path = Gtk.TreePath((path[0] + 1) % len(model))
         if not column:
             column, cell = self.next_column(new_path)
-        self.set_cursor(new_path, column, True)
+        self.set_cursor(new_path, column, start_editing=True)
         self.scroll_to_cell(new_path)
         return new_path
 
     def _key_up(self, path, model, column=None):
         if path[0] == 0 and self.editable == 'top':
             self.on_create_line()
-            new_path = 0
+            new_path = Gtk.TreePath(0)
         else:
-            new_path = (path[0] - 1) % len(model)
+            new_path = Gtk.TreePath((path[0] - 1) % len(model))
         if not column:
             column, cell = self.next_column(new_path)
-        self.set_cursor(new_path, column, True)
+        self.set_cursor(new_path, column, start_editing=True)
         self.scroll_to_cell(new_path)
         return new_path
 

Reply via email to