[bitbake-devel] [PATCH 2/6] bb/ui/crumbs/runningbuild: optionally create list entries sequentially

Joshua Lock josh at linux.intel.com
Wed Aug 3 01:17:35 UTC 2011


In b947e7aa405966262c0614cae02e7978ec637095 Bob changed the behaviour of
the RunningBuildModel such that the items are added to the model in a
non-sequential order.

The messages in the view being listed out of order from how they are
received is undesirable for users of the hob UI, therefore this patch adds
an optional sequential parameter to the RunningBuild initialiser which,
when set to True, will always append new messages so that the order shown
in the view is that the messages are received in. The parameter defaults to
to False such that the behaviour added by Bob is preserved.

Partially addresses [YOCTO #1311]

CC: Bob Foerster <robert at erafx.com>
Signed-off-by: Joshua Lock <josh at linux.intel.com>
---
 lib/bb/ui/crumbs/runningbuild.py |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/lib/bb/ui/crumbs/runningbuild.py b/lib/bb/ui/crumbs/runningbuild.py
index bdab340..c4d6d33 100644
--- a/lib/bb/ui/crumbs/runningbuild.py
+++ b/lib/bb/ui/crumbs/runningbuild.py
@@ -63,9 +63,10 @@ class RunningBuild (gobject.GObject):
     pids_to_task = {}
     tasks_to_iter = {}
 
-    def __init__ (self):
+    def __init__ (self, sequential=False):
         gobject.GObject.__init__ (self)
         self.model = RunningBuildModel()
+        self.sequential = sequential
 
     def handle_event (self, event, pbar=None):
         # Handle an event from the event queue, this may result in updating
@@ -105,18 +106,18 @@ class RunningBuild (gobject.GObject):
 
             # if we know which package we belong to, we'll append onto its list.
             # otherwise, we'll jump to the top of the master list
-            if parent:
+            if self.sequential or not parent:
                 tree_add = self.model.append
             else:
                 tree_add = self.model.prepend
             tree_add(parent,
-                              (None,
-                               package,
-                               task,
-                               event.getMessage(),
-                               icon,
-                               color,
-                               0))
+                     (None,
+                      package,
+                      task,
+                      event.getMessage(),
+                      icon,
+                      color,
+                      0))
 
         elif isinstance(event, bb.build.TaskStarted):
             (package, task) = (event._package, event._task)
@@ -130,13 +131,17 @@ class RunningBuild (gobject.GObject):
             if ((package, None) in self.tasks_to_iter):
                 parent = self.tasks_to_iter[(package, None)]
             else:
-                parent = self.model.prepend(None, (None,
-                                                   package,
-                                                   None,
-                                                   "Package: %s" % (package),
-                                                   None,
-                                                   Colors.OK,
-                                                   0))
+                if self.sequential:
+                    add = self.model.append
+                else:
+                    add = self.model.prepend
+                parent = add(None, (None,
+                                    package,
+                                    None,
+                                    "Package: %s" % (package),
+                                    None,
+                                    Colors.OK,
+                                    0))
                 self.tasks_to_iter[(package, None)] = parent
 
             # Because this parent package now has an active child mark it as
-- 
1.7.6





More information about the bitbake-devel mailing list