changeset c2f0a344661c in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=c2f0a344661c
description:
        Fix drag & drop on export/import CSV

        With Gtk3, selection data must be UTF-8 encoded.
        set_drag_dest_row requires a GtkTreePath and no more integer.

        issue8194
        review277121002
diffstat:

 tryton/gui/window/win_csv.py |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 509a3463eecf -r c2f0a344661c tryton/gui/window/win_csv.py
--- a/tryton/gui/window/win_csv.py      Sat Mar 23 22:59:28 2019 +0100
+++ b/tryton/gui/window/win_csv.py      Wed Mar 27 00:32:12 2019 +0100
@@ -244,7 +244,8 @@
         try:
             treeview.set_drag_dest_row(*treeview.get_dest_row_at_pos(x, y))
         except TypeError:
-            treeview.set_drag_dest_row(len(treeview.get_model()) - 1,
+            treeview.set_drag_dest_row(
+                Gtk.TreePath(len(treeview.get_model()) - 1),
                 Gtk.TreeViewDropPosition.AFTER)
         Gdk.drag_status(context, Gdk.DragAction.MOVE, time)
         return True
@@ -265,7 +266,7 @@
         if not data:
             return
         data = ','.join(str(x) for x in data)
-        selection.set(selection.get_target(), 8, data)
+        selection.set(selection.get_target(), 8, data.encode('utf-8'))
         return True
 
     def drag_data_received(self, treeview, context, x, y, selection,
@@ -277,6 +278,7 @@
             selection_data = selection.get_data()
         if not selection_data:
             return
+        selection_data = selection_data.decode('utf-8')
         store = treeview.get_model()
 
         data_iters = [store.get_iter((int(i),))

Reply via email to