Patchwork [bitbake-devel] bitbake: Hob "Edit packages" page now restores correctly previously selected packages list upon "Back" action

login
register
mail settings
Submitter Cristiana Voicu
Date Aug. 30, 2012, 11:42 a.m.
Message ID <1346326935-12569-1-git-send-email-cristiana.voicu@intel.com>
Download mbox | patch
Permalink /patch/35539/
State New
Headers show

Comments

Cristiana Voicu - Aug. 30, 2012, 11:42 a.m.
Fixes [YOCTO 2984]

Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py              |   10 +++++++++-
 bitbake/lib/bb/ui/crumbs/packageselectionpage.py |    3 +++
 2 files changed, 12 insertions(+), 1 deletion(-)
Richard Purdie - Aug. 31, 2012, 12:43 a.m.
On Thu, 2012-08-30 at 14:42 +0300, Cristiana Voicu wrote:
> Fixes [YOCTO 2984]
> 
> Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>

Could you tweak this commit message a bit please. The subject needs to
be more specific and concise including a suitable prefix about the area
being changed, something like:

"hob/packageselection: Correctly restore previously selected packages"

You then need a longer description of why the change is necessary as
well as what changed.

The correct form for the bug number is simply:

[YOCTO #2984]

I know this probably sounds picky but people do appreciate decent commit
messages when looking back in time and some simple tweaks like this can
make a big difference.

Cheers,

Richard


>  bitbake/lib/bb/ui/crumbs/builder.py              |   10 +++++++++-
>  bitbake/lib/bb/ui/crumbs/packageselectionpage.py |    3 +++
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
> index 7de4798..c6e0f39 100755
> --- a/bitbake/lib/bb/ui/crumbs/builder.py
> +++ b/bitbake/lib/bb/ui/crumbs/builder.py
> @@ -123,6 +123,7 @@ class Configuration:
>          self.selected_image = None
>          self.selected_recipes = []
>          self.selected_packages = []
> +        self.initial_selected_packages = []
>  
>      def split_proxy(self, protocol, proxy):
>          entry = []
> @@ -519,6 +520,12 @@ class Builder(gtk.Window):
>          self.handler.reset_build()
>          self.handler.generate_packages(all_recipes, self.configuration.default_task)
>  
> +    def restore_initial_selected_packages(self):
> +        self.package_model.set_selected_packages(self.configuration.initial_selected_packages)
> +        for package in self.configuration.selected_packages:
> +            if package not in self.configuration.initial_selected_packages:
> +                self.package_model.exclude_item(self.package_model.find_path_for_item(package))
> +
>      def fast_generate_image_async(self, log = False):
>          self.switch_page(self.FAST_IMAGE_GENERATING)
>          if log:
> @@ -658,6 +665,7 @@ class Builder(gtk.Window):
>              self.build_details_page.show_page(next_step)
>  
>          elif next_step == self.PACKAGE_GENERATED:
> +            self.configuration.initial_selected_packages = self.configuration.selected_packages
>              if self.recipe_model.get_selected_image() == self.recipe_model.__custom_image__:
>                  self.package_details_page.set_packages_curr_tab(self.package_details_page.ALL)
>              else:
> @@ -1334,4 +1342,4 @@ class Builder(gtk.Window):
>              format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
>              self.consolelog.setFormatter(format)
>  
> -            self.logger.addHandler(self.consolelog)
> \ No newline at end of file
> +            self.logger.addHandler(self.consolelog)
> diff --git a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
> index 3576ed5..89bf047 100755
> --- a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
> +++ b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
> @@ -192,6 +192,9 @@ class PackageSelectionPage (HobPage):
>          self.builder.build_image()
>  
>      def back_button_clicked_cb(self, button):
> +        self.builder.restore_initial_selected_packages()
> +        self.refresh_selection()
> +
>          if self.builder.current_step ==  self.builder.PACKAGE_GENERATED:
>              self.builder.show_recipes()
>          elif self.builder.previous_step ==  self.builder.IMAGE_GENERATED:

Patch

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 7de4798..c6e0f39 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -123,6 +123,7 @@  class Configuration:
         self.selected_image = None
         self.selected_recipes = []
         self.selected_packages = []
+        self.initial_selected_packages = []
 
     def split_proxy(self, protocol, proxy):
         entry = []
@@ -519,6 +520,12 @@  class Builder(gtk.Window):
         self.handler.reset_build()
         self.handler.generate_packages(all_recipes, self.configuration.default_task)
 
+    def restore_initial_selected_packages(self):
+        self.package_model.set_selected_packages(self.configuration.initial_selected_packages)
+        for package in self.configuration.selected_packages:
+            if package not in self.configuration.initial_selected_packages:
+                self.package_model.exclude_item(self.package_model.find_path_for_item(package))
+
     def fast_generate_image_async(self, log = False):
         self.switch_page(self.FAST_IMAGE_GENERATING)
         if log:
@@ -658,6 +665,7 @@  class Builder(gtk.Window):
             self.build_details_page.show_page(next_step)
 
         elif next_step == self.PACKAGE_GENERATED:
+            self.configuration.initial_selected_packages = self.configuration.selected_packages
             if self.recipe_model.get_selected_image() == self.recipe_model.__custom_image__:
                 self.package_details_page.set_packages_curr_tab(self.package_details_page.ALL)
             else:
@@ -1334,4 +1342,4 @@  class Builder(gtk.Window):
             format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
             self.consolelog.setFormatter(format)
 
-            self.logger.addHandler(self.consolelog)
\ No newline at end of file
+            self.logger.addHandler(self.consolelog)
diff --git a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
index 3576ed5..89bf047 100755
--- a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
+++ b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
@@ -192,6 +192,9 @@  class PackageSelectionPage (HobPage):
         self.builder.build_image()
 
     def back_button_clicked_cb(self, button):
+        self.builder.restore_initial_selected_packages()
+        self.refresh_selection()
+
         if self.builder.current_step ==  self.builder.PACKAGE_GENERATED:
             self.builder.show_recipes()
         elif self.builder.previous_step ==  self.builder.IMAGE_GENERATED: