Merge lp:~simar/clicompanion/fix-738260 into lp:clicompanion

Proposed by Gursimran singh
Status: Merged
Merged at revision: 78
Proposed branch: lp:~simar/clicompanion/fix-738260
Merge into: lp:clicompanion
Diff against target: 89 lines (+12/-42) (has conflicts)
2 files modified
clicompanionlib/controller.py (+0/-42)
clicompanionlib/view.py (+12/-0)
Text conflict in clicompanionlib/view.py
To merge this branch: bzr merge lp:~simar/clicompanion/fix-738260
Reviewer Review Type Date Requested Status
Duane Hinnen Approve
Review via email: mp+55731@code.launchpad.net

Description of the change

There was a built in functionality of drap and drop in pygtk treeview widget. So I removed all the drag and drop code and used that functionality. It fits nicely.

        self.treeview.set_reorderable(True)

To post a comment you must log in.
Revision history for this message
Duane Hinnen (duanedesign) wrote :

I do not know how you figured this out, but great job. This is a much much better solution for adding drag and drop. Good work!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'clicompanionlib/controller.py'
2--- clicompanionlib/controller.py 2011-03-29 17:31:11 +0000
3+++ clicompanionlib/controller.py 2011-03-31 11:15:53 +0000
4@@ -641,45 +641,3 @@
5 ## not work.
6 dialog.destroy()
7
8-
9- ## drag and drop
10- def drag_data_get_data(self, treeview, context, selection, target_id,
11- etime):
12- treeselection = treeview.get_selection()
13- model, iter = treeselection.get_selected()
14- data = model.get(iter, 0,1,2)
15-
16-
17- selection.set(selection.target, 8, str(data))
18- ## drag and drop
19- def drag_data_received_data(self, treeview, context, x, y, selection,
20- info, etime):
21- model = treeview.get_model()
22- data_selection = selection.data
23- data = str(data_selection).split(',')
24- print data[0][2:-1]
25- print data[1][2:-1]
26- print data[2][2:-2]
27- drop_info = treeview.get_dest_row_at_pos(x, y)
28- if drop_info:
29- path, position = drop_info
30- iter = model.get_iter(path)
31- if (position == gtk.TREE_VIEW_DROP_BEFORE
32- or position == gtk.TREE_VIEW_DROP_INTO_OR_BEFORE):
33- model.set(iter, 0, data[0][2:-1],1, data[1][2:-1],2, data[2][2:-2])
34- else:
35- model.set(iter, 0, data[0][2:-1],1, data[1][2:-1],2, data[2][2:-2])
36- else:
37- model.append([data])
38- if context.action == gtk.gdk.ACTION_MOVE:
39- context.finish(True, True, etime)
40- return
41-
42-
43-
44-
45-
46-
47-
48-
49-
50
51=== modified file 'clicompanionlib/view.py'
52--- clicompanionlib/view.py 2011-03-29 17:31:11 +0000
53+++ clicompanionlib/view.py 2011-03-31 11:15:53 +0000
54@@ -255,9 +255,16 @@
55
56 ''' set treeview model and put treeview in the scrolled window
57 and the scrolled window in the expander. '''
58+<<<<<<< TREE
59 self.treeview.set_model(self.liststore)
60 self.scrolledwindow.add(self.treeview)
61 self.expander.add(self.scrolledwindow)
62+=======
63+ treeview.set_model(self.liststore)
64+ treeview.set_reorderable(True)
65+ scrolledwindow.add(treeview)
66+ expander.add(scrolledwindow)
67+>>>>>>> MERGE-SOURCE
68 #self.window.show_all()
69
70 ## instantiate tabs
71@@ -299,6 +306,7 @@
72 ## double-click
73 self.treeview.connect("button-press-event", treeview_clicked)
74 #press enter to run command
75+<<<<<<< TREE
76 self.treeview.connect("key-press-event", treeview_button)
77
78 ##drag and drop
79@@ -307,6 +315,10 @@
80 self.treeview.connect("drag_data_get", actions.drag_data_get_data)
81 self.treeview.connect("drag_data_received", actions.drag_data_received_data)
82
83+=======
84+ treeview.connect("key-press-event", treeview_button)
85+
86+>>>>>>> MERGE-SOURCE
87 global menu_search_hbox
88
89 ## The search section

Subscribers

People subscribed via source and target branches