Patchwork [bitbake-devel,10/11] Hob: Add stop button for parsing progress

login
register
mail settings
Submitter Dongxiao Xu
Date March 14, 2012, 9:26 a.m.
Message ID <b336abc11268177d4030f526384819717b43d2ce.1331716896.git.dongxiao.xu@intel.com>
Download mbox | patch
Permalink /patch/23303/
State New
Headers show

Comments

Dongxiao Xu - March 14, 2012, 9:26 a.m.
Add a Stop button to allow user to quit the parsing process.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 lib/bb/ui/crumbs/builder.py                |   22 +++++++++++++++++++++-
 lib/bb/ui/crumbs/hobeventhandler.py        |    3 +++
 lib/bb/ui/crumbs/imageconfigurationpage.py |   14 +++++++++++++-
 3 files changed, 37 insertions(+), 2 deletions(-)
Joshua Lock - March 14, 2012, 7:37 p.m.
On 14/03/12 02:26, Dongxiao Xu wrote:
> Add a Stop button to allow user to quit the parsing process.
>
> Signed-off-by: Dongxiao Xu<dongxiao.xu@intel.com>

I'm upset to see using 5 for padding after having raised the issue so 
many times... I don't think it's a good enough reason to bounce this 
functionality when the padding is all over app-wide though.

Signed-off-by: Joshua Lock <josh@linux.intel.com>

> ---
>   lib/bb/ui/crumbs/builder.py                |   22 +++++++++++++++++++++-
>   lib/bb/ui/crumbs/hobeventhandler.py        |    3 +++
>   lib/bb/ui/crumbs/imageconfigurationpage.py |   14 +++++++++++++-
>   3 files changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
> index 1363475..1d255ac 100755
> --- a/lib/bb/ui/crumbs/builder.py
> +++ b/lib/bb/ui/crumbs/builder.py
> @@ -443,7 +443,20 @@ class Builder(gtk.Window):
>           self.switch_page(self.MACHINE_SELECTION)
>
>       def window_sensitive(self, sensitive):
> -        self.set_sensitive(sensitive)
> +        self.image_configuration_page.machine_combo.set_sensitive(sensitive)
> +        self.image_configuration_page.image_combo.set_sensitive(sensitive)
> +        self.image_configuration_page.layer_button.set_sensitive(sensitive)
> +        self.image_configuration_page.layer_info_icon.set_sensitive(sensitive)
> +        self.image_configuration_page.toolbar.set_sensitive(sensitive)
> +        self.image_configuration_page.view_recipes_button.set_sensitive(sensitive)
> +        self.image_configuration_page.view_packages_button.set_sensitive(sensitive)
> +        self.image_configuration_page.config_build_button.set_sensitive(sensitive)
> +
> +        self.recipe_details_page.set_sensitive(sensitive)
> +        self.package_details_page.set_sensitive(sensitive)
> +        self.build_details_page.set_sensitive(sensitive)
> +        self.image_details_page.set_sensitive(sensitive)
> +
>           if sensitive:
>               self.get_root_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
>           else:
> @@ -482,6 +495,10 @@ class Builder(gtk.Window):
>           fraction = 0
>           if message["eventname"] == "TreeDataPreparationStarted":
>               fraction = 0.6 + fraction
> +            self.image_configuration_page.stop_button.set_sensitive(False)
> +        else:
> +            self.image_configuration_page.stop_button.set_sensitive(True)
> +
>           self.image_configuration_page.update_progress_bar(message["title"], fraction)
>
>       def handler_parsing_cb(self, handler, message):
> @@ -836,6 +853,9 @@ class Builder(gtk.Window):
>       def show_configuration(self):
>           self.switch_page(self.BASEIMG_SELECTED)
>
> +    def stop_parse(self):
> +        self.handler.cancel_parse()
> +
>       def stop_build(self):
>           if self.stopping:
>               lbl = "<b>Force Stop build?</b>\nYou've already selected Stop once,"
> diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
> index cd25754..790e2ef 100644
> --- a/lib/bb/ui/crumbs/hobeventhandler.py
> +++ b/lib/bb/ui/crumbs/hobeventhandler.py
> @@ -371,6 +371,9 @@ class HobHandler(gobject.GObject):
>           self.commands_async = []
>           self.building = False
>
> +    def cancel_parse(self):
> +        self.server.runCommand(["stateStop"])
> +
>       def cancel_build(self, force=False):
>           if force:
>               # Force the cooker to stop as quickly as possible
> diff --git a/lib/bb/ui/crumbs/imageconfigurationpage.py b/lib/bb/ui/crumbs/imageconfigurationpage.py
> index f386281..2af9054 100644
> --- a/lib/bb/ui/crumbs/imageconfigurationpage.py
> +++ b/lib/bb/ui/crumbs/imageconfigurationpage.py
> @@ -150,7 +150,13 @@ class ImageConfigurationPage (HobPage):
>           markup += "poky-ref-manual.html#usingpoky-changes-layers\">reference manual</a>."
>           self.layer_info_icon = HobInfoButton(markup, self.get_parent())
>
> +        self.progress_box = gtk.HBox(False, 5)
>           self.progress_bar = HobProgressBar()
> +        self.progress_box.pack_start(self.progress_bar, expand=True, fill=True)
> +        self.stop_button = gtk.LinkButton("Stop the parsing process", "Stop")
> +        self.stop_button.connect("clicked", self.stop_button_clicked_cb)
> +        self.progress_box.pack_end(self.stop_button, expand=False, fill=False)
> +
>           self.machine_separator = gtk.HSeparator()
>
>       def set_config_machine_layout(self, show_progress_bar = False):
> @@ -160,7 +166,7 @@ class ImageConfigurationPage (HobPage):
>           self.gtable.attach(self.layer_button, 12, 36, 6, 10)
>           self.gtable.attach(self.layer_info_icon, 36, 40, 6, 9)
>           if show_progress_bar == True:
> -            self.gtable.attach(self.progress_bar, 0, 40, 13, 17)
> +            self.gtable.attach(self.progress_box, 0, 40, 13, 17)
>           self.gtable.attach(self.machine_separator, 0, 40, 12, 13)
>
>       def create_config_baseimg(self):
> @@ -242,8 +248,14 @@ class ImageConfigurationPage (HobPage):
>
>           return button_box
>
> +    def stop_button_clicked_cb(self, button):
> +        self.builder.stop_parse()
> +
>       def machine_combo_changed_cb(self, machine_combo):
>           combo_item = machine_combo.get_active_text()
> +        if not combo_item:
> +            return
> +
>           self.builder.configuration.curr_mach = combo_item
>           # Do reparse recipes
>           self.builder.switch_page(self.builder.RCPPKGINFO_POPULATING)
Dongxiao Xu - March 15, 2012, 12:44 a.m.
On Wed, 2012-03-14 at 12:37 -0700, Joshua Lock wrote:
> 
> On 14/03/12 02:26, Dongxiao Xu wrote:
> > Add a Stop button to allow user to quit the parsing process.
> >
> > Signed-off-by: Dongxiao Xu<dongxiao.xu@intel.com>
> 
> I'm upset to see using 5 for padding after having raised the issue so 
> many times... I don't think it's a good enough reason to bounce this 
> functionality when the padding is all over app-wide though.

Sorry for this change...
I just simply copied another piece of code in builddetailspage and
didn't care the padding value.

I will modify both of these values to 6.

Thanks,
Dongxiao

> 
> Signed-off-by: Joshua Lock <josh@linux.intel.com>
> 
> > ---
> >   lib/bb/ui/crumbs/builder.py                |   22 +++++++++++++++++++++-
> >   lib/bb/ui/crumbs/hobeventhandler.py        |    3 +++
> >   lib/bb/ui/crumbs/imageconfigurationpage.py |   14 +++++++++++++-
> >   3 files changed, 37 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
> > index 1363475..1d255ac 100755
> > --- a/lib/bb/ui/crumbs/builder.py
> > +++ b/lib/bb/ui/crumbs/builder.py
> > @@ -443,7 +443,20 @@ class Builder(gtk.Window):
> >           self.switch_page(self.MACHINE_SELECTION)
> >
> >       def window_sensitive(self, sensitive):
> > -        self.set_sensitive(sensitive)
> > +        self.image_configuration_page.machine_combo.set_sensitive(sensitive)
> > +        self.image_configuration_page.image_combo.set_sensitive(sensitive)
> > +        self.image_configuration_page.layer_button.set_sensitive(sensitive)
> > +        self.image_configuration_page.layer_info_icon.set_sensitive(sensitive)
> > +        self.image_configuration_page.toolbar.set_sensitive(sensitive)
> > +        self.image_configuration_page.view_recipes_button.set_sensitive(sensitive)
> > +        self.image_configuration_page.view_packages_button.set_sensitive(sensitive)
> > +        self.image_configuration_page.config_build_button.set_sensitive(sensitive)
> > +
> > +        self.recipe_details_page.set_sensitive(sensitive)
> > +        self.package_details_page.set_sensitive(sensitive)
> > +        self.build_details_page.set_sensitive(sensitive)
> > +        self.image_details_page.set_sensitive(sensitive)
> > +
> >           if sensitive:
> >               self.get_root_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
> >           else:
> > @@ -482,6 +495,10 @@ class Builder(gtk.Window):
> >           fraction = 0
> >           if message["eventname"] == "TreeDataPreparationStarted":
> >               fraction = 0.6 + fraction
> > +            self.image_configuration_page.stop_button.set_sensitive(False)
> > +        else:
> > +            self.image_configuration_page.stop_button.set_sensitive(True)
> > +
> >           self.image_configuration_page.update_progress_bar(message["title"], fraction)
> >
> >       def handler_parsing_cb(self, handler, message):
> > @@ -836,6 +853,9 @@ class Builder(gtk.Window):
> >       def show_configuration(self):
> >           self.switch_page(self.BASEIMG_SELECTED)
> >
> > +    def stop_parse(self):
> > +        self.handler.cancel_parse()
> > +
> >       def stop_build(self):
> >           if self.stopping:
> >               lbl = "<b>Force Stop build?</b>\nYou've already selected Stop once,"
> > diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
> > index cd25754..790e2ef 100644
> > --- a/lib/bb/ui/crumbs/hobeventhandler.py
> > +++ b/lib/bb/ui/crumbs/hobeventhandler.py
> > @@ -371,6 +371,9 @@ class HobHandler(gobject.GObject):
> >           self.commands_async = []
> >           self.building = False
> >
> > +    def cancel_parse(self):
> > +        self.server.runCommand(["stateStop"])
> > +
> >       def cancel_build(self, force=False):
> >           if force:
> >               # Force the cooker to stop as quickly as possible
> > diff --git a/lib/bb/ui/crumbs/imageconfigurationpage.py b/lib/bb/ui/crumbs/imageconfigurationpage.py
> > index f386281..2af9054 100644
> > --- a/lib/bb/ui/crumbs/imageconfigurationpage.py
> > +++ b/lib/bb/ui/crumbs/imageconfigurationpage.py
> > @@ -150,7 +150,13 @@ class ImageConfigurationPage (HobPage):
> >           markup += "poky-ref-manual.html#usingpoky-changes-layers\">reference manual</a>."
> >           self.layer_info_icon = HobInfoButton(markup, self.get_parent())
> >
> > +        self.progress_box = gtk.HBox(False, 5)
> >           self.progress_bar = HobProgressBar()
> > +        self.progress_box.pack_start(self.progress_bar, expand=True, fill=True)
> > +        self.stop_button = gtk.LinkButton("Stop the parsing process", "Stop")
> > +        self.stop_button.connect("clicked", self.stop_button_clicked_cb)
> > +        self.progress_box.pack_end(self.stop_button, expand=False, fill=False)
> > +
> >           self.machine_separator = gtk.HSeparator()
> >
> >       def set_config_machine_layout(self, show_progress_bar = False):
> > @@ -160,7 +166,7 @@ class ImageConfigurationPage (HobPage):
> >           self.gtable.attach(self.layer_button, 12, 36, 6, 10)
> >           self.gtable.attach(self.layer_info_icon, 36, 40, 6, 9)
> >           if show_progress_bar == True:
> > -            self.gtable.attach(self.progress_bar, 0, 40, 13, 17)
> > +            self.gtable.attach(self.progress_box, 0, 40, 13, 17)
> >           self.gtable.attach(self.machine_separator, 0, 40, 12, 13)
> >
> >       def create_config_baseimg(self):
> > @@ -242,8 +248,14 @@ class ImageConfigurationPage (HobPage):
> >
> >           return button_box
> >
> > +    def stop_button_clicked_cb(self, button):
> > +        self.builder.stop_parse()
> > +
> >       def machine_combo_changed_cb(self, machine_combo):
> >           combo_item = machine_combo.get_active_text()
> > +        if not combo_item:
> > +            return
> > +
> >           self.builder.configuration.curr_mach = combo_item
> >           # Do reparse recipes
> >           self.builder.switch_page(self.builder.RCPPKGINFO_POPULATING)
>

Patch

diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
index 1363475..1d255ac 100755
--- a/lib/bb/ui/crumbs/builder.py
+++ b/lib/bb/ui/crumbs/builder.py
@@ -443,7 +443,20 @@  class Builder(gtk.Window):
         self.switch_page(self.MACHINE_SELECTION)
 
     def window_sensitive(self, sensitive):
-        self.set_sensitive(sensitive)
+        self.image_configuration_page.machine_combo.set_sensitive(sensitive)
+        self.image_configuration_page.image_combo.set_sensitive(sensitive)
+        self.image_configuration_page.layer_button.set_sensitive(sensitive)
+        self.image_configuration_page.layer_info_icon.set_sensitive(sensitive)
+        self.image_configuration_page.toolbar.set_sensitive(sensitive)
+        self.image_configuration_page.view_recipes_button.set_sensitive(sensitive)
+        self.image_configuration_page.view_packages_button.set_sensitive(sensitive)
+        self.image_configuration_page.config_build_button.set_sensitive(sensitive)
+
+        self.recipe_details_page.set_sensitive(sensitive)
+        self.package_details_page.set_sensitive(sensitive)
+        self.build_details_page.set_sensitive(sensitive)
+        self.image_details_page.set_sensitive(sensitive)
+
         if sensitive:
             self.get_root_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
         else:
@@ -482,6 +495,10 @@  class Builder(gtk.Window):
         fraction = 0
         if message["eventname"] == "TreeDataPreparationStarted":
             fraction = 0.6 + fraction
+            self.image_configuration_page.stop_button.set_sensitive(False)
+        else:
+            self.image_configuration_page.stop_button.set_sensitive(True)
+
         self.image_configuration_page.update_progress_bar(message["title"], fraction)
 
     def handler_parsing_cb(self, handler, message):
@@ -836,6 +853,9 @@  class Builder(gtk.Window):
     def show_configuration(self):
         self.switch_page(self.BASEIMG_SELECTED)
 
+    def stop_parse(self):
+        self.handler.cancel_parse()
+
     def stop_build(self):
         if self.stopping:
             lbl = "<b>Force Stop build?</b>\nYou've already selected Stop once,"
diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
index cd25754..790e2ef 100644
--- a/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/lib/bb/ui/crumbs/hobeventhandler.py
@@ -371,6 +371,9 @@  class HobHandler(gobject.GObject):
         self.commands_async = []
         self.building = False
 
+    def cancel_parse(self):
+        self.server.runCommand(["stateStop"])
+
     def cancel_build(self, force=False):
         if force:
             # Force the cooker to stop as quickly as possible
diff --git a/lib/bb/ui/crumbs/imageconfigurationpage.py b/lib/bb/ui/crumbs/imageconfigurationpage.py
index f386281..2af9054 100644
--- a/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -150,7 +150,13 @@  class ImageConfigurationPage (HobPage):
         markup += "poky-ref-manual.html#usingpoky-changes-layers\">reference manual</a>."
         self.layer_info_icon = HobInfoButton(markup, self.get_parent())
 
+        self.progress_box = gtk.HBox(False, 5)
         self.progress_bar = HobProgressBar()
+        self.progress_box.pack_start(self.progress_bar, expand=True, fill=True)
+        self.stop_button = gtk.LinkButton("Stop the parsing process", "Stop")
+        self.stop_button.connect("clicked", self.stop_button_clicked_cb)
+        self.progress_box.pack_end(self.stop_button, expand=False, fill=False)
+
         self.machine_separator = gtk.HSeparator()
 
     def set_config_machine_layout(self, show_progress_bar = False):
@@ -160,7 +166,7 @@  class ImageConfigurationPage (HobPage):
         self.gtable.attach(self.layer_button, 12, 36, 6, 10)
         self.gtable.attach(self.layer_info_icon, 36, 40, 6, 9)
         if show_progress_bar == True:
-            self.gtable.attach(self.progress_bar, 0, 40, 13, 17)
+            self.gtable.attach(self.progress_box, 0, 40, 13, 17)
         self.gtable.attach(self.machine_separator, 0, 40, 12, 13)
 
     def create_config_baseimg(self):
@@ -242,8 +248,14 @@  class ImageConfigurationPage (HobPage):
 
         return button_box
 
+    def stop_button_clicked_cb(self, button):
+        self.builder.stop_parse()
+
     def machine_combo_changed_cb(self, machine_combo):
         combo_item = machine_combo.get_active_text()
+        if not combo_item:
+            return
+
         self.builder.configuration.curr_mach = combo_item
         # Do reparse recipes
         self.builder.switch_page(self.builder.RCPPKGINFO_POPULATING)