bb/ui/crumbs/runningbuild: optionally create list entries sequentially

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@erafx.com>
(Bitbake rev: b16663e1919fddbf63d0ca7f9ad3ffdc7d1121fd)

Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Lock 2011-08-02 16:59:01 -07:00 committed by Richard Purdie
parent 647643b654
commit f353148390
1 changed files with 21 additions and 16 deletions

View File

@ -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