add pagecount

master
Felix Pankratz 1 year ago
parent 41d3e07a3f
commit 0e590eefed

@ -9,6 +9,7 @@ import requests
from bs4 import BeautifulSoup as Soup from bs4 import BeautifulSoup as Soup
import curses import curses
import webbrowser import webbrowser
import math
import api import api
@ -43,6 +44,7 @@ class Client:
def set_footer(self, footer): def set_footer(self, footer):
self.screen.addstr(curses.LINES - 1, 0, footer, curses.A_REVERSE) self.screen.addstr(curses.LINES - 1, 0, footer, curses.A_REVERSE)
self.screen.clrtoeol()
def draw(self): def draw(self):
self.screen.clear() self.screen.clear()
@ -68,8 +70,6 @@ class Client:
link = story.link.replace('https://', '').replace('http://', '') link = story.link.replace('https://', '').replace('http://', '')
link = link[:max_url_len-1] + "" if len(link) > max_url_len else link link = link[:max_url_len-1] + "" if len(link) > max_url_len else link
#text = '{}{} ({})\n'.format(prefix, title, link)
self.screen.addstr(prefix) self.screen.addstr(prefix)
if i == self.cursor_pos: if i == self.cursor_pos:
self.screen.addstr(title, curses.A_UNDERLINE) self.screen.addstr(title, curses.A_UNDERLINE)
@ -79,7 +79,10 @@ class Client:
else: else:
self.screen.addstr(title) self.screen.addstr(title)
self.screen.addstr(f' ({link})\n', curses.A_DIM ) self.screen.addstr(f' ({link})\n', curses.A_DIM )
self.set_footer(f'Loaded {len(self.loadedstories)} stories.')
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.')
def handle_input(self): def handle_input(self):
c = self.screen.getch() c = self.screen.getch()

Loading…
Cancel
Save