Esempio n. 1
0
 def show_error_dialog(self, msg):
     lbl = "<b>Hob found an error</b>\n"
     dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR, msg)
     button = dialog.add_button("Close", gtk.RESPONSE_OK)
     HobButton.style_button(button)
     response = dialog.run()
     dialog.destroy()
Esempio n. 2
0
    def build_image_clicked_cb(self, button):
        selected_pkgs = self.package_model.get_selected_packages()
        show_missing_pkg_dialog = False
        lbl = "<b>Missing important packages</b>\n\nYour list of included "
        lbl = lbl + " packages is missing:\n\n"
        if not ('eglibc' in selected_pkgs or 'uclibc' in selected_pkgs):
            show_missing_pkg_dialog = True
            lbl = lbl + "-A C library (choose eglibc or uclibc)\n\n"
        if not ('bash' in selected_pkgs or 'busybox' in selected_pkgs):
            show_missing_pkg_dialog = True
            lbl = lbl + "-A shell provider (choose bash or busybox)\n\n"
        if 'initscripts' not in selected_pkgs:
            show_missing_pkg_dialog = True
            lbl = lbl + "-Initialization scripts (choose initscripts)\n\n"

        if show_missing_pkg_dialog:
            dialog = CrumbsMessageDialog(None, lbl, gtk.STOCK_DIALOG_INFO)
            button = dialog.add_button("Build anyway", gtk.RESPONSE_OK)
            tooltip = "Build the image without changing the included packages"
            button.set_tooltip_text(tooltip)
            HobButton.style_button(button)
            button = dialog.add_button("Edit packages", gtk.RESPONSE_CANCEL)
            tooltip = "Change the list of included packages"
            button.set_tooltip_text(tooltip)
            HobButton.style_button(button)
            response = dialog.run()
            dialog.destroy()
            if response == gtk.RESPONSE_CANCEL:
                return
        self.builder.build_image()
    def response_cb(self, dialog, response_id):
        if response_id == gtk.RESPONSE_YES:
            lbl = ''
            msg = ''
            combo_item = self.usb_combo.get_active_text()
            if combo_item and combo_item != self.__dummy_usb__ and self.image_path:
                cmdline = bb.ui.crumbs.utils.which_terminal()
                if cmdline:
                    tmpfile = tempfile.NamedTemporaryFile()
                    cmdline += "\"sudo dd if=" + self.image_path + \
                                " of=" + combo_item + " && sync; echo $? > " + tmpfile.name + "\""
                    subprocess.call(shlex.split(cmdline))

                    if int(tmpfile.readline().strip()) == 0:
                        lbl = "<b>Deploy image successfully.</b>"
                    else:
                        lbl = "<b>Failed to deploy image.</b>"
                        msg = "Please check image <b>%s</b> exists and USB device <b>%s</b> is writable." % (
                            self.image_path, combo_item)
                    tmpfile.close()
            else:
                if not self.image_path:
                    lbl = "<b>No selection made.</b>"
                    msg = "You have not selected an image to deploy."
                else:
                    lbl = "<b>No selection made.</b>"
                    msg = "You have not selected a USB device."
            if len(lbl):
                crumbs_dialog = CrumbsMessageDialog(self, lbl,
                                                    gtk.MESSAGE_INFO, msg)
                button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK)
                HobButton.style_button(button)
                crumbs_dialog.run()
                crumbs_dialog.destroy()
Esempio n. 4
0
 def handler_no_provider_cb(self, running_build, msg):
     dialog = CrumbsMessageDialog(self, glib.markup_escape_text(msg),
                                  gtk.STOCK_DIALOG_INFO)
     button = dialog.add_button("Close", gtk.RESPONSE_OK)
     HobButton.style_button(button)
     dialog.run()
     dialog.destroy()
     self.build_failed()
Esempio n. 5
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()
Esempio n. 6
0
 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(True)
Esempio n. 7
0
    def show_invalid_input_error_dialog(self):
        lbl = "<b>Invalid characters in image recipe name</b>"
        msg = "Image recipe names should be all lowercase and\n"
        msg += "include only alphanumeric characters. The only\n"
        msg += "special character you can use is the ASCII hyphen (-)."
        dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_ERROR, msg)
        button = dialog.add_button("Close", gtk.RESPONSE_OK)
        HobButton.style_button(button)

        res = dialog.run()
        self.name_entry.grab_focus()
        dialog.destroy()
Esempio n. 8
0
 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'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.\n\n"
         lbl = lbl + "'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."
         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)
         HobAltButton.style_button(button)
         button = dialog.add_button("Stop", gtk.RESPONSE_OK)
         HobButton.style_button(button)
     response = dialog.run()
     dialog.destroy()
     if response != gtk.RESPONSE_CANCEL:
         self.stopping = True
     if response == gtk.RESPONSE_OK:
         self.build_details_page.progress_bar.set_stop_title(
             "Stopping the build....")
         self.build_details_page.progress_bar.set_rcstyle("stop")
         self.cancel_build_sync()
     elif response == gtk.RESPONSE_YES:
         self.cancel_build_sync(True)
Esempio n. 9
0
    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)
            dialog.run()
            dialog.destroy()
            return

        kernel_path = os.path.join(self.parameters.image_addr, kernel_name)
        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()
Esempio n. 10
0
    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.__custom_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(True)
Esempio n. 11
0
    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

        dialog = DeployImageDialog(self,
                                   title="Hob IoT",
                                   image=image_name,
                                   parent=self,
                                   flags=gtk.DIALOG_MODAL
                                   | gtk.DIALOG_DESTROY_WITH_PARENT
                                   | gtk.DIALOG_NO_SEPARATOR)
        response = dialog.run()
        dialog.destroy()
Esempio n. 12
0
 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(True)
         else:
             self.switch_page(self.PACKAGE_SELECTION)
     else:
         self.switch_page(self.PACKAGE_SELECTION)
    def response_cb(self, dialog, response_id):
        if response_id == gtk.RESPONSE_YES:
            # Check that all proxy entries have a corresponding port
            for proxy, port in zip(self.all_proxy_addresses,
                                   self.all_proxy_ports):
                if proxy.get_text() and not port.get_text():
                    lbl = "<b>Enter all port numbers</b>\n\n"
                    msg = "Proxy servers require a port number. Please make sure you have entered a port number for each proxy server."
                    dialog = CrumbsMessageDialog(self, lbl,
                                                 gtk.STOCK_DIALOG_WARNING, msg)
                    button = dialog.add_button("Close", gtk.RESPONSE_OK)
                    HobButton.style_button(button)
                    response = dialog.run()
                    dialog.destroy()
                    self.emit_stop_by_name("response")
                    return

        self.configuration.dldir = self.dldir_text.get_text()
        self.configuration.sstatedir = self.sstatedir_text.get_text()
        self.configuration.sstatemirror = ""
        for mirror in self.sstatemirrors_list:
            if mirror[1] != "" and mirror[2].startswith("file://"):
                if mirror[1].endswith("\\1"):
                    smirror = mirror[2] + " " + mirror[1] + " \\n "
                else:
                    smirror = mirror[2] + " " + mirror[1] + "\\1 \\n "
                self.configuration.sstatemirror += smirror
        self.configuration.bbthread = self.bb_spinner.get_value_as_int()
        self.configuration.pmake = self.pmake_spinner.get_value_as_int()
        self.save_proxy_data()
        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)
        self.proxy_settings_changed = (self.proxy_md5 !=
                                       self.config_proxy_md5())
Esempio n. 14
0
    def layer_widget_add_clicked_cb(self, action, layer_store, parent):
        dialog = gtk.FileChooserDialog("Add new layer", parent,
                                       gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
        button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
        HobAltButton.style_button(button)
        button = dialog.add_button("Open", gtk.RESPONSE_YES)
        HobButton.style_button(button)
        label = gtk.Label("Select the layer you wish to add")
        label.show()
        dialog.set_extra_widget(label)
        response = dialog.run()
        path = dialog.get_filename()
        dialog.destroy()

        lbl = "<b>Error</b>"
        msg = "Unable to load layer <i>%s</i> because " % path
        if response == gtk.RESPONSE_YES:
            import os
            import os.path
            layers = []
            it = layer_store.get_iter_first()
            while it:
                layers.append(layer_store.get_value(it, 0))
                it = layer_store.iter_next(it)

            if not path:
                msg += "it is an invalid path."
            elif not os.path.exists(path+"/conf/layer.conf"):
                msg += "there is no layer.conf inside the directory."
            elif path in layers:
                msg += "it is already in loaded layers."
            else:
                layer_store.append([path])
                return
            dialog = CrumbsMessageDialog(parent, lbl, gtk.MESSAGE_ERROR, msg)
            dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_OK)
            response = dialog.run()
            dialog.destroy()