def loop(interface_queue, rpc_queue): window = init_curses() state = { 'mode': "monitor", 'blocks': { 'cursor': 0, 'offset': 0 }, 'networkhashps': {} } while 1: check_window_size(window, 20, 75) # y, x error_message = process.queue(state, window, interface_queue) if error_message: break # ends if stop command sent by rpc if state['mode'] == "monitor": if (int(time.time() * 1000) % 1000) < 100: # hackish idle monitor.draw_window(state, window) if process.user_input(state, window, rpc_queue): break # returns 1 when quit key is pressed time.sleep(0.05) # TODO: base updates on interrupts to avoid needless polling curses.nocbreak() curses.endwin() rpc_queue.put({ 'stop': True }) if error_message: sys.stderr.write("bitcoind-ncurses encountered an error\n") sys.stderr.write("Message: " + error_message + "\n")
def loop(interface_queue, rpc_queue): window = init_curses() state = { 'mode': "splash", 'blocks': { 'cursor': 0, 'offset': 0 }, 'networkhashps': {}, 'console': { 'cbuffer': [], 'rbuffer': [], 'offset': 0 }, 'x': -1, 'y': -1, 'history': { 'getnettotals': [] } } splash.draw_window(state, window) iterations = 0 while 1: check_window_size(interface_queue, state, window, 12, 75) # min_y, min_x error_message = process.queue(state, window, interface_queue) if error_message: break # ends if stop command sent by rpc if state['mode'] == "monitor": if not iterations % 20: monitor.draw_window(state, window) if hotkey.check(state, window, rpc_queue): # poll for user input break # returns 1 when quit key is pressed iterations += 1 curses.nocbreak() curses.endwin() rpc_queue.put({'stop': True}) if error_message: sys.stderr.write("bitcoind-ncurses encountered an error\n") sys.stderr.write("Message: " + error_message + "\n")
def loop(state, window, interface_queue, rpc_queue): iterations = 0 while 1: check_window_size(interface_queue, state, window, 12, 75) # min_y, min_x error_message = process.queue(state, window, interface_queue) if error_message: return error_message # ends if stop command sent by rpc if state['mode'] == "monitor": if not iterations % 20: monitor.draw_window(state, window) if hotkey.check(state, window, rpc_queue): # poll for user input break # returns 1 when quit key is pressed iterations += 1 return False
def loop(block_viewer, state, window, interface_queue, rpcc, poller): iterations = 0 while 1: check_window_size(interface_queue, state, window, 12, 75) # min_y, min_x error_message = process.queue(state, window, interface_queue) if error_message: return error_message # ends if stop command sent by rpc gevent.sleep(0.0001) # TODO: Can we kill this? if state['mode'] == "monitor": if not iterations % 20: monitor.draw_window(state, window) footer.draw_window(state) if hotkey.check(block_viewer, state, window, rpcc, poller): # poll for user input break # returns 1 when quit key is pressed iterations += 1 return False
def loop(state, window, interface_queue, rpc_queue): iterations = 0 tick = 25 while 1: check_window_size(interface_queue, state, window, 11, 79, 80, 130) # min_y, min_x, max_y, max_x error_message = process.queue(state, window, interface_queue, rpc_queue) if error_message: return error_message # ends if stop command sent by rpc if not iterations % tick: iterations = 0 if state['mode'] == "home": monitor.draw_window(state, window, rpc_queue, False) if hotkey.check(state, window, rpc_queue): # poll for user input break # returns 1 when quit key is pressed iterations += 1 return False
def loop(interface_queue, rpc_queue): window = init_curses() state = { 'mode': "splash", 'blocks': { 'cursor': 0, 'offset': 0 }, 'networkhashps': {}, 'console': { 'cbuffer': [], 'rbuffer': [], 'offset': 0 }, 'x': -1, 'y': -1, 'history': { 'getnettotals': [] } } splash.draw_window(state, window) iterations = 0 while 1: check_window_size(interface_queue, state, window, 12, 75) # min_y, min_x error_message = process.queue(state, window, interface_queue) if error_message: break # ends if stop command sent by rpc if state['mode'] == "monitor": if not iterations % 20: monitor.draw_window(state, window) if hotkey.check(state, window, rpc_queue): # poll for user input break # returns 1 when quit key is pressed iterations += 1 curses.nocbreak() curses.endwin() rpc_queue.put({ 'stop': True }) if error_message: sys.stderr.write("bitcoind-ncurses encountered an error\n") sys.stderr.write("Message: " + error_message + "\n")