* [PATCH] hob: reordering the layers in the Hob Layers dialog
@ 2012-10-26 13:54 Cristiana Voicu
2012-10-27 8:57 ` Richard Purdie
0 siblings, 1 reply; 2+ messages in thread
From: Cristiana Voicu @ 2012-10-26 13:54 UTC (permalink / raw)
To: bitbake-devel
-since the order of the layers can potentially impact
the build outcome, users should be able to reorder
the layers within the layers dialog;
-used TreeView Drag and Drop
[YOCTO #3270]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
bitbake/lib/bb/ui/crumbs/hig.py | 42 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index 4f4fecb..ee44117 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -1516,6 +1516,13 @@ class CellRendererPixbufActivatable(gtk.CellRendererPixbuf):
#
class LayerSelectionDialog (CrumbsDialog):
+ TARGETS = [
+ ("MY_TREE_MODEL_ROW", gtk.TARGET_SAME_WIDGET, 0),
+ ("text/plain", 0, 1),
+ ("TEXT", 0, 2),
+ ("STRING", 0, 3),
+ ]
+
def gen_label_widget(self, content):
label = gtk.Label()
label.set_alignment(0, 0)
@@ -1579,7 +1586,17 @@ class LayerSelectionDialog (CrumbsDialog):
layer_tv.set_rules_hint(True)
layer_tv.set_headers_visible(False)
tree_selection = layer_tv.get_selection()
- tree_selection.set_mode(gtk.SELECTION_NONE)
+ tree_selection.set_mode(gtk.SELECTION_SINGLE)
+
+ # Allow enable drag and drop of rows including row move
+ layer_tv.enable_model_drag_source( gtk.gdk.BUTTON1_MASK,
+ self.TARGETS,
+ gtk.gdk.ACTION_DEFAULT|
+ gtk.gdk.ACTION_MOVE)
+ layer_tv.enable_model_drag_dest(self.TARGETS,
+ gtk.gdk.ACTION_DEFAULT)
+ layer_tv.connect("drag_data_get", self.drag_data_get_cb)
+ layer_tv.connect("drag_data_received", self.drag_data_received_cb)
col0= gtk.TreeViewColumn('Path')
cell0 = gtk.CellRendererText()
@@ -1634,6 +1651,29 @@ class LayerSelectionDialog (CrumbsDialog):
return hbox, layer_store
+ def drag_data_get_cb(self, treeview, context, selection, target_id, etime):
+ treeselection = treeview.get_selection()
+ model, iter = treeselection.get_selected()
+ data = model.get_value(iter, 0)
+ selection.set(selection.target, 8, data)
+
+ def drag_data_received_cb(self, treeview, context, x, y, selection, info, etime):
+ model = treeview.get_model()
+ data = selection.data
+ drop_info = treeview.get_dest_row_at_pos(x, y)
+ if drop_info:
+ path, position = drop_info
+ iter = model.get_iter(path)
+ if (position == gtk.TREE_VIEW_DROP_BEFORE or position == gtk.TREE_VIEW_DROP_INTO_OR_BEFORE):
+ model.insert_before(iter, [data])
+ else:
+ model.insert_after(iter, [data])
+ else:
+ model.append([data])
+ if context.action == gtk.gdk.ACTION_MOVE:
+ context.finish(True, True, etime)
+ return
+
def add_hover_cb(self, button, event):
self.im.set_from_file(hic.ICON_INDI_ADD_HOVER_FILE)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hob: reordering the layers in the Hob Layers dialog
2012-10-26 13:54 [PATCH] hob: reordering the layers in the Hob Layers dialog Cristiana Voicu
@ 2012-10-27 8:57 ` Richard Purdie
0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2012-10-27 8:57 UTC (permalink / raw)
To: Cristiana Voicu; +Cc: bitbake-devel
On Fri, 2012-10-26 at 16:54 +0300, Cristiana Voicu wrote:
> -since the order of the layers can potentially impact
> the build outcome, users should be able to reorder
> the layers within the layers dialog;
> -used TreeView Drag and Drop
>
> [YOCTO #3270]
> Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
> ---
> bitbake/lib/bb/ui/crumbs/hig.py | 42 ++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 41 insertions(+), 1 deletion(-)
Merged to master, thanks.
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-27 9:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-26 13:54 [PATCH] hob: reordering the layers in the Hob Layers dialog Cristiana Voicu
2012-10-27 8:57 ` Richard Purdie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.