def create_config_machine(self):
        self.machine_title = gtk.Label()
        self.machine_title.set_alignment(0.0, 0.5)
        mark = "<span %s>Select a machine</span>" % self.span_tag(
            'x-large', 'bold')
        self.machine_title.set_markup(mark)

        self.machine_title_desc = gtk.Label()
        self.machine_title_desc.set_alignment(0.0, 0.5)
        mark = (
            "<span %s>Your selection is the profile of the target machine for which you"
            " are building the image.\n</span>") % (self.span_tag('medium'))
        self.machine_title_desc.set_markup(mark)

        self.machine_combo = gtk.combo_box_new_text()
        self.machine_combo.connect("changed", self.machine_combo_changed_cb)

        icon_file = hic.ICON_LAYERS_DISPLAY_FILE
        hover_file = hic.ICON_LAYERS_HOVER_FILE
        self.layer_button = HobImageButton(
            "Layers", "Add support for machines, software, etc.", icon_file,
            hover_file)
        self.layer_button.connect("clicked", self.layer_button_clicked_cb)

        markup = "Layers are a powerful mechanism to extend the Yocto Project "
        markup += "with your own functionality.\n"
        markup += "For more on layers, check the <a href=\""
        markup += "http://www.yoctoproject.org/docs/current/dev-manual/"
        markup += "dev-manual.html#understanding-and-using-layers\">reference manual</a>."
        self.layer_info_icon = HobInfoButton("<b>Layers</b>" + "*" + markup,
                                             self.get_parent())
        self.progress_bar = HobProgressBar()
        self.stop_button = HobAltButton("Stop")
        self.stop_button.connect("clicked", self.stop_button_clicked_cb)
        self.machine_separator = gtk.HSeparator()
    def gen_proxy_entry_widget(self,
                               protocol,
                               parent,
                               need_button=True,
                               line=0):
        label = gtk.Label(protocol.upper() + " proxy")
        self.proxy_table.attach(label, 0, 1, line, line + 1, xpadding=24)

        proxy_entry = gtk.Entry()
        proxy_entry.set_size_request(300, -1)
        self.proxy_table.attach(proxy_entry, 1, 2, line, line + 1, ypadding=4)

        self.proxy_table.attach(gtk.Label(":"),
                                2,
                                3,
                                line,
                                line + 1,
                                xpadding=12,
                                ypadding=4)

        port_entry = gtk.Entry()
        port_entry.set_size_request(60, -1)
        self.proxy_table.attach(port_entry, 3, 4, line, line + 1, ypadding=4)

        details_button = HobAltButton("Details")
        details_button.connect("clicked", self.details_cb, parent, protocol)
        self.proxy_table.attach(details_button,
                                4,
                                5,
                                line,
                                line + 1,
                                xpadding=4,
                                yoptions=gtk.EXPAND)

        return proxy_entry, port_entry, details_button
Beispiel #3
0
    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()
Beispiel #4
0
    def create_visual_elements(self):
        self.eventbox = self.add_onto_top_bar(None, 73)
        self.pack_start(self.eventbox, expand=False, fill=False)
        self.pack_start(self.group_align, expand=True, fill=True)

        # set visible members
        self.ins = HobNotebook()
        self.tables = []  # we need modify table when the dialog is shown

        search_names = []
        search_tips = []
        # append the tabs in order
        for page in self.pages:
            columns = page['columns']
            name = page['name']
            tab = HobViewTable(columns, name)
            search_names.append(page['search'])
            search_tips.append(page['searchtip'])
            filter = page['filter']
            sort_model = self.recipe_model.tree_model(filter, initial=True)
            tab.set_model(sort_model)
            tab.connect("toggled", self.table_toggled_cb, name)
            if name == "Included recipes":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped",
                            self.after_fadeout_checkin_include)
            if name == "Package Groups":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped",
                            self.after_fadeout_checkin_include)
            if name == "All recipes":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped", self.button_click_cb)
            self.ins.append_page(tab, page['name'], page['tooltip'])
            self.tables.append(tab)

        self.ins.set_entry(search_names, search_tips)
        self.ins.search.connect("changed", self.search_entry_changed)

        # add all into the window
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_end(button_box, expand=False, fill=False)

        self.build_packages_button = HobButton('Build packages')
        #self.build_packages_button.set_size_request(205, 49)
        self.build_packages_button.set_tooltip_text(
            "Build selected recipes into packages")
        self.build_packages_button.set_flags(gtk.CAN_DEFAULT)
        self.build_packages_button.grab_default()
        self.build_packages_button.connect("clicked",
                                           self.build_packages_clicked_cb)
        button_box.pack_end(self.build_packages_button,
                            expand=False,
                            fill=False)

        self.back_button = HobAltButton('Cancel')
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        button_box.pack_end(self.back_button, expand=False, fill=False)
Beispiel #5
0
 def show_adv_settings_dialog(self):
     dialog = AdvancedSettingDialog(
         title="Settings",
         configuration=copy.deepcopy(self.configuration),
         all_image_types=self.parameters.image_types,
         all_package_formats=self.parameters.all_package_formats,
         all_distros=self.parameters.all_distros,
         all_sdk_machines=self.parameters.all_sdk_machines,
         max_threads=self.parameters.max_threads,
         enable_proxy=self.parameters.enable_proxy,
         parent=self,
         flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR,
     )
     button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
     HobAltButton.style_button(button)
     button = dialog.add_button("Save", gtk.RESPONSE_YES)
     HobButton.style_button(button)
     response = dialog.run()
     settings_changed = False
     if response == gtk.RESPONSE_YES:
         self.parameters.enable_proxy = dialog.enable_proxy
         self.configuration = dialog.configuration
         self.save_defaults()  # remember settings
         settings_changed = dialog.settings_changed
     dialog.destroy()
     return response == gtk.RESPONSE_YES, settings_changed
Beispiel #6
0
 def show_adv_settings_dialog(self):
     dialog = AdvancedSettingDialog(
         title="Settings",
         configuration=copy.deepcopy(self.configuration),
         all_image_types=self.parameters.image_types,
         all_package_formats=self.parameters.all_package_formats,
         all_distros=self.parameters.all_distros,
         all_sdk_machines=self.parameters.all_sdk_machines,
         max_threads=self.parameters.max_threads,
         enable_proxy=self.parameters.enable_proxy,
         parent=self,
         flags=gtk.DIALOG_MODAL
         | gtk.DIALOG_DESTROY_WITH_PARENT
         | gtk.DIALOG_NO_SEPARATOR)
     button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
     HobAltButton.style_button(button)
     button = dialog.add_button("Save", gtk.RESPONSE_YES)
     HobButton.style_button(button)
     response = dialog.run()
     settings_changed = False
     if response == gtk.RESPONSE_YES:
         self.parameters.enable_proxy = dialog.enable_proxy
         self.configuration = dialog.configuration
         self.save_defaults()  # remember settings
         settings_changed = dialog.settings_changed
     dialog.destroy()
     return response == gtk.RESPONSE_YES, settings_changed
Beispiel #7
0
    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()
Beispiel #8
0
    def create_visual_elements(self):
        # create visual elements
        self.vbox = gtk.VBox(False, 12)

        self.progress_box = gtk.VBox(False, 12)
        self.progress_hbox = gtk.HBox(False, 6)
        self.progress_box.pack_end(self.progress_hbox, expand=True, fill=True)
        self.progress_bar = HobProgressBar()
        self.progress_hbox.pack_start(self.progress_bar, expand=True, fill=True)
        self.stop_button = HobAltButton("Stop")
        self.stop_button.connect("clicked", self.stop_button_clicked_cb)
        tooltip = "Cancel build in progress"
        self.stop_button.set_tooltip_text(tooltip)
        self.stop_button.set_sensitive(True)
        self.progress_hbox.pack_end(self.stop_button, expand=False, fill=False)

        self.build_tv = RunningBuildTreeView(readonly=True, hob=True)
        self.build_tv.set_model(self.builder.handler.build.model)
        self.scrolled_view_build = gtk.ScrolledWindow ()
        self.scrolled_view_build.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
        self.scrolled_view_build.add(self.build_tv)

        self.builder.handler.build.model.connect_after("row-changed", self.scroll_to_present_row, self.scrolled_view_build.get_vadjustment(), self.build_tv)

        self.button_box = gtk.HBox(False, 6)
        self.back_button = HobAltButton('&lt;&lt; Back')
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        self.button_box.pack_start(self.back_button, expand=False, fill=False)
Beispiel #9
0
    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()
Beispiel #10
0
    def create_visual_elements(self):
        # create visual elements
        self.vbox = gtk.VBox(False, 12)

        self.progress_box = gtk.VBox(False, 12)
        self.progress_hbox = gtk.HBox(False, 6)
        self.progress_box.pack_end(self.progress_hbox, expand=True, fill=True)
        self.progress_bar = HobProgressBar()
        self.progress_hbox.pack_start(self.progress_bar,
                                      expand=True,
                                      fill=True)
        self.stop_button = HobAltButton("Stop")
        self.stop_button.connect("clicked", self.stop_button_clicked_cb)
        tooltip = "Cancel build in progress"
        self.stop_button.set_tooltip_text(tooltip)
        self.stop_button.set_sensitive(True)
        self.progress_hbox.pack_end(self.stop_button, expand=False, fill=False)

        self.build_tv = RunningBuildTreeView(readonly=True, hob=True)
        self.build_tv.set_model(self.builder.handler.build.model)
        self.scrolled_view_build = gtk.ScrolledWindow()
        self.scrolled_view_build.set_policy(gtk.POLICY_NEVER,
                                            gtk.POLICY_ALWAYS)
        self.scrolled_view_build.add(self.build_tv)

        self.builder.handler.build.model.connect_after(
            "row-changed", self.scroll_to_present_row,
            self.scrolled_view_build.get_vadjustment(), self.build_tv)

        self.button_box = gtk.HBox(False, 6)
        self.back_button = HobAltButton('&lt;&lt; Back')
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        self.button_box.pack_start(self.back_button, expand=False, fill=False)
Beispiel #11
0
    def create_visual_elements(self):
        self.set_size_request(350, 350)
        self.heading_label = gtk.Label()
        self.heading_label.set_alignment(0, 0)
        self.warning_label = gtk.Label()
        self.warning_label.set_selectable(True)
        self.warning_label.set_alignment(0, 0)
        self.textWindow = gtk.ScrolledWindow()

        table = gtk.Table(1, 10, False)

        cancel_button = gtk.Button()
        cancel_button.set_label("Close")
        cancel_button.connect("clicked", self.cancel_button_cb)
        cancel_button.set_size_request(110, 30)

        self.previous_button = gtk.Button()
        image1 = gtk.image_new_from_stock(gtk.STOCK_GO_BACK, gtk.ICON_SIZE_BUTTON)
        image1.show()
        box = gtk.HBox(False, 6)
        box.show()
        self.previous_button.add(box)
        lbl = gtk.Label("Previous")
        lbl.show()
        box.pack_start(image1, expand=False, fill=False, padding=3)
        box.pack_start(lbl, expand=True, fill=True, padding=3)
        self.previous_button.connect("clicked", self.previous_button_cb)
        self.previous_button.set_size_request(110, 30)

        self.next_button = gtk.Button()
        image2 = gtk.image_new_from_stock(gtk.STOCK_GO_FORWARD, gtk.ICON_SIZE_BUTTON)
        image2.show()
        box = gtk.HBox(False, 6)
        box.show()
        self.next_button.add(box)
        lbl = gtk.Label("Next")
        lbl.show()
        box.pack_start(lbl, expand=True, fill=True, padding=3)
        box.pack_start(image2, expand=False, fill=False, padding=3)
        self.next_button.connect("clicked", self.next_button_cb)
        self.next_button.set_size_request(110, 30)

        #when there more than one warning, we need "previous" and "next" button
        if self.warn_nb>1:
            self.vbox.pack_start(self.heading_label, expand=False, fill=False)
            self.vbox.pack_start(self.warning_label, expand=False, fill=False)
            self.vbox.pack_start(self.textWindow, expand=False, fill=False)
            table.attach(cancel_button, 6, 7, 0, 1, xoptions=gtk.SHRINK)
            table.attach(self.previous_button, 7, 8, 0, 1, xoptions=gtk.SHRINK)
            table.attach(self.next_button, 8, 9, 0, 1, xoptions=gtk.SHRINK)
            self.vbox.pack_end(table, expand=False, fill=False)
        else:
            self.vbox.pack_start(self.heading_label, expand=False, fill=False)
            self.vbox.pack_start(self.warning_label, expand=False, fill=False)
            self.vbox.pack_start(self.textWindow, expand=False, fill=False)
            cancel_button = self.add_button("Close", gtk.RESPONSE_CANCEL)
            HobAltButton.style_button(cancel_button)

        self.refresh_components()
    def create_visual_elements(self):
        # create visual elements
        self.vbox = gtk.VBox(False, 12)

        self.progress_box = gtk.VBox(False, 12)
        self.task_status = gtk.Label("\n")  # to ensure layout is correct
        self.task_status.set_alignment(0.0, 0.5)
        self.progress_box.pack_start(self.task_status,
                                     expand=False,
                                     fill=False)
        self.progress_hbox = gtk.HBox(False, 6)
        self.progress_box.pack_end(self.progress_hbox, expand=True, fill=True)
        self.progress_bar = HobProgressBar()
        self.progress_hbox.pack_start(self.progress_bar,
                                      expand=True,
                                      fill=True)
        self.stop_button = HobAltButton("Stop")
        self.stop_button.connect("clicked", self.stop_button_clicked_cb)
        self.stop_button.set_sensitive(False)
        self.progress_hbox.pack_end(self.stop_button, expand=False, fill=False)

        self.notebook = HobNotebook()
        self.config_tv = BuildConfigurationTreeView()
        self.scrolled_view_config = gtk.ScrolledWindow()
        self.scrolled_view_config.set_policy(gtk.POLICY_NEVER,
                                             gtk.POLICY_ALWAYS)
        self.scrolled_view_config.add(self.config_tv)
        self.notebook.append_page(self.scrolled_view_config,
                                  gtk.Label("Build configuration"))

        self.failure_tv = BuildFailureTreeView()
        self.failure_model = self.builder.handler.build.model.failure_model()
        self.failure_tv.set_model(self.failure_model)
        self.scrolled_view_failure = gtk.ScrolledWindow()
        self.scrolled_view_failure.set_policy(gtk.POLICY_NEVER,
                                              gtk.POLICY_ALWAYS)
        self.scrolled_view_failure.add(self.failure_tv)
        self.notebook.append_page(self.scrolled_view_failure,
                                  gtk.Label("Issues"))

        self.build_tv = RunningBuildTreeView(readonly=True, hob=True)
        self.build_tv.set_model(self.builder.handler.build.model)
        self.scrolled_view_build = gtk.ScrolledWindow()
        self.scrolled_view_build.set_policy(gtk.POLICY_NEVER,
                                            gtk.POLICY_ALWAYS)
        self.scrolled_view_build.add(self.build_tv)
        self.notebook.append_page(self.scrolled_view_build, gtk.Label("Log"))

        self.builder.handler.build.model.connect_after(
            "row-changed", self.scroll_to_present_row,
            self.scrolled_view_build.get_vadjustment(), self.build_tv)

        self.button_box = gtk.HBox(False, 6)
        self.back_button = HobAltButton("<< Back to image configuration")
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        self.button_box.pack_start(self.back_button, expand=False, fill=False)
Beispiel #13
0
    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()
Beispiel #14
0
    def add_build_fail_top_bar(self, actions):
        mainly_action = "Edit %s" % actions
        if 'image' in actions:
            next_action   = ""
        else:
            next_action   = "Create new image"

        #set to issue page
        self.notebook.set_page("Issues")

        color = HobColors.ERROR
        build_fail_top = gtk.EventBox()
        build_fail_top.set_size_request(-1, 260)
        build_fail_top.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))

        build_fail_tab = gtk.Table(7, 40, True)
        build_fail_top.add(build_fail_tab)

        icon = gtk.Image()
        icon_pix_buffer = gtk.gdk.pixbuf_new_from_file(hic.ICON_INDI_ERROR_FILE)
        icon.set_from_pixbuf(icon_pix_buffer)
        build_fail_tab.attach(icon, 1, 4, 0, 3)

        label = gtk.Label()
        label.set_alignment(0.0, 0.5)
        label.set_markup("<span size='x-large'>%s</span>" % self.title)
        build_fail_tab.attach(label, 4, 20, 0, 3)

        label = gtk.Label()
        label.set_alignment(0.0, 0.5)
        num_of_fails = self.update_failures_sum_display()
        current_fail, recipe_task_status = self.task_status.get_text().split('\n')
        label.set_markup(" %d tasks failed,  %s, %s" % (num_of_fails, current_fail, recipe_task_status))
        build_fail_tab.attach(label, 4, 40, 2, 4)

        # create button 'Edit packages'
        action_button = HobButton(mainly_action)
        action_button.set_size_request(-1, 49)
        action_button.connect('clicked', self.failure_main_action_button_clicked_cb, mainly_action)
        build_fail_tab.attach(action_button, 4, 16, 4, 6)

        if next_action:
            next_button = HobAltButton(next_action)
            next_button.set_alignment(0.0, 0.5)
            next_button.connect('clicked', self.failure_next_action_button_clicked_cb, next_action)
            build_fail_tab.attach(next_button, 17, 24, 4, 5)

        file_bug_button = HobAltButton('File a bug')
        file_bug_button.set_alignment(0.0, 0.5)
        file_bug_button.connect('clicked', self.failure_file_bug_activate_link_cb)
        build_fail_tab.attach(file_bug_button, 17, 24, 4 + abs(next_action != ""), 6)

        return build_fail_top
Beispiel #15
0
    def create_visual_elements(self):
        self.label = gtk.Label(
            "Packages included: 0\nSelected packages size: 0 MB")
        self.eventbox = self.add_onto_top_bar(self.label, 73)
        self.pack_start(self.eventbox, expand=False, fill=False)
        self.pack_start(self.group_align, expand=True, fill=True)

        # set visible members
        self.ins = HobNotebook()
        self.tables = []  # we need to modify table when the dialog is shown
        # append the tab
        for page in self.pages:
            columns = page['columns']
            tab = HobViewTable(columns)
            filter = page['filter']
            tab.set_model(self.package_model.tree_model(filter))
            tab.connect("toggled", self.table_toggled_cb, page['name'])
            if page['name'] == "Included packages":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped",
                            self.after_fadeout_checkin_include)
            self.ins.append_page(tab, page['name'], page['tooltip'])
            self.tables.append(tab)

        self.ins.set_entry("Search packages:")
        # set the search entry for each table
        for tab in self.tables:
            search_tip = "Enter a package name to find it"
            self.ins.search.set_tooltip_text(search_tip)
            self.ins.search.props.has_tooltip = True
            tab.set_search_entry(0, self.ins.search)

        # add all into the dialog
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        self.button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_start(self.button_box,
                                       expand=False,
                                       fill=False)

        self.build_image_button = HobButton('Build image')
        #self.build_image_button.set_size_request(205, 49)
        self.build_image_button.set_tooltip_text("Build target image")
        self.build_image_button.set_flags(gtk.CAN_DEFAULT)
        self.build_image_button.grab_default()
        self.build_image_button.connect("clicked", self.build_image_clicked_cb)
        self.button_box.pack_end(self.build_image_button,
                                 expand=False,
                                 fill=False)

        self.back_button = HobAltButton('Cancel')
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        self.button_box.pack_end(self.back_button, expand=False, fill=False)
Beispiel #16
0
 def show_save_template_dialog(self):
     dialog = gtk.FileChooserDialog("Save Template Files", self, gtk.FILE_CHOOSER_ACTION_SAVE)
     button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
     HobAltButton.style_button(button)
     button = dialog.add_button("Save", gtk.RESPONSE_YES)
     HobButton.style_button(button)
     dialog.set_current_name("hob")
     response = dialog.run()
     if response == gtk.RESPONSE_YES:
         path = dialog.get_filename()
         self.save_template(path)
     dialog.destroy()
Beispiel #17
0
    def create_visual_elements(self):
        self.label = gtk.Label(
            "Packages included: 0\nSelected packages size: 0 MB")
        self.eventbox = self.add_onto_top_bar(self.label, padding=15)
        self.pack_start(self.eventbox, expand=False, fill=False)
        self.pack_start(self.group_align, expand=True, fill=True)

        # set visible members
        self.ins = HobNotebook()
        self.tables = []  # we need to modify table when the dialog is shown

        search_names = []
        search_tips = []
        # append the tab
        page = self.pages[0]
        columns = page['columns']
        name = page['name']
        self.tab = HobViewTable(columns, name)
        search_names.append(page['search'])
        search_tips.append(page['searchtip'])
        self.ins.set_entry(search_names, search_tips)
        self.ins.search.connect("changed", self.search_entry_changed)
        filter = page['filter']
        sort_model = self.package_model.tree_model(filter, initial=True)
        self.tab.set_model(sort_model)
        self.tab.connect("toggled", self.table_toggled_cb, name)
        self.tab.connect("button-release-event", self.button_click_cb)
        self.tab.connect("cell-fadeinout-stopped",
                         self.after_fadeout_checkin_include, filter)
        #self.tab.set_size_request(-1, 350)
        self.ins.append_page(self.tab, page['name'], page['tooltip'])
        self.tables.append(self.tab)

        # add all into the dialog
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        self.button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_start(self.button_box,
                                       expand=False,
                                       fill=False)

        self.build_image_button = HobButton('Build image')
        self.build_image_button.set_tooltip_text("Build your image")
        self.build_image_button.set_flags(gtk.CAN_DEFAULT)
        self.build_image_button.grab_default()
        self.build_image_button.connect("clicked", self.build_image_clicked_cb)
        self.button_box.pack_end(self.build_image_button,
                                 expand=False,
                                 fill=False)

        self.back_button = HobAltButton('Cancel')
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        self.button_box.pack_end(self.back_button, expand=False, fill=False)
Beispiel #18
0
    def entry_widget_select_path_cb(self, action, parent, entry):
        dialog = gtk.FileChooserDialog("", 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)
        response = dialog.run()
        if response == gtk.RESPONSE_YES:
            path = dialog.get_filename()
            entry.set_text(path)

        dialog.destroy()
 def show_page(self, log_file):
     children = self.button_box.get_children() or []
     for child in children:
         self.button_box.remove(child)
     # re-packed the buttons as request, add the 'open log' button if build success
     self.button_box.pack_end(self.build_image_button, expand=False, fill=False)
     if log_file:
         open_log_button = HobAltButton("Open log")
         open_log_button.connect("clicked", self.open_log_clicked_cb, log_file)
         open_log_button.set_tooltip_text("Open the build's log file")
         self.button_box.pack_end(open_log_button, expand=False, fill=False)
     self.button_box.pack_end(self.back_button, expand=False, fill=False)
     self.show_all()
Beispiel #20
0
 def show_save_template_dialog(self):
     dialog = gtk.FileChooserDialog("Save Template Files", self,
                                    gtk.FILE_CHOOSER_ACTION_SAVE)
     button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
     HobAltButton.style_button(button)
     button = dialog.add_button("Save", gtk.RESPONSE_YES)
     HobButton.style_button(button)
     dialog.set_current_name("hob")
     response = dialog.run()
     if response == gtk.RESPONSE_YES:
         path = dialog.get_filename()
         self.save_template(path)
     dialog.destroy()
Beispiel #21
0
    def show_packages_property_dialog(self, properties):
        information = {}
        dialog = PropertyDialog(title = properties["name"] +' '+ "properties",
                      parent = self,
                      information = properties,
                      flags = gtk.DIALOG_DESTROY_WITH_PARENT
                          | gtk.DIALOG_NO_SEPARATOR)

        dialog.set_modal(False)

        button = dialog.add_button("Close", gtk.RESPONSE_NO)
        HobAltButton.style_button(button)
        button.connect("clicked", lambda w: dialog.destroy())

        dialog.run()
    def entry_widget_select_path_cb(self, action, parent, entry):
        dialog = gtk.FileChooserDialog("", parent,
                                       gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
        text = entry.get_text()
        dialog.set_current_folder(text if len(text) > 0 else os.getcwd())
        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:
            path = dialog.get_filename()
            entry.set_text(path)

        dialog.destroy()
Beispiel #23
0
    def show_packages_property_dialog(self, properties):
        information = {}
        dialog = PropertyDialog(title=properties["name"] + ' ' + "properties",
                                parent=self,
                                information=properties,
                                flags=gtk.DIALOG_DESTROY_WITH_PARENT
                                | gtk.DIALOG_NO_SEPARATOR)

        dialog.set_modal(False)

        button = dialog.add_button("Close", gtk.RESPONSE_NO)
        HobAltButton.style_button(button)
        button.connect("clicked", lambda w: dialog.destroy())

        dialog.run()
    def create_visual_elements(self):
        hbox = gtk.HBox(False, 12)
        self.user_label = gtk.Label("The log will open in a text editor")
        hbox.pack_start(self.user_label, expand=False, fill=False)
        self.vbox.pack_start(hbox, expand=False, fill=False)

        hbox = gtk.HBox(False, 12)
        # Progress bar
        self.progress_bar = HobProgressBar()
        hbox.pack_start(self.progress_bar)
        self.start()
        self.vbox.pack_start(hbox, expand=False, fill=False)

        button = self.add_button("Cancel", gtk.RESPONSE_CANCEL)
        HobAltButton.style_button(button)
        self.show_all()
    def create_config_machine(self):
        self.machine_title = gtk.Label()
        self.machine_title.set_alignment(0.0, 0.5)
        mark = "<span %s>Select a machine</span>" % self.span_tag('x-large', 'bold')
        self.machine_title.set_markup(mark)

        self.machine_title_desc = gtk.Label()
        self.machine_title_desc.set_alignment(0.0, 0.5)
        mark = ("<span %s>Your selection is the profile of the target machine for which you"
        " are building the image.\n</span>") % (self.span_tag('medium'))
        self.machine_title_desc.set_markup(mark)

        self.machine_combo = gtk.combo_box_new_text()
        self.machine_combo.connect("changed", self.machine_combo_changed_cb)

        icon_file = hic.ICON_LAYERS_DISPLAY_FILE
        hover_file = hic.ICON_LAYERS_HOVER_FILE
        self.layer_button = HobImageButton("Layers", "Add support for machines, software, etc.",
                                icon_file, hover_file)
        self.layer_button.connect("clicked", self.layer_button_clicked_cb)

        markup = "Layers are a powerful mechanism to extend the Yocto Project "
        markup += "with your own functionality.\n"
        markup += "For more on layers, check the <a href=\""
        markup += "http://www.yoctoproject.org/docs/current/dev-manual/"
        markup += "dev-manual.html#understanding-and-using-layers\">reference manual</a>."
        self.layer_info_icon = HobInfoButton(markup, self.get_parent())

#        self.progress_box = gtk.HBox(False, 6)
        self.progress_bar = HobProgressBar()
#        self.progress_box.pack_start(self.progress_bar, expand=True, fill=True)
        self.stop_button = HobAltButton("Stop")
        self.stop_button.connect("clicked", self.stop_button_clicked_cb)
#        self.progress_box.pack_end(stop_button, expand=False, fill=False)
        self.machine_separator = gtk.HSeparator()
Beispiel #26
0
    def create_visual_elements(self):
        hbox = gtk.HBox(False, 12)
        self.user_label = gtk.Label("The log will open in a text editor")
        hbox.pack_start(self.user_label, expand=False, fill=False)
        self.vbox.pack_start(hbox, expand=False, fill=False)

        hbox = gtk.HBox(False, 12)
        # Progress bar
        self.progress_bar = HobProgressBar()
        hbox.pack_start(self.progress_bar)
        self.start()
        self.vbox.pack_start(hbox, expand=False, fill=False)

        button = self.add_button("Cancel", gtk.RESPONSE_CANCEL)
        HobAltButton.style_button(button)
        self.show_all()
    def create_visual_elements(self):
        # create visual elements
        self.vbox = gtk.VBox(False, 12)

        self.progress_box = gtk.VBox(False, 12)
        self.task_status = gtk.Label("\n")  # to ensure layout is correct
        self.task_status.set_alignment(0.0, 0.5)
        self.progress_box.pack_start(self.task_status, expand=False, fill=False)
        self.progress_hbox = gtk.HBox(False, 6)
        self.progress_box.pack_end(self.progress_hbox, expand=True, fill=True)
        self.progress_bar = HobProgressBar()
        self.progress_hbox.pack_start(self.progress_bar, expand=True, fill=True)
        self.stop_button = HobAltButton("Stop")
        self.stop_button.connect("clicked", self.stop_button_clicked_cb)
        self.stop_button.set_sensitive(False)
        self.progress_hbox.pack_end(self.stop_button, expand=False, fill=False)

        self.notebook = HobNotebook()
        self.config_tv = BuildConfigurationTreeView()
        self.scrolled_view_config = gtk.ScrolledWindow()
        self.scrolled_view_config.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
        self.scrolled_view_config.add(self.config_tv)
        self.notebook.append_page(self.scrolled_view_config, "Build configuration")

        self.failure_tv = BuildFailureTreeView()
        self.failure_model = self.builder.handler.build.model.failure_model()
        self.failure_tv.set_model(self.failure_model)
        self.scrolled_view_failure = gtk.ScrolledWindow()
        self.scrolled_view_failure.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
        self.scrolled_view_failure.add(self.failure_tv)
        self.notebook.append_page(self.scrolled_view_failure, "Issues")

        self.build_tv = RunningBuildTreeView(readonly=True, hob=True)
        self.build_tv.set_model(self.builder.handler.build.model)
        self.scrolled_view_build = gtk.ScrolledWindow()
        self.scrolled_view_build.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
        self.scrolled_view_build.add(self.build_tv)
        self.notebook.append_page(self.scrolled_view_build, "Log")

        self.builder.handler.build.model.connect_after(
            "row-changed", self.scroll_to_present_row, self.scrolled_view_build.get_vadjustment(), self.build_tv
        )

        self.button_box = gtk.HBox(False, 6)
        self.back_button = HobAltButton("&lt;&lt; Back")
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        self.button_box.pack_start(self.back_button, expand=False, fill=False)
Beispiel #28
0
 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
Beispiel #29
0
    def select_path_cb(self, action, parent, entry):
        dialog = gtk.FileChooserDialog("", parent,
                                       gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
        text = entry.get_text()
        dialog.set_current_folder(text if len(text) > 0 else os.getcwd())
        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:
            path = dialog.get_filename()
            entry.set_text(path)
            self.image_folder = path
            self.fill_image_store()

        dialog.destroy()
Beispiel #30
0
 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
Beispiel #31
0
    def show_load_template_dialog(self):
        dialog = gtk.FileChooserDialog("Load Template Files", self, gtk.FILE_CHOOSER_ACTION_OPEN)
        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("Hob Files")
        filter.add_pattern("*.hob")
        dialog.add_filter(filter)

        response = dialog.run()
        path = None
        if response == gtk.RESPONSE_YES:
            path = dialog.get_filename()
        dialog.destroy()
        return response == gtk.RESPONSE_YES, path
Beispiel #32
0
    def show_load_template_dialog(self):
        dialog = gtk.FileChooserDialog("Load Template Files", self,
                                       gtk.FILE_CHOOSER_ACTION_OPEN)
        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("Hob Files")
        filter.add_pattern("*.hob")
        dialog.add_filter(filter)

        response = dialog.run()
        path = None
        if response == gtk.RESPONSE_YES:
            path = dialog.get_filename()
        dialog.destroy()
        return response == gtk.RESPONSE_YES, path
Beispiel #33
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()
         else:
             self.switch_page(self.PACKAGE_SELECTION)
     else:
         self.switch_page(self.PACKAGE_SELECTION)
    def gen_proxy_entry_widget(self, protocol, parent, need_button=True, line=0):
        label = gtk.Label(protocol.upper() + " proxy")
        self.proxy_table.attach(label, 0, 1, line, line+1, xpadding=24)

        proxy_entry = gtk.Entry()
        proxy_entry.set_size_request(300, -1)
        self.proxy_table.attach(proxy_entry, 1, 2, line, line+1, ypadding=4)

        self.proxy_table.attach(gtk.Label(":"), 2, 3, line, line+1, xpadding=12, ypadding=4)

        port_entry = gtk.Entry()
        port_entry.set_size_request(60, -1)
        self.proxy_table.attach(port_entry, 3, 4, line, line+1, ypadding=4)

        details_button = HobAltButton("Details")
        details_button.connect("clicked", self.details_cb, parent, protocol)
        self.proxy_table.attach(details_button, 4, 5, line, line+1, xpadding=4, yoptions=gtk.EXPAND)

        return proxy_entry, port_entry, details_button
Beispiel #35
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 create_visual_elements(self):
        self.eventbox = self.add_onto_top_bar(None, 73)
        self.pack_start(self.eventbox, expand=False, fill=False)
        self.pack_start(self.group_align, expand=True, fill=True)

        # set visible members
        self.ins = HobNotebook()
        self.tables = [] # we need modify table when the dialog is shown

        search_names = []
        search_tips = []
        # append the tabs in order
        for page in self.pages:
            columns = page['columns']
            name = page['name']
            tab = HobViewTable(columns, name)
            search_names.append(page['search'])
            search_tips.append(page['searchtip'])
            filter = page['filter']
            sort_model = self.recipe_model.tree_model(filter, initial=True)
            tab.set_model(sort_model)
            tab.connect("toggled", self.table_toggled_cb, name)
            if name == "Included recipes":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
            if name == "Package Groups":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
            if name == "All recipes":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped", self.button_click_cb)
            self.ins.append_page(tab, page['name'], page['tooltip'])
            self.tables.append(tab)

        self.ins.set_entry(search_names, search_tips)
        self.ins.search.connect("changed", self.search_entry_changed)

        # add all into the window
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_end(button_box, expand=False, fill=False)

        self.build_packages_button = HobButton('Build packages')
        #self.build_packages_button.set_size_request(205, 49)
        self.build_packages_button.set_tooltip_text("Build selected recipes into packages")
        self.build_packages_button.set_flags(gtk.CAN_DEFAULT)
        self.build_packages_button.grab_default()
        self.build_packages_button.connect("clicked", self.build_packages_clicked_cb)
        button_box.pack_end(self.build_packages_button, expand=False, fill=False)

        self.back_button = HobAltButton('Cancel')
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        button_box.pack_end(self.back_button, expand=False, fill=False)
Beispiel #37
0
 def show_layer_selection_dialog(self):
     dialog = LayerSelectionDialog(
         title="Layers",
         layers=copy.deepcopy(self.configuration.layers),
         all_layers=self.parameters.all_layers,
         parent=self,
         flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR,
     )
     button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
     HobAltButton.style_button(button)
     button = dialog.add_button("OK", gtk.RESPONSE_YES)
     HobButton.style_button(button)
     response = dialog.run()
     if response == gtk.RESPONSE_YES:
         self.configuration.layers = dialog.layers
         self.save_defaults()  # remember layers
         # DO refresh layers
         if dialog.layers_changed:
             self.update_config_async()
     dialog.destroy()
Beispiel #38
0
 def show_layer_selection_dialog(self):
     dialog = LayerSelectionDialog(title="Layers",
                                   layers=copy.deepcopy(
                                       self.configuration.layers),
                                   all_layers=self.parameters.all_layers,
                                   parent=self,
                                   flags=gtk.DIALOG_MODAL
                                   | gtk.DIALOG_DESTROY_WITH_PARENT
                                   | gtk.DIALOG_NO_SEPARATOR)
     button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
     HobAltButton.style_button(button)
     button = dialog.add_button("OK", gtk.RESPONSE_YES)
     HobButton.style_button(button)
     response = dialog.run()
     if response == gtk.RESPONSE_YES:
         self.configuration.layers = dialog.layers
         self.save_defaults()  # remember layers
         # DO refresh layers
         if dialog.layers_changed:
             self.update_config_async()
     dialog.destroy()
Beispiel #39
0
    def create_config_build_button(self):
        # Create the "Build packages" and "Build image" buttons at the bottom
        button_box = gtk.HBox(False, 6)

        # create button "Build image"
        self.just_bake_button = HobButton("Build image")
        #self.just_bake_button.set_size_request(205, 49)
        self.just_bake_button.set_tooltip_text("Build target image")
        self.just_bake_button.connect("clicked",
                                      self.just_bake_button_clicked_cb)
        button_box.pack_end(self.just_bake_button, expand=False, fill=False)

        # create button "Edit Image"
        self.edit_image_button = HobAltButton("Edit image")
        #self.edit_image_button.set_size_request(205, 49)
        self.edit_image_button.set_tooltip_text("Edit target image")
        self.edit_image_button.connect("clicked",
                                       self.edit_image_button_clicked_cb)
        button_box.pack_end(self.edit_image_button, expand=False, fill=False)

        return button_box
Beispiel #40
0
    def create_config_build_button(self):
        # Create the "Build packages" and "Build image" buttons at the bottom
        button_box = gtk.HBox(False, 6)

        # create button "Build image"
        self.just_bake_button = HobButton("Build image")
        self.just_bake_button.set_tooltip_text(
            "Build the image recipe as it is")
        self.just_bake_button.connect("clicked",
                                      self.just_bake_button_clicked_cb)
        button_box.pack_end(self.just_bake_button, expand=False, fill=False)

        # create button "Edit image recipe"
        self.edit_image_button = HobAltButton("Edit image recipe")
        self.edit_image_button.set_tooltip_text(
            "Customize the recipes and packages to be included in your image")
        self.edit_image_button.connect("clicked",
                                       self.edit_image_button_clicked_cb)
        button_box.pack_end(self.edit_image_button, expand=False, fill=False)

        return button_box
Beispiel #41
0
    def create_config_build_button(self):
        # Create the "Build packages" and "Build image" buttons at the bottom
        button_box = gtk.HBox(False, 6)

        # create button "Build image"
        just_bake_button = HobButton("Build image")
        just_bake_button.set_size_request(205, 49)
        just_bake_button.set_tooltip_text("Build target image")
        just_bake_button.connect("clicked", self.just_bake_button_clicked_cb)
        button_box.pack_end(just_bake_button, expand=False, fill=False)

        label = gtk.Label(" or ")
        button_box.pack_end(label, expand=False, fill=False)

        # create button "Build Packages"
        build_packages_button = HobAltButton("Build packages")
        build_packages_button.connect("clicked", self.build_packages_button_clicked_cb)
        build_packages_button.set_tooltip_text("Build recipes into packages")
        button_box.pack_end(build_packages_button, expand=False, fill=False)

        return button_box
    def create_visual_elements(self):
        self.label = gtk.Label("Packages included: 0\nSelected packages size: 0 MB")
        self.eventbox = self.add_onto_top_bar(self.label, 73)
        self.pack_start(self.eventbox, expand=False, fill=False)
        self.pack_start(self.group_align, expand=True, fill=True)

        # set visible members
        self.ins = HobNotebook()
        self.tables = []  # we need to modify table when the dialog is shown

        search_names = []
        search_tips = []
        # append the tab
        for page in self.pages:
            columns = page["columns"]
            name = page["name"]
            tab = HobViewTable(columns, name)
            search_names.append(page["search"])
            search_tips.append(page["searchtip"])
            filter = page["filter"]
            sort_model = self.package_model.tree_model(filter, initial=True)
            tab.set_model(sort_model)
            tab.connect("toggled", self.table_toggled_cb, name)
            if name == "Included packages":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
            if name == "All packages":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
            self.ins.append_page(tab, page["name"], page["tooltip"])
            self.tables.append(tab)

        self.ins.set_entry(search_names, search_tips)
        self.ins.search.connect("changed", self.search_entry_changed)

        # add all into the dialog
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        self.button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_start(self.button_box, expand=False, fill=False)

        self.build_image_button = HobButton("Build image")
        # self.build_image_button.set_size_request(205, 49)
        self.build_image_button.set_tooltip_text("Build target image")
        self.build_image_button.set_flags(gtk.CAN_DEFAULT)
        self.build_image_button.grab_default()
        self.build_image_button.connect("clicked", self.build_image_clicked_cb)
        self.button_box.pack_end(self.build_image_button, expand=False, fill=False)

        self.back_button = HobAltButton("Cancel")
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        self.button_box.pack_end(self.back_button, expand=False, fill=False)
Beispiel #43
0
    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
Beispiel #44
0
    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
Beispiel #45
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()
Beispiel #46
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

        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()
Beispiel #47
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

        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 create_visual_elements(self):
        self.label = gtk.Label()
        self.eventbox = self.add_onto_top_bar(self.label, 73)
        self.pack_start(self.eventbox, expand=False, fill=False)
        self.pack_start(self.group_align, expand=True, fill=True)

        # set visiable members
        self.ins = HobNotebook()
        self.tables = [] # we need modify table when the dialog is shown
        # append the tabs in order
        for page in self.pages:
            columns = page['columns']
            tab = HobViewTable(columns)
            filter = page['filter']
            tab.set_model(self.recipe_model.tree_model(filter))
            tab.connect("toggled", self.table_toggled_cb, page['name'])
            if page['name'] == "Included":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
            label = gtk.Label(page['name'])
            label.set_selectable(False)
            label.set_tooltip_text(page['tooltip'])
            self.ins.append_page(tab, label)
            self.tables.append(tab)

        self.ins.set_entry("Search recipes:")
        # set the search entry for each table
        for tab in self.tables:
            search_tip = "Enter a recipe's or task's name to find it"
            self.ins.search.set_tooltip_text(search_tip)
            self.ins.search.props.has_tooltip = True
            tab.set_search_entry(0, self.ins.search)

        # add all into the window
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_end(button_box, expand=False, fill=False)

        self.build_packages_button = HobButton('Build packages')
        self.build_packages_button.set_size_request(205, 49)
        self.build_packages_button.set_tooltip_text("Build selected recipes into packages")
        self.build_packages_button.set_flags(gtk.CAN_DEFAULT)
        self.build_packages_button.grab_default()
        self.build_packages_button.connect("clicked", self.build_packages_clicked_cb)
        button_box.pack_end(self.build_packages_button, expand=False, fill=False)

        self.back_button = HobAltButton("<< Back to image configuration")
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        button_box.pack_start(self.back_button, expand=False, fill=False)
Beispiel #49
0
    def create_bottom_buttons(self, buttonlist, image_name):
        # Create the buttons at the bottom
        self.button_ids = {}
        is_runnable = False

        # create button "Deploy image"
        name = "Deploy image"
        if name in buttonlist:  # and self.test_deployable(image_name):
            deploy_button = HobButton('Deploy image')
            tooltip = "Burn your image to an external storage device"
            deploy_button.set_tooltip_text(tooltip)
            deploy_button.set_flags(gtk.CAN_DEFAULT)
            button_id = deploy_button.connect("clicked", self.deploy_button_clicked_cb)
            self.button_ids[button_id] = deploy_button
            self.details_bottom_buttons.pack_end(deploy_button, expand=False, fill=False)

        name = "Edit packages"
        if name in buttonlist:
            # create button "Edit packages"
            edit_packages_button = HobAltButton("Edit packages")
            tooltip = "Edit the list of packages included in your image"
            edit_packages_button.set_tooltip_text(tooltip)
            edit_packages_button.connect("clicked", self.edit_packages_button_clicked_cb)

            self.details_bottom_buttons.pack_end(edit_packages_button, expand=False, fill=False)
            button_id = edit_packages_button.connect("clicked", self.edit_packages_button_clicked_cb)
            self.button_ids[button_id] = edit_packages_button

        name = "New image"
        if name in buttonlist:
            build_new_button = HobAltButton("New image")
            self.details_bottom_buttons.pack_end(build_new_button, expand=False, fill=False)
            build_new_button.set_tooltip_text("Create a new image from scratch")
            button_id = build_new_button.connect("clicked", self.build_new_button_clicked_cb)
            self.button_ids[button_id] = build_new_button

        return is_runnable
Beispiel #50
0
    def add_build_stop_top_bar(self, action, log_file=None):
        color = HobColors.LIGHT_GRAY
        build_stop_top = gtk.EventBox()
        build_stop_top.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
        build_stop_top.set_flags(gtk.CAN_DEFAULT)
        build_stop_top.grab_default()

        build_stop_tab = gtk.Table(11, 46, True)
        build_stop_top.add(build_stop_tab)

        icon = gtk.Image()
        icon_pix_buffer = gtk.gdk.pixbuf_new_from_file(hic.ICON_INFO_HOVER_FILE)
        icon.set_from_pixbuf(icon_pix_buffer)
        build_stop_tab.attach(icon, 1, 4, 0, 6)

        label = gtk.Label()
        label.set_alignment(0.0, 0.5)
        label.set_markup("<span size='x-large'><b>%s</b></span>" % self.title)
        build_stop_tab.attach(label, 4, 40, 0, 6)

        action_button = HobButton("Edit %s" % action)
        action_button.set_size_request(-1, 40)
        if action == "image":
            action_button.set_tooltip_text("Edit the image parameters")
        elif action == "recipes":
            action_button.set_tooltip_text("Edit the included recipes")
        elif action == "packages":
            action_button.set_tooltip_text("Edit the included packages")
        action_button.connect('clicked', self.stop_primary_action_button_clicked_cb, action)
        build_stop_tab.attach(action_button, 4, 20, 6, 9)

        build_button = HobAltButton("Build new image")
        build_button.set_tooltip_text("Create a new image from scratch")
        build_button.connect('clicked', self.new_image_button_clicked_cb)
        build_stop_tab.attach(build_button, 21, 40, 6, 9)

        return build_stop_top, action_button
    def create_visual_elements(self):
        self.label = gtk.Label("Packages included: 0\nSelected packages size: 0 MB")
        self.eventbox = self.add_onto_top_bar(self.label, padding=15)
        self.pack_start(self.eventbox, expand=False, fill=False)
        self.pack_start(self.group_align, expand=True, fill=True)

        # set visible members
        self.ins = HobNotebook()
        self.tables = [] # we need to modify table when the dialog is shown

        search_names = []
        search_tips = []
        # append the tab
        page = self.pages[0]
        columns = page['columns']
        name = page['name']
        self.tab = HobViewTable(columns, name)
        search_names.append(page['search'])
        search_tips.append(page['searchtip'])
        self.ins.set_entry(search_names, search_tips)
        self.ins.search.connect("changed", self.search_entry_changed)
        filter = page['filter']
        sort_model = self.package_model.tree_model(filter, initial=True)
        self.tab.set_model(sort_model)
        self.tab.connect("toggled", self.table_toggled_cb, name)
        self.tab.connect("button-release-event", self.button_click_cb)
        self.tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include, filter)
        #self.tab.set_size_request(-1, 350)
        self.ins.append_page(self.tab, page['name'], page['tooltip'])
        self.tables.append(self.tab)

        # add all into the dialog
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        self.button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_start(self.button_box, expand=False, fill=False)

        self.build_image_button = HobButton('Build image')
        self.build_image_button.set_tooltip_text("Build your image")
        self.build_image_button.set_flags(gtk.CAN_DEFAULT)
        self.build_image_button.grab_default()
        self.build_image_button.connect("clicked", self.build_image_clicked_cb)
        self.button_box.pack_end(self.build_image_button, expand=False, fill=False)

        self.back_button = HobAltButton('Cancel')
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        self.button_box.pack_end(self.back_button, expand=False, fill=False)
    def create_config_build_button(self):
        # Create the "Build packages" and "Build image" buttons at the bottom
        button_box = gtk.HBox(False, 6)

        # create button "Build image"
        self.just_bake_button = HobButton("Build image")
        self.just_bake_button.set_tooltip_text("Build the image recipe as it is")
        self.just_bake_button.connect("clicked", self.just_bake_button_clicked_cb)
        button_box.pack_end(self.just_bake_button, expand=False, fill=False)

        # create button "Edit image recipe"
        self.edit_image_button = HobAltButton("Edit image recipe")
        self.edit_image_button.set_tooltip_text("Customize the recipes and packages to be included in your image")
        self.edit_image_button.connect("clicked", self.edit_image_button_clicked_cb)
        button_box.pack_end(self.edit_image_button, expand=False, fill=False)

        return button_box
Beispiel #53
0
 def show_page(self, log_file):
     children = self.button_box.get_children() or []
     for child in children:
         self.button_box.remove(child)
     # re-packed the buttons as request, add the 'open log' button if build success
     self.button_box.pack_end(self.build_image_button, expand=False, fill=False)
     if log_file:
         open_log_button = HobAltButton("Open log")
         open_log_button.connect("clicked", self.open_log_clicked_cb, log_file)
         open_log_button.set_tooltip_text("Open the build's log file")
         self.button_box.pack_end(open_log_button, expand=False, fill=False)
     self.button_box.pack_end(self.back_button, expand=False, fill=False)
     self.show_all()
    def create_config_build_button(self):
        # Create the "Build packages" and "Build image" buttons at the bottom
        button_box = gtk.HBox(False, 6)

        # create button "Build image"
        just_bake_button = HobButton("Build image")
        just_bake_button.set_size_request(205, 49)
        just_bake_button.set_tooltip_text("Build target image")
        just_bake_button.connect("clicked", self.just_bake_button_clicked_cb)
        button_box.pack_end(just_bake_button, expand=False, fill=False)

        label = gtk.Label(" or ")
        button_box.pack_end(label, expand=False, fill=False)

        # create button "Build Packages"
        build_packages_button = HobAltButton("Build packages")
        build_packages_button.connect("clicked", self.build_packages_button_clicked_cb)
        build_packages_button.set_tooltip_text("Build recipes into packages")
        button_box.pack_end(build_packages_button, expand=False, fill=False)

        return button_box
Beispiel #55
0
    def add_build_stop_top_bar(self, action, log_file=None):
        color = HobColors.LIGHT_GRAY
        build_stop_top = gtk.EventBox()
        build_stop_top.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
        build_stop_top.set_flags(gtk.CAN_DEFAULT)
        build_stop_top.grab_default()

        build_stop_tab = gtk.Table(11, 46, True)
        build_stop_top.add(build_stop_tab)

        icon = gtk.Image()
        icon_pix_buffer = gtk.gdk.pixbuf_new_from_file(
            hic.ICON_INFO_HOVER_FILE)
        icon.set_from_pixbuf(icon_pix_buffer)
        build_stop_tab.attach(icon, 1, 4, 0, 6)

        label = gtk.Label()
        label.set_alignment(0.0, 0.5)
        label.set_markup("<span size='x-large'><b>%s</b></span>" % self.title)
        build_stop_tab.attach(label, 4, 40, 0, 6)

        action_button = HobButton("Edit %s" % action)
        action_button.set_size_request(-1, 40)
        if action == "image":
            action_button.set_tooltip_text("Edit the image parameters")
        elif action == "recipes":
            action_button.set_tooltip_text("Edit the included recipes")
        elif action == "packages":
            action_button.set_tooltip_text("Edit the included packages")
        action_button.connect('clicked',
                              self.stop_primary_action_button_clicked_cb,
                              action)
        build_stop_tab.attach(action_button, 4, 20, 6, 9)

        build_button = HobAltButton("Build new image")
        build_button.set_tooltip_text("Create a new image from scratch")
        build_button.connect('clicked', self.new_image_button_clicked_cb)
        build_stop_tab.attach(build_button, 21, 40, 6, 9)

        return build_stop_top, action_button
Beispiel #56
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)
Beispiel #57
0
class ImageConfigurationPage(HobPage):

    __dummy_machine__ = "--select a machine--"
    __dummy_image__ = "--select an image recipe--"
    __custom_image__ = "Select from my image recipes"

    def __init__(self, builder):
        super(ImageConfigurationPage, self).__init__(builder,
                                                     "Image configuration")

        self.image_combo_id = None
        # we use machine_combo_changed_by_manual to identify the machine is changed by code
        # or by manual. If by manual, all user's recipe selection and package selection are
        # cleared.
        self.machine_combo_changed_by_manual = True
        self.stopping = False
        self.warning_shift = 0
        self.custom_image_selected = None
        self.create_visual_elements()

    def create_visual_elements(self):
        # create visual elements
        self.toolbar = gtk.Toolbar()
        self.toolbar.set_orientation(gtk.ORIENTATION_HORIZONTAL)
        self.toolbar.set_style(gtk.TOOLBAR_BOTH)

        my_images_button = self.append_toolbar_button(
            self.toolbar, "Images", hic.ICON_IMAGES_DISPLAY_FILE,
            hic.ICON_IMAGES_HOVER_FILE, "Open previously built images",
            self.my_images_button_clicked_cb)
        settings_button = self.append_toolbar_button(
            self.toolbar, "Settings", hic.ICON_SETTINGS_DISPLAY_FILE,
            hic.ICON_SETTINGS_HOVER_FILE, "View additional build settings",
            self.settings_button_clicked_cb)

        self.config_top_button = self.add_onto_top_bar(self.toolbar)

        self.gtable = gtk.Table(40, 40, True)
        self.create_config_machine()
        self.create_config_baseimg()
        self.config_build_button = self.create_config_build_button()

    def _remove_all_widget(self):
        children = self.gtable.get_children() or []
        for child in children:
            self.gtable.remove(child)
        children = self.box_group_area.get_children() or []
        for child in children:
            self.box_group_area.remove(child)
        children = self.get_children() or []
        for child in children:
            self.remove(child)

    def _pack_components(self, pack_config_build_button=False):
        self._remove_all_widget()
        self.pack_start(self.config_top_button, expand=False, fill=False)
        self.pack_start(self.group_align, expand=True, fill=True)

        self.box_group_area.pack_start(self.gtable, expand=True, fill=True)
        if pack_config_build_button:
            self.box_group_area.pack_end(self.config_build_button,
                                         expand=False,
                                         fill=False)
        else:
            box = gtk.HBox(False, 6)
            box.show()
            subbox = gtk.HBox(False, 0)
            subbox.set_size_request(205, 49)
            subbox.show()
            box.add(subbox)
            self.box_group_area.pack_end(box, False, False)

    def show_machine(self):
        self.progress_bar.reset()
        self._pack_components(pack_config_build_button=False)
        self.set_config_machine_layout(show_progress_bar=False)
        self.show_all()

    def update_progress_bar(self, title, fraction, status=None):
        if self.stopping == False:
            self.progress_bar.update(fraction)
            self.progress_bar.set_text(title)
            self.progress_bar.set_rcstyle(status)

    def show_info_populating(self):
        self._pack_components(pack_config_build_button=False)
        self.set_config_machine_layout(show_progress_bar=True)
        self.show_all()

    def show_info_populated(self):
        self.progress_bar.reset()
        self._pack_components(pack_config_build_button=False)
        self.set_config_machine_layout(show_progress_bar=False)
        self.set_config_baseimg_layout()
        self.show_all()

    def show_baseimg_selected(self):
        self.progress_bar.reset()
        self._pack_components(pack_config_build_button=True)
        self.set_config_machine_layout(show_progress_bar=False)
        self.set_config_baseimg_layout()
        self.show_all()
        if self.builder.recipe_model.get_selected_image(
        ) == self.builder.recipe_model.__custom_image__:
            self.just_bake_button.hide()

    def add_warnings_bar(self):
        #create the warnings bar shown when recipes parsing generates warnings
        color = HobColors.KHAKI
        warnings_bar = gtk.EventBox()
        warnings_bar.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
        warnings_bar.set_flags(gtk.CAN_DEFAULT)
        warnings_bar.grab_default()

        build_stop_tab = gtk.Table(10, 20, True)
        warnings_bar.add(build_stop_tab)

        icon = gtk.Image()
        icon_pix_buffer = gtk.gdk.pixbuf_new_from_file(
            hic.ICON_INDI_ALERT_FILE)
        icon.set_from_pixbuf(icon_pix_buffer)
        build_stop_tab.attach(icon, 0, 2, 0, 10)

        label = gtk.Label()
        label.set_alignment(0.0, 0.5)
        warnings_nb = len(self.builder.parsing_warnings)
        if warnings_nb == 1:
            label.set_markup(
                "<span size='x-large'><b>1 recipe parsing warning</b></span>")
        else:
            label.set_markup(
                "<span size='x-large'><b>%s recipe parsing warnings</b></span>"
                % warnings_nb)
        build_stop_tab.attach(label, 2, 12, 0, 10)

        view_warnings_button = HobButton("View warnings")
        view_warnings_button.connect('clicked',
                                     self.view_warnings_button_clicked_cb)
        build_stop_tab.attach(view_warnings_button, 15, 19, 1, 9)

        return warnings_bar

    def disable_warnings_bar(self):
        if self.builder.parsing_warnings:
            if hasattr(self, 'warnings_bar'):
                self.warnings_bar.hide_all()
            self.builder.parsing_warnings = []

    def create_config_machine(self):
        self.machine_title = gtk.Label()
        self.machine_title.set_alignment(0.0, 0.5)
        mark = "<span %s>Select a machine</span>" % self.span_tag(
            'x-large', 'bold')
        self.machine_title.set_markup(mark)

        self.machine_title_desc = gtk.Label()
        self.machine_title_desc.set_alignment(0.0, 0.5)
        mark = (
            "<span %s>Your selection is the profile of the target machine for which you"
            " are building the image.\n</span>") % (self.span_tag('medium'))
        self.machine_title_desc.set_markup(mark)

        self.machine_combo = gtk.combo_box_new_text()
        self.machine_combo.connect("changed", self.machine_combo_changed_cb)

        icon_file = hic.ICON_LAYERS_DISPLAY_FILE
        hover_file = hic.ICON_LAYERS_HOVER_FILE
        self.layer_button = HobImageButton(
            "Layers", "Add support for machines, software, etc.", icon_file,
            hover_file)
        self.layer_button.connect("clicked", self.layer_button_clicked_cb)

        markup = "Layers are a powerful mechanism to extend the Yocto Project "
        markup += "with your own functionality.\n"
        markup += "For more on layers, check the <a href=\""
        markup += "http://www.yoctoproject.org/docs/current/dev-manual/"
        markup += "dev-manual.html#understanding-and-using-layers\">reference manual</a>."
        self.layer_info_icon = HobInfoButton("<b>Layers</b>" + "*" + markup,
                                             self.get_parent())
        self.progress_bar = HobProgressBar()
        self.stop_button = HobAltButton("Stop")
        self.stop_button.connect("clicked", self.stop_button_clicked_cb)
        self.machine_separator = gtk.HSeparator()

    def set_config_machine_layout(self, show_progress_bar=False):
        self.gtable.attach(self.machine_title, 0, 40, 0, 4)
        self.gtable.attach(self.machine_title_desc, 0, 40, 4, 6)
        self.gtable.attach(self.machine_combo, 0, 12, 7, 10)
        self.gtable.attach(self.layer_button, 14, 36, 7, 12)
        self.gtable.attach(self.layer_info_icon, 36, 40, 7, 11)
        if show_progress_bar:
            #self.gtable.attach(self.progress_box, 0, 40, 15, 18)
            self.gtable.attach(self.progress_bar, 0, 37, 15, 18)
            self.gtable.attach(self.stop_button, 37, 40, 15, 18, 0, 0)
        if self.builder.parsing_warnings:
            self.warnings_bar = self.add_warnings_bar()
            self.gtable.attach(self.warnings_bar, 0, 40, 14, 18)
            self.warning_shift = 4
        else:
            self.warning_shift = 0
        self.gtable.attach(self.machine_separator, 0, 40, 13, 14)

    def create_config_baseimg(self):
        self.image_title = gtk.Label()
        self.image_title.set_alignment(0, 1.0)
        mark = "<span %s>Select an image recipe</span>" % self.span_tag(
            'x-large', 'bold')
        self.image_title.set_markup(mark)

        self.image_title_desc = gtk.Label()
        self.image_title_desc.set_alignment(0, 0.5)

        mark = (
            "<span %s>Image recipes are a starting point for the type of image you want. "
            "You can build them as \n"
            "they are or edit them to suit your needs.\n</span>"
        ) % self.span_tag('medium')
        self.image_title_desc.set_markup(mark)

        self.image_combo = gtk.combo_box_new_text()
        self.image_combo.set_row_separator_func(self.combo_separator_func,
                                                None)
        self.image_combo_id = self.image_combo.connect(
            "changed", self.image_combo_changed_cb)

        self.image_desc = gtk.Label()
        self.image_desc.set_alignment(0.0, 0.5)
        self.image_desc.set_size_request(256, -1)
        self.image_desc.set_justify(gtk.JUSTIFY_LEFT)
        self.image_desc.set_line_wrap(True)

        # button to view recipes
        icon_file = hic.ICON_RCIPE_DISPLAY_FILE
        hover_file = hic.ICON_RCIPE_HOVER_FILE
        self.view_adv_configuration_button = HobImageButton(
            "Advanced configuration",
            "Select image types, package formats, etc", icon_file, hover_file)
        self.view_adv_configuration_button.connect(
            "clicked", self.view_adv_configuration_button_clicked_cb)

        self.image_separator = gtk.HSeparator()

    def combo_separator_func(self, model, iter, user_data):
        name = model.get_value(iter, 0)
        if name == "--Separator--":
            return True

    def set_config_baseimg_layout(self):
        self.gtable.attach(self.image_title, 0, 40, 15 + self.warning_shift,
                           17 + self.warning_shift)
        self.gtable.attach(self.image_title_desc, 0, 40,
                           18 + self.warning_shift, 22 + self.warning_shift)
        self.gtable.attach(self.image_combo, 0, 12, 23 + self.warning_shift,
                           26 + self.warning_shift)
        self.gtable.attach(self.image_desc, 0, 12, 27 + self.warning_shift,
                           33 + self.warning_shift)
        self.gtable.attach(self.view_adv_configuration_button, 14, 36,
                           23 + self.warning_shift, 28 + self.warning_shift)
        self.gtable.attach(self.image_separator, 0, 40,
                           35 + self.warning_shift, 36 + self.warning_shift)

    def create_config_build_button(self):
        # Create the "Build packages" and "Build image" buttons at the bottom
        button_box = gtk.HBox(False, 6)

        # create button "Build image"
        self.just_bake_button = HobButton("Build image")
        self.just_bake_button.set_tooltip_text(
            "Build the image recipe as it is")
        self.just_bake_button.connect("clicked",
                                      self.just_bake_button_clicked_cb)
        button_box.pack_end(self.just_bake_button, expand=False, fill=False)

        # create button "Edit image recipe"
        self.edit_image_button = HobAltButton("Edit image recipe")
        self.edit_image_button.set_tooltip_text(
            "Customize the recipes and packages to be included in your image")
        self.edit_image_button.connect("clicked",
                                       self.edit_image_button_clicked_cb)
        button_box.pack_end(self.edit_image_button, expand=False, fill=False)

        return button_box

    def stop_button_clicked_cb(self, button):
        self.stopping = True
        self.progress_bar.set_text("Stopping recipe parsing")
        self.progress_bar.set_rcstyle("stop")
        self.builder.cancel_parse_sync()

    def view_warnings_button_clicked_cb(self, button):
        self.builder.show_warning_dialog()

    def machine_combo_changed_idle_cb(self):
        self.builder.window.set_cursor(None)

    def machine_combo_changed_cb(self, machine_combo):
        self.stopping = False
        self.builder.parsing_warnings = []
        combo_item = machine_combo.get_active_text()
        if not combo_item or combo_item == self.__dummy_machine__:
            return

        self.builder.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
        self.builder.wait(0.1)  #wait for combo and cursor to update

        # remove __dummy_machine__ item from the store list after first user selection
        # because it is no longer valid
        combo_store = machine_combo.get_model()
        if len(combo_store) and (combo_store[0][0] == self.__dummy_machine__):
            machine_combo.remove_text(0)

        self.builder.configuration.curr_mach = combo_item
        if self.machine_combo_changed_by_manual:
            self.builder.configuration.clear_selection()
        # reset machine_combo_changed_by_manual
        self.machine_combo_changed_by_manual = True

        self.builder.configuration.selected_image = None

        # Do reparse recipes
        self.builder.populate_recipe_package_info_async()

        glib.idle_add(self.machine_combo_changed_idle_cb)

    def update_machine_combo(self):
        self.disable_warnings_bar()
        all_machines = [self.__dummy_machine__
                        ] + self.builder.parameters.all_machines

        model = self.machine_combo.get_model()
        model.clear()
        for machine in all_machines:
            self.machine_combo.append_text(machine)
        self.machine_combo.set_active(0)

    def switch_machine_combo(self):
        self.disable_warnings_bar()
        self.machine_combo_changed_by_manual = False
        model = self.machine_combo.get_model()
        active = 0
        while active < len(model):
            if model[active][0] == self.builder.configuration.curr_mach:
                self.machine_combo.set_active(active)
                return
            active += 1

        if model[0][0] != self.__dummy_machine__:
            self.machine_combo.insert_text(0, self.__dummy_machine__)

        self.machine_combo.set_active(0)

    def update_image_desc(self):
        desc = ""
        selected_image = self.image_combo.get_active_text()
        if selected_image and selected_image in self.builder.recipe_model.pn_path.keys(
        ):
            image_path = self.builder.recipe_model.pn_path[selected_image]
            image_iter = self.builder.recipe_model.get_iter(image_path)
            desc = self.builder.recipe_model.get_value(
                image_iter, self.builder.recipe_model.COL_DESC)

        mark = ("<span %s>%s</span>\n") % (self.span_tag('small'), desc)
        self.image_desc.set_markup(mark)

    def image_combo_changed_idle_cb(self, selected_image, selected_recipes,
                                    selected_packages):
        self.builder.update_recipe_model(selected_image, selected_recipes)
        self.builder.update_package_model(selected_packages)
        self.builder.window_sensitive(True)

    def image_combo_changed_cb(self, combo):
        self.builder.window_sensitive(False)
        selected_image = self.image_combo.get_active_text()
        if selected_image == self.__custom_image__:
            topdir = self.builder.get_topdir()
            images_dir = topdir + "/recipes/images/"
            self.builder.ensure_dir(images_dir)

            dialog = RetrieveImageDialog(
                images_dir, "Select from my image recipes", self.builder,
                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
            response = dialog.run()
            if response == gtk.RESPONSE_OK:
                image_name = dialog.get_filename()
                head, tail = os.path.split(image_name)
                selected_image = os.path.splitext(tail)[0]
                self.custom_image_selected = selected_image
                self.update_image_combo(self.builder.recipe_model,
                                        selected_image)
            else:
                selected_image = self.__dummy_image__
                self.update_image_combo(self.builder.recipe_model, None)
            dialog.destroy()
        else:
            if self.custom_image_selected:
                self.custom_image_selected = None
                self.update_image_combo(self.builder.recipe_model,
                                        selected_image)

        if not selected_image or (selected_image == self.__dummy_image__):
            self.builder.window_sensitive(True)
            self.just_bake_button.hide()
            self.edit_image_button.hide()
            return

        # remove __dummy_image__ item from the store list after first user selection
        # because it is no longer valid
        combo_store = combo.get_model()
        if len(combo_store) and (combo_store[0][0] == self.__dummy_image__):
            combo.remove_text(0)

        self.builder.customized = False

        selected_recipes = []

        image_path = self.builder.recipe_model.pn_path[selected_image]
        image_iter = self.builder.recipe_model.get_iter(image_path)
        selected_packages = self.builder.recipe_model.get_value(
            image_iter, self.builder.recipe_model.COL_INSTALL).split()
        self.update_image_desc()

        self.builder.recipe_model.reset()
        self.builder.package_model.reset()

        self.show_baseimg_selected()

        if selected_image == self.builder.recipe_model.__custom_image__:
            self.just_bake_button.hide()

        glib.idle_add(self.image_combo_changed_idle_cb, selected_image,
                      selected_recipes, selected_packages)

    def _image_combo_connect_signal(self):
        if not self.image_combo_id:
            self.image_combo_id = self.image_combo.connect(
                "changed", self.image_combo_changed_cb)

    def _image_combo_disconnect_signal(self):
        if self.image_combo_id:
            self.image_combo.disconnect(self.image_combo_id)
            self.image_combo_id = None

    def update_image_combo(self, recipe_model, selected_image):
        # Update the image combo according to the images in the recipe_model
        # populate image combo
        filter = {RecipeListModel.COL_TYPE: ['image']}
        image_model = recipe_model.tree_model(filter)
        image_model.set_sort_column_id(recipe_model.COL_NAME,
                                       gtk.SORT_ASCENDING)
        active = 0
        cnt = 0

        white_pattern = []
        if self.builder.parameters.image_white_pattern:
            for i in self.builder.parameters.image_white_pattern.split():
                white_pattern.append(re.compile(i))

        black_pattern = []
        if self.builder.parameters.image_black_pattern:
            for i in self.builder.parameters.image_black_pattern.split():
                black_pattern.append(re.compile(i))
        black_pattern.append(re.compile("hob-image"))

        it = image_model.get_iter_first()
        self._image_combo_disconnect_signal()
        model = self.image_combo.get_model()
        model.clear()
        # Set a indicator text to combo store when first open
        if not selected_image:
            self.image_combo.append_text(self.__dummy_image__)
            cnt = cnt + 1

        self.image_combo.append_text(self.__custom_image__)
        self.image_combo.append_text("--Separator--")
        cnt = cnt + 2

        topdir = self.builder.get_topdir()
        # append and set active
        while it:
            path = image_model.get_path(it)
            it = image_model.iter_next(it)
            image_name = image_model[path][recipe_model.COL_NAME]
            if image_name == self.builder.recipe_model.__custom_image__:
                continue

            if black_pattern:
                allow = True
                for pattern in black_pattern:
                    if pattern.search(image_name):
                        allow = False
                        break
            elif white_pattern:
                allow = False
                for pattern in white_pattern:
                    if pattern.search(image_name):
                        allow = True
                        break
            else:
                allow = True

            file_name = image_model[path][recipe_model.COL_FILE]
            if file_name and topdir in file_name:
                allow = False

            if allow:
                self.image_combo.append_text(image_name)
                if image_name == selected_image:
                    active = cnt
                cnt = cnt + 1
        self.image_combo.append_text(
            self.builder.recipe_model.__custom_image__)

        if selected_image == self.builder.recipe_model.__custom_image__:
            active = cnt

        if self.custom_image_selected:
            self.image_combo.append_text("--Separator--")
            self.image_combo.append_text(self.custom_image_selected)
            cnt = cnt + 2
            if self.custom_image_selected == selected_image:
                active = cnt

        self.image_combo.set_active(active)

        if active != 0:
            self.show_baseimg_selected()

        self._image_combo_connect_signal()

    def layer_button_clicked_cb(self, button):
        # Create a layer selection dialog
        self.builder.show_layer_selection_dialog()

    def view_adv_configuration_button_clicked_cb(self, button):
        # Create an advanced settings dialog
        response, settings_changed = self.builder.show_adv_settings_dialog()
        if not response:
            return
        if settings_changed:
            self.builder.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
            self.builder.wait(0.1)  #wait for adv_settings_dialog to terminate
            self.builder.reparse_post_adv_settings()
            self.builder.window.set_cursor(None)

    def just_bake_button_clicked_cb(self, button):
        self.builder.parsing_warnings = []
        self.builder.just_bake()

    def edit_image_button_clicked_cb(self, button):
        self.builder.configuration.initial_selected_image = self.builder.configuration.selected_image
        self.builder.show_recipes()

    def my_images_button_clicked_cb(self, button):
        self.builder.show_load_my_images_dialog()

    def settings_button_clicked_cb(self, button):
        # Create an advanced settings dialog
        response, settings_changed = self.builder.show_simple_settings_dialog()
        if not response:
            return
        if settings_changed:
            self.builder.reparse_post_adv_settings()
Beispiel #58
0
class ImageConfigurationPage(HobPage):

    __dummy_machine__ = "--select a machine--"
    __dummy_image__ = "--select a base image--"

    def __init__(self, builder):
        super(ImageConfigurationPage, self).__init__(builder,
                                                     "Image configuration")

        self.image_combo_id = None
        # we use machine_combo_changed_by_manual to identify the machine is changed by code
        # or by manual. If by manual, all user's recipe selection and package selection are
        # cleared.
        self.machine_combo_changed_by_manual = True
        self.stopping = False
        self.create_visual_elements()

    def create_visual_elements(self):
        # create visual elements
        self.toolbar = gtk.Toolbar()
        self.toolbar.set_orientation(gtk.ORIENTATION_HORIZONTAL)
        self.toolbar.set_style(gtk.TOOLBAR_BOTH)

        template_button = self.append_toolbar_button(
            self.toolbar, "Templates", hic.ICON_TEMPLATES_DISPLAY_FILE,
            hic.ICON_TEMPLATES_HOVER_FILE, "Load a previously saved template",
            self.template_button_clicked_cb)
        my_images_button = self.append_toolbar_button(
            self.toolbar, "Images", hic.ICON_IMAGES_DISPLAY_FILE,
            hic.ICON_IMAGES_HOVER_FILE, "Open previously built images",
            self.my_images_button_clicked_cb)
        settings_button = self.append_toolbar_button(
            self.toolbar, "Settings", hic.ICON_SETTINGS_DISPLAY_FILE,
            hic.ICON_SETTINGS_HOVER_FILE, "View additional build settings",
            self.settings_button_clicked_cb)

        self.config_top_button = self.add_onto_top_bar(self.toolbar)

        self.gtable = gtk.Table(40, 40, True)
        self.create_config_machine()
        self.create_config_baseimg()
        self.config_build_button = self.create_config_build_button()

    def _remove_all_widget(self):
        children = self.gtable.get_children() or []
        for child in children:
            self.gtable.remove(child)
        children = self.box_group_area.get_children() or []
        for child in children:
            self.box_group_area.remove(child)
        children = self.get_children() or []
        for child in children:
            self.remove(child)

    def _pack_components(self, pack_config_build_button=False):
        self._remove_all_widget()
        self.pack_start(self.config_top_button, expand=False, fill=False)
        self.pack_start(self.group_align, expand=True, fill=True)

        self.box_group_area.pack_start(self.gtable, expand=True, fill=True)
        if pack_config_build_button:
            self.box_group_area.pack_end(self.config_build_button,
                                         expand=False,
                                         fill=False)
        else:
            box = gtk.HBox(False, 6)
            box.show()
            subbox = gtk.HBox(False, 0)
            subbox.set_size_request(205, 49)
            subbox.show()
            box.add(subbox)
            self.box_group_area.pack_end(box, False, False)

    def show_machine(self):
        self.progress_bar.reset()
        self._pack_components(pack_config_build_button=False)
        self.set_config_machine_layout(show_progress_bar=False)
        self.show_all()

    def update_progress_bar(self, title, fraction, status=None):
        if self.stopping == False:
            self.progress_bar.update(fraction)
            self.progress_bar.set_text(title)
            self.progress_bar.set_rcstyle(status)

    def show_info_populating(self):
        self._pack_components(pack_config_build_button=False)
        self.set_config_machine_layout(show_progress_bar=True)
        self.show_all()

    def show_info_populated(self):
        self.progress_bar.reset()
        self._pack_components(pack_config_build_button=False)
        self.set_config_machine_layout(show_progress_bar=False)
        self.set_config_baseimg_layout()
        self.show_all()

    def show_baseimg_selected(self):
        self.progress_bar.reset()
        self._pack_components(pack_config_build_button=True)
        self.set_config_machine_layout(show_progress_bar=False)
        self.set_config_baseimg_layout()
        self.show_all()
        if self.builder.recipe_model.get_selected_image(
        ) == self.builder.recipe_model.__custom_image__:
            self.just_bake_button.hide()

    def create_config_machine(self):
        self.machine_title = gtk.Label()
        self.machine_title.set_alignment(0.0, 0.5)
        mark = "<span %s>Select a machine</span>" % self.span_tag(
            'x-large', 'bold')
        self.machine_title.set_markup(mark)

        self.machine_title_desc = gtk.Label()
        self.machine_title_desc.set_alignment(0.0, 0.5)
        mark = (
            "<span %s>Your selection is the profile of the target machine for which you"
            " are building the image.\n</span>") % (self.span_tag('medium'))
        self.machine_title_desc.set_markup(mark)

        self.machine_combo = gtk.combo_box_new_text()
        self.machine_combo.connect("changed", self.machine_combo_changed_cb)

        icon_file = hic.ICON_LAYERS_DISPLAY_FILE
        hover_file = hic.ICON_LAYERS_HOVER_FILE
        self.layer_button = HobImageButton(
            "Layers", "Add support for machines, software, etc.", icon_file,
            hover_file)
        self.layer_button.connect("clicked", self.layer_button_clicked_cb)

        markup = "Layers are a powerful mechanism to extend the Yocto Project "
        markup += "with your own functionality.\n"
        markup += "For more on layers, check the <a href=\""
        markup += "http://www.yoctoproject.org/docs/current/dev-manual/"
        markup += "dev-manual.html#understanding-and-using-layers\">reference manual</a>."
        self.layer_info_icon = HobInfoButton(markup, self.get_parent())

        #        self.progress_box = gtk.HBox(False, 6)
        self.progress_bar = HobProgressBar()
        #        self.progress_box.pack_start(self.progress_bar, expand=True, fill=True)
        self.stop_button = HobAltButton("Stop")
        self.stop_button.connect("clicked", self.stop_button_clicked_cb)
        #        self.progress_box.pack_end(stop_button, expand=False, fill=False)
        self.machine_separator = gtk.HSeparator()

    def set_config_machine_layout(self, show_progress_bar=False):
        self.gtable.attach(self.machine_title, 0, 40, 0, 4)
        self.gtable.attach(self.machine_title_desc, 0, 40, 4, 6)
        self.gtable.attach(self.machine_combo, 0, 12, 7, 10)
        self.gtable.attach(self.layer_button, 14, 36, 7, 12)
        self.gtable.attach(self.layer_info_icon, 36, 40, 7, 11)
        if show_progress_bar:
            #self.gtable.attach(self.progress_box, 0, 40, 15, 18)
            self.gtable.attach(self.progress_bar, 0, 37, 15, 18)
            self.gtable.attach(self.stop_button, 37, 40, 15, 18, 0, 0)
        self.gtable.attach(self.machine_separator, 0, 40, 13, 14)

    def create_config_baseimg(self):
        self.image_title = gtk.Label()
        self.image_title.set_alignment(0, 1.0)
        mark = "<span %s>Select a base image</span>" % self.span_tag(
            'x-large', 'bold')
        self.image_title.set_markup(mark)

        self.image_title_desc = gtk.Label()
        self.image_title_desc.set_alignment(0, 0.5)
        mark = (
            "<span %s>Base images are a starting point for the type of image you want. "
            "You can build them as \n"
            "they are or customize them to your specific needs.\n</span>"
        ) % self.span_tag('medium')
        self.image_title_desc.set_markup(mark)

        self.image_combo = gtk.combo_box_new_text()
        self.image_combo_id = self.image_combo.connect(
            "changed", self.image_combo_changed_cb)

        self.image_desc = gtk.Label()
        self.image_desc.set_alignment(0.0, 0.5)
        self.image_desc.set_size_request(256, -1)
        self.image_desc.set_justify(gtk.JUSTIFY_LEFT)
        self.image_desc.set_line_wrap(True)

        # button to view recipes
        icon_file = hic.ICON_RCIPE_DISPLAY_FILE
        hover_file = hic.ICON_RCIPE_HOVER_FILE
        self.view_adv_configuration_button = HobImageButton(
            "Advanced configuration",
            "Select image types, package formats, etc", icon_file, hover_file)
        self.view_adv_configuration_button.connect(
            "clicked", self.view_adv_configuration_button_clicked_cb)

        self.image_separator = gtk.HSeparator()

    def set_config_baseimg_layout(self):
        self.gtable.attach(self.image_title, 0, 40, 15, 17)
        self.gtable.attach(self.image_title_desc, 0, 40, 18, 22)
        self.gtable.attach(self.image_combo, 0, 12, 23, 26)
        self.gtable.attach(self.image_desc, 0, 12, 27, 33)
        self.gtable.attach(self.view_adv_configuration_button, 14, 36, 23, 28)
        self.gtable.attach(self.image_separator, 0, 40, 35, 36)

    def create_config_build_button(self):
        # Create the "Build packages" and "Build image" buttons at the bottom
        button_box = gtk.HBox(False, 6)

        # create button "Build image"
        self.just_bake_button = HobButton("Build image")
        #self.just_bake_button.set_size_request(205, 49)
        self.just_bake_button.set_tooltip_text("Build target image")
        self.just_bake_button.connect("clicked",
                                      self.just_bake_button_clicked_cb)
        button_box.pack_end(self.just_bake_button, expand=False, fill=False)

        # create button "Edit Image"
        self.edit_image_button = HobAltButton("Edit image")
        #self.edit_image_button.set_size_request(205, 49)
        self.edit_image_button.set_tooltip_text("Edit target image")
        self.edit_image_button.connect("clicked",
                                       self.edit_image_button_clicked_cb)
        button_box.pack_end(self.edit_image_button, expand=False, fill=False)

        return button_box

    def stop_button_clicked_cb(self, button):
        self.stopping = True
        self.progress_bar.set_text("Stopping recipe parsing")
        self.progress_bar.set_rcstyle("stop")
        self.builder.cancel_parse_sync()

    def machine_combo_changed_cb(self, machine_combo):
        self.stopping = False
        combo_item = machine_combo.get_active_text()
        if not combo_item or combo_item == self.__dummy_machine__:
            return

        # remove __dummy_machine__ item from the store list after first user selection
        # because it is no longer valid
        combo_store = machine_combo.get_model()
        if len(combo_store) and (combo_store[0][0] == self.__dummy_machine__):
            machine_combo.remove_text(0)

        self.builder.configuration.curr_mach = combo_item
        if self.machine_combo_changed_by_manual:
            self.builder.configuration.clear_selection()
        # reset machine_combo_changed_by_manual
        self.machine_combo_changed_by_manual = True

        # Do reparse recipes
        self.builder.populate_recipe_package_info_async()

    def update_machine_combo(self):
        all_machines = [self.__dummy_machine__
                        ] + self.builder.parameters.all_machines

        model = self.machine_combo.get_model()
        model.clear()
        for machine in all_machines:
            self.machine_combo.append_text(machine)
        self.machine_combo.set_active(0)

    def switch_machine_combo(self):
        self.machine_combo_changed_by_manual = False
        model = self.machine_combo.get_model()
        active = 0
        while active < len(model):
            if model[active][0] == self.builder.configuration.curr_mach:
                self.machine_combo.set_active(active)
                return
            active += 1

        if model[0][0] != self.__dummy_machine__:
            self.machine_combo.insert_text(0, self.__dummy_machine__)

        self.machine_combo.set_active(0)

    def update_image_desc(self):
        desc = ""
        selected_image = self.image_combo.get_active_text()
        if selected_image and selected_image in self.builder.recipe_model.pn_path.keys(
        ):
            image_path = self.builder.recipe_model.pn_path[selected_image]
            image_iter = self.builder.recipe_model.get_iter(image_path)
            desc = self.builder.recipe_model.get_value(
                image_iter, self.builder.recipe_model.COL_DESC)

        mark = ("<span %s>%s</span>\n") % (self.span_tag('small'), desc)
        self.image_desc.set_markup(mark)

    def image_combo_changed_idle_cb(self, selected_image, selected_recipes,
                                    selected_packages):
        self.builder.update_recipe_model(selected_image, selected_recipes)
        self.builder.update_package_model(selected_packages)
        self.builder.window_sensitive(True)

    def image_combo_changed_cb(self, combo):
        self.builder.window_sensitive(False)
        selected_image = self.image_combo.get_active_text()
        if not selected_image or (selected_image == self.__dummy_image__):
            return

        # remove __dummy_image__ item from the store list after first user selection
        # because it is no longer valid
        combo_store = combo.get_model()
        if len(combo_store) and (combo_store[0][0] == self.__dummy_image__):
            combo.remove_text(0)

        self.builder.customized = False

        selected_recipes = []

        image_path = self.builder.recipe_model.pn_path[selected_image]
        image_iter = self.builder.recipe_model.get_iter(image_path)
        selected_packages = self.builder.recipe_model.get_value(
            image_iter, self.builder.recipe_model.COL_INSTALL).split()
        self.update_image_desc()

        self.builder.recipe_model.reset()
        self.builder.package_model.reset()

        self.show_baseimg_selected()

        if selected_image == self.builder.recipe_model.__custom_image__:
            self.just_bake_button.hide()

        glib.idle_add(self.image_combo_changed_idle_cb, selected_image,
                      selected_recipes, selected_packages)

    def _image_combo_connect_signal(self):
        if not self.image_combo_id:
            self.image_combo_id = self.image_combo.connect(
                "changed", self.image_combo_changed_cb)

    def _image_combo_disconnect_signal(self):
        if self.image_combo_id:
            self.image_combo.disconnect(self.image_combo_id)
            self.image_combo_id = None

    def update_image_combo(self, recipe_model, selected_image):
        # Update the image combo according to the images in the recipe_model
        # populate image combo
        filter = {RecipeListModel.COL_TYPE: ['image']}
        image_model = recipe_model.tree_model(filter)
        image_model.set_sort_column_id(recipe_model.COL_NAME,
                                       gtk.SORT_ASCENDING)
        active = 0
        cnt = 1

        white_pattern = []
        if self.builder.parameters.image_white_pattern:
            for i in self.builder.parameters.image_white_pattern.split():
                white_pattern.append(re.compile(i))

        black_pattern = []
        if self.builder.parameters.image_black_pattern:
            for i in self.builder.parameters.image_black_pattern.split():
                black_pattern.append(re.compile(i))
        black_pattern.append(re.compile("hob-image"))

        it = image_model.get_iter_first()
        self._image_combo_disconnect_signal()
        model = self.image_combo.get_model()
        model.clear()
        # Set a indicator text to combo store when first open
        self.image_combo.append_text(self.__dummy_image__)
        # append and set active
        while it:
            path = image_model.get_path(it)
            it = image_model.iter_next(it)
            image_name = image_model[path][recipe_model.COL_NAME]
            if image_name == self.builder.recipe_model.__custom_image__:
                continue

            if black_pattern:
                allow = True
                for pattern in black_pattern:
                    if pattern.search(image_name):
                        allow = False
                        break
            elif white_pattern:
                allow = False
                for pattern in white_pattern:
                    if pattern.search(image_name):
                        allow = True
                        break
            else:
                allow = True

            if allow:
                self.image_combo.append_text(image_name)
                if image_name == selected_image:
                    active = cnt
                cnt = cnt + 1

        self.image_combo.append_text(
            self.builder.recipe_model.__custom_image__)
        if selected_image == self.builder.recipe_model.__custom_image__:
            active = cnt

        self.image_combo.set_active(active)

        if active != 0:
            self.show_baseimg_selected()

        self._image_combo_connect_signal()

    def layer_button_clicked_cb(self, button):
        # Create a layer selection dialog
        self.builder.show_layer_selection_dialog()

    def view_adv_configuration_button_clicked_cb(self, button):
        # Create an advanced settings dialog
        response, settings_changed = self.builder.show_adv_settings_dialog()
        if not response:
            return
        if settings_changed:
            self.builder.reparse_post_adv_settings()

    def just_bake_button_clicked_cb(self, button):
        self.builder.just_bake()

    def edit_image_button_clicked_cb(self, button):
        self.builder.configuration.initial_selected_image = self.builder.configuration.selected_image
        self.builder.show_recipes()

    def template_button_clicked_cb(self, button):
        response, path = self.builder.show_load_template_dialog()
        if not response:
            return
        if path:
            self.builder.load_template(path)

    def my_images_button_clicked_cb(self, button):
        self.builder.show_load_my_images_dialog()

    def settings_button_clicked_cb(self, button):
        # Create an advanced settings dialog
        response, settings_changed = self.builder.show_simple_settings_dialog()
        if not response:
            return
        if settings_changed:
            self.builder.reparse_post_adv_settings()