diff options
author | Liming An <limingx.l.an@intel.com> | 2012-06-04 18:52:13 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-06-08 12:03:12 +0100 |
commit | d548eb8a03cfba5c64c018898972bc0a0bdb280c (patch) | |
tree | 334d9800bfcd84c3bd804d5694c7169b4ce21040 /lib/bb/ui/crumbs/builder.py | |
parent | fb82f6eb5405274f702bd6d64cbe995fd4b74145 (diff) | |
download | bitbake-d548eb8a03cfba5c64c018898972bc0a0bdb280c.tar.gz |
Hob: Change 'run image' work flow and image detail screen as ui design
Added the qemu_image_kernel selection view box to image detail screen GUI, and
changed the 'run image' button clicked work flow.
[YOCTO #2155]
Signed-off-by: Liming An <limingx.l.an@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/ui/crumbs/builder.py')
-rwxr-xr-x | lib/bb/ui/crumbs/builder.py | 118 |
1 files changed, 51 insertions, 67 deletions
diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py index 7861a6fba..ad9c0f458 100755 --- a/lib/bb/ui/crumbs/builder.py +++ b/lib/bb/ui/crumbs/builder.py @@ -303,6 +303,7 @@ class Parameters: self.tmpdir = params["tmpdir"] self.image_white_pattern = params["image_white_pattern"] self.image_black_pattern = params["image_black_pattern"] + self.kernel_image_type = params["kernel_image_type"] # for build log to show self.bb_version = params["bb_version"] self.target_arch = params["target_arch"] @@ -1160,25 +1161,32 @@ class Builder(gtk.Window): response = dialog.run() dialog.destroy() - def get_kernel_file_name(self): - name_list = [] - kernel_name = "" - image_path = self.parameters.image_addr - if image_path: - files = [f for f in os.listdir(image_path) if f[0] <> '.'] - for check_file in files: - if check_file.endswith(".bin"): - name_splits = check_file.split(".")[0] - if self.configuration.curr_mach in name_splits.split("-"): - kernel_name = check_file - if not os.path.islink(os.path.join(image_path, check_file)): - name_list.append(check_file) - - return kernel_name, len(name_list) - - def runqemu_image(self, image_name): - if not image_name: - lbl = "<b>Please select an image to launch in QEMU.</b>" + def show_load_kernel_dialog(self): + dialog = gtk.FileChooserDialog("Load Kernel Files", self, + gtk.FILE_CHOOSER_ACTION_SAVE) + button = dialog.add_button("Cancel", gtk.RESPONSE_NO) + HobAltButton.style_button(button) + button = dialog.add_button("Open", gtk.RESPONSE_YES) + HobButton.style_button(button) + filter = gtk.FileFilter() + filter.set_name("Kernel Files") + filter.add_pattern("*.bin") + dialog.add_filter(filter) + + dialog.set_current_folder(self.parameters.image_addr) + + response = dialog.run() + kernel_path = "" + if response == gtk.RESPONSE_YES: + kernel_path = dialog.get_filename() + + dialog.destroy() + + return kernel_path + + def runqemu_image(self, image_name, kernel_name): + if not image_name or not kernel_name: + lbl = "<b>Please select an %s to launch in QEMU.</b>" % ("kernel" if image_name else "image") dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) @@ -1186,57 +1194,33 @@ class Builder(gtk.Window): dialog.destroy() return - kernel_name, kernels_number = self.get_kernel_file_name() - if not kernel_name or kernels_number > 1: - dialog = gtk.FileChooserDialog("Load Kernel Files", self, - gtk.FILE_CHOOSER_ACTION_SAVE) - button = dialog.add_button("Cancel", gtk.RESPONSE_NO) - HobAltButton.style_button(button) - button = dialog.add_button("Open", gtk.RESPONSE_YES) - HobButton.style_button(button) - filter = gtk.FileFilter() - filter.set_name("Kernel Files") - filter.add_pattern("*.bin") - dialog.add_filter(filter) - - dialog.set_current_folder(self.parameters.image_addr) + kernel_path = os.path.join(self.parameters.image_addr, kernel_name) + image_path = os.path.join(self.parameters.image_addr, image_name) - response = dialog.run() - if response == gtk.RESPONSE_YES: - kernel_path = dialog.get_filename() - image_path = os.path.join(self.parameters.image_addr, image_name) + source_env_path = os.path.join(self.parameters.core_base, "oe-init-build-env") + tmp_path = self.parameters.tmpdir + cmdline = bb.ui.crumbs.utils.which_terminal() + if os.path.exists(image_path) and os.path.exists(kernel_path) \ + and os.path.exists(source_env_path) and os.path.exists(tmp_path) \ + and cmdline: + cmdline += "\' bash -c \"export OE_TMPDIR=" + tmp_path + "; " + cmdline += "source " + source_env_path + " " + os.getcwd() + "; " + cmdline += "runqemu " + kernel_path + " " + image_path + "\"\'" + subprocess.Popen(shlex.split(cmdline)) + else: + lbl = "<b>Path error</b>\nOne of your paths is wrong," + lbl = lbl + " please make sure the following paths exist:\n" + lbl = lbl + "image path:" + image_path + "\n" + lbl = lbl + "kernel path:" + kernel_path + "\n" + lbl = lbl + "source environment path:" + source_env_path + "\n" + lbl = lbl + "tmp path: " + tmp_path + "." + lbl = lbl + "You may be missing either xterm or vte for terminal services." + dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) + button = dialog.add_button("Close", gtk.RESPONSE_OK) + HobButton.style_button(button) + dialog.run() dialog.destroy() - elif kernel_name: - kernel_path = os.path.join(self.parameters.image_addr, kernel_name) - image_path = os.path.join(self.parameters.image_addr, image_name) - response = gtk.RESPONSE_YES - - if response == gtk.RESPONSE_YES: - source_env_path = os.path.join(self.parameters.core_base, "oe-init-build-env") - tmp_path = self.parameters.tmpdir - cmdline = bb.ui.crumbs.utils.which_terminal() - if os.path.exists(image_path) and os.path.exists(kernel_path) \ - and os.path.exists(source_env_path) and os.path.exists(tmp_path) \ - and cmdline: - cmdline += "\' bash -c \"export OE_TMPDIR=" + tmp_path + "; " - cmdline += "source " + source_env_path + " " + os.getcwd() + "; " - cmdline += "runqemu " + kernel_path + " " + image_path + "\"\'" - subprocess.Popen(shlex.split(cmdline)) - else: - lbl = "<b>Path error</b>\nOne of your paths is wrong," - lbl = lbl + " please make sure the following paths exist:\n" - lbl = lbl + "image path:" + image_path + "\n" - lbl = lbl + "kernel path:" + kernel_path + "\n" - lbl = lbl + "source environment path:" + source_env_path + "\n" - lbl = lbl + "tmp path: " + tmp_path + "." - lbl = lbl + "You may be missing either xterm or vte for terminal services." - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) - button = dialog.add_button("Close", gtk.RESPONSE_OK) - HobButton.style_button(button) - dialog.run() - dialog.destroy() - def show_packages(self, ask=True): _, selected_recipes = self.recipe_model.get_selected_recipes() if selected_recipes and ask: |