def updateToolTip(self, profile): spaceHandle = SpaceHandle(profile.userInfo.iphandle) self.setToolTip( iIdentityInfo( profile.userInfo.vplanet, spaceHandle.human if spaceHandle.valid else iUnknown(), profile.userInfo.personDid))
def updateProfile(self): spaceHandle = SpaceHandle(self.profile.userInfo.iphandle) if spaceHandle.valid: self.ui.ipHandle.setText('<b>{0}</b>'.format(str(spaceHandle))) self.ui.profileDid.setText('<b>{0}</b>'.format( self.profile.userInfo.personDid)) else: self.ui.ipHandle.setText(iUnknown()) self.ui.profileDid.setText('<b>{0}</b>'.format(iUnknown()))
def peerToolTip(ctx): handle = SpaceHandle(ctx.iphandle) try: data = QByteArray() buffer = QBuffer(data) buffer.open(QIODevice.WriteOnly) ctx.avatarPixmapScaled(128, 128).save(buffer, 'PNG') buffer.close() avatarUrl = 'data:image/png;base64, {}'.format( bytes(buffer.data().toBase64()).decode()) except Exception: avatarUrl = ':/share/icons/unknown-file.png' return iPeerToolTip(avatarUrl, ctx.peerId, str(handle), ctx.ipid.did, ctx.validated, ctx.authenticated, ctx.pingAvg())
async def scanNetworkGraph(self, ipfsop): profile = ipfsop.ctx.currentProfile async with profile.dagNetwork.read() as ng: for peerId, peerHandles in ng.d['peers'].items(): for handle, hData in peerHandles.items(): sHandle = SpaceHandle(handle) did = hData.get('did') if peerId == ipfsop.ctx.node.id: if did != profile.userInfo.personDid: # Don't load inactive IPIDs continue log.debug( f'scanNetworkGraph: processing {handle} ({did})') if not sHandle.valid: continue # Is it in the model already ? if self.app.peersTracker.model.didRegistered(did): continue if did in self._didGraphLStatus: await ipfsop.sleep() continue ensure( self.loadDidFromGraph(ipfsop, peerId, did, sHandle)) self._didGraphLStatus.append(did) await ipfsop.sleep(0.1) await ipfsop.sleep(0.05) self._pgScanCount += 1
def spaceHandle(self): return SpaceHandle(self.iphandle)
def iphandleValid(self): return SpaceHandle(self.iphandle).valid