def handler_no_provider_cb(self, running_build, msg): dialog = CrumbsMessageDialog(self, msg, gtk.STOCK_DIALOG_INFO) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run() dialog.destroy() self.build_failed()
def show_load_my_images_dialog(self): dialog = ImageSelectionDialog(self.parameters.image_addr, self.parameters.image_types, "Open My Images", 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) response = dialog.run() if response == gtk.RESPONSE_YES: if not dialog.image_names: lbl = "<b>No selections made</b>\nYou have not made any selections" crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) crumbs_dialog.run() crumbs_dialog.destroy() dialog.destroy() return self.parameters.image_addr = dialog.image_folder self.parameters.image_names = dialog.image_names[:] self.switch_page(self.MY_IMAGE_OPENED) dialog.destroy()
def stop_build(self): if self.stopping: lbl = "<b>Force Stop build?</b>\nYou've already selected Stop once," lbl = lbl + " would you like to 'Force Stop' the build?\n\n" lbl = lbl + "This will stop the build as quickly as possible but may" lbl = lbl + " well leave your build directory in an unusable state" lbl = lbl + " that requires manual steps to fix.\n" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) dialog.add_button("Force Stop", gtk.RESPONSE_YES) else: lbl = "<b>Stop build?</b>\n\nAre you sure you want to stop this" lbl = lbl + " build?\n\n'Force Stop' will stop the build as quickly as" lbl = lbl + " possible but may well leave your build directory in an" lbl = lbl + " unusable state that requires manual steps to fix.\n\n" lbl = lbl + "'Stop' will stop the build as soon as all in" lbl = lbl + " progress build tasks are finished. However if a" lbl = lbl + " lengthy compilation phase is in progress this may take" lbl = lbl + " some time." dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) dialog.add_button("Stop", gtk.RESPONSE_OK) dialog.add_button("Force Stop", gtk.RESPONSE_YES) response = dialog.run() dialog.destroy() if response != gtk.RESPONSE_CANCEL: self.stopping = True if response == gtk.RESPONSE_OK: self.handler.cancel_build() elif response == gtk.RESPONSE_YES: self.handler.cancel_build(True)
def show_load_my_images_dialog(self): dialog = ImageSelectionDialog( self.parameters.image_addr, self.parameters.image_types, "Open My Images", 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) response = dialog.run() if response == gtk.RESPONSE_YES: if not dialog.image_names: lbl = "<b>No selections made</b>\nYou have not made any selections" crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) crumbs_dialog.run() crumbs_dialog.destroy() dialog.destroy() return self.parameters.image_addr = dialog.image_folder self.parameters.image_names = dialog.image_names[:] self.switch_page(self.MY_IMAGE_OPENED) dialog.destroy()
def show_error_dialog(self, msg): lbl = "<b>Error</b>\n" lbl = lbl + "%s\n\n" % msg dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) response = dialog.run() dialog.destroy()
def handler_command_failed_cb(self, handler, msg): lbl = "<b>Error</b>\n" lbl = lbl + "%s\n\n" % msg dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) response = dialog.run() dialog.destroy() self.handler.clear_busy() self.configuration.curr_mach = None self.image_configuration_page.switch_machine_combo() self.switch_page(self.MACHINE_SELECTION)
def build_image(self): selected_packages = self.package_model.get_selected_packages() if not selected_packages: lbl = "<b>No selections made</b>\nYou have not made any selections" lbl = lbl + " so there isn't anything to bake at this time." dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) dialog.run() dialog.destroy() return self.switch_page(self.IMAGE_GENERATING)
def build_image(self): selected_packages = self.package_model.get_selected_packages() if not selected_packages: lbl = "<b>No selections made</b>\nYou have not made any selections" lbl = lbl + " so there isn't anything to bake at this time." dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run() dialog.destroy() return self.generate_image_async()
def destroy_window_cb(self, widget, event): lbl = "<b>Do you really want to exit the Hob image creator?</b>" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) dialog.add_button("Keep using Hob", gtk.RESPONSE_NO) dialog.add_button("Exit Hob", gtk.RESPONSE_YES) dialog.set_default_response(gtk.RESPONSE_YES) response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_YES: gtk.main_quit() return False else: return True
def just_bake(self): selected_image = self.recipe_model.get_selected_image() selected_packages = self.package_model.get_selected_packages() or [] # If no base image and no selected packages don't build anything if not (selected_packages or selected_image != self.recipe_model.__dummy_image__): lbl = "<b>No selections made</b>\nYou have not made any selections" lbl = lbl + " so there isn't anything to bake at this time." dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) dialog.run() dialog.destroy() return self.switch_page(self.FAST_IMAGE_GENERATING)
def just_bake(self): selected_image = self.recipe_model.get_selected_image() selected_packages = self.package_model.get_selected_packages() or [] # If no base image and no selected packages don't build anything if not (selected_packages or selected_image != self.recipe_model.__dummy_image__): lbl = "<b>No selections made</b>\nYou have not made any selections" lbl = lbl + " so there isn't anything to bake at this time." dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run() dialog.destroy() return self.fast_generate_image_async()
def show_packages(self, ask=True): _, selected_recipes = self.recipe_model.get_selected_recipes() if selected_recipes and ask: lbl = "<b>Package list may be incomplete!</b>\nDo you want to build selected recipes" lbl = lbl + " to get a full list (Yes) or just view the existing packages (No)?" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) dialog.add_button(gtk.STOCK_NO, gtk.RESPONSE_NO) dialog.add_button(gtk.STOCK_YES, gtk.RESPONSE_YES) dialog.set_default_response(gtk.RESPONSE_YES) response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_YES: self.switch_page(self.PACKAGE_GENERATING) else: self.switch_page(self.PACKAGE_SELECTION) else: self.switch_page(self.PACKAGE_SELECTION)
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) HobAltButton.style_button(button) button = dialog.add_button("Exit Hob", gtk.RESPONSE_YES) HobButton.style_button(button) dialog.set_default_response(gtk.RESPONSE_YES) response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_YES: gtk.main_quit() return False else: return True
def show_packages(self, ask=True): _, selected_recipes = self.recipe_model.get_selected_recipes() if selected_recipes and ask: lbl = "<b>Package list may be incomplete!</b>\nDo you want to build selected recipes" lbl = lbl + " to get a full list or just view the existing packages?" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = dialog.add_button("View packages", gtk.RESPONSE_NO) HobAltButton.style_button(button) button = dialog.add_button("Build packages", gtk.RESPONSE_YES) HobButton.style_button(button) dialog.set_default_response(gtk.RESPONSE_YES) response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_YES: self.generate_packages_async() else: self.switch_page(self.PACKAGE_SELECTION) else: self.switch_page(self.PACKAGE_SELECTION)
def deploy_image(self, image_name): if not image_name: lbl = "<b>Please select an image to deploy.</b>" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) dialog.run() dialog.destroy() return image_path = os.path.join(self.parameters.image_addr, image_name) dialog = DeployImageDialog(title = "Usb Image Maker", image_path = image_path, parent = self, flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR, buttons = ("Close", gtk.RESPONSE_NO, "Make usb image", gtk.RESPONSE_YES)) response = dialog.run() dialog.destroy()
def runqemu_image(self, image_name): if not image_name: lbl = "<b>Please select an image to launch in QEMU.</b>" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run() dialog.destroy() return kernel_name, kernels_number = self.get_kernel_file_name(self.parameters.image_addr) 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) response = dialog.run() if response == gtk.RESPONSE_YES: kernel_path = dialog.get_filename() image_path = os.path.join(self.parameters.image_addr, image_name) 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 deploy_image(self, image_name): if not image_name: lbl = "<b>Please select an image to deploy.</b>" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run() dialog.destroy() return image_path = os.path.join(self.parameters.image_addr, image_name) dialog = DeployImageDialog(title="Usb Image Maker", image_path=image_path, parent=self, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR) button = dialog.add_button("Close", gtk.RESPONSE_NO) HobAltButton.style_button(button) button = dialog.add_button("Make usb image", gtk.RESPONSE_YES) HobButton.style_button(button) response = dialog.run() dialog.destroy()
def stop_build(self): if self.stopping: lbl = "<b>Force Stop build?</b>\nYou've already selected Stop once," lbl = lbl + " would you like to 'Force Stop' the build?\n\n" lbl = lbl + "This will stop the build as quickly as possible but may" lbl = lbl + " well leave your build directory in an unusable state" lbl = lbl + " that requires manual steps to fix.\n" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) button = dialog.add_button("Cancel", gtk.RESPONSE_CANCEL) HobAltButton.style_button(button) button = dialog.add_button("Force Stop", gtk.RESPONSE_YES) HobButton.style_button(button) else: lbl = "<b>Stop build?</b>\n\nAre you sure you want to stop this" lbl = lbl + " build?\n\n'Force Stop' will stop the build as quickly as" lbl = lbl + " possible but may well leave your build directory in an" lbl = lbl + " unusable state that requires manual steps to fix.\n\n" lbl = lbl + "'Stop' will stop the build as soon as all in" lbl = lbl + " progress build tasks are finished. However if a" lbl = lbl + " lengthy compilation phase is in progress this may take" lbl = lbl + " some time." dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) button = dialog.add_button("Cancel", gtk.RESPONSE_CANCEL) HobAltButton.style_button(button) button = dialog.add_button("Stop", gtk.RESPONSE_OK) HobAltButton.style_button(button) button = dialog.add_button("Force Stop", gtk.RESPONSE_YES) HobButton.style_button(button) response = dialog.run() dialog.destroy() if response != gtk.RESPONSE_CANCEL: self.stopping = True if response == gtk.RESPONSE_OK: self.cancel_build_sync() elif response == gtk.RESPONSE_YES: self.cancel_build_sync(True)
def runqemu_image(self, image_name): if not image_name: lbl = "<b>Please select an image to launch in QEMU.</b>" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run() dialog.destroy() return 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() if response == gtk.RESPONSE_YES: kernel_path = dialog.get_filename() image_path = os.path.join(self.parameters.image_addr, image_name) dialog.destroy() 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 runqemu_image(self, image_name): if not image_name: lbl = "<b>Please select an image to launch in QEMU.</b>" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) dialog.run() dialog.destroy() return dialog = gtk.FileChooserDialog("Load Kernel Files", self, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_NO, gtk.STOCK_OPEN, gtk.RESPONSE_YES)) 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() if response == gtk.RESPONSE_YES: kernel_path = dialog.get_filename() image_path = os.path.join(self.parameters.image_addr, image_name) dialog.destroy() if response == gtk.RESPONSE_YES: source_env_path = os.path.join(self.parameters.core_base, "oe-init-build-env") tmp_path = os.path.join(os.getcwd(), "tmp") 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): cmdline = "/usr/bin/xterm -e " cmdline += "\" export OE_TMPDIR=" + tmp_path + "; " cmdline += "source " + source_env_path + " " + os.getcwd() + "; " cmdline += "runqemu " + kernel_path + " " + image_path + "; bash\"" 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 + "." dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) dialog.run() dialog.destroy()