def gen_entry_widget(self, content, parent, tooltip="", need_button=True):
        hbox = gtk.HBox(False, 12)
        entry = gtk.Entry()
        entry.set_text(content)
        entry.set_size_request(350, 30)

        if need_button:
            table = gtk.Table(1, 10, False)
            hbox.pack_start(table, expand=True, fill=True)
            table.attach(entry, 0, 9, 0, 1, xoptions=gtk.SHRINK)
            image = gtk.Image()
            image.set_from_stock(gtk.STOCK_OPEN, gtk.ICON_SIZE_BUTTON)
            open_button = gtk.Button()
            open_button.set_image(image)
            open_button.connect("clicked", self.entry_widget_select_path_cb,
                                parent, entry)
            table.attach(open_button, 9, 10, 0, 1, xoptions=gtk.SHRINK)
        else:
            hbox.pack_start(entry, expand=True, fill=True)

        if tooltip != "":
            info = HobInfoButton(tooltip, self)
            hbox.pack_start(info, expand=False, fill=False)

        hbox.show_all()
        return hbox, entry
Example #2
0
    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_label_info_widget(self, content, tooltip):
     table = gtk.Table(1, 10, False)
     label = self.gen_label_widget(content)
     info = HobInfoButton(tooltip, self)
     table.attach(label, 0, 1, 0, 1, xoptions=gtk.FILL)
     table.attach(info, 1, 2, 0, 1, xoptions=gtk.FILL, xpadding=10)
     return table
Example #4
0
    def gen_pkgfmt_widget(self, curr_package_format, all_package_format, tooltip_combo="", tooltip_extra=""):
        pkgfmt_vbox = gtk.VBox(False, 6)

        label = self.gen_label_widget("Root file system package format")
        pkgfmt_vbox.pack_start(label, expand=False, fill=False)

        rootfs_format = ""
        if curr_package_format:
            rootfs_format = curr_package_format.split()[0]

        rootfs_format_widget, rootfs_combo = self.gen_combo_widget(rootfs_format, all_package_format, tooltip_combo)
        pkgfmt_vbox.pack_start(rootfs_format_widget, expand=False, fill=False)

        label = self.gen_label_widget("Additional package formats")
        pkgfmt_vbox.pack_start(label, expand=False, fill=False)

        check_hbox = gtk.HBox(False, 12)
        pkgfmt_vbox.pack_start(check_hbox, expand=False, fill=False)
        for format in all_package_format:
            if format != rootfs_format:
                check_button = gtk.CheckButton(format)
                is_active = (format in curr_package_format.split())
                check_button.set_active(is_active)
                check_hbox.pack_start(check_button, expand=False, fill=False)

        self.pkgfmt_info = HobInfoButton(tooltip_extra, self)
        check_hbox.pack_start(self.pkgfmt_info, expand=False, fill=False)

        rootfs_combo.connect("changed", self.rootfs_combo_changed_cb, all_package_format, check_hbox)

        pkgfmt_vbox.show_all()

        return pkgfmt_vbox, rootfs_combo, check_hbox
Example #5
0
    def create_image_types_page(self):
        main_vbox = gtk.VBox(False, 16)
        main_vbox.set_border_width(6)

        advanced_vbox = gtk.VBox(False, 6)
        advanced_vbox.set_border_width(6)

        distro_vbox = gtk.VBox(False, 6)        
        label = self.gen_label_widget("Distro:")
        tooltip = "Selects the Yocto Project distribution you want"
        try:
            i = self.all_distros.index( "defaultsetup" )
        except ValueError:
            i = -1
        if i != -1:
            self.all_distros[ i ] = "Default"
            if self.configuration.curr_distro == "defaultsetup":
                self.configuration.curr_distro = "Default"
        distro_widget, self.distro_combo = self.gen_combo_widget(self.configuration.curr_distro, self.all_distros,"<b>Distro</b>" + "*" + tooltip)
        distro_vbox.pack_start(label, expand=False, fill=False)
        distro_vbox.pack_start(distro_widget, expand=False, fill=False)
        main_vbox.pack_start(distro_vbox, expand=False, fill=False)


        rows = (len(self.image_types)+1)/3
        table = gtk.Table(rows + 1, 10, True)
        advanced_vbox.pack_start(table, expand=False, fill=False)

        tooltip = "Image file system types you want."
        info = HobInfoButton("<b>Image types</b>" + "*" + tooltip, self)
        label = self.gen_label_widget("Image types:")
        align = gtk.Alignment(0, 0.5, 0, 0)
        table.attach(align, 0, 4, 0, 1)
        align.add(label)
        table.attach(info, 4, 5, 0, 1)

        i = 1
        j = 1
        for image_type in sorted(self.image_types):
            self.image_types_checkbuttons[image_type] = gtk.CheckButton(image_type)
            self.image_types_checkbuttons[image_type].connect("toggled", self.image_type_checkbutton_clicked_cb)
            article = ""
            if image_type.startswith(("a", "e", "i", "o", "u")):
                article = "n"
            if image_type == "live":
                self.image_types_checkbuttons[image_type].set_tooltip_text("Build iso and hddimg images")
            else:
                self.image_types_checkbuttons[image_type].set_tooltip_text("Build a%s %s image" % (article, image_type))
            table.attach(self.image_types_checkbuttons[image_type], j - 1, j + 3, i, i + 1)
            if image_type in self.configuration.image_fstypes.split():
                self.image_types_checkbuttons[image_type].set_active(True)
            i += 1
            if i > rows:
                i = 1
                j = j + 4

        main_vbox.pack_start(advanced_vbox, expand=False, fill=False)
        self.set_save_button_state()
        
        return main_vbox
    def gen_spinner_widget(self, content, lower, upper, tooltip=""):
        hbox = gtk.HBox(False, 12)
        adjust = gtk.Adjustment(value=content,
                                lower=lower,
                                upper=upper,
                                step_incr=1)
        spinner = gtk.SpinButton(adjustment=adjust, climb_rate=1, digits=0)

        spinner.set_value(content)
        hbox.pack_start(spinner, expand=False, fill=False)

        info = HobInfoButton(tooltip, self)
        hbox.pack_start(info, expand=False, fill=False)

        hbox.show_all()
        return hbox, spinner
    def gen_combo_widget(self, curr_item, all_item, tooltip=""):
        hbox = gtk.HBox(False, 12)
        combo = gtk.combo_box_new_text()
        hbox.pack_start(combo, expand=False, fill=False)

        index = 0
        for item in all_item or []:
            combo.append_text(item)
            if item == curr_item:
                combo.set_active(index)
            index += 1

        info = HobInfoButton(tooltip, self)
        hbox.pack_start(info, expand=False, fill=False)

        hbox.show_all()
        return hbox, combo
    def gen_editable_settings(self, setting, tooltip=""):
        setting_hbox = gtk.HBox(False, 12)

        vbox = gtk.VBox(False, 12)
        setting_hbox.pack_start(vbox, expand=True, fill=True)

        setting_store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
        for key in setting.keys():
            setting_store.set(setting_store.append(), 0, key, 1, setting[key])

        setting_tree = gtk.TreeView(setting_store)
        setting_tree.set_headers_visible(True)
        setting_tree.set_size_request(300, 100)

        col = gtk.TreeViewColumn('Key')
        col.set_min_width(100)
        col.set_max_width(150)
        col.set_resizable(True)
        col1 = gtk.TreeViewColumn('Value')
        col1.set_min_width(100)
        col1.set_max_width(150)
        col1.set_resizable(True)
        setting_tree.append_column(col)
        setting_tree.append_column(col1)
        cell = gtk.CellRendererText()
        cell.set_property('width-chars', 10)
        cell.set_property('editable', True)
        cell.set_data("column", 0)
        cell.connect("edited", self.editable_settings_cell_edited, setting_store)
        cell1 = gtk.CellRendererText()
        cell1.set_property('width-chars', 10)
        cell1.set_property('editable', True)
        cell1.set_data("column", 1)
        cell1.connect("edited", self.editable_settings_cell_edited, setting_store)
        col.pack_start(cell, True)
        col1.pack_end(cell1, True)
        col.set_attributes(cell, text=0)
        col1.set_attributes(cell1, text=1)

        scroll = gtk.ScrolledWindow()
        scroll.set_shadow_type(gtk.SHADOW_IN)
        scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroll.add(setting_tree)
        vbox.pack_start(scroll, expand=True, fill=True)

        # some buttons
        hbox = gtk.HBox(True, 6)
        vbox.pack_start(hbox, False, False)

        button = gtk.Button(stock=gtk.STOCK_ADD)
        button.connect("clicked", self.editable_settings_add_item_clicked, setting_store)
        hbox.pack_start(button)

        button = gtk.Button(stock=gtk.STOCK_REMOVE)
        button.connect("clicked", self.editable_settings_remove_item_clicked, setting_tree)
        hbox.pack_start(button)

        info = HobInfoButton(tooltip, self)
        setting_hbox.pack_start(info, expand=False, fill=False)

        return setting_hbox, setting_store
    def create_network_page(self):
        advanced_vbox = gtk.VBox(False, 6)
        advanced_vbox.set_border_width(6)
        self.same_proxy_addresses = []
        self.same_proxy_ports = []
        self.all_proxy_ports = []
        self.all_proxy_addresses = []

        sub_vbox = gtk.VBox(False, 6)
        advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
        label = self.gen_label_widget("<span weight=\"bold\">Set the proxies used when fetching source code</span>")
        tooltip = "Set the proxies used when fetching source code.  A blank field uses a direct internet connection."
        info = HobInfoButton("<span weight=\"bold\">Set the proxies used when fetching source code</span>" + "*" + tooltip, self)
        hbox = gtk.HBox(False, 12)
        hbox.pack_start(label, expand=True, fill=True)
        hbox.pack_start(info, expand=False, fill=False)
        sub_vbox.pack_start(hbox, expand=False, fill=False)

        proxy_test_focus = []
        self.direct_checkbox = gtk.RadioButton(None, "Direct network connection")
        proxy_test_focus.append(self.direct_checkbox)
        self.direct_checkbox.set_tooltip_text("Check this box to use a direct internet connection with no proxy")
        self.direct_checkbox.set_active(not self.configuration.enable_proxy)
        sub_vbox.pack_start(self.direct_checkbox, expand=False, fill=False)

        self.proxy_checkbox = gtk.RadioButton(self.direct_checkbox, "Manual proxy configuration")
        proxy_test_focus.append(self.proxy_checkbox)
        self.proxy_checkbox.set_tooltip_text("Check this box to manually set up a specific proxy")
        self.proxy_checkbox.set_active(self.configuration.enable_proxy)
        sub_vbox.pack_start(self.proxy_checkbox, expand=False, fill=False)

        self.same_checkbox = gtk.CheckButton("Use the HTTP proxy for all protocols")
        proxy_test_focus.append(self.same_checkbox)
        self.same_checkbox.set_tooltip_text("Check this box to use the HTTP proxy for all five proxies")
        self.same_checkbox.set_active(self.configuration.same_proxy)
        hbox = gtk.HBox(False, 12)
        hbox.pack_start(self.same_checkbox, expand=False, fill=False, padding=24)
        sub_vbox.pack_start(hbox, expand=False, fill=False)

        self.proxy_table = gtk.Table(6, 5, False)
        self.http_proxy, self.http_proxy_port, self.http_proxy_details = self.gen_proxy_entry_widget(
            "http", self, True, 0)
        proxy_test_focus +=[self.http_proxy, self.http_proxy_port]
        self.http_proxy.connect("changed", self.http_proxy_changed)
        self.http_proxy_port.connect("changed", self.http_proxy_changed)

        self.https_proxy, self.https_proxy_port, self.https_proxy_details = self.gen_proxy_entry_widget(
            "https", self, True, 1)
        proxy_test_focus += [self.https_proxy, self.https_proxy_port]
        self.same_proxy_addresses.append(self.https_proxy)
        self.same_proxy_ports.append(self.https_proxy_port)

        self.ftp_proxy, self.ftp_proxy_port, self.ftp_proxy_details = self.gen_proxy_entry_widget(
            "ftp", self, True, 2)
        proxy_test_focus += [self.ftp_proxy, self.ftp_proxy_port]
        self.same_proxy_addresses.append(self.ftp_proxy)
        self.same_proxy_ports.append(self.ftp_proxy_port)

        self.socks_proxy, self.socks_proxy_port, self.socks_proxy_details = self.gen_proxy_entry_widget(
            "socks", self, True, 3)
        proxy_test_focus += [self.socks_proxy, self.socks_proxy_port]
        self.same_proxy_addresses.append(self.socks_proxy)
        self.same_proxy_ports.append(self.socks_proxy_port)

        self.cvs_proxy, self.cvs_proxy_port, self.cvs_proxy_details = self.gen_proxy_entry_widget(
            "cvs", self, True, 4)
        proxy_test_focus += [self.cvs_proxy, self.cvs_proxy_port]
        self.same_proxy_addresses.append(self.cvs_proxy)
        self.same_proxy_ports.append(self.cvs_proxy_port)
        self.all_proxy_ports = self.same_proxy_ports + [self.http_proxy_port]
        self.all_proxy_addresses = self.same_proxy_addresses + [self.http_proxy]
        sub_vbox.pack_start(self.proxy_table, expand=False, fill=False)
        self.proxy_table.show_all()

        # Create the graphical elements for the network test feature, but don't display them yet
        self.test_network_button = HobAltButton("Test network configuration")
        self.test_network_button.connect("clicked", self.test_network_button_cb)
        self.test_proxy_progress = HobProgressBar()
        self.dummy_progress = HobProgressBar()
        self.retest_network_button = HobAltButton("Retest")
        self.retest_network_button.connect("clicked", self.test_network_button_cb)
        self.test_gui_elements = [self.test_network_button, self.test_proxy_progress, self.dummy_progress, self.retest_network_button]
        # Initialize the network tester
        self.test_proxy_state = self.TEST_NETWORK_NONE
        self.set_test_proxy_state(self.TEST_NETWORK_INITIAL)
        self.proxy_test_passed_id = self.handler.connect("network-passed", lambda h:self.test_proxy_ended(True))
        self.proxy_test_failed_id = self.handler.connect("network-failed", lambda h:self.test_proxy_ended(False))
        [w.connect("focus-in-event", self.test_proxy_focus_event) for w in proxy_test_focus]
        [w.connect("focus-out-event", self.proxy_address_focus_out_event) for w in self.all_proxy_addresses]

        self.direct_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb)
        self.proxy_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb)
        self.same_checkbox.connect("toggled", self.same_checkbox_toggled_cb)

        self.refresh_proxy_components()
        return advanced_vbox