当前位置: 首页>>代码示例>>Python>>正文


Python hobpages.HobPage类代码示例

本文整理汇总了Python中bb.ui.crumbs.hobpages.HobPage的典型用法代码示例。如果您正苦于以下问题:Python HobPage类的具体用法?Python HobPage怎么用?Python HobPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HobPage类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: populate

    def populate(self, pkginfolist):
        self.clear()
        self.pkgs_size = 0
        self.pn_path = {}
        self.pkg_path = {}
        self.rprov_pkg = {}

        def getpkgvalue(pkgdict, key, pkgname, defaultval = None):
            value = pkgdict.get('%s_%s' % (key, pkgname), None)
            if not value:
                value = pkgdict.get(key, defaultval)
            return value

        for pkginfo in pkginfolist:
            pn = pkginfo['PN']
            pv = pkginfo['PV']
            pr = pkginfo['PR']
            if pn in self.pn_path.keys():
                pniter = self.get_iter(self.pn_path[pn])
            else:
                pniter = self.append(None)
                self.set(pniter, self.COL_NAME, pn + '-' + pv + '-' + pr,
                                 self.COL_INC, False)
                self.pn_path[pn] = self.get_path(pniter)

            # PKG is always present
            pkg = pkginfo['PKG']
            pkgv = getpkgvalue(pkginfo, 'PKGV', pkg)
            pkgr = getpkgvalue(pkginfo, 'PKGR', pkg)
            # PKGSIZE is artificial, will always be overridden with the package name if present
            pkgsize = pkginfo.get('PKGSIZE_%s' % pkg, "0")
            # PKG_%s is the renamed version
            pkg_rename = pkginfo.get('PKG_%s' % pkg, "")
            # The rest may be overridden or not
            section = getpkgvalue(pkginfo, 'SECTION', pkg, "")
            summary = getpkgvalue(pkginfo, 'SUMMARY', pkg, "")
            rdep = getpkgvalue(pkginfo, 'RDEPENDS', pkg, "")
            rrec = getpkgvalue(pkginfo, 'RRECOMMENDS', pkg, "")
            rprov = getpkgvalue(pkginfo, 'RPROVIDES', pkg, "")
            for i in rprov.split():
                self.rprov_pkg[i] = pkg

            allow_empty = getpkgvalue(pkginfo, 'ALLOW_EMPTY', pkg, "")

            if pkgsize == "0" and not allow_empty:
                continue

            # pkgsize is in KB
            size = HobPage._size_to_string(HobPage._string_to_size(pkgsize + ' KB'))

            it = self.append(pniter)
            self.pkg_path[pkg] = self.get_path(it)
            self.set(it, self.COL_NAME, pkg, self.COL_VER, pkgv,
                     self.COL_REV, pkgr, self.COL_RNM, pkg_rename,
                     self.COL_SEC, section, self.COL_SUM, summary,
                     self.COL_RDEP, rdep + ' ' + rrec,
                     self.COL_RPROV, rprov, self.COL_SIZE, size,
                     self.COL_BINB, "", self.COL_INC, False, self.COL_FONT, '10')
开发者ID:TizenTeam,项目名称:poky,代码行数:58,代码来源:hoblistmodel.py

示例2: populate

    def populate(self, pkginfolist):
        # First clear the model, in case repopulating
        self.clear()

        def getpkgvalue(pkgdict, key, pkgname, defaultval = None):
            value = pkgdict.get('%s_%s' % (key, pkgname), None)
            if not value:
                value = pkgdict.get(key, defaultval)
            return value

        for pkginfo in pkginfolist:
            pn = pkginfo['PN']
            pv = pkginfo['PV']
            pr = pkginfo['PR']
            pkg = pkginfo['PKG']
            pkgv = getpkgvalue(pkginfo, 'PKGV', pkg)
            pkgr = getpkgvalue(pkginfo, 'PKGR', pkg)
            # PKGSIZE is artificial, will always be overridden with the package name if present
            pkgsize = pkginfo.get('PKGSIZE_%s' % pkg, "0")
            # PKG_%s is the renamed version
            pkg_rename = pkginfo.get('PKG_%s' % pkg, "")
            # The rest may be overridden or not
            section = getpkgvalue(pkginfo, 'SECTION', pkg, "")
            summary = getpkgvalue(pkginfo, 'SUMMARY', pkg, "")
            rdep = getpkgvalue(pkginfo, 'RDEPENDS', pkg, "")
            rrec = getpkgvalue(pkginfo, 'RRECOMMENDS', pkg, "")
            rprov = getpkgvalue(pkginfo, 'RPROVIDES', pkg, "")
            files_list = getpkgvalue(pkginfo, 'FILES_INFO', pkg, "")
            for i in rprov.split():
                self.rprov_pkg[i] = pkg

            recipe = pn + '-' + pv + '-' + pr

            allow_empty = getpkgvalue(pkginfo, 'ALLOW_EMPTY', pkg, "")

            if pkgsize == "0" and not allow_empty:
                continue

            # pkgsize is in KB
            size = HobPage._size_to_string(HobPage._string_to_size(pkgsize + ' KB'))

            self.set(self.append(), self.COL_NAME, pkg, self.COL_VER, pkgv,
                     self.COL_REV, pkgr, self.COL_RNM, pkg_rename,
                     self.COL_SEC, section, self.COL_SUM, summary,
                     self.COL_RDEP, rdep + ' ' + rrec,
                     self.COL_RPROV, rprov, self.COL_SIZE, size,
                     self.COL_RCP, recipe, self.COL_BINB, "",
                     self.COL_INC, False, self.COL_FONT, '10', self.COL_FLIST, files_list)

        self.pn_path = {}
        it = self.get_iter_first()
        while it:
            pn = self.get_value(it, self.COL_NAME)
            path = self.get_path(it)
            self.pn_path[pn] = path
            it = self.iter_next(it)
开发者ID:aniltolinux,项目名称:poky,代码行数:56,代码来源:hoblistmodel.py

示例3: populate

    def populate(self, pkginfolist):
        self.clear()
        self.pkgs_size = 0
        self.pn_path = {}
        self.pkg_path = {}
        self.rprov_pkg = {}

        for pkginfo in pkginfolist:
            pn = pkginfo['PN']
            pv = pkginfo['PV']
            pr = pkginfo['PR']
            if pn in self.pn_path.keys():
                pniter = self.get_iter(self.pn_path[pn])
            else:
                pniter = self.append(None)
                self.set(pniter, self.COL_NAME, pn + '-' + pv + '-' + pr,
                                 self.COL_INC, False)
                self.pn_path[pn] = self.get_path(pniter)

            pkg = pkginfo['PKG']
            pkgv = pkginfo['PKGV']
            pkgr = pkginfo['PKGR']
            pkgsize = pkginfo['PKGSIZE_%s' % pkg] if 'PKGSIZE_%s' % pkg in pkginfo.keys() else "0"
            pkg_rename = pkginfo['PKG_%s' % pkg] if 'PKG_%s' % pkg in pkginfo.keys() else ""
            section = pkginfo['SECTION_%s' % pkg] if 'SECTION_%s' % pkg in pkginfo.keys() else ""
            summary = pkginfo['SUMMARY_%s' % pkg] if 'SUMMARY_%s' % pkg in pkginfo.keys() else ""
            rdep = pkginfo['RDEPENDS_%s' % pkg] if 'RDEPENDS_%s' % pkg in pkginfo.keys() else ""
            rrec = pkginfo['RRECOMMENDS_%s' % pkg] if 'RRECOMMENDS_%s' % pkg in pkginfo.keys() else ""
            rprov = pkginfo['RPROVIDES_%s' % pkg] if 'RPROVIDES_%s' % pkg in pkginfo.keys() else ""
            for i in rprov.split():
                self.rprov_pkg[i] = pkg

            if 'ALLOW_EMPTY_%s' % pkg in pkginfo.keys():
                allow_empty = pkginfo['ALLOW_EMPTY_%s' % pkg]
            elif 'ALLOW_EMPTY' in pkginfo.keys():
                allow_empty = pkginfo['ALLOW_EMPTY']
            else:
                allow_empty = ""

            if pkgsize == "0" and not allow_empty:
                continue

            # pkgsize is in KB
            size = HobPage._size_to_string(HobPage._string_to_size(pkgsize + ' KB'))

            it = self.append(pniter)
            self.pkg_path[pkg] = self.get_path(it)
            self.set(it, self.COL_NAME, pkg, self.COL_VER, pkgv,
                     self.COL_REV, pkgr, self.COL_RNM, pkg_rename,
                     self.COL_SEC, section, self.COL_SUM, summary,
                     self.COL_RDEP, rdep + ' ' + rrec,
                     self.COL_RPROV, rprov, self.COL_SIZE, size,
                     self.COL_BINB, "", self.COL_INC, False, self.COL_FONT, '10')
开发者ID:dlespiau,项目名称:poky,代码行数:53,代码来源:hoblistmodel.py

示例4: sort_column

    def sort_column(self, model, row1, row2, col):
        value1 = model.get_value(row1, col)
        value2 = model.get_value(row2, col)
        if col==PackageListModel.COL_SIZE:
            value1 = HobPage._string_to_size(value1)
            value2 = HobPage._string_to_size(value2)

        cmp_res = cmp(value1, value2)
        if cmp_res!=0:
            if col==PackageListModel.COL_INC:
                return -cmp_res
            else:
                return cmp_res
        else:
            name1 = model.get_value(row1, PackageListModel.COL_NAME)
            name2 = model.get_value(row2, PackageListModel.COL_NAME)
            return cmp(name1,name2)
开发者ID:117111302,项目名称:poky,代码行数:17,代码来源:hoblistmodel.py

示例5: refresh_selection

    def refresh_selection(self):
        self.builder.configuration.selected_packages = self.package_model.get_selected_packages()
        self.builder.configuration.user_selected_packages = self.package_model.get_user_selected_packages()
        selected_packages_num = len(self.builder.configuration.selected_packages)
        selected_packages_size = self.package_model.get_packages_size()
        selected_packages_size_str = HobPage._size_to_string(selected_packages_size)

        self.label.set_label("Packages included: %s   Selected packages size: %s" %
                            (selected_packages_num, selected_packages_size_str))
开发者ID:alex1818,项目名称:yocto-iot,代码行数:9,代码来源:packageselectionpage.py

示例6: refresh_selection

    def refresh_selection(self):
        self.builder.configuration.selected_packages = self.package_model.get_selected_packages()
        self.builder.configuration.user_selected_packages = self.package_model.get_user_selected_packages()
        selected_packages_num = len(self.builder.configuration.selected_packages)
        selected_packages_size = self.package_model.get_packages_size()
        selected_packages_size_str = HobPage._size_to_string(selected_packages_size)

        image_overhead_factor = self.builder.configuration.image_overhead_factor
        image_rootfs_size = self.builder.configuration.image_rootfs_size / 1024 # image_rootfs_size is KB
        image_extra_size = self.builder.configuration.image_extra_size / 1024 # image_extra_size is KB
        base_size = image_overhead_factor * selected_packages_size
        image_total_size = max(base_size, image_rootfs_size) + image_extra_size
        if "zypper" in self.builder.configuration.selected_packages:
            image_total_size += (51200 * 1024)
        image_total_size_str = HobPage._size_to_string(image_total_size)

        self.label.set_label("Packages included: %s\nSelected packages size: %s\nTotal image size: %s" %
                            (selected_packages_num, selected_packages_size_str, image_total_size_str))
        self.ins.show_indicator_icon("Included packages", selected_packages_num)
开发者ID:aniltolinux,项目名称:poky,代码行数:19,代码来源:packageselectionpage.py

示例7: get_packages_size

    def get_packages_size(self):
        packages_size = 0
        it = self.get_iter_first()
        while it:
            if self.get_value(it, self.COL_INC):
                str_size = self.get_value(it, self.COL_SIZE)
                if not str_size:
                    continue

                packages_size += HobPage._string_to_size(str_size)

            it = self.iter_next(it)
        return packages_size
开发者ID:aniltolinux,项目名称:poky,代码行数:13,代码来源:hoblistmodel.py

示例8: show_page

    def show_page(self, step):
        self.build_succeeded = (step == self.builder.IMAGE_GENERATED)
        image_addr = self.builder.parameters.image_addr
        image_names = self.builder.parameters.image_names
        if self.build_succeeded:
            machine = self.builder.configuration.curr_mach
            base_image = self.builder.recipe_model.get_selected_image()
            layers = self.builder.configuration.layers
            pkg_num = "%s" % len(self.builder.package_model.get_selected_packages())
            log_file = self.builder.current_logfile
        else:
            pkg_num = "N/A"
            log_file = None

        # remove
        for button_id, button in self.button_ids.items():
            button.disconnect(button_id)
        self._remove_all_widget()

        # repack
        self.pack_start(self.details_top_buttons, expand=False, fill=False)
        self.pack_start(self.group_align, expand=True, fill=True)

        self.build_result = None
        if self.image_saved or (self.build_succeeded and self.builder.current_step == self.builder.IMAGE_GENERATING):
            # building is the previous step
            icon = gtk.Image()
            pixmap_path = hic.ICON_INDI_CONFIRM_FILE
            color = HobColors.RUNNING
            pix_buffer = gtk.gdk.pixbuf_new_from_file(pixmap_path)
            icon.set_from_pixbuf(pix_buffer)
            varlist = [""]
            if self.image_saved:
                vallist = ["Your image recipe has been saved"]
            else:
                vallist = ["Your image is ready"]
            self.build_result = self.BuildDetailBox(varlist=varlist, vallist=vallist, icon=icon, color=color)
            self.box_group_area.pack_start(self.build_result, expand=False, fill=False)

        self.buttonlist = ["Build new image", "Save image recipe", "Run image", "Deploy image"]

        # Name
        self.image_store = []
        self.toggled_image = ""
        default_image_size = 0
        self.num_toggled = 0
        i = 0
        for image_name in image_names:
            image_size = HobPage._size_to_string(os.stat(os.path.join(image_addr, image_name)).st_size)

            image_attr = ("run" if (self.test_type_runnable(image_name) and self.test_mach_runnable(image_name)) else \
                          ("deploy" if self.test_deployable(image_name) else ""))
            is_toggled = (image_attr != "")

            if not self.toggled_image:
                if i == (len(image_names) - 1):
                    is_toggled = True
                if is_toggled:
                    default_image_size = image_size
                    self.toggled_image = image_name

            split_stuff = image_name.split('.')
            if "rootfs" in split_stuff:
                image_type = image_name[(len(split_stuff[0]) + len(".rootfs") + 1):]
            else:
                image_type = image_name[(len(split_stuff[0]) + 1):]

            self.image_store.append({'name': image_name,
                                    'type': image_type,
                                    'size': image_size,
                                    'is_toggled': is_toggled,
                                    'action_attr': image_attr,})

            i = i + 1
            self.num_toggled += is_toggled

        is_runnable = self.create_bottom_buttons(self.buttonlist, self.toggled_image)

        # Generated image files info
        varlist = ["Name: ", "Files created: ", "Directory: "]
        vallist = []

        vallist.append(image_name.split('.')[0])
        vallist.append(',  '.join(fileitem['type'] for fileitem in self.image_store))
        vallist.append(image_addr)

        view_files_button = HobAltButton("View files")
        view_files_button.connect("clicked", self.view_files_clicked_cb, image_addr)
        view_files_button.set_tooltip_text("Open the directory containing the image files")
        open_log_button = None
        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.image_detail = self.DetailBox(varlist=varlist, vallist=vallist, button=view_files_button, button2=open_log_button)
        self.box_group_area.pack_start(self.image_detail, expand=False, fill=True)

        # The default kernel box for the qemu images
        self.sel_kernel = ""
        self.kernel_detail = None
#.........这里部分代码省略.........
开发者ID:Firestorm552,项目名称:bitbake,代码行数:101,代码来源:imagedetailspage.py

示例9: show_page

    def show_page(self, step):
        self.build_succeeded = (step == self.builder.IMAGE_GENERATED)
        image_addr = self.builder.parameters.image_addr
        image_names = self.builder.parameters.image_names
        if self.build_succeeded:
            machine = self.builder.configuration.curr_mach
            base_image = self.builder.recipe_model.get_selected_image()
            pkg_num = "%s" % len(self.builder.package_model.get_selected_packages())
            log_file = self.builder.current_logfile
        else:
            pkg_num = "N/A"
            log_file = None

        # remove
        for button_id, button in self.button_ids.items():
            button.disconnect(button_id)
        self._remove_all_widget()

        # repack
        self.pack_start(self.group_align, expand=True, fill=True)

        self.build_result = None
        if self.build_succeeded and self.builder.current_step == self.builder.IMAGE_GENERATING:
            # building is the previous step
            icon = gtk.Image()
            pixmap_path = hic.ICON_INDI_CONFIRM_FILE
            color = HobColors.RUNNING
            pix_buffer = gtk.gdk.pixbuf_new_from_file(pixmap_path)
            icon.set_from_pixbuf(pix_buffer)
            varlist = [""]
            vallist = ["Your image is ready"]
            self.build_result = self.BuildDetailBox(varlist=varlist, vallist=vallist, icon=icon, color=color)
            self.box_group_area.pack_start(self.build_result, expand=False, fill=False)

        self.buttonlist = ["New image", "Edit packages"]
        if self.builder.configuration.selected_image == self.builder.recipe_model.__custom_image__:
            img_recipe_name = "Custom " + self.builder.configuration.initial_selected_image
        else:
            img_recipe_name = self.builder.configuration.selected_image

        if "spi" not in img_recipe_name:
            self.buttonlist.append("Deploy image")

        # Name
        self.image_store = []
        self.toggled_image = ""
        default_image_size = 0
        self.num_toggled = 0
        i = 0
        for image_name in image_names:
            image_size = HobPage._size_to_string(os.stat(os.path.join(image_addr, image_name)).st_size)

            image_attr = ("run" if (self.test_type_runnable(image_name) and self.test_mach_runnable(image_name)) else \
                          ("deploy" if self.test_deployable(image_name) else ""))
            is_toggled = (image_attr != "")

            if not self.toggled_image:
                if i == (len(image_names) - 1):
                    is_toggled = True
                if is_toggled:
                    default_image_size = image_size
                    self.toggled_image = image_name

            split_stuff = image_name.split('.')
            if "rootfs" in split_stuff:
                image_type = image_name[(len(split_stuff[0]) + len(".rootfs") + 1):]
            else:
                image_type = image_name[(len(split_stuff[0]) + 1):]

            self.image_store.append({'name': image_name,
                                    'type': image_type,
                                    'size': image_size,
                                    'is_toggled': is_toggled,
                                    'action_attr': image_attr,})

            i = i + 1
            self.num_toggled += is_toggled

        is_runnable = self.create_bottom_buttons(self.buttonlist, self.toggled_image)

        table = gtk.Table(40, 40, True)
        image_info_label = self.create_label("<span weight='bold' font_desc='15'>Image information</span>")
        table.attach(image_info_label, 0, 40, 0, 3)

        image_label = self.create_label("<span weight='bold' font_desc='12'>Image</span>")
        table.attach(image_label, 0, 40, 3, 5)

        image_name_label = self.create_label("<span font_desc='12'>%s</span>" % img_recipe_name)
        table.attach(image_name_label, 2, 40, 5, 7)

        distro_label = self.create_label("<span weight='bold' font_desc='12'>Toolchain</span>")
        table.attach(distro_label, 0, 40, 7, 9)

        if self.builder.configuration.toolchain_build:
            text = "Yes"
        else:
            text ="No"
        distro_name_label = self.create_label("<span font_desc='12'>%s</span>" % text)
        table.attach(distro_name_label, 2, 40, 9, 11)

#.........这里部分代码省略.........
开发者ID:djdeath,项目名称:yocto-iot,代码行数:101,代码来源:imagedetailspage.py

示例10: show_page

    def show_page(self, step):
        build_succeeded = (step == self.builder.IMAGE_GENERATED)
        image_addr = self.builder.parameters.image_addr
        image_names = self.builder.parameters.image_names
        if build_succeeded:
            machine = self.builder.configuration.curr_mach
            base_image = self.builder.recipe_model.get_selected_image()
            layers = self.builder.configuration.layers
            pkg_num = "%s" % len(self.builder.package_model.get_selected_packages())
        else:
            pkg_num = "N/A"

        # remove
        for button_id, button in self.button_ids.items():
            button.disconnect(button_id)
        self._remove_all_widget()

        # repack
        self.pack_start(self.details_top_buttons, expand=False, fill=False)
        self.pack_start(self.group_align, expand=True, fill=True)

        self.build_result = None
        if build_succeeded:
            # building is the previous step
            icon = gtk.Image()
            pixmap_path = hic.ICON_INDI_CONFIRM_FILE
            color = HobColors.RUNNING
            pix_buffer = gtk.gdk.pixbuf_new_from_file(pixmap_path)
            icon.set_from_pixbuf(pix_buffer)
            varlist = [""]
            vallist = ["Your image is ready"]
            self.build_result = self.DetailBox(varlist=varlist, vallist=vallist, icon=icon, color=color)
            self.box_group_area.pack_start(self.build_result, expand=False, fill=False)

        # create the buttons at the bottom first because the buttons are used in apply_button_per_image()
        if build_succeeded:
            self.buttonlist = ["Build new image", "Save as template", "Run image", "Deploy image"]
        else: # get to this page from "My images"
            self.buttonlist = ["Build new image", "Run image", "Deploy image"]

        # Name
        varlist = [""]
        vallist = ["Listed generated image and package files."]
        t = ''
        self.image_store.clear()
        default_toggled = False
        default_image_size = 0
        i = 0
        for image_name in image_names:
            image_size = HobPage._size_to_string(os.stat(os.path.join(image_addr, image_name)).st_size)
            if not default_toggled:
                default_toggled = (self.test_type_runnable(image_name) and self.test_mach_runnable(image_name)) \
                    or self.test_deployable(image_name)
                if i == (len(image_names) - 1):
                    default_toggled = True
                self.image_store.set(self.image_store.append(), 0, image_name, 1, image_size, 2, default_toggled)
                if default_toggled:
                    default_image_size = image_size
                    self.create_bottom_buttons(self.buttonlist, image_name)
                    if 'qemu' in image_name:
                        t = ' (Selected QEMU items to be as runnable image)'
                    else:
                        t = ' (Selected Targeted item to be deploy)'
            else:
                self.image_store.set(self.image_store.append(), 0, image_name, 1, image_size, 2, False)
            i = i + 1

        if build_succeeded:
            varlist = ["Name: ", "Directory: ", ". "]
            vallist = []
            vallist.append(image_name.split('.')[0])
            vallist.append(image_addr)
            vallist.append(t)
            image_table = None
        else:
            image_table = HobViewTable(self.__columns__)
            image_table.set_model(self.image_store)
            image_table.connect("row-activated", self.row_activated_cb)
            if default_image_size and ('qemu' in image_name):
                t = '\n(Selected QEMU items to be as runnable image, so you need to select prompted kernel to run)'
            vallist[0] += t

        view_files_button = HobAltButton("View files")
        view_files_button.connect("clicked", self.view_files_clicked_cb, image_addr)
        view_files_button.set_tooltip_text("Open the directory containing the image files")
        self.image_detail = self.DetailBox(widget=image_table, varlist=varlist, vallist=vallist, button=view_files_button)
        self.box_group_area.pack_start(self.image_detail, expand=True, fill=True)

        # Machine, Base image and Layers
        layer_num_limit = 15
        varlist = ["Machine: ", "Base image: ", "Layers: "]
        vallist = []
        self.setting_detail = None
        if build_succeeded:
            vallist.append(machine)
            vallist.append(base_image)
            i = 0
            for layer in layers:
                varlist.append(" - ")
                if i > layer_num_limit:
#.........这里部分代码省略.........
开发者ID:sunfirefox,项目名称:bitbake,代码行数:101,代码来源:imagedetailspage.py


注:本文中的bb.ui.crumbs.hobpages.HobPage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。