Hob: Simplify the init process
authorDongxiao Xu <dongxiao.xu@intel.com>
Sun, 15 Apr 2012 07:26:38 +0000 (15:26 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 15 Apr 2012 16:31:57 +0000 (17:31 +0100)
This commit merges some functionalities together and avoid unnecessary
signal handling. This can help to speed up the Hob startup.

(Bitbake rev: e5a6eb4f007bf270f2fddc814eb856da46e20eee)

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/ui/crumbs/builder.py
bitbake/lib/bb/ui/crumbs/hobeventhandler.py

index dd59d59..cd66c3f 100755 (executable)
@@ -398,12 +398,12 @@ class Builder(gtk.Window):
         if self.load_template(TemplateMgr.convert_to_template_pathfilename("default", ".hob/")) == None:
             self.handler.init_cooker()
             self.handler.set_extra_inherit("image_types")
-            self.handler.parse_config()
+            self.handler.generate_configuration()
 
     def update_config_async(self):
         self.switch_page(self.MACHINE_SELECTION)
         self.set_user_config()
-        self.handler.parse_generate_configuration()
+        self.handler.generate_configuration()
 
     def populate_recipe_package_info_async(self):
         self.switch_page(self.RCPPKGINFO_POPULATING)
@@ -456,9 +456,6 @@ class Builder(gtk.Window):
     def cancel_build_sync(self, force=False):
         self.handler.cancel_build(force)
 
-    def generate_configuration_async(self):
-        self.handler.generate_configuration()
-
     def cancel_parse_sync(self):
         self.handler.cancel_parse()
 
@@ -604,11 +601,7 @@ class Builder(gtk.Window):
         self.parameters.all_package_formats = formats
 
     def handler_command_succeeded_cb(self, handler, initcmd):
-        if initcmd == self.handler.PARSE_CONFIG:
-            # settings
-            self.update_configuration_parameters(self.get_parameters_sync())
-            self.generate_configuration_async()
-        elif initcmd == self.handler.GENERATE_CONFIGURATION:
+        if initcmd == self.handler.GENERATE_CONFIGURATION:
             self.update_configuration_parameters(self.get_parameters_sync())
             self.image_configuration_page.switch_machine_combo()
         elif initcmd in [self.handler.GENERATE_RECIPES,
index a61cca0..216b406 100644 (file)
@@ -59,7 +59,7 @@ class HobHandler(gobject.GObject):
                                      (gobject.TYPE_PYOBJECT,)),
     }
 
-    (PARSE_CONFIG, GENERATE_CONFIGURATION, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO) = range(6)
+    (GENERATE_CONFIGURATION, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO) = range(5)
     (SUB_PATH_LAYERS, SUB_FILES_DISTRO, SUB_FILES_MACH, SUB_FILES_SDKMACH, SUB_MATCH_CLASS, SUB_PARSE_CONFIG, SUB_GNERATE_TGTS, SUB_GENERATE_PKGINFO, SUB_BUILD_RECIPES, SUB_BUILD_IMAGE) = range(10)
 
     def __init__(self, server, recipe_model, package_model):
@@ -219,14 +219,6 @@ class HobHandler(gobject.GObject):
     def init_cooker(self):
         self.server.runCommand(["initCooker"])
 
-    def parse_config(self):
-        self.commands_async.append(self.SUB_PARSE_CONFIG)
-        self.run_next_command(self.PARSE_CONFIG)
-
-    def parse_generate_configuration(self):
-        self.commands_async.append(self.SUB_PARSE_CONFIG)
-        self.generate_configuration()
-
     def set_extra_inherit(self, bbclass):
         inherits = self.server.runCommand(["getVariable", "INHERIT"]) or ""
         inherits = inherits + " " + bbclass
@@ -312,6 +304,7 @@ class HobHandler(gobject.GObject):
         self.run_next_command(self.POPULATE_PACKAGEINFO)
 
     def generate_configuration(self):
+        self.commands_async.append(self.SUB_PARSE_CONFIG)
         self.commands_async.append(self.SUB_PATH_LAYERS)
         self.commands_async.append(self.SUB_FILES_DISTRO)
         self.commands_async.append(self.SUB_FILES_MACH)