summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Wang <shane.wang@intel.com>2012-02-29 22:15:10 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-01 15:51:33 +0000
commitae9539f2f466b90954eb7baab0980f23448fd6bf (patch)
tree118ac336407aff7fdf3a634f84673fd1a885b974
parent5090837991af49732857dffaa596b7bdb9418e80 (diff)
downloadpoky-ae9539f2f466b90954eb7baab0980f23448fd6bf.tar.gz
crumbs: Factor common dialogue configuration out
Factor out the base dialogue configuration into CrumbsDialog and create a new CrumbsMessageDialog which acts as the CrumbsDialog did to handle dialogues with buttons. Adopt CrumbsMessageDialog wherever CrumbsDialog was used. (Bitbake rev: d8c62f54d9f2421cfe7f1083b9d0acfe0373d38a) Signed-off-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py28
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig.py21
2 files changed, 31 insertions, 18 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index eb38819294..38f76c5821 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -33,7 +33,7 @@ from bb.ui.crumbs.packageselectionpage import PackageSelectionPage
33from bb.ui.crumbs.builddetailspage import BuildDetailsPage 33from bb.ui.crumbs.builddetailspage import BuildDetailsPage
34from bb.ui.crumbs.imagedetailspage import ImageDetailsPage 34from bb.ui.crumbs.imagedetailspage import ImageDetailsPage
35from bb.ui.crumbs.hobwidget import hwc 35from bb.ui.crumbs.hobwidget import hwc
36from bb.ui.crumbs.hig import CrumbsDialog, BinbDialog, \ 36from bb.ui.crumbs.hig import CrumbsMessageDialog, BinbDialog, \
37 AdvancedSettingDialog, LayerSelectionDialog, \ 37 AdvancedSettingDialog, LayerSelectionDialog, \
38 DeployImageDialog, ImageSelectionDialog 38 DeployImageDialog, ImageSelectionDialog
39 39
@@ -234,7 +234,7 @@ class Builder(gtk.Window):
234 else: 234 else:
235 lbl = "<b>Screen dimension mismatched</b>\nfor better usability and visual effects," 235 lbl = "<b>Screen dimension mismatched</b>\nfor better usability and visual effects,"
236 lbl = lbl + " the screen dimension should be 1024x768 or above." 236 lbl = lbl + " the screen dimension should be 1024x768 or above."
237 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_INFO) 237 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
238 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) 238 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
239 dialog.run() 239 dialog.run()
240 dialog.destroy() 240 dialog.destroy()
@@ -441,7 +441,7 @@ class Builder(gtk.Window):
441 def handler_command_failed_cb(self, handler, msg): 441 def handler_command_failed_cb(self, handler, msg):
442 lbl = "<b>Error</b>\n" 442 lbl = "<b>Error</b>\n"
443 lbl = lbl + "%s\n\n" % msg 443 lbl = lbl + "%s\n\n" % msg
444 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) 444 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING)
445 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) 445 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
446 response = dialog.run() 446 response = dialog.run()
447 dialog.destroy() 447 dialog.destroy()
@@ -588,7 +588,7 @@ class Builder(gtk.Window):
588 588
589 def destroy_window_cb(self, widget, event): 589 def destroy_window_cb(self, widget, event):
590 lbl = "<b>Do you really want to exit the Hob image creator?</b>" 590 lbl = "<b>Do you really want to exit the Hob image creator?</b>"
591 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_INFO) 591 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
592 dialog.add_button(gtk.STOCK_YES, gtk.RESPONSE_YES) 592 dialog.add_button(gtk.STOCK_YES, gtk.RESPONSE_YES)
593 dialog.add_button(gtk.STOCK_NO, gtk.RESPONSE_NO) 593 dialog.add_button(gtk.STOCK_NO, gtk.RESPONSE_NO)
594 dialog.set_default_response(gtk.RESPONSE_NO) 594 dialog.set_default_response(gtk.RESPONSE_NO)
@@ -605,7 +605,7 @@ class Builder(gtk.Window):
605 if not all_recipes: 605 if not all_recipes:
606 lbl = "<b>No selections made</b>\nYou have not made any selections" 606 lbl = "<b>No selections made</b>\nYou have not made any selections"
607 lbl = lbl + " so there isn't anything to bake at this time." 607 lbl = lbl + " so there isn't anything to bake at this time."
608 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_INFO) 608 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
609 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) 609 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
610 dialog.run() 610 dialog.run()
611 dialog.destroy() 611 dialog.destroy()
@@ -617,7 +617,7 @@ class Builder(gtk.Window):
617 if not selected_packages: 617 if not selected_packages:
618 lbl = "<b>No selections made</b>\nYou have not made any selections" 618 lbl = "<b>No selections made</b>\nYou have not made any selections"
619 lbl = lbl + " so there isn't anything to bake at this time." 619 lbl = lbl + " so there isn't anything to bake at this time."
620 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_INFO) 620 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
621 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) 621 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
622 dialog.run() 622 dialog.run()
623 dialog.destroy() 623 dialog.destroy()
@@ -632,7 +632,7 @@ class Builder(gtk.Window):
632 if not (selected_packages or selected_image != self.recipe_model.__dummy_image__): 632 if not (selected_packages or selected_image != self.recipe_model.__dummy_image__):
633 lbl = "<b>No selections made</b>\nYou have not made any selections" 633 lbl = "<b>No selections made</b>\nYou have not made any selections"
634 lbl = lbl + " so there isn't anything to bake at this time." 634 lbl = lbl + " so there isn't anything to bake at this time."
635 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_INFO) 635 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
636 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) 636 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
637 dialog.run() 637 dialog.run()
638 dialog.destroy() 638 dialog.destroy()
@@ -703,7 +703,7 @@ class Builder(gtk.Window):
703 if response == gtk.RESPONSE_YES: 703 if response == gtk.RESPONSE_YES:
704 if not dialog.image_names: 704 if not dialog.image_names:
705 lbl = "<b>No selections made</b>\nYou have not made any selections" 705 lbl = "<b>No selections made</b>\nYou have not made any selections"
706 crumbs_dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_INFO) 706 crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
707 crumbs_dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) 707 crumbs_dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
708 crumbs_dialog.run() 708 crumbs_dialog.run()
709 crumbs_dialog.destroy() 709 crumbs_dialog.destroy()
@@ -745,7 +745,7 @@ class Builder(gtk.Window):
745 def deploy_image(self, image_name): 745 def deploy_image(self, image_name):
746 if not image_name: 746 if not image_name:
747 lbl = "<b>Please select an image to deploy.</b>" 747 lbl = "<b>Please select an image to deploy.</b>"
748 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_INFO) 748 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
749 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) 749 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
750 dialog.run() 750 dialog.run()
751 dialog.destroy() 751 dialog.destroy()
@@ -766,7 +766,7 @@ class Builder(gtk.Window):
766 def runqemu_image(self, image_name): 766 def runqemu_image(self, image_name):
767 if not image_name: 767 if not image_name:
768 lbl = "<b>Please select an image to launch in QEMU.</b>" 768 lbl = "<b>Please select an image to launch in QEMU.</b>"
769 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_INFO) 769 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
770 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) 770 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
771 dialog.run() 771 dialog.run()
772 dialog.destroy() 772 dialog.destroy()
@@ -806,7 +806,7 @@ class Builder(gtk.Window):
806 lbl = lbl + "kernel path:" + kernel_path + "\n" 806 lbl = lbl + "kernel path:" + kernel_path + "\n"
807 lbl = lbl + "source environment path:" + source_env_path + "\n" 807 lbl = lbl + "source environment path:" + source_env_path + "\n"
808 lbl = lbl + "tmp path: " + tmp_path + "." 808 lbl = lbl + "tmp path: " + tmp_path + "."
809 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_INFO) 809 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
810 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) 810 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
811 dialog.run() 811 dialog.run()
812 dialog.destroy() 812 dialog.destroy()
@@ -816,7 +816,7 @@ class Builder(gtk.Window):
816 if selected_recipes and ask: 816 if selected_recipes and ask:
817 lbl = "<b>Package list may be incomplete!</b>\nDo you want to build selected recipes" 817 lbl = "<b>Package list may be incomplete!</b>\nDo you want to build selected recipes"
818 lbl = lbl + " to get a full list (Yes) or just view the existing packages (No)?" 818 lbl = lbl + " to get a full list (Yes) or just view the existing packages (No)?"
819 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_INFO) 819 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
820 dialog.add_button(gtk.STOCK_YES, gtk.RESPONSE_YES) 820 dialog.add_button(gtk.STOCK_YES, gtk.RESPONSE_YES)
821 dialog.add_button(gtk.STOCK_NO, gtk.RESPONSE_NO) 821 dialog.add_button(gtk.STOCK_NO, gtk.RESPONSE_NO)
822 dialog.set_default_response(gtk.RESPONSE_YES) 822 dialog.set_default_response(gtk.RESPONSE_YES)
@@ -847,7 +847,7 @@ class Builder(gtk.Window):
847 lbl = lbl + "This will stop the build as quickly as possible but may" 847 lbl = lbl + "This will stop the build as quickly as possible but may"
848 lbl = lbl + " well leave your build directory in an unusable state" 848 lbl = lbl + " well leave your build directory in an unusable state"
849 lbl = lbl + " that requires manual steps to fix.\n" 849 lbl = lbl + " that requires manual steps to fix.\n"
850 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) 850 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING)
851 dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) 851 dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
852 dialog.add_button("Force Stop", gtk.RESPONSE_YES) 852 dialog.add_button("Force Stop", gtk.RESPONSE_YES)
853 else: 853 else:
@@ -859,7 +859,7 @@ class Builder(gtk.Window):
859 lbl = lbl + " progress build tasks are finished. However if a" 859 lbl = lbl + " progress build tasks are finished. However if a"
860 lbl = lbl + " lengthy compilation phase is in progress this may take" 860 lbl = lbl + " lengthy compilation phase is in progress this may take"
861 lbl = lbl + " some time." 861 lbl = lbl + " some time."
862 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) 862 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING)
863 dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) 863 dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
864 dialog.add_button("Stop", gtk.RESPONSE_OK) 864 dialog.add_button("Stop", gtk.RESPONSE_OK)
865 dialog.add_button("Force Stop", gtk.RESPONSE_YES) 865 dialog.add_button("Force Stop", gtk.RESPONSE_YES)
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index cbad899ae0..85efbe6908 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -45,11 +45,24 @@ class CrumbsDialog(gtk.Dialog):
45 A GNOME HIG compliant dialog widget. 45 A GNOME HIG compliant dialog widget.
46 Add buttons with gtk.Dialog.add_button or gtk.Dialog.add_buttons 46 Add buttons with gtk.Dialog.add_button or gtk.Dialog.add_buttons
47 """ 47 """
48 def __init__(self, title="", parent=None, flags=0, buttons=None):
49 super(CrumbsDialog, self).__init__(title, parent, flags, buttons)
50
51 self.set_property("has-separator", False) # note: deprecated in 2.22
52
53 self.set_border_width(6)
54 self.vbox.set_property("spacing", 12)
55 self.action_area.set_property("spacing", 12)
56 self.action_area.set_property("border-width", 6)
57
58class CrumbsMessageDialog(CrumbsDialog):
59 """
60 A GNOME HIG compliant dialog widget.
61 Add buttons with gtk.Dialog.add_button or gtk.Dialog.add_buttons
62 """
48 def __init__(self, parent=None, label="", icon=gtk.STOCK_INFO): 63 def __init__(self, parent=None, label="", icon=gtk.STOCK_INFO):
49 super(CrumbsDialog, self).__init__("", parent, gtk.DIALOG_DESTROY_WITH_PARENT) 64 super(CrumbsMessageDialog, self).__init__("", parent, gtk.DIALOG_DESTROY_WITH_PARENT)
50 65
51 #self.set_property("has-separator", False) # note: deprecated in 2.22
52
53 self.set_border_width(6) 66 self.set_border_width(6)
54 self.vbox.set_property("spacing", 12) 67 self.vbox.set_property("spacing", 12)
55 self.action_area.set_property("spacing", 12) 68 self.action_area.set_property("spacing", 12)
@@ -839,7 +852,7 @@ class LayerSelectionDialog (gtk.Dialog):
839 else: 852 else:
840 layer_store.append([path]) 853 layer_store.append([path])
841 return 854 return
842 dialog = CrumbsDialog(parent, lbl) 855 dialog = CrumbsMessageDialog(parent, lbl)
843 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) 856 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
844 response = dialog.run() 857 response = dialog.run()
845 dialog.destroy() 858 dialog.destroy()