Browse Source

fixed toast so it prints linefeeds

no_compress
Raphael Roberts 7 years ago
parent
commit
0371736015
  1. 10
      main.py

10
main.py

@ -17,7 +17,11 @@ CHICAGO_TZ = tz.gettz("America/Chicago")
def toast(text): def toast(text):
subprocess.check_call(["termux-toast",text])
read, write = os.pipe()
os.write(write, text.encode())
os.close(write)
subprocess.Popen(["termux-toast", "-g", "top", "-c", "white", "-b", "black"],
stdin=read)
def atoi(text): def atoi(text):
@ -146,6 +150,8 @@ def show(data, rt_filter=None, _clear=False):
config.format(**locals()), end='\n'*2 config.format(**locals()), end='\n'*2
) )
print("="*36) print("="*36)
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(prog='ctabus') parser = argparse.ArgumentParser(prog='ctabus')
parser.add_argument('-l', '--lucky', action='store_true', parser.add_argument('-l', '--lucky', action='store_true',
@ -197,7 +203,7 @@ if __name__ == '__main__':
timeout = 1 timeout = 1
if args.periodic > timeout: if args.periodic > timeout:
timeout = args.periodic timeout = args.periodic
data = ctabus.get_times(stop_id,timeout=timeout)
data = ctabus.get_times(stop_id, timeout=timeout)
e = time.perf_counter() - s e = time.perf_counter() - s
if e < args.periodic: if e < args.periodic:
time.sleep(args.periodic-e) time.sleep(args.periodic-e)

Loading…
Cancel
Save