MCPcopy Create free account
hub / github.com/PyQt5/PyQt / textMessageReceived

Method textMessageReceived

QWebChannel/Lib/WebChannelObject.py:33–46  ·  view source on GitHub ↗
(self, message)

Source from the content-addressed store, hash-verified

31 'utf-8', errors='ignore'))
32
33 def textMessageReceived(self, message):
34 print('textMessageReceived:', message)
35 error = QJsonParseError()
36 json = QJsonDocument.fromJson(message.encode('utf-8', errors='ignore'),
37 error)
38 if error.error:
39 print('Failed to parse message:{}, Error is:{}'.format(
40 message, error.errorString()))
41 return
42 if not json.isObject():
43 print('Received JSON message that is not an object:{}'.format(
44 message))
45 return
46 self.messageReceived.emit(json.object(), self)
47
48
49class WebChannelObject(QObject):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected