Exemplo n.º 1
0
def fill_icon_path(app: ArchPackage, icon_paths: List[str], only_exact_match: bool):
    ends_with = re.compile(r'.+/{}\.(png|svg)$'.format(app.icon_path if app.icon_path else app.name), re.IGNORECASE)

    for path in icon_paths:
        if ends_with.match(path):
            app.icon_path = path
            return

    if not only_exact_match:
        pkg_icons_path = pacman.list_icon_paths({app.name})

        if pkg_icons_path:
            app.set_icon(pkg_icons_path)
Exemplo n.º 2
0
def fill_icon_path(pkg: ArchPackage, icon_paths: List[str],
                   only_exact_match: bool):
    clean_name = RE_CLEAN_NAME.sub('', pkg.name)
    ends_with = re.compile(
        r'.+/{}\.(png|svg|xpm)$'.format(
            pkg.icon_path if pkg.icon_path else clean_name), re.IGNORECASE)

    for path in icon_paths:
        if ends_with.match(path):
            pkg.icon_path = path
            return

    if not only_exact_match:
        pkg_icons_path = pacman.list_icon_paths({pkg.name})

        if pkg_icons_path:
            pkg.set_icon(pkg_icons_path)