def create(self): # balance amount = account.to_ether(account.get_balance(app.addr)) self.obj.icon = abs_path('icons/person.png') self.obj.username = '******'.format(app.username) self.obj.amount = '{}'.format(amount) wallet.market_client.products().addCallbacks(self.renderProducts)
def load(self): logger.debug('create') self.balance.value = account.to_ether(account.get_balance(app.addr)) logger.debug('get balance') # Load records wallet.market_client.query_records(address=app.addr).addCallbacks( self.loaded_data) logger.debug('query records')
def itemHandler(data): items = [] items.append(data.category) items.append(data.payer) try: amount = str(account.to_ether(abs(data.amount))) if data.amount > 0: amount = '+' + amount elif data.amount < 0: amount = '-' + amount except ValueError as e: logger.error(e) wid = QLabel(amount) wid.setStyleSheet("QLabel{{color: {};}}".format( '#00a20e' if data.amount >= 0 else '#d0021b')) items.append(wid) items.append(data.time) return items
def data(self): account_ = account.to_ether(account.get_balance(app.addr)) return { "id": self.product_id, "image": self.image_, "icon": self.icon, "name": self.name_, "category": self.category, "created": self.created, "sales": self.sales, "cpc": self.cpc_, "remain": self.remain, "description": self.description_, "gas": 1, "account": account_, "password": "", "storagePath": "", "status_text": "Delivered on May 2, 08:09:08" }
def update(_): self.balance.value = account.to_ether(account.get_balance( app.addr))