From c195083fe8a88180b82b19df84bb01749f562206 Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Fri, 11 Nov 2022 15:27:25 +0500 Subject: [PATCH] Moved item list fetch to startup instead of first search --- tui.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tui.py b/tui.py index 41f27c7..d2c7e46 100644 --- a/tui.py +++ b/tui.py @@ -43,6 +43,7 @@ class App(): self.root = root self.gui = GUI(self.root, *self.root.getmaxyx(), 0, 0) self.client = Session() + self.item_list = self.client.api_request(url = '/items').get('payload').get('items') def show_gui(self): self.root.clear() @@ -50,10 +51,6 @@ class App(): def update_item_search_results(self): search_str = self.gui.search_in.gather() - try: - self.item_list - except: - self.item_list = self.client.api_request(url = '/items').get('payload').get('items') items = [item for item in self.item_list if search_str.strip().lower() in item.get('item_name').lower()][:self.gui.results_box.getmaxyx()[0] - 2] self.gui.results_box.clear() self.gui.results_box.border()