bb/ui/crumbs/tasklistmodel: optimise find_path_for_item

If the item_name contains virtual/, -native or -cross it won't be present
in the model. Return None early in this circumstance rather than iterating
the entire model and still returning None.

(Bitbake rev: aeef5a4b3999bd924e89e7738efe24f80ae94fd0)

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-12 15:06:06 -07:00
committed by Richard Purdie
parent 912a33bd7e
commit c82dc42d4d

View File

@@ -472,6 +472,11 @@ class TaskListModel(gtk.ListStore):
Returns the path in the model or None
"""
def find_path_for_item(self, item_name):
# We don't include virtual/* or *-native items in the model so save a
# heavy iteration loop by exiting early for these items
if item_name.startswith("virtual/") or item_name.count('-native') or item_name.count('-cross'):
return None
it = self.get_iter_first()
path = None
while it: