app.py 文件源码

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

项目:x-mario-center 作者: fossasia 项目源码 文件源码
def setup_dbus_or_bring_other_instance_to_front(self, args):
        """
        This sets up a dbus listener
        """
        try:
            bus = dbus.SessionBus()
        except:
            LOG.exception("could not initiate dbus")
            return
        # if there is another Softwarecenter running bring it to front
        # and exit, otherwise install the dbus controller
        try:
            proxy_obj = bus.get_object('com.ubuntu.Softwarecenter',
                                       '/com/ubuntu/Softwarecenter')
            iface = dbus.Interface(proxy_obj, 'com.ubuntu.SoftwarecenterIFace')
            if args:
                res = iface.bringToFront(args)
            else:
                # None can not be transported over dbus
                res = iface.bringToFront('nothing-to-show')
            # ensure that the running s-c is working
            if res is not True:
                LOG.info("found a running software-center on dbus, "
                         "reconnecting")
                sys.exit()
        except dbus.DBusException:
            bus_name = dbus.service.BusName('com.ubuntu.Softwarecenter', bus)
            self.dbusControler = SoftwarecenterDbusController(self, bus_name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号