diff --git a/API.py b/API.py index 74cdb7f..ec6ea50 100644 --- a/API.py +++ b/API.py @@ -31,3 +31,8 @@ class Fetcher: def articlesFromFeed(self, feed, category): return [article for article in self.articles[category] if article["origin"]["streamId"] == feed] + + def fetch(self): + for category in self.categories: + yield "Fetching category " + category["name"] + self.articlesFromCategory(category["name"], str(self.unreadCounts[category["id"]][0])) diff --git a/App.py b/App.py index f73aa1d..d95b193 100644 --- a/App.py +++ b/App.py @@ -197,7 +197,6 @@ class TUI(urwid.Frame): self.activePane = False self.executor = ThreadPoolExecutor(max_workers=1) self.loop = None - self.articleItems = [urwid.Text("Article# " + str(i)) for i in range(0, 10)] self.feedView = LeftPane(self.fetcher.categories) self.articleView = RightPane([]) self.leftBox = urwid.LineBox(self.feedView, title="Categories") @@ -225,6 +224,18 @@ class TUI(urwid.Frame): self.container.set_focus(int(self.activePane)) elif key == "q": raise urwid.ExitMainLoop() + elif key == "f": + self.olb = urwid.ListBox(urwid.SimpleListWalker([urwid.Text("TEST")])) + overlay = urwid.Overlay( + urwid.LineBox(self.olb), + self.body, align="center", width=("relative", 50), valign="middle", height=3) + self.body = overlay + elif key == "F": + articles = tui.fetcher.fetch() + # for text in articles: + # print(text) + # self.olb.body = urwid.SimpleListWalker([urwid.Text(text)]) + # self.body = overlay.bottom_w tui = TUI.create()