MCPcopy
hub / github.com/PyQt5/PyQt / __init__

Method __init__

QWebChannel/Lib/WebChannelObject.py:51–69  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

49class WebChannelObject(QObject):
50
51 def __init__(self, *args, **kwargs):
52 super(WebChannelObject, self).__init__(*args, **kwargs)
53 # 内部属性供外部调用
54 self._intValue = 0
55 self._floatValue = 0.0
56 self._boolValue = False
57 self._strValue = ''
58 # 设置数组或者字典有一定问题
59 # self._listValue = []
60 # self._mapValue = {}
61
62 # webchannel对象
63 self.m_webchannel = QWebChannel(self)
64 # 这里默认注册自己,这里使用了类名作为名称
65 self.registerObject(self.__class__.__name__, self)
66 # websocket服务
67 self.m_clients = {}
68 self.m_server = QWebSocketServer(self.__class__.__name__,
69 QWebSocketServer.NonSecureMode, self)
70
71 def registerObject(self, name, obj):
72 """注册对象

Callers 1

__init__Method · 0.45

Calls 2

registerObjectMethod · 0.95
QWebChannelFunction · 0.50

Tested by

no test coverage detected