app.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:Linalfred 作者: PeterHo 项目源码 文件源码
def getAllApps():
        AppList.apps.clear()
        iconTheme = Gtk.IconTheme.get_default()
        appList = Gio.AppInfo.get_all()
        for app in appList:
            name = Gio.AppInfo.get_display_name(app)
            executable = Gio.AppInfo.get_executable(app)
            iconName = None
            icon = Gio.AppInfo.get_icon(app)
            if icon:
                iconInfo = Gtk.IconTheme.lookup_by_gicon(iconTheme, icon, 256, Gtk.IconLookupFlags.USE_BUILTIN)
                if iconInfo:
                    iconName = iconInfo.get_filename()

            AppList.apps.append(AppCmd().set(name=name, executable=executable, iconName=iconName))

        # ??
        AppList.apps = reduce(lambda x, y: x if y in x else x + [y], [[], ] + AppList.apps)
        AppList.apps.sort(key=lambda x: x.name.lower())
        return AppList.apps
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号