|
|
|
@ -32,7 +32,6 @@ class Client:
|
|
|
|
|
|
|
|
|
|
def load_stories(self, from_pos, to_pos):
|
|
|
|
|
for idx, i in enumerate(self.topstories[from_pos:to_pos]):
|
|
|
|
|
#stdscr.clear()
|
|
|
|
|
self.set_footer(f'[{spinner_states[idx%4]}] Loading { to_pos - from_pos } stories...')
|
|
|
|
|
self.screen.refresh()
|
|
|
|
|
self.loadedstories.append(api.get_story(i))
|
|
|
|
@ -49,7 +48,7 @@ class Client:
|
|
|
|
|
self.stories_in_a_site = self.lines - 3
|
|
|
|
|
|
|
|
|
|
title_string = '[Y] Hacker News'
|
|
|
|
|
title_string +=' ' * ( self.cols - len(title_string) - 1) + '\n'
|
|
|
|
|
title_string +=' ' * (self.cols - len(title_string) - 1) + '\n'
|
|
|
|
|
|
|
|
|
|
self.screen.addstr(title_string, curses.color_pair(1))
|
|
|
|
|
|
|
|
|
@ -83,7 +82,7 @@ class Client:
|
|
|
|
|
|
|
|
|
|
page = int(self.story_pos / self.stories_in_a_site + 1)
|
|
|
|
|
total_pages = math.ceil(len(self.loadedstories)/self.stories_in_a_site)
|
|
|
|
|
self.set_footer(f'Page {page}/{total_pages}, loaded {len(self.loadedstories)} stories.')
|
|
|
|
|
self.set_footer(f'Page {page}/{total_pages}, loaded {len(self.loadedstories)} stories.')
|
|
|
|
|
|
|
|
|
|
def handle_input(self):
|
|
|
|
|
c = self.screen.getch()
|
|
|
|
|