summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig.py42
1 files changed, 41 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index c28fa64ad7..d973086102 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -1501,6 +1501,13 @@ class CellRendererPixbufActivatable(gtk.CellRendererPixbuf):
1501# 1501#
1502class LayerSelectionDialog (CrumbsDialog): 1502class LayerSelectionDialog (CrumbsDialog):
1503 1503
1504 TARGETS = [
1505 ("MY_TREE_MODEL_ROW", gtk.TARGET_SAME_WIDGET, 0),
1506 ("text/plain", 0, 1),
1507 ("TEXT", 0, 2),
1508 ("STRING", 0, 3),
1509 ]
1510
1504 def gen_label_widget(self, content): 1511 def gen_label_widget(self, content):
1505 label = gtk.Label() 1512 label = gtk.Label()
1506 label.set_alignment(0, 0) 1513 label.set_alignment(0, 0)
@@ -1564,7 +1571,17 @@ class LayerSelectionDialog (CrumbsDialog):
1564 layer_tv.set_rules_hint(True) 1571 layer_tv.set_rules_hint(True)
1565 layer_tv.set_headers_visible(False) 1572 layer_tv.set_headers_visible(False)
1566 tree_selection = layer_tv.get_selection() 1573 tree_selection = layer_tv.get_selection()
1567 tree_selection.set_mode(gtk.SELECTION_NONE) 1574 tree_selection.set_mode(gtk.SELECTION_SINGLE)
1575
1576 # Allow enable drag and drop of rows including row move
1577 layer_tv.enable_model_drag_source( gtk.gdk.BUTTON1_MASK,
1578 self.TARGETS,
1579 gtk.gdk.ACTION_DEFAULT|
1580 gtk.gdk.ACTION_MOVE)
1581 layer_tv.enable_model_drag_dest(self.TARGETS,
1582 gtk.gdk.ACTION_DEFAULT)
1583 layer_tv.connect("drag_data_get", self.drag_data_get_cb)
1584 layer_tv.connect("drag_data_received", self.drag_data_received_cb)
1568 1585
1569 col0= gtk.TreeViewColumn('Path') 1586 col0= gtk.TreeViewColumn('Path')
1570 cell0 = gtk.CellRendererText() 1587 cell0 = gtk.CellRendererText()
@@ -1619,6 +1636,29 @@ class LayerSelectionDialog (CrumbsDialog):
1619 1636
1620 return hbox, layer_store 1637 return hbox, layer_store
1621 1638
1639 def drag_data_get_cb(self, treeview, context, selection, target_id, etime):
1640 treeselection = treeview.get_selection()
1641 model, iter = treeselection.get_selected()
1642 data = model.get_value(iter, 0)
1643 selection.set(selection.target, 8, data)
1644
1645 def drag_data_received_cb(self, treeview, context, x, y, selection, info, etime):
1646 model = treeview.get_model()
1647 data = selection.data
1648 drop_info = treeview.get_dest_row_at_pos(x, y)
1649 if drop_info:
1650 path, position = drop_info
1651 iter = model.get_iter(path)
1652 if (position == gtk.TREE_VIEW_DROP_BEFORE or position == gtk.TREE_VIEW_DROP_INTO_OR_BEFORE):
1653 model.insert_before(iter, [data])
1654 else:
1655 model.insert_after(iter, [data])
1656 else:
1657 model.append([data])
1658 if context.action == gtk.gdk.ACTION_MOVE:
1659 context.finish(True, True, etime)
1660 return
1661
1622 def add_hover_cb(self, button, event): 1662 def add_hover_cb(self, button, event):
1623 self.im.set_from_file(hic.ICON_INDI_ADD_HOVER_FILE) 1663 self.im.set_from_file(hic.ICON_INDI_ADD_HOVER_FILE)
1624 1664