Patchwork [bitbake-devel,1/9] lib/bb/ui/crumbs/hig: sort layers in Layer Selection dialogue

login
register
mail settings
Submitter Joshua Lock
Date March 24, 2012, 12:22 a.m.
Message ID <dda67dfb43279c2f605ce88a84c0adb9a83f9dfd.1332545580.git.josh@linux.intel.com>
Download mbox | patch
Permalink /patch/24407/
State Accepted
Commit 6e51643325611f6cfc9090dcbbff20755d09c92d
Headers show

Comments

Joshua Lock - March 24, 2012, 12:22 a.m.
The two layers which cannot be removed, meta and meta-hob, should be the
first two items in the tree view.

Signed-off-by: Joshua Lock <josh@linux.intel.com>
---
 lib/bb/ui/crumbs/hig.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
Dongxiao Xu - March 24, 2012, 12:26 a.m.
On Fri, 2012-03-23 at 17:22 -0700, Joshua Lock wrote:
> The two layers which cannot be removed, meta and meta-hob, should be the
> first two items in the tree view.
> 
> Signed-off-by: Joshua Lock <josh@linux.intel.com>
Acked-by: Dongxiao Xu <dongxiao.xu@intel.com>

> ---
>  lib/bb/ui/crumbs/hig.py |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/bb/ui/crumbs/hig.py b/lib/bb/ui/crumbs/hig.py
> index 1db93ea..3a66e7c 100644
> --- a/lib/bb/ui/crumbs/hig.py
> +++ b/lib/bb/ui/crumbs/hig.py
> @@ -803,8 +803,14 @@ class LayerSelectionDialog (CrumbsDialog):
>          table_layer.attach(scroll, 0, 10, 0, 1)
>  
>          layer_store = gtk.ListStore(gobject.TYPE_STRING)
> +        core_iter = None
>          for layer in layers:
> -            layer_store.set(layer_store.append(), 0, layer)
> +            if layer.endswith("/meta"):
> +                core_iter = layer_store.prepend([layer])
> +            elif layer.endswith("/meta-hob") and core_iter:
> +                layer_store.insert_after(core_iter, [layer])
> +            else:
> +                layer_store.append([layer])
>  
>          col1 = gtk.TreeViewColumn('Enabled')
>          layer_tv.append_column(col1)

Patch

diff --git a/lib/bb/ui/crumbs/hig.py b/lib/bb/ui/crumbs/hig.py
index 1db93ea..3a66e7c 100644
--- a/lib/bb/ui/crumbs/hig.py
+++ b/lib/bb/ui/crumbs/hig.py
@@ -803,8 +803,14 @@  class LayerSelectionDialog (CrumbsDialog):
         table_layer.attach(scroll, 0, 10, 0, 1)
 
         layer_store = gtk.ListStore(gobject.TYPE_STRING)
+        core_iter = None
         for layer in layers:
-            layer_store.set(layer_store.append(), 0, layer)
+            if layer.endswith("/meta"):
+                core_iter = layer_store.prepend([layer])
+            elif layer.endswith("/meta-hob") and core_iter:
+                layer_store.insert_after(core_iter, [layer])
+            else:
+                layer_store.append([layer])
 
         col1 = gtk.TreeViewColumn('Enabled')
         layer_tv.append_column(col1)