aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdan Marinescu <bogdan.a.marinescu@intel.com>2012-09-27 17:13:45 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-27 16:39:24 +0100
commitb45438555ecf2e25ebb99324a18d31c812a2738a (patch)
tree032cda6fd6341b585aef47cadd2108011ff13421
parentd11fe38a38adc10eedec3b4c251c575b95339774 (diff)
downloadbitbake-b45438555ecf2e25ebb99324a18d31c812a2738a.tar.gz
Multiple user interface fixes in settings
1. Move the "Others" tab from advanced settings to simple settings 2. Organize content of tabs into headings 3. Match various labels in the settings with the design 4. Clean up config_md5 in both simple and advanced settings This patch implements a part of the changes requested by Belen in the settings dialogs. The second version of the patch addresses all the UI changes requested by Belen (more details are in the bug description): alphabetical ordering of the image types and warnings if no image type is selected. [YOCTO #2162] Signed-off-by: Bogdan Marinescu <bogdan.a.marinescu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xlib/bb/ui/crumbs/builder.py1
-rw-r--r--lib/bb/ui/crumbs/hig.py203
2 files changed, 150 insertions, 54 deletions
diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
index 357089d7c..b84716503 100755
--- a/lib/bb/ui/crumbs/builder.py
+++ b/lib/bb/ui/crumbs/builder.py
@@ -1283,6 +1283,7 @@ class Builder(gtk.Window):
HobAltButton.style_button(button)
button = dialog.add_button("Save", gtk.RESPONSE_YES)
HobButton.style_button(button)
+ dialog.set_save_button(button)
response = dialog.run()
settings_changed = False
if response == gtk.RESPONSE_YES:
diff --git a/lib/bb/ui/crumbs/hig.py b/lib/bb/ui/crumbs/hig.py
index f52510c55..bdb3702e2 100644
--- a/lib/bb/ui/crumbs/hig.py
+++ b/lib/bb/ui/crumbs/hig.py
@@ -313,14 +313,6 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
def config_md5(self):
data = ""
- data += ("PACKAGE_CLASSES: " + self.configuration.curr_package_format + '\n')
- data += ("DISTRO: " + self._get_sorted_value(self.configuration.curr_distro))
- data += ("IMAGE_ROOTFS_SIZE: " + self._get_sorted_value(self.configuration.image_rootfs_size))
- data += ("IMAGE_EXTRA_SIZE: " + self._get_sorted_value(self.configuration.image_extra_size))
- data += ("INCOMPATIBLE_LICENSE: " + self._get_sorted_value(self.configuration.incompat_license))
- data += ("SDK_MACHINE: " + self._get_sorted_value(self.configuration.curr_sdk_machine))
- data += ("TOOLCHAIN_BUILD: " + self._get_sorted_value(self.configuration.toolchain_build))
- data += ("IMAGE_FSTYPES: " + self._get_sorted_value(self.configuration.image_fstypes))
data += ("ENABLE_PROXY: " + self._get_sorted_value(self.configuration.enable_proxy))
if self.configuration.enable_proxy:
for protocol in self.configuration.proxies.keys():
@@ -448,6 +440,14 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
self.configuration.split_proxy("git", self.git_proxy.get_text() + ":" + self.git_proxy_port.get_text())
self.configuration.split_proxy("cvs", self.cvs_proxy.get_text() + ":" + self.cvs_proxy_port.get_text())
+ self.configuration.extra_setting = {}
+ it = self.setting_store.get_iter_first()
+ while it:
+ key = self.setting_store.get_value(it, 0)
+ value = self.setting_store.get_value(it, 1)
+ self.configuration.extra_setting[key] = value
+ it = self.setting_store.iter_next(it)
+
md5 = self.config_md5()
self.settings_changed = (self.md5 != md5)
@@ -455,9 +455,10 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
advanced_vbox = gtk.VBox(False, 6)
advanced_vbox.set_border_width(6)
+ advanced_vbox.pack_start(self.gen_label_widget('<span weight="bold">Parallel threads</span>'), expand=False, fill=False)
sub_vbox = gtk.VBox(False, 6)
advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
- label = self.gen_label_widget("<span weight=\"bold\">BB number threads:</span>")
+ label = self.gen_label_widget("BitBake parallel threads")
tooltip = "Sets the number of threads that BitBake tasks can simultaneously run. See the <a href=\""
tooltip += "http://www.yoctoproject.org/docs/current/poky-ref-manual/"
tooltip += "poky-ref-manual.html#var-BB_NUMBER_THREADS\">Poky reference manual</a> for information"
@@ -467,7 +468,7 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
sub_vbox = gtk.VBox(False, 6)
advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
- label = self.gen_label_widget("<span weight=\"bold\">Parallel make:</span>")
+ label = self.gen_label_widget("Make parallel threads")
tooltip = "Sets the maximum number of threads the host can use during the build. See the <a href=\""
tooltip += "http://www.yoctoproject.org/docs/current/poky-ref-manual/"
tooltip += "poky-ref-manual.html#var-PARALLEL_MAKE\">Poky reference manual</a> for information"
@@ -475,9 +476,10 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
sub_vbox.pack_start(label, expand=False, fill=False)
sub_vbox.pack_start(pmake_widget, expand=False, fill=False)
+ advanced_vbox.pack_start(self.gen_label_widget('<span weight="bold">Cache directories and mirror</span>'), expand=False, fill=False)
sub_vbox = gtk.VBox(False, 6)
advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
- label = self.gen_label_widget("<span weight=\"bold\">Select download directory:</span>")
+ label = self.gen_label_widget("Download directory")
tooltip = "Select a folder that caches the upstream project source code"
dldir_widget, self.dldir_text = self.gen_entry_widget(self.configuration.dldir, self, tooltip)
sub_vbox.pack_start(label, expand=False, fill=False)
@@ -723,7 +725,7 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
if iter:
path = model.get_path(iter)[0]
model.remove(iter)
-
+
def gen_editable_settings(self, setting, tooltip=""):
setting_hbox = gtk.HBox(False, 12)
@@ -786,6 +788,102 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
return setting_hbox, setting_store
+ def create_others_page(self):
+ advanced_vbox = gtk.VBox(False, 6)
+ advanced_vbox.set_border_width(6)
+
+ sub_vbox = gtk.VBox(False, 6)
+ advanced_vbox.pack_start(sub_vbox, expand=True, fill=True)
+ label = self.gen_label_widget("<span weight=\"bold\">Add your own variables:</span>")
+ tooltip = "These are key/value pairs for your extra settings. Click \'Add\' and then directly edit the key and the value"
+ setting_widget, self.setting_store = self.gen_editable_settings(self.configuration.extra_setting, tooltip)
+ sub_vbox.pack_start(label, expand=False, fill=False)
+ sub_vbox.pack_start(setting_widget, expand=True, fill=True)
+
+ return advanced_vbox
+
+ def create_visual_elements(self):
+ self.nb = gtk.Notebook()
+ self.nb.set_show_tabs(True)
+ self.nb.append_page(self.create_build_environment_page(), gtk.Label("Build environment"))
+ self.nb.append_page(self.create_proxy_page(), gtk.Label("Proxies"))
+ self.nb.append_page(self.create_others_page(), gtk.Label("Others"))
+ self.nb.set_current_page(0)
+ self.vbox.pack_start(self.nb, expand=True, fill=True)
+ self.vbox.pack_end(gtk.HSeparator(), expand=True, fill=True)
+
+ self.show_all()
+
+
+#
+# AdvancedSettings Dialog
+#
+class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
+
+ def details_cb(self, button, parent, protocol):
+ dialog = ProxyDetailsDialog(title = protocol.upper() + " Proxy Details",
+ user = self.configuration.proxies[protocol][1],
+ passwd = self.configuration.proxies[protocol][2],
+ parent = parent,
+ flags = gtk.DIALOG_MODAL
+ | gtk.DIALOG_DESTROY_WITH_PARENT
+ | gtk.DIALOG_NO_SEPARATOR)
+ dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_OK)
+ response = dialog.run()
+ if response == gtk.RESPONSE_OK:
+ self.configuration.proxies[protocol][1] = dialog.user
+ self.configuration.proxies[protocol][2] = dialog.passwd
+ self.refresh_proxy_components()
+ dialog.destroy()
+
+ def set_save_button(self, button):
+ self.save_button = button
+
+ def rootfs_combo_changed_cb(self, rootfs_combo, all_package_format, check_hbox):
+ combo_item = self.rootfs_combo.get_active_text()
+ for child in check_hbox.get_children():
+ if isinstance(child, gtk.CheckButton):
+ check_hbox.remove(child)
+ for format in all_package_format:
+ if format != combo_item:
+ check_button = gtk.CheckButton(format)
+ check_hbox.pack_start(check_button, expand=False, fill=False)
+ check_hbox.show_all()
+
+ def gen_pkgfmt_widget(self, curr_package_format, all_package_format, tooltip_combo="", tooltip_extra=""):
+ pkgfmt_vbox = gtk.VBox(False, 6)
+
+ label = self.gen_label_widget("Root file system package format")
+ pkgfmt_vbox.pack_start(label, expand=False, fill=False)
+
+ rootfs_format = ""
+ if curr_package_format:
+ rootfs_format = curr_package_format.split()[0]
+
+ rootfs_format_widget, rootfs_combo = self.gen_combo_widget(rootfs_format, all_package_format, tooltip_combo)
+ pkgfmt_vbox.pack_start(rootfs_format_widget, expand=False, fill=False)
+
+ label = self.gen_label_widget("Additional package formats")
+ pkgfmt_vbox.pack_start(label, expand=False, fill=False)
+
+ check_hbox = gtk.HBox(False, 12)
+ pkgfmt_vbox.pack_start(check_hbox, expand=False, fill=False)
+ for format in all_package_format:
+ if format != rootfs_format:
+ check_button = gtk.CheckButton(format)
+ is_active = (format in curr_package_format.split())
+ check_button.set_active(is_active)
+ check_hbox.pack_start(check_button, expand=False, fill=False)
+
+ info = HobInfoButton(tooltip_extra, self)
+ check_hbox.pack_start(info, expand=False, fill=False)
+
+ rootfs_combo.connect("changed", self.rootfs_combo_changed_cb, all_package_format, check_hbox)
+
+ pkgfmt_vbox.show_all()
+
+ return pkgfmt_vbox, rootfs_combo, check_hbox
+
def __init__(self, title, configuration, all_image_types,
all_package_formats, all_distros, all_sdk_machines,
max_threads, parent, flags, buttons=None):
@@ -811,13 +909,13 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
self.extra_size_spinner = None
self.gplv3_checkbox = None
self.toolchain_checkbox = None
- self.setting_store = None
self.image_types_checkbuttons = {}
self.md5 = self.config_md5()
self.settings_changed = False
# create visual elements on the dialog
+ self.save_button = None
self.create_visual_elements()
self.connect("response", self.response_cb)
@@ -834,12 +932,6 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
data += ("SDK_MACHINE: " + self._get_sorted_value(self.configuration.curr_sdk_machine))
data += ("TOOLCHAIN_BUILD: " + self._get_sorted_value(self.configuration.toolchain_build))
data += ("IMAGE_FSTYPES: " + self._get_sorted_value(self.configuration.image_fstypes))
- data += ("ENABLE_PROXY: " + self._get_sorted_value(self.configuration.enable_proxy))
- if self.configuration.enable_proxy:
- for protocol in self.configuration.proxies.keys():
- data += (protocol + ": " + self._get_sorted_value(self.configuration.combine_proxy(protocol)))
- for key in self.configuration.extra_setting.keys():
- data += (key + ": " + self._get_sorted_value(self.configuration.extra_setting[key]))
return hashlib.md5(data).hexdigest()
def create_visual_elements(self):
@@ -847,13 +939,34 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
self.nb.set_show_tabs(True)
self.nb.append_page(self.create_image_types_page(), gtk.Label("Image types"))
self.nb.append_page(self.create_output_page(), gtk.Label("Output"))
- self.nb.append_page(self.create_others_page(), gtk.Label("Others"))
self.nb.set_current_page(0)
self.vbox.pack_start(self.nb, expand=True, fill=True)
self.vbox.pack_end(gtk.HSeparator(), expand=True, fill=True)
self.show_all()
+ def get_num_checked_image_types(self):
+ total = 0
+ for b in self.image_types_checkbuttons.values():
+ if b.get_active():
+ total = total + 1
+ return total
+
+ def set_save_button_state(self):
+ if self.save_button:
+ self.save_button.set_sensitive(self.get_num_checked_image_types() > 0)
+
+ def image_type_checkbutton_clicked_cb(self, button):
+ self.set_save_button_state()
+ if self.get_num_checked_image_types() == 0:
+ # Show an error dialog
+ lbl = "<b>Select an image type</b>\n\nYou need to select at least one image type."
+ dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING)
+ button = dialog.add_button("OK", gtk.RESPONSE_OK)
+ HobButton.style_button(button)
+ response = dialog.run()
+ dialog.destroy()
+
def create_image_types_page(self):
main_vbox = gtk.VBox(False, 16)
main_vbox.set_border_width(6)
@@ -862,7 +975,7 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
advanced_vbox.set_border_width(6)
distro_vbox = gtk.VBox(False, 6)
- label = self.gen_label_widget("<span weight=\"bold\">Distro:</span>")
+ label = self.gen_label_widget("Distro:")
tooltip = "Selects the Yocto Project distribution you want"
distro_widget, self.distro_combo = self.gen_combo_widget(self.configuration.curr_distro, self.all_distros, tooltip)
distro_vbox.pack_start(label, expand=False, fill=False)
@@ -876,19 +989,22 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
tooltip = "Image file system types you want."
info = HobInfoButton(tooltip, self)
- label = self.gen_label_widget("<span weight=\"bold\">Select image types:</span>")
- table.attach(label, 0, 9, 0, 1)
- table.attach(info, 9, 10, 0, 1)
+ label = self.gen_label_widget("Image types:")
+ align = gtk.Alignment(0, 0.5, 0, 0)
+ table.attach(align, 0, 4, 0, 1)
+ align.add(label)
+ table.attach(info, 4, 5, 0, 1)
i = 1
j = 1
- for image_type in self.image_types:
+ for image_type in sorted(self.image_types):
self.image_types_checkbuttons[image_type] = gtk.CheckButton(image_type)
+ self.image_types_checkbuttons[image_type].connect("toggled", self.image_type_checkbutton_clicked_cb)
article = ""
if image_type.startswith(("a", "e", "i", "o", "u")):
article = "n"
self.image_types_checkbuttons[image_type].set_tooltip_text("Build a%s %s image" % (article, image_type))
- table.attach(self.image_types_checkbuttons[image_type], j, j + 4, i, i + 1)
+ table.attach(self.image_types_checkbuttons[image_type], j - 1, j + 3, i, i + 1)
if image_type in self.configuration.image_fstypes.split():
self.image_types_checkbuttons[image_type].set_active(True)
i += 1
@@ -897,6 +1013,7 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
j = j + 4
main_vbox.pack_start(advanced_vbox, expand=False, fill=False)
+ self.set_save_button_state()
return main_vbox
@@ -904,18 +1021,18 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
advanced_vbox = gtk.VBox(False, 6)
advanced_vbox.set_border_width(6)
+ advanced_vbox.pack_start(self.gen_label_widget('<span weight="bold">Package format</span>'), expand=False, fill=False)
sub_vbox = gtk.VBox(False, 6)
advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
- label = self.gen_label_widget("<span weight=\"bold\">Packaging format:</span>")
tooltip_combo = "Selects the package format used to generate rootfs."
tooltip_extra = "Selects extra package formats to build"
pkgfmt_widget, self.rootfs_combo, self.check_hbox = self.gen_pkgfmt_widget(self.configuration.curr_package_format, self.all_package_formats, tooltip_combo, tooltip_extra)
- sub_vbox.pack_start(label, expand=False, fill=False)
sub_vbox.pack_start(pkgfmt_widget, expand=False, fill=False)
+ advanced_vbox.pack_start(self.gen_label_widget('<span weight="bold">Image size</span>'), expand=False, fill=False)
sub_vbox = gtk.VBox(False, 6)
advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
- label = self.gen_label_widget("<span weight=\"bold\">Image rootfs size: (MB)</span>")
+ label = self.gen_label_widget("Image basic size (in MB)")
tooltip = "Sets the basic size of your target image.\nThis is the basic size of your target image unless your selected package size exceeds this value or you select \'Image Extra Size\'."
rootfs_size_widget, self.rootfs_size_spinner = self.gen_spinner_widget(int(self.configuration.image_rootfs_size*1.0/1024), 0, 65536, tooltip)
sub_vbox.pack_start(label, expand=False, fill=False)
@@ -923,12 +1040,13 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
sub_vbox = gtk.VBox(False, 6)
advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
- label = self.gen_label_widget("<span weight=\"bold\">Image extra size: (MB)</span>")
+ label = self.gen_label_widget("Additional free space (in MB)")
tooltip = "Sets the extra free space of your target image.\nBy default, the system reserves 30% of your image size as free space. If your image contains zypper, it brings in 50MB more space. The maximum free space is 64GB."
extra_size_widget, self.extra_size_spinner = self.gen_spinner_widget(int(self.configuration.image_extra_size*1.0/1024), 0, 65536, tooltip)
sub_vbox.pack_start(label, expand=False, fill=False)
sub_vbox.pack_start(extra_size_widget, expand=False, fill=False)
+ advanced_vbox.pack_start(self.gen_label_widget('<span weight="bold">Licensing</span>'), expand=False, fill=False)
self.gplv3_checkbox = gtk.CheckButton("Exclude GPLv3 packages")
self.gplv3_checkbox.set_tooltip_text("Check this box to prevent GPLv3 packages from being included in your image")
if "GPLv3" in self.configuration.incompat_license.split():
@@ -937,6 +1055,7 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
self.gplv3_checkbox.set_active(False)
advanced_vbox.pack_start(self.gplv3_checkbox, expand=False, fill=False)
+ advanced_vbox.pack_start(self.gen_label_widget('<span weight="bold">Toolchain</span>'), expand=False, fill=False)
sub_hbox = gtk.HBox(False, 6)
advanced_vbox.pack_start(sub_hbox, expand=False, fill=False)
self.toolchain_checkbox = gtk.CheckButton("Build toolchain")
@@ -950,21 +1069,6 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
return advanced_vbox
- def create_others_page(self):
- advanced_vbox = gtk.VBox(False, 6)
- advanced_vbox.set_border_width(6)
-
- sub_vbox = gtk.VBox(False, 6)
- advanced_vbox.pack_start(sub_vbox, expand=True, fill=True)
- label = self.gen_label_widget("<span weight=\"bold\">Add your own variables:</span>")
- tooltip = "These are key/value pairs for your extra settings. Click \'Add\' and then directly edit the key and the value"
- setting_widget, self.setting_store = self.gen_editable_settings(self.configuration.extra_setting, tooltip)
- sub_vbox.pack_start(label, expand=False, fill=False)
- sub_vbox.pack_start(setting_widget, expand=True, fill=True)
-
- return advanced_vbox
-
-
def response_cb(self, dialog, response_id):
package_format = []
package_format.append(self.rootfs_combo.get_active_text())
@@ -993,15 +1097,6 @@ class AdvancedSettingDialog (CrumbsDialog, SettingsUIHelper):
self.configuration.incompat_license = self.configuration.incompat_license.strip()
self.configuration.toolchain_build = self.toolchain_checkbox.get_active()
-
- self.configuration.extra_setting = {}
- it = self.setting_store.get_iter_first()
- while it:
- key = self.setting_store.get_value(it, 0)
- value = self.setting_store.get_value(it, 1)
- self.configuration.extra_setting[key] = value
- it = self.setting_store.iter_next(it)
-
self.configuration.curr_sdk_machine = self.sdk_machine_combo.get_active_text()
md5 = self.config_md5()
self.settings_changed = (self.md5 != md5)