pkginstall.py 文件源码

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

项目:ibus-typing-booster 作者: mike-fabian 项目源码 文件源码
def __init__(self,pkg):
        bus_type = Gio.BusType.SESSION
        flags = 0
        iface_info = None
        # Creating proxies does not do any blocking I/O, and never fails
        proxy = Gio.DBusProxy.new_for_bus_sync(
            bus_type,
            flags,
            iface_info,
            'org.freedesktop.PackageKit',
            '/org/freedesktop/PackageKit',
            'org.freedesktop.PackageKit.Modify',
            None)
        try:
            # The default timeout is approximately 25 seconds.
            # This is too short here, the call to InstallPackageNames
            # would usually return too early then before the package
            # has completed installing. Then the callback to reload
            # the dictionary would be called to early and would not
            # be able to load the dictionary.
            # So I use a very long timeout here to make sure
            # InstallPackageNames does not return before either the
            # dictionary is really installed or the user cancels:
            proxy.set_default_timeout(0x7fffffff) # timeout in milliseconds
            proxy.InstallPackageNames("(uass)", 0, [pkg], "show-confirm-search,hide-finished")
        except GLib.GError as e:
            print("GError: " + str(e))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号