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
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))
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)))
def setJson(self, mjson): if mjson.toObject() != self.m_json.toObject(): self.m_json = QJsonValue(mjson) self.jsonChanged.emit()
def start(self): self.loading.emit(True) self.ac( self.p.start, lambda rsp: self.started.emit(QJsonValue(asdict(rsp))), )
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)