def pay_to_URI(self, URI): # WARNING: Copied as needed for PayToEdit if not URI: return try: out = web.parse_URI(URI, self.on_pr) except Exception as e: self.show_error(_('Invalid bitcoincash URI:') + '\n' + str(e)) return r = out.get('r') sig = out.get('sig') name = out.get('name') if r or (name and sig): self.prepare_for_payment_request() return address = out.get('address') amount = out.get('amount') label = out.get('label') message = out.get('message') # use label as description (not BIP21 compliant) if label and not message: message = label if address: self.payto_edit.setText(address) if message: self.description_edit.setText(message) if amount: self.amount_e.setAmount(amount) self.amount_e.textEdited.emit("")
def set_URI(self, text): try: uri = parse_URI(text, self.app.on_pr) except: self.app.show_info(_("Not a Bitcoin URI")) return amount = uri.get('amount') self.screen.address = uri.get('address', '') self.screen.message = uri.get('message', '') self.screen.amount = self.app.format_amount_and_units(amount) if amount else '' self.payment_request = None self.screen.is_pr = False