Example #1
0
def receive_loop():
    global receive_addr, receive_amount, receive_message
    print "receive loop"
    receive_URI = util.create_URI(receive_addr, receive_amount, receive_message)
    make_bitmap(receive_URI)
    droid.fullShow(qr_layout(receive_addr, receive_amount, receive_message))
    out = None
    while out is None:
        event = droid.eventWait().result
        if not event:
            continue

        elif event["name"]=="key":
            if event["data"]["key"] == '4':
                out = 'main'

        elif event["name"]=="clipboard":
            droid.setClipboard(receive_URI)
            modal_dialog('URI copied to clipboard', receive_URI)

        elif event["name"]=="amount":
            amount = modal_input('Amount', 'Amount you want to receive (in DASH). ', format_satoshis(receive_amount) if receive_amount else None, "numberDecimal")
            if amount is not None:
                receive_amount = int(COIN * Decimal(amount)) if amount else None
                out = 'receive'

        elif event["name"]=="message":
            message = modal_input('Message', 'Message in your request', receive_message)
            if message is not None:
                receive_message = unicode(message)
                out = 'receive'

    return out
Example #2
0
 def get_URI(self):
     from electrum_dash.util import create_URI
     amount = self.screen.amount
     if amount:
         a, u = self.screen.amount.split()
         assert u == self.app.base_unit
         amount = Decimal(a) * pow(10, self.app.decimal_point())
     return create_URI(self.screen.address, amount, self.screen.message)
Example #3
0
def receive_loop():
    global receive_addr, receive_amount, receive_message
    print "receive loop"
    receive_URI = util.create_URI(receive_addr, receive_amount,
                                  receive_message)
    make_bitmap(receive_URI)
    droid.fullShow(qr_layout(receive_addr, receive_amount, receive_message))
    out = None
    while out is None:
        event = droid.eventWait().result
        if not event:
            continue

        elif event["name"] == "key":
            if event["data"]["key"] == '4':
                out = 'main'

        elif event["name"] == "clipboard":
            droid.setClipboard(receive_URI)
            modal_dialog('URI copied to clipboard', receive_URI)

        elif event["name"] == "amount":
            amount = modal_input(
                'Amount', 'Amount you want to receive (in DASH). ',
                format_satoshis(receive_amount) if receive_amount else None,
                "numberDecimal")
            if amount is not None:
                receive_amount = int(COIN *
                                     Decimal(amount)) if amount else None
                out = 'receive'

        elif event["name"] == "message":
            message = modal_input('Message', 'Message in your request',
                                  receive_message)
            if message is not None:
                receive_message = unicode(message)
                out = 'receive'

    return out