예제 #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
    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")