コード例 #1
0
    def textMessageReceived(self, messageData):
        error = QJsonParseError()
        message = QJsonDocument(eval(messageData))
        '''
        if error:
            print("Failed to parse text message as JSON object:", messageData)
            print("Error is:", error.errorString())
            return
        elif not messageData.isObject():
            print("Received JSON message that is not an object: ", messageData)
            return
        '''

        self.messageReceived.emit(message.object(), self)
コード例 #2
0
ファイル: FlowViewStyle.py プロジェクト: FMichelD/PyQt5Nodes
    def loadJsonFromByteArray(self, byteArray: QByteArray):

        json = QJsonDocument(QJsonDocument.fromJson(byteArray))

        topLevelObject = json.object()

        nodeStyleValues = topLevelObject["FlowViewStyle"]

        obj = nodeStyleValues.toObject()

        self.BackgroundColor = self.flowViewStyleReadColor(
            obj, "BackgroundColor")
        self.FineGridColor = self.flowViewStyleReadColor(obj, "FineGridColor")
        self.CoarseGridColor = self.flowViewStyleReadColor(
            obj, "CoarseGridColor")