Patchwork [bitbake-devel] HOB: Busy cursor when saving configuration

login
register
mail settings
Submitter Valentin Popa
Date Sept. 10, 2013, 12:58 p.m.
Message ID <1378817932-5304-1-git-send-email-valentin.popa@intel.com>
Download mbox | patch
Permalink /patch/57753/
State New
Headers show

Comments

Valentin Popa - Sept. 10, 2013, 12:58 p.m.
Display a busy cursor while the configuration is saved.

[YOCTO #4846]
Signed-off-by: Valentin Popa <valentin.popa@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py                |  8 ++++++++
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py | 10 ++++++++++
 2 files changed, 18 insertions(+)
Cristiana Voicu - Sept. 27, 2013, 10:40 a.m.
On 09/10/2013 03:58 PM, Valentin Popa wrote:
> Display a busy cursor while the configuration is saved.
>
> [YOCTO #4846]
> Signed-off-by: Valentin Popa <valentin.popa@intel.com>
> ---
>   bitbake/lib/bb/ui/crumbs/builder.py                |  8 ++++++++
>   bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py | 10 ++++++++++
>   2 files changed, 18 insertions(+)
>
> diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
> index 86fdbfe..8292813 100755
> --- a/bitbake/lib/bb/ui/crumbs/builder.py
> +++ b/bitbake/lib/bb/ui/crumbs/builder.py
> @@ -31,6 +31,7 @@ import re
>   import logging
>   import sys
>   import signal
> +import time
>   from bb.ui.crumbs.imageconfigurationpage import ImageConfigurationPage
>   from bb.ui.crumbs.recipeselectionpage import RecipeSelectionPage
>   from bb.ui.crumbs.packageselectionpage import PackageSelectionPage
> @@ -1466,3 +1467,10 @@ class Builder(gtk.Window):
>   
>       def get_topdir(self):
>           return self.handler.get_topdir()
> +
> +    def wait(self, delay):
> +        time_start = time.time()
> +        time_end = time_start + delay
> +        while time_end > time.time():
> +            while gtk.events_pending():
> +                gtk.main_iteration()
> diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
> index 3babc8e..79709d0 100644
> --- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
> +++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
> @@ -300,7 +300,12 @@ class ImageConfigurationPage (HobPage):
>       def view_warnings_button_clicked_cb(self, button):
>           self.builder.show_warning_dialog()
>   
> +    def machine_combo_changed_idle_cb(self):
> +        self.builder.window.set_cursor(None)
> +
>       def machine_combo_changed_cb(self, machine_combo):
> +        self.builder.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
> +        self.builder.wait(0.1) #wait for combo and cursor to update
>           self.stopping = False
>           self.builder.parsing_warnings = []
>           combo_item = machine_combo.get_active_text()
> @@ -324,6 +329,8 @@ class ImageConfigurationPage (HobPage):
>           # Do reparse recipes
>           self.builder.populate_recipe_package_info_async()
>   
> +        glib.idle_add(self.machine_combo_changed_idle_cb)
> +
>       def update_machine_combo(self):
>           self.disable_warnings_bar()
>           all_machines = [self.__dummy_machine__] + self.builder.parameters.all_machines
> @@ -527,7 +534,10 @@ class ImageConfigurationPage (HobPage):
>           if not response:
>               return
>           if settings_changed:
> +            self.builder.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
> +            self.builder.wait(0.1) #wait for adv_settings_dialog to terminate
>               self.builder.reparse_post_adv_settings()
> +            self.builder.window.set_cursor(None)
>   
>       def just_bake_button_clicked_cb(self, button):
>           self.builder.parsing_warnings = []
Hi Richard,
I think this patch was forgotten. Can you please merge it?
Thanks!

Patch

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 86fdbfe..8292813 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -31,6 +31,7 @@  import re
 import logging
 import sys
 import signal
+import time
 from bb.ui.crumbs.imageconfigurationpage import ImageConfigurationPage
 from bb.ui.crumbs.recipeselectionpage import RecipeSelectionPage
 from bb.ui.crumbs.packageselectionpage import PackageSelectionPage
@@ -1466,3 +1467,10 @@  class Builder(gtk.Window):
 
     def get_topdir(self):
         return self.handler.get_topdir()
+
+    def wait(self, delay):
+        time_start = time.time()
+        time_end = time_start + delay
+        while time_end > time.time():
+            while gtk.events_pending():
+                gtk.main_iteration()
diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
index 3babc8e..79709d0 100644
--- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -300,7 +300,12 @@  class ImageConfigurationPage (HobPage):
     def view_warnings_button_clicked_cb(self, button):
         self.builder.show_warning_dialog()
 
+    def machine_combo_changed_idle_cb(self):
+        self.builder.window.set_cursor(None)
+
     def machine_combo_changed_cb(self, machine_combo):
+        self.builder.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
+        self.builder.wait(0.1) #wait for combo and cursor to update
         self.stopping = False
         self.builder.parsing_warnings = []
         combo_item = machine_combo.get_active_text()
@@ -324,6 +329,8 @@  class ImageConfigurationPage (HobPage):
         # Do reparse recipes
         self.builder.populate_recipe_package_info_async()
 
+        glib.idle_add(self.machine_combo_changed_idle_cb)
+
     def update_machine_combo(self):
         self.disable_warnings_bar()
         all_machines = [self.__dummy_machine__] + self.builder.parameters.all_machines
@@ -527,7 +534,10 @@  class ImageConfigurationPage (HobPage):
         if not response:
             return
         if settings_changed:
+            self.builder.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
+            self.builder.wait(0.1) #wait for adv_settings_dialog to terminate
             self.builder.reparse_post_adv_settings()
+            self.builder.window.set_cursor(None)
 
     def just_bake_button_clicked_cb(self, button):
         self.builder.parsing_warnings = []