コード例 #1
0
ファイル: hotkey.py プロジェクト: TheOnePerson/coind-ncurses
def scroll_up(state, window, rpc_queue):
    if state['mode'] == 'tx':
        if 'tx' in state:
            if state['tx']['cursor'] > 0 and state['tx']['mode'] == 'inputs':
                if (state['tx']['cursor'] - state['tx']['offset']) == 0:
                    state['tx']['offset'] -= 1
                state['tx']['cursor'] -= 1
                tx.draw_inputs(state)

            if state['tx']['out_offset'] > 0 and state['tx']['mode'] == 'outputs':
                state['tx']['out_offset'] -= 1
                tx.draw_outputs(state)

    elif state['mode'] == "mempool":
        if 'mempool' in state:
            if state['mempool']['cursor'] > 0:
                if (state['mempool']['cursor'] - state['mempool']['offset']) == 0:
                    state['mempool']['offset'] -= 1
                state['mempool']['cursor'] -= 1
                mempool.draw_transactions(state)

    elif state['mode'] == "block":
        if 'blocks' in state:
            if state['blocks']['cursor'] > 0:
                if (state['blocks']['cursor'] - state['blocks']['offset']) == 0:
                    state['blocks']['offset'] -= 1
                state['blocks']['cursor'] -= 1
                block.draw_transactions(state)

    elif state['mode'] == "peers":
        if 'peerinfo' in state and 'peerinfo_offset' in state:
            if state['peerinfo_offset'] > 0:
                state['peerinfo_offset'] -= 1
                peers.draw_peers(state)

    elif state['mode'] == "forks":
        if 'chaintips' in state and 'chaintips_offset' in state:
            if state['chaintips_offset'] > 0:
                state['chaintips_offset'] -= 1
                forks.draw_tips(state)

    elif state['mode'] == "wallet":
        if 'wallet' in state:
            if state['wallet']['mode'] == 'tx':
                if state['wallet']['cursor'] > 0:
                    state['wallet']['cursor'] -= 1
                    lines = 5 if state['wallet']['verbose'] > 0 else 4
                    if ((state['wallet']['cursor'] * lines - 1) < state['wallet']['offset']):
                        state['wallet']['offset'] = state['wallet']['cursor'] * lines - 1
                    wallet.draw_transactions(state)
            elif state['wallet']['mode'] == 'addresses':
                if state['wallet']['offset'] > 0:
                    state['wallet']['offset'] -= 1
                    wallet.draw_addresses(state)

    elif state['mode'] == "console":
        state['console']['offset'] += 1
        console.draw_buffer(state)
コード例 #2
0
ファイル: hotkey.py プロジェクト: guoyu07/bitcoind-ncurses
def scroll_down(state, window, rpcc, poller):
    if state['mode'] == 'tx':
        if 'tx' in state:
            window_height = (state['y'] - 4) / 2
            if state['tx']['cursor'] < (len(state['tx']['vin']) - 1) and state['tx']['mode'] == 'inputs':
                state['tx']['cursor'] += 1

                if (state['tx']['cursor'] - state['tx']['offset']) > window_height-2:
                    state['tx']['offset'] += 1
                tx.draw_inputs(state)

            elif state['tx']['out_offset'] < (len(state['tx']['vout_string']) - (window_height-1)) and state['tx']['mode'] == 'outputs':
                state['tx']['out_offset'] += 1
                tx.draw_outputs(state)

    elif state['mode'] == "block":
        return
        if 'blocks' in state:
            height = str(state['blocks']['browse_height'])
            if height in state['blocks']:
                blockdata = state['blocks'][height]
                if state['blocks']['cursor'] < (len(blockdata['tx']) - 1):
                    state['blocks']['cursor'] += 1
                    window_height = state['y'] - 6
                    if (state['blocks']['cursor'] - state['blocks']['offset']) > window_height-2:
                        state['blocks']['offset'] += 1
                    block.draw_transactions(state)

    elif state['mode'] == "peers":
        if 'peerinfo' in state and 'peerinfo_offset' in state:
            window_height = state['y'] - 4
            if state['peerinfo_offset'] < (len(state['peerinfo']) - window_height):
                state['peerinfo_offset'] += 1
                peers.draw_peers(state)

    elif state['mode'] == "forks":
        if 'chaintips' in state and 'chaintips_offset' in state:
            window_height = state['y'] - 4
            if state['chaintips_offset'] < (len(state['chaintips']) - window_height):
                state['chaintips_offset'] += 1
                forks.draw_tips(state)

    elif state['mode'] == "wallet":
        if 'wallet' in state:
            if state['wallet']['cursor'] < (len(state['wallet']['transactions']) - 1):
                state['wallet']['cursor'] += 1
                window_height = state['y'] - 3
                if ( (state['wallet']['cursor']*4 +1 ) - state['wallet']['offset']) > window_height-2:
                    state['wallet']['offset'] += 4
                wallet.draw_transactions(state)

    elif state['mode'] == "console":
        if state['console']['offset'] > 0:
            state['console']['offset'] -= 1
            console.draw_buffer(state)
コード例 #3
0
def scroll_down(state, window, rpcc, poller):
    if state['mode'] == 'tx':
        if 'tx' in state:
            window_height = (state['y'] - 4) / 2
            if state['tx']['cursor'] < (len(state['tx']['vin']) -
                                        1) and state['tx']['mode'] == 'inputs':
                state['tx']['cursor'] += 1

                if (state['tx']['cursor'] -
                        state['tx']['offset']) > window_height - 2:
                    state['tx']['offset'] += 1
                tx.draw_inputs(state)

            elif state['tx']['out_offset'] < (
                    len(state['tx']['vout_string']) -
                (window_height - 1)) and state['tx']['mode'] == 'outputs':
                state['tx']['out_offset'] += 1
                tx.draw_outputs(state)

    elif state['mode'] == "peers":
        if 'peerinfo' in state and 'peerinfo_offset' in state:
            window_height = state['y'] - 4
            if state['peerinfo_offset'] < (len(state['peerinfo']) -
                                           window_height):
                state['peerinfo_offset'] += 1
                peers.draw_peers(state)

    elif state['mode'] == "forks":
        if 'chaintips' in state and 'chaintips_offset' in state:
            window_height = state['y'] - 4
            if state['chaintips_offset'] < (len(state['chaintips']) -
                                            window_height):
                state['chaintips_offset'] += 1
                forks.draw_tips(state)

    elif state['mode'] == "wallet":
        if 'wallet' in state:
            if state['wallet']['cursor'] < (
                    len(state['wallet']['transactions']) - 1):
                state['wallet']['cursor'] += 1
                window_height = state['y'] - 3
                if ((state['wallet']['cursor'] * 4 + 1) -
                        state['wallet']['offset']) > window_height - 2:
                    state['wallet']['offset'] += 4
                wallet.draw_transactions(state)

    elif state['mode'] == "console":
        if state['console']['offset'] > 0:
            state['console']['offset'] -= 1
            console.draw_buffer(state)
コード例 #4
0
ファイル: hotkey.py プロジェクト: TheOnePerson/coind-ncurses
def scroll_up(state, window, rpc_queue):
    if state['mode'] == 'tx':
        if 'tx' in state:
            if state['tx']['cursor'] > 0 and state['tx']['mode'] == 'inputs':
                if (state['tx']['cursor'] - state['tx']['offset']) == 0:
                    state['tx']['offset'] -= 1
                state['tx']['cursor'] -= 1
                tx.draw_inputs(state)

            if state['tx']['out_offset'] > 0 and state['tx']['mode'] == 'outputs':
                state['tx']['out_offset'] -= 1
                tx.draw_outputs(state)

    elif state['mode'] == "block":
        if 'blocks' in state:
            if state['blocks']['cursor'] > 0:
                if (state['blocks']['cursor'] - state['blocks']['offset']) == 0:
                    state['blocks']['offset'] -= 1
                state['blocks']['cursor'] -= 1
                block.draw_transactions(state)

    elif state['mode'] == "peers":
        if 'peerinfo' in state and 'peerinfo_offset' in state:
            if state['peerinfo_offset'] > 0:
                state['peerinfo_offset'] -= 1
                peers.draw_peers(state)

    elif state['mode'] == "forks":
        if 'chaintips' in state and 'chaintips_offset' in state:
            if state['chaintips_offset'] > 0:
                state['chaintips_offset'] -= 1
                forks.draw_tips(state)

    elif state['mode'] == "wallet":
        if 'wallet' in state:
            if state['wallet']['mode'] == 'tx':
                if state['wallet']['cursor'] > 0:
                    state['wallet']['cursor'] -= 1
                    if ((state['wallet']['cursor']*4 +1) - state['wallet']['offset']) == -3:
                        state['wallet']['offset'] -= 4
                    wallet.draw_transactions(state)
            else:
                if state['wallet']['offset'] > 0:
                    state['wallet']['offset'] -= 1
                    wallet.draw_addresses(state)

    elif state['mode'] == "console":
        state['console']['offset'] += 1
        console.draw_buffer(state)
コード例 #5
0
ファイル: hotkey.py プロジェクト: MarkTseng/bitcoind-ncurses
def scroll_up(state, window, rpcc, poller):
    if state['mode'] == 'tx':
        if 'tx' in state:
            if state['tx']['cursor'] > 0 and state['tx']['mode'] == 'inputs':
                if (state['tx']['cursor'] - state['tx']['offset']) == 0:
                    state['tx']['offset'] -= 1
                state['tx']['cursor'] -= 1
                tx.draw_inputs(state)

            if state['tx']['out_offset'] > 0 and state['tx'][
                    'mode'] == 'outputs':
                state['tx']['out_offset'] -= 1
                tx.draw_outputs(state)

    elif state['mode'] == "block":
        return
        if 'blocks' in state:
            if state['blocks']['cursor'] > 0:
                if (state['blocks']['cursor'] -
                        state['blocks']['offset']) == 0:
                    state['blocks']['offset'] -= 1
                state['blocks']['cursor'] -= 1
                block.draw_transactions(state)

    elif state['mode'] == "peers":
        if 'peerinfo' in state and 'peerinfo_offset' in state:
            if state['peerinfo_offset'] > 0:
                state['peerinfo_offset'] -= 1
                peers.draw_peers(state)

    elif state['mode'] == "forks":
        if 'chaintips' in state and 'chaintips_offset' in state:
            if state['chaintips_offset'] > 0:
                state['chaintips_offset'] -= 1
                forks.draw_tips(state)

    elif state['mode'] == "wallet":
        if 'wallet' in state:
            if state['wallet']['cursor'] > 0:
                state['wallet']['cursor'] -= 1
                if ((state['wallet']['cursor'] * 4 + 1) -
                        state['wallet']['offset']) == -3:
                    state['wallet']['offset'] -= 4
                wallet.draw_transactions(state)

    elif state['mode'] == "console":
        state['console']['offset'] += 1
        console.draw_buffer(state)
コード例 #6
0
ファイル: hotkey.py プロジェクト: TheOnePerson/coind-ncurses
def scroll_down(state, window, rpc_queue):
    if state['mode'] == 'tx':
        if 'tx' in state:
            window_height = (state['y'] - 4) / 2
            if state['tx']['cursor'] < (len(state['tx']['vin']) - 1) and state['tx']['mode'] == 'inputs':
                state['tx']['cursor'] += 1

                if (state['tx']['cursor'] - state['tx']['offset']) > window_height-2:
                    state['tx']['offset'] += 1
                tx.draw_inputs(state)

            elif state['tx']['out_offset'] < (len(state['tx']['vout_string']) - (window_height-1)) and state['tx']['mode'] == 'outputs':
                state['tx']['out_offset'] += 1
                tx.draw_outputs(state)

    elif state['mode'] == "mempool":
        if 'mempool' in state:
            if 'transactions' in state['mempool']:
                txdata = state['mempool']['transactions']
                if state['mempool']['cursor'] < (len(txdata) - 1):
                    state['mempool']['cursor'] += 1
                    window_height = g.viewport_height
                    if (state['mempool']['cursor'] - state['mempool']['offset']) > window_height - 2:
                        state['mempool']['offset'] += 1
                    mempool.draw_transactions(state)

    elif state['mode'] == "block":
        if 'blocks' in state:
            height = str(state['blocks']['browse_height'])
            if height in state['blocks']:
                blockdata = state['blocks'][height]
                if state['blocks']['cursor'] < (len(blockdata['tx']) - 1):
                    state['blocks']['cursor'] += 1
                    window_height = g.viewport_height
                    if (state['blocks']['cursor'] - state['blocks']['offset']) > window_height - 2:
                        state['blocks']['offset'] += 1
                    block.draw_transactions(state)

    elif state['mode'] == "peers":
        if 'peerinfo' in state and 'peerinfo_offset' in state:
            window_height = state['y'] - 4
            if state['peerinfo_offset'] < (len(state['peerinfo']) - window_height):
                state['peerinfo_offset'] += 1
                peers.draw_peers(state)

    elif state['mode'] == "forks":
        if 'chaintips' in state and 'chaintips_offset' in state:
            window_height = state['y'] - 5
            if state['chaintips_offset'] < (len(state['chaintips']) - window_height):
                state['chaintips_offset'] += 1
                forks.draw_tips(state)

    elif state['mode'] == "wallet":
        if 'wallet' in state:
            window_height = g.viewport_heigth
            if state['wallet']['mode'] == 'tx':
                if 'transactions' in state['wallet']:
                    if state['wallet']['cursor'] < (len(state['wallet']['transactions']) - 1):
                        state['wallet']['cursor'] += 1
                        lines = 5 if state['wallet']['verbose'] > 0 else 4
                        if (state['wallet']['cursor'] * lines) - state['wallet']['offset'] >= window_height - 1:
                            state['wallet']['offset'] += lines  #(state['wallet']['cursor'] * lines) - 1
                        # make sure that the last tx is fully visible
                        if state['wallet']['cursor'] == len(state['wallet']['transactions']) - 1:
                            if state['wallet']['offset'] + window_height - 1 <= len(state['wallet']['transactions']) * lines:
                                state['wallet']['offset'] += (len(state['wallet']['transactions']) * lines) - (state['wallet']['offset'] + window_height - 1)

                        wallet.draw_transactions(state)
            elif state['wallet']['mode'] == 'addresses':
                if 'addresses' in state['wallet']:
                    if len(state['wallet']['addresses']) * 4 - state['wallet']['offset'] > window_height - 1:
                        state['wallet']['offset'] += 1
                        wallet.draw_addresses(state)

    elif state['mode'] == "console":
        if state['console']['offset'] > 0:
            state['console']['offset'] -= 1
            console.draw_buffer(state)