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


Python Hook.register_weakref方法代码示例

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


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

示例1: init_host

# 需要导入模块: from dNG.plugins.hook import Hook [as 别名]
# 或者: from dNG.plugins.hook.Hook import register_weakref [as 别名]
    def init_host(self, device, service_id, configid = None):
        """
Initializes a host service.

:param device: Host device this UPnP service is added to
:param service_id: Unique UPnP service ID
:param configid: UPnP configId for the host device

:return: (bool) Returns true if initialization was successful.
:since:  v0.2.00
        """

        self.configid = configid
        self.host_service = True
        self.service_id = service_id
        self.udn = device.get_udn()

        self.url_base = "{0}{1}/".format(device.get_url_base(), Link.encode_query_value(service_id))
        self.url_control = "{0}control".format(self.url_base)
        self.url_event_control = "{0}eventsub".format(self.url_base)
        self.url_scpd = "{0}xml".format(self.url_base)

        self._init_host_actions(device)
        self._init_host_variables(device)

        Hook.call("dNG.pas.upnp.Service.initHost", device = device, service = self)
        Hook.register_weakref("dNG.pas.upnp.Gena.onRegistered", self._on_gena_registration)

        return ((len(self.actions) + len(self.variables)) > 0)
开发者ID:dNG-git,项目名称:pas_upnp,代码行数:31,代码来源:abstract_service.py

示例2: __init__

# 需要导入模块: from dNG.plugins.hook import Hook [as 别名]
# 或者: from dNG.plugins.hook.Hook import register_weakref [as 别名]
    def __init__(self):
        """
Constructor __init__(GlibThread)

:since: v0.2.00
        """

        Thread.__init__(self)

        self.log_handler = NamedLoader.get_singleton("dNG.data.logging.LogHandler", False)
        """
The LogHandler is called whenever debug messages should be logged or errors
happened.
        """
        self.mainloop = None
        """
Active mainloop instance
        """

        Hook.register_weakref("dNG.pas.Status.onShutdown", self.stop)
开发者ID:dNG-git,项目名称:pas_gapi_core,代码行数:22,代码来源:glib_thread.py

示例3: init_host

# 需要导入模块: from dNG.plugins.hook import Hook [as 别名]
# 或者: from dNG.plugins.hook.Hook import register_weakref [as 别名]
    def init_host(self, device, service_id = None, configid = None):
        """
Initializes a host service.

:param device: Host device this UPnP service is added to
:param service_id: Unique UPnP service ID
:param configid: UPnP configId for the host device

:return: (bool) Returns true if initialization was successful.
:since:  v0.2.00
        """

        self.type = "ContentDirectory"
        self.upnp_domain = "schemas-upnp-org"
        self.version = "4"

        if (service_id is None): service_id = "ContentDirectory"

        Hook.register_weakref("dNG.pas.upnp.Resource.onUpdateIdChanged", self._on_updated_id)
        Hook.register_weakref("dNG.pas.upnp.services.ContentDirectory.onSystemUpdateIdChanged", self._on_updated_id)

        return AbstractService.init_host(self, device, service_id, configid)
开发者ID:dNG-git,项目名称:mp_core,代码行数:24,代码来源:content_directory.py

示例4: __init__

# 需要导入模块: from dNG.plugins.hook import Hook [as 别名]
# 或者: from dNG.plugins.hook.Hook import register_weakref [as 别名]
    def __init__(self):
        """
Constructor __init__(AbstractServer)

:since: v1.0.0
        """

        Thread.__init__(self)

        self.host = None
        """
Configured server host
        """
        self._log_handler = NamedLoader.get_singleton("dNG.data.logging.LogHandler", False)
        """
The LogHandler is called whenever debug messages should be logged or errors
happened.
        """
        self.port = None
        """
Configured server port
        """
        self.socket_hostname = None
        """
Socket server hostname
        """

        socket_hostname = getfqdn()

        try:
            getaddrinfo(socket_hostname, None)
            self.socket_hostname = socket_hostname
        except socket_error: self.socket_hostname = gethostname()

        self.socket_hostname = self.socket_hostname.lower()

        Hook.register_weakref("dNG.pas.http.Server.getHost", self.get_host)
        Hook.register_weakref("dNG.pas.http.Server.getPort", self.get_port)
开发者ID:dNG-git,项目名称:pas_http_core,代码行数:40,代码来源:abstract_server.py


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