def save(self, contract_addr, bind_addr):
     try:
         r = self.parent().network.run_from_another_thread(self.parent().network.get_token_info(contract_addr))
         name = r.get('name')
         decimals = r.get('decimals')
         symbol = r.get('symbol')
         if not name or not symbol or not isinstance(decimals, int) or decimals is None:
             self.show_message('token info not valid: {} {} {}'.format(name, symbol, decimals))
             return
         token = Token(contract_addr, bind_addr, name, symbol, decimals, 0)
         self.parent().set_token(token)
     except BaseException as e:
         import traceback, sys
         traceback.print_exc(file=sys.stderr)
         self.show_message(str(e))
 def add_token(self):
     contract_addr = self.contract_addr
     bind_addr = self.my_address
     if contract_addr == '':
         self.app.show_info(_("Contract Address is empty"))
         return
     try:
         r = self.app.network.run_from_another_thread(
             self.app.network.get_token_info(contract_addr))
         name = r.get('name')
         decimals = r.get('decimals')
         symbol = r.get('symbol')
         if not name or not symbol or not isinstance(
                 decimals, int) or decimals is None:
             self.app.show_info(
                 _("token info not valid: {} {} {}").format(
                     name, symbol, decimals))
             return
         token = Token(contract_addr, bind_addr, name, symbol, decimals, 0)
         self.app.set_token(token)
     except BaseException as e:
         import traceback, sys
         traceback.print_exc(file=sys.stderr)
         self.app.show_info(e)