auto update when there is no input
This commit is contained in:
parent
5412b5b225
commit
0f1c1c570c
1 changed files with 84 additions and 76 deletions
14
nboard
14
nboard
|
@ -3,12 +3,14 @@
|
|||
|
||||
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<>?"
|
||||
data = {}
|
||||
|
||||
def main(stdscr):
|
||||
curses.halfdelay(5)
|
||||
|
||||
stdscr.erase()
|
||||
stdscr.refresh()
|
||||
k='NOU'
|
||||
|
@ -20,10 +22,11 @@ def main(stdscr):
|
|||
|
||||
stdscr.move(cy,cx)
|
||||
while True:
|
||||
try:
|
||||
cx = width // 2
|
||||
cy = height // 2
|
||||
|
||||
stdscr.clear()
|
||||
#stdscr.clear()
|
||||
|
||||
height, width = stdscr.getmaxyx()
|
||||
|
||||
|
@ -101,7 +104,7 @@ def main(stdscr):
|
|||
|
||||
|
||||
# display some info
|
||||
stdscr.addstr(height-1, 0, 'x: {}, y: {}, arrow keys to move, ctrl to go faster'.format(tx, 1-ty)[:width-1])
|
||||
stdscr.addstr(height-1, 0, 'x: {}, y: {}, arrow keys to move, ctrl to go faster '.format(tx, 1-ty)[:width-1])
|
||||
|
||||
|
||||
# move the cursor where its actually supposed to be
|
||||
|
@ -109,8 +112,13 @@ def main(stdscr):
|
|||
|
||||
#print(str(k)) # debug keycodes
|
||||
|
||||
try:
|
||||
k = stdscr.getkey()
|
||||
except curses.error:
|
||||
k = 'NOU'
|
||||
time.sleep(0)
|
||||
except json.decoder.JSONDecodeError:
|
||||
time.sleep(0.5)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in a new issue