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


Python Activity.connect方法代码示例

本文整理汇总了Python中activity.Activity.connect方法的典型用法代码示例。如果您正苦于以下问题:Python Activity.connect方法的具体用法?Python Activity.connect怎么用?Python Activity.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在activity.Activity的用法示例。


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

示例1: _new_activity

# 需要导入模块: from activity import Activity [as 别名]
# 或者: from activity.Activity import connect [as 别名]
    def _new_activity(self, activity_id, tp, room):
        try:
            objid = self._get_next_object_id()
            activity = Activity(self._session_bus, objid, self, tp, room,
                                id=activity_id)
        except Exception:
            # FIXME: catching bare Exception considered harmful
            _logger.debug("Invalid activity:", exc_info=1)
            try:
                del self._activities_by_handle[tp][room]
            except KeyError:
                pass
            return None

        activity.connect("validity-changed",
                         self._activity_validity_changed_cb)
        activity.connect("disappeared", self._activity_disappeared_cb)
        self._activities_by_id[activity_id] = activity
        self._activities_by_handle[tp][room] = activity
        return activity
开发者ID:tchx84,项目名称:debian-pkg-sugar-presence,代码行数:22,代码来源:presenceservice.py

示例2: async_err_cb

# 需要导入模块: from activity import Activity [as 别名]
# 或者: from activity.Activity import connect [as 别名]
        except ValueError, e:
            async_err_cb(e)
            return

        objid = self._get_next_object_id()
        # XXX: is the preferred Telepathy plugin always the right way to
        # share the activity?
        # We set private=True here - when the activity becomes shared
        # via join(), we'll set private to the correct value.
        activity = Activity(self._session_bus, objid, self,
                            self._get_preferred_plugin(), 0,
                            id=actid, type=atype,
                            name=name, color=self._owner.props.color,
                            local=True, private=True, tags=tags)

        activity.connect("validity-changed",
                         self._activity_validity_changed_cb)
        activity.connect("disappeared", self._activity_disappeared_cb)
        self._activities_by_id[actid] = activity

        def activity_shared():
            tp, room = activity.room_details
            self._activities_by_handle[tp][room] = activity
            async_cb(activity.object_path())

        activity.join(activity_shared, async_err_cb, sharing=True,
                      private=private, sender=sender)

        # local activities are valid at creation by definition, but we can't
        # connect to the activity's validity-changed signal until its already
        # issued the signal, which happens in the activity's constructor
        # for local activities.
开发者ID:tchx84,项目名称:debian-pkg-sugar-presence,代码行数:34,代码来源:presenceservice.py


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