Esempio n. 1
0
def update_layout():
    global status_text
    if not network.is_connected():
        text = "Not connected..."
    elif not wallet.up_to_date:
        text = "Synchronizing..."
    else:
        c, u = wallet.get_balance()
        text = "Balance:" + format_satoshis(c)
        if u: text += '   [' + format_satoshis(u, True).strip() + ']'

    # vibrate if status changed
    if text != status_text:
        if status_text and network.is_connected() and wallet.up_to_date:
            droid.vibrate()
        status_text = text

    droid.fullSetProperty("balanceTextView", "text", status_text)

    if wallet.up_to_date:
        set_history_layout(15)
Esempio n. 2
0
def update_layout():
    global status_text
    if not network.is_connected():
        text = "Not connected..."
    elif not wallet.up_to_date:
        text = "Synchronizing..."
    else:
        c, u = wallet.get_balance()
        text = "Balance:"+format_satoshis(c) 
        if u : text += '   [' + format_satoshis(u,True).strip() + ']'


    # vibrate if status changed
    if text != status_text:
        if status_text and network.is_connected() and wallet.up_to_date:
            droid.vibrate()
        status_text = text

    droid.fullSetProperty("balanceTextView", "text", status_text)

    if wallet.up_to_date:
        set_history_layout(15)
Esempio n. 3
0
def get_history_values(n):
    values = []
    h = wallet.get_tx_history()
    length = min(n, len(h))
    for i in range(length):
        tx_hash, conf, is_mine, value, fee, balance, timestamp = h[-i-1]
        try:
            dt = datetime.datetime.fromtimestamp( timestamp )
            if dt.date() == dt.today().date():
                time_str = str( dt.time() )
            else:
                time_str = str( dt.date() )
        except Exception:
            time_str = 'pending'

        conf_str = 'v' if conf else 'o'
        label, is_default_label = wallet.get_label(tx_hash)
        values.append((conf_str, '  ' + time_str, '  ' + format_satoshis(value,True), '  ' + label ))

    return values
Esempio n. 4
0
def get_history_values(n):
    values = []
    h = wallet.get_tx_history()
    length = min(n, len(h))
    for i in range(length):
        tx_hash, conf, is_mine, value, fee, balance, timestamp = h[-i - 1]
        try:
            dt = datetime.datetime.fromtimestamp(timestamp)
            if dt.date() == dt.today().date():
                time_str = str(dt.time())
            else:
                time_str = str(dt.date())
        except Exception:
            time_str = 'pending'

        conf_str = 'v' if conf else 'o'
        label, is_default_label = wallet.get_label(tx_hash)
        values.append((conf_str, '  ' + time_str,
                       '  ' + format_satoshis(value, True), '  ' + label))

    return values