diff options
author | Valentin Popa <valentin.popa@intel.com> | 2013-11-04 12:53:12 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-11-08 17:25:38 +0000 |
commit | 67a7ac1ea7403bf6b64becc58945c724b276f20f (patch) | |
tree | 40e679fb70fa52422b6e6eeae4c8188fe62c24ef /bitbake/lib/bb/ui/crumbs/hig | |
parent | 34eb0044356a04cc816808a57804242ea58d59c2 (diff) | |
download | poky-67a7ac1ea7403bf6b64becc58945c724b276f20f.tar.gz |
bitbake: HOB: HIG compliant message dialogs
"More" HIG compliant dialogs for HOB.
(Bitbake rev: a1ccb5e70523be6af7f4bcaabd728af1ddaf6dc5)
Signed-off-by: Valentin Popa <valentin.popa@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hig')
6 files changed, 38 insertions, 59 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig/advancedsettingsdialog.py b/bitbake/lib/bb/ui/crumbs/hig/advancedsettingsdialog.py index 5542471c7b..e0b3553c2f 100644 --- a/bitbake/lib/bb/ui/crumbs/hig/advancedsettingsdialog.py +++ b/bitbake/lib/bb/ui/crumbs/hig/advancedsettingsdialog.py | |||
@@ -183,8 +183,9 @@ class AdvancedSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
183 | self.set_save_button_state() | 183 | self.set_save_button_state() |
184 | if self.get_num_checked_image_types() == 0: | 184 | if self.get_num_checked_image_types() == 0: |
185 | # Show an error dialog | 185 | # Show an error dialog |
186 | lbl = "<b>Select an image type</b>\n\nYou need to select at least one image type." | 186 | lbl = "<b>Select an image type</b>" |
187 | dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) | 187 | msg = "You need to select at least one image type." |
188 | dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_WARNING, msg) | ||
188 | button = dialog.add_button("OK", gtk.RESPONSE_OK) | 189 | button = dialog.add_button("OK", gtk.RESPONSE_OK) |
189 | HobButton.style_button(button) | 190 | HobButton.style_button(button) |
190 | response = dialog.run() | 191 | response = dialog.run() |
diff --git a/bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py index 097ce7b027..3b998e4637 100644 --- a/bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py +++ b/bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py | |||
@@ -31,51 +31,28 @@ BitBake GUI's | |||
31 | In summary: spacing = 12px, border-width = 6px | 31 | In summary: spacing = 12px, border-width = 6px |
32 | """ | 32 | """ |
33 | 33 | ||
34 | class CrumbsMessageDialog(CrumbsDialog): | 34 | class CrumbsMessageDialog(gtk.MessageDialog): |
35 | """ | 35 | """ |
36 | A GNOME HIG compliant dialog widget. | 36 | A GNOME HIG compliant dialog widget. |
37 | Add buttons with gtk.Dialog.add_button or gtk.Dialog.add_buttons | 37 | Add buttons with gtk.Dialog.add_button or gtk.Dialog.add_buttons |
38 | """ | 38 | """ |
39 | def __init__(self, parent=None, label="", icon=gtk.STOCK_INFO, msg=""): | 39 | def __init__(self, parent = None, label="", dialog_type = gtk.MESSAGE_QUESTION, msg=""): |
40 | super(CrumbsMessageDialog, self).__init__("", parent, gtk.DIALOG_MODAL) | 40 | super(CrumbsMessageDialog, self).__init__(None, |
41 | gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, | ||
42 | dialog_type, | ||
43 | gtk.BUTTONS_NONE, | ||
44 | None) | ||
41 | 45 | ||
42 | self.set_border_width(6) | 46 | self.set_skip_taskbar_hint(False) |
43 | self.vbox.set_property("spacing", 12) | ||
44 | self.action_area.set_property("spacing", 12) | ||
45 | self.action_area.set_property("border-width", 6) | ||
46 | 47 | ||
47 | first_column = gtk.HBox(spacing=12) | 48 | self.set_markup(label) |
48 | first_column.set_property("border-width", 6) | ||
49 | first_column.show() | ||
50 | self.vbox.add(first_column) | ||
51 | 49 | ||
52 | self.icon = gtk.Image() | 50 | if 0 <= len(msg) < 300: |
53 | # We have our own Info icon which should be used in preference of the stock icon | 51 | self.format_secondary_markup(msg) |
54 | self.icon_chk = HobIconChecker() | ||
55 | self.icon.set_from_stock(self.icon_chk.check_stock_icon(icon), gtk.ICON_SIZE_DIALOG) | ||
56 | self.icon.set_property("yalign", 0.00) | ||
57 | self.icon.show() | ||
58 | first_column.pack_start(self.icon, expand=False, fill=True, padding=0) | ||
59 | |||
60 | if 0 <= len(msg) < 200: | ||
61 | lbl = label + "%s" % glib.markup_escape_text(msg) | ||
62 | self.label_short = gtk.Label() | ||
63 | self.label_short.set_use_markup(True) | ||
64 | self.label_short.set_line_wrap(True) | ||
65 | self.label_short.set_markup(lbl) | ||
66 | self.label_short.set_property("yalign", 0.00) | ||
67 | self.label_short.show() | ||
68 | first_column.add(self.label_short) | ||
69 | else: | 52 | else: |
70 | second_row = gtk.VBox(spacing=12) | 53 | vbox = self.get_message_area() |
71 | second_row.set_property("border-width", 6) | 54 | vbox.set_border_width(1) |
72 | self.label_long = gtk.Label() | 55 | vbox.set_property("spacing", 12) |
73 | self.label_long.set_use_markup(True) | ||
74 | self.label_long.set_line_wrap(True) | ||
75 | self.label_long.set_markup(label) | ||
76 | self.label_long.set_alignment(0.0, 0.0) | ||
77 | second_row.pack_start(self.label_long, expand=False, fill=False, padding=0) | ||
78 | self.label_long.show() | ||
79 | self.textWindow = gtk.ScrolledWindow() | 56 | self.textWindow = gtk.ScrolledWindow() |
80 | self.textWindow.set_shadow_type(gtk.SHADOW_IN) | 57 | self.textWindow.set_shadow_type(gtk.SHADOW_IN) |
81 | self.textWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) | 58 | self.textWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) |
@@ -89,7 +66,5 @@ class CrumbsMessageDialog(CrumbsDialog): | |||
89 | self.msgView.set_buffer(self.buf) | 66 | self.msgView.set_buffer(self.buf) |
90 | self.textWindow.add(self.msgView) | 67 | self.textWindow.add(self.msgView) |
91 | self.msgView.show() | 68 | self.msgView.show() |
92 | second_row.add(self.textWindow) | 69 | vbox.add(self.textWindow) |
93 | self.textWindow.show() | 70 | self.textWindow.show() |
94 | first_column.add(second_row) | ||
95 | second_row.show() | ||
diff --git a/bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py index bc1efbbfaf..f64fbd6ea4 100644 --- a/bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py +++ b/bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py | |||
@@ -160,6 +160,7 @@ class DeployImageDialog (CrumbsDialog): | |||
160 | def response_cb(self, dialog, response_id): | 160 | def response_cb(self, dialog, response_id): |
161 | if response_id == gtk.RESPONSE_YES: | 161 | if response_id == gtk.RESPONSE_YES: |
162 | lbl = '' | 162 | lbl = '' |
163 | msg = '' | ||
163 | combo_item = self.usb_combo.get_active_text() | 164 | combo_item = self.usb_combo.get_active_text() |
164 | if combo_item and combo_item != self.__dummy_usb__ and self.image_path: | 165 | if combo_item and combo_item != self.__dummy_usb__ and self.image_path: |
165 | cmdline = bb.ui.crumbs.utils.which_terminal() | 166 | cmdline = bb.ui.crumbs.utils.which_terminal() |
@@ -172,15 +173,18 @@ class DeployImageDialog (CrumbsDialog): | |||
172 | if int(tmpfile.readline().strip()) == 0: | 173 | if int(tmpfile.readline().strip()) == 0: |
173 | lbl = "<b>Deploy image successfully.</b>" | 174 | lbl = "<b>Deploy image successfully.</b>" |
174 | else: | 175 | else: |
175 | lbl = "<b>Failed to deploy image.</b>\nPlease check image <b>%s</b> exists and USB device <b>%s</b> is writable." % (self.image_path, combo_item) | 176 | lbl = "<b>Failed to deploy image.</b>" |
177 | msg = "Please check image <b>%s</b> exists and USB device <b>%s</b> is writable." % (self.image_path, combo_item) | ||
176 | tmpfile.close() | 178 | tmpfile.close() |
177 | else: | 179 | else: |
178 | if not self.image_path: | 180 | if not self.image_path: |
179 | lbl = "<b>No selection made.</b>\nYou have not selected an image to deploy." | 181 | lbl = "<b>No selection made.</b>" |
182 | msg = "You have not selected an image to deploy." | ||
180 | else: | 183 | else: |
181 | lbl = "<b>No selection made.</b>\nYou have not selected a USB device." | 184 | lbl = "<b>No selection made.</b>" |
185 | msg = "You have not selected a USB device." | ||
182 | if len(lbl): | 186 | if len(lbl): |
183 | crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) | 187 | crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_INFO, msg) |
184 | button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK) | 188 | button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK) |
185 | HobButton.style_button(button) | 189 | HobButton.style_button(button) |
186 | crumbs_dialog.run() | 190 | crumbs_dialog.run() |
diff --git a/bitbake/lib/bb/ui/crumbs/hig/layerselectiondialog.py b/bitbake/lib/bb/ui/crumbs/hig/layerselectiondialog.py index 783ee73c7a..1d100c54f1 100644 --- a/bitbake/lib/bb/ui/crumbs/hig/layerselectiondialog.py +++ b/bitbake/lib/bb/ui/crumbs/hig/layerselectiondialog.py | |||
@@ -92,7 +92,8 @@ class LayerSelectionDialog (CrumbsDialog): | |||
92 | path = dialog.get_filename() | 92 | path = dialog.get_filename() |
93 | dialog.destroy() | 93 | dialog.destroy() |
94 | 94 | ||
95 | lbl = "<b>Error</b>\nUnable to load layer <i>%s</i> because " % path | 95 | lbl = "<b>Error</b>" |
96 | msg = "Unable to load layer <i>%s</i> because " % path | ||
96 | if response == gtk.RESPONSE_YES: | 97 | if response == gtk.RESPONSE_YES: |
97 | import os | 98 | import os |
98 | import os.path | 99 | import os.path |
@@ -103,15 +104,15 @@ class LayerSelectionDialog (CrumbsDialog): | |||
103 | it = layer_store.iter_next(it) | 104 | it = layer_store.iter_next(it) |
104 | 105 | ||
105 | if not path: | 106 | if not path: |
106 | lbl += "it is an invalid path." | 107 | msg += "it is an invalid path." |
107 | elif not os.path.exists(path+"/conf/layer.conf"): | 108 | elif not os.path.exists(path+"/conf/layer.conf"): |
108 | lbl += "there is no layer.conf inside the directory." | 109 | msg += "there is no layer.conf inside the directory." |
109 | elif path in layers: | 110 | elif path in layers: |
110 | lbl += "it is already in loaded layers." | 111 | msg += "it is already in loaded layers." |
111 | else: | 112 | else: |
112 | layer_store.append([path]) | 113 | layer_store.append([path]) |
113 | return | 114 | return |
114 | dialog = CrumbsMessageDialog(parent, lbl) | 115 | dialog = CrumbsMessageDialog(parent, lbl, gtk.MESSAGE_ERROR, msg) |
115 | dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_OK) | 116 | dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_OK) |
116 | response = dialog.run() | 117 | response = dialog.run() |
117 | dialog.destroy() | 118 | dialog.destroy() |
diff --git a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py index e940ceee43..4195f70e1e 100644 --- a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py +++ b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py | |||
@@ -146,12 +146,11 @@ class SaveImageDialog (CrumbsDialog): | |||
146 | self.show_invalid_input_error_dialog() | 146 | self.show_invalid_input_error_dialog() |
147 | 147 | ||
148 | def show_invalid_input_error_dialog(self): | 148 | def show_invalid_input_error_dialog(self): |
149 | lbl = "<b>Invalid characters in image recipe name</b>\n" | 149 | lbl = "<b>Invalid characters in image recipe name</b>" |
150 | msg = "Image recipe names should be all lowercase and\n" | 150 | msg = "Image recipe names should be all lowercase and\n" |
151 | msg += "include only alphanumeric characters. The only\n" | 151 | msg += "include only alphanumeric characters. The only\n" |
152 | msg += "special character you can use is the ASCII hyphen (-)." | 152 | msg += "special character you can use is the ASCII hyphen (-)." |
153 | lbl = lbl + "\n%s\n" % glib.markup_escape_text(msg) | 153 | dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_ERROR, msg) |
154 | dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) | ||
155 | button = dialog.add_button("Close", gtk.RESPONSE_OK) | 154 | button = dialog.add_button("Close", gtk.RESPONSE_OK) |
156 | HobButton.style_button(button) | 155 | HobButton.style_button(button) |
157 | 156 | ||
diff --git a/bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py b/bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py index 4a7cfad52c..ab5b614c8d 100644 --- a/bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py +++ b/bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py | |||
@@ -212,13 +212,12 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
212 | def response_cb(self, dialog, response_id): | 212 | def response_cb(self, dialog, response_id): |
213 | if response_id == gtk.RESPONSE_YES: | 213 | if response_id == gtk.RESPONSE_YES: |
214 | if self.proxy_checkbox.get_active(): | 214 | if self.proxy_checkbox.get_active(): |
215 | # Check that all proxy entries have a corresponding port | 215 | # Check that all proxy entries have a corresponding port |
216 | for proxy, port in zip(self.all_proxy_addresses, self.all_proxy_ports): | 216 | for proxy, port in zip(self.all_proxy_addresses, self.all_proxy_ports): |
217 | if proxy.get_text() and not port.get_text(): | 217 | if proxy.get_text() and not port.get_text(): |
218 | lbl = "<b>Enter all port numbers</b>\n\n" | 218 | lbl = "<b>Enter all port numbers</b>" |
219 | msg = "Proxy servers require a port number. Please make sure " | 219 | msg = "Proxy servers require a port number. Please make sure you have entered a port number for each proxy server." |
220 | msg += "you have entered a port number for each proxy server." | 220 | dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_WARNING, msg) |
221 | dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING, msg) | ||
222 | button = dialog.add_button("Close", gtk.RESPONSE_OK) | 221 | button = dialog.add_button("Close", gtk.RESPONSE_OK) |
223 | HobButton.style_button(button) | 222 | HobButton.style_button(button) |
224 | response = dialog.run() | 223 | response = dialog.run() |