本文整理汇总了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)
示例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)
示例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)
示例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)