示例#1
0
 def __init__(self, mid, order, mjson, metadata, parent=None):
     QObject.__init__(self, parent)
     self.setObjectName(str(mid))
     self.m_id = mid
     self.m_order = order
     self.m_json = QJsonValue(mjson)  # or  self.m_json = mjson #
     self.m_metadata = metadata
示例#2
0
 def appendAttribute(self, attribute, value=QJsonValue()):
     if isinstance(value, QJsonValue):
         if value.isArray():
             pyValue = value.toArray().toVariantList()
         else:
             pyValue = None if value.isNull() else value.toObject()
     else:
         pyValue = value
     self.push(commands.ListAttributeAppendCommand(self._graph, attribute, pyValue))
示例#3
0
        def cb(res: ChallengeRsp):
            if res.qtype == 'roundSummary':
                prg_data = [{
                    'wrd': asdict(i)['prg'][0]['wrd'],
                    'prg': asdict(i)['prg'][0]["prg"],
                    'def_': asdict(i)['prg'][0]['def_']
                } for i in res.pdata.round]

                self.roundSummary.emit(QJsonArray.fromVariantList(prg_data))
            else:
                self.newCard.emit(QJsonValue(asdict(res)))
示例#4
0
 def setJson(self, mjson):
     if mjson.toObject() != self.m_json.toObject():
         self.m_json = QJsonValue(mjson)
         self.jsonChanged.emit()
示例#5
0
 def start(self):
     self.loading.emit(True)
     self.ac(
         self.p.start,
         lambda rsp: self.started.emit(QJsonValue(asdict(rsp))),
     )
示例#6
0
 def verify_answer(self, idx, nonce):
     logging.info(f'Getting answer for option {idx}, {nonce}')
     self.ac(
         self.p.verify_answer, lambda answer: self.answerBingo.emit(
             idx, QJsonValue(asdict(answer))), nonce,
         self.p.cur_question.secret)