add status bar at the bottom

master
Felix Pankratz 1 year ago
parent ed2e395e5f
commit 1a5ac7bb5a

@ -22,6 +22,10 @@ class Story:
votes: int
comments: int
def footer(stdscr, content):
stdscr.addstr(curses.LINES-1, 0, content, curses.A_REVERSE)
def main(stdscr):
stdscr.clear()
@ -36,8 +40,8 @@ def main(stdscr):
stories = []
for idx, i in enumerate(ids):
stdscr.clear()
stdscr.addstr(f'{num_stories}\n')
stdscr.addstr(f'[{spinner_states[idx%4]}] Getting stories...')
#stdscr.addstr(f'[{spinner_states[idx%4]}] Getting stories...')
footer(stdscr, f'[{spinner_states[idx%4]}] Getting stories...')
stdscr.refresh()
story_url = f'https://hacker-news.firebaseio.com/v0/item/{i}.json'
s = requests.get(story_url).json()
@ -69,6 +73,7 @@ def main(stdscr):
if i == current_pos:
detail = f' by {story.author} | {story.comments} comments | {story.votes} points\n'
stdscr.addstr(detail)
footer(stdscr, f'Loaded {num_stories} stories.')
stdscr.refresh()
c = stdscr.getch()

Loading…
Cancel
Save