auto update when there is no input

This commit is contained in:
xfnw 2021-07-22 11:10:56 -04:00
parent 5412b5b225
commit 0f1c1c570c

12
nboard
View file

@ -3,12 +3,14 @@
import curses,time,json,sys,os,subprocess import curses,time,json,sys,os,subprocess
dataPath = os.path.expanduser('~')+'/.nboard/nboard.json' dataPath = '/home/xfnw/.nboard/nboard.json'
allowedChars = " `~1234567890-=!@#$%^&*()_+qwertyuiop[]\\QWERTYUIOP{}|asdfghjkl;'ASDFGHJKL:\"zxcvbnm,./ZXCVBNM<>?" allowedChars = " `~1234567890-=!@#$%^&*()_+qwertyuiop[]\\QWERTYUIOP{}|asdfghjkl;'ASDFGHJKL:\"zxcvbnm,./ZXCVBNM<>?"
data = {} data = {}
def main(stdscr): def main(stdscr):
curses.halfdelay(5)
stdscr.erase() stdscr.erase()
stdscr.refresh() stdscr.refresh()
k='NOU' k='NOU'
@ -20,10 +22,11 @@ def main(stdscr):
stdscr.move(cy,cx) stdscr.move(cy,cx)
while True: while True:
try:
cx = width // 2 cx = width // 2
cy = height // 2 cy = height // 2
stdscr.clear() #stdscr.clear()
height, width = stdscr.getmaxyx() height, width = stdscr.getmaxyx()
@ -109,8 +112,13 @@ def main(stdscr):
#print(str(k)) # debug keycodes #print(str(k)) # debug keycodes
try:
k = stdscr.getkey() k = stdscr.getkey()
except curses.error:
k = 'NOU'
time.sleep(0) time.sleep(0)
except json.decoder.JSONDecodeError:
time.sleep(0.5)
if __name__ == "__main__": if __name__ == "__main__":