def input_loop(s, do_quit, single_cmd): if not single_cmd: print('Type quit or a blank line to close the connection') sys.stdout.flush() file_in = FileObject(sys.stdin) while not do_quit.is_set(): sys.stdout.flush() if single_cmd: line = single_cmd else: line = file_in.readline() if not line or not line.decode().strip() or re.match('quit$', line.decode().strip().lower()): print('bye!') do_quit.set() break s.sendall(line) if single_cmd: break
def input_loop(s, do_quit, single_cmd): if not single_cmd: print('Type quit or a blank line to close the connection') sys.stdout.flush() file_in = FileObject(sys.stdin) while not do_quit.is_set(): sys.stdout.flush() if single_cmd: line = single_cmd else: line = file_in.readline() if not line or not line.decode().strip() or re.match( 'quit$', line.decode().strip().lower()): print('bye!') do_quit.set() break s.sendall(line) if single_cmd: break
@rh.touch.A.press() def touch_a(channel, b): global action a = "60\n".encode('utf-8') mytimer.timer_select(0) os.write(pipeout, a) @rh.touch.B.press() def touch_b(channel, b): global action a = "120\n".encode('utf-8') mytimer.timer_select(1) os.write(pipeout, a) @rh.touch.C.press() def touch_c(channel, c): global action #a = "4200\n".encode('utf-8') a = "600\n".encode('utf-8') mytimer.timer_select(2) os.write(pipeout, a) while True: #if action: c = pipein_fo.readline() mytimer.start_timer(int(c))