Patchwork [bitbake-devel,2/2] Hob: forbid users to exit Hob directly when Hob is busy

login
register
mail settings
Submitter Shane Wang
Date April 12, 2012, 2:22 p.m.
Message ID <7c149ef6bdd51f91462d60c4aee756badefc032f.1334240256.git.shane.wang@intel.com>
Download mbox | patch
Permalink /patch/25681/
State New
Headers show

Comments

Shane Wang - April 12, 2012, 2:22 p.m.
When Hob is busy with generating data, exiting Hob is not allowed.
That should be reasonable because at that time the mouse cursor is not a pointer.
If users want to exit, they can click "Stop" first and then do exit.

That is also a walkaround for [Yocto #2142]

Signed-off-by: Shane Wang <shane.wang@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Patch

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 10b9a77..e3f2d40 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -274,6 +274,9 @@  class Builder(gtk.Window):
         # Indicate whether user has customized the image
         self.customized = False
 
+        # Indicate whether the UI is working
+        self.sensitive = True
+
         # create visual elements
         self.create_visual_elements()
 
@@ -584,6 +587,7 @@  class Builder(gtk.Window):
             self.get_root_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
         else:
             self.get_root_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
+        self.sensitive = sensitive
 
 
     def handler_generating_data_cb(self, handler):
@@ -738,6 +742,8 @@  class Builder(gtk.Window):
         self.build_details_page.show_issues()
 
     def destroy_window_cb(self, widget, event):
+        if not self.sensitive:
+            return True
         lbl = "<b>Do you really want to exit the Hob image creator?</b>"
         dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
         button = dialog.add_button("Cancel", gtk.RESPONSE_NO)