From aa6aa9c5338508421f992161cbb3e503d2065aeb Mon Sep 17 00:00:00 2001 From: Isaac Holston Date: Mon, 27 Nov 2023 09:00:30 -0500 Subject: [PATCH] feat: make log tab auto refresh --- lolbot/common/config.py | 2 +- lolbot/view/main_window.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lolbot/common/config.py b/lolbot/common/config.py index ae4447d..c2c62be 100644 --- a/lolbot/common/config.py +++ b/lolbot/common/config.py @@ -21,7 +21,7 @@ class Constants: ICON_PATH = 'lolbot/resources/images/a.ico' # Other - VERSION = '2.1.1' + VERSION = '2.1.2' @staticmethod def create_dirs(): diff --git a/lolbot/view/main_window.py b/lolbot/view/main_window.py index afbecad..6c6eddc 100644 --- a/lolbot/view/main_window.py +++ b/lolbot/view/main_window.py @@ -54,7 +54,7 @@ def show(self) -> None: dpg.add_theme_color(dpg.mvThemeCol_ButtonActive, [0, 0, 0, 0]) dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, [29, 151, 236, 25]) dpg.add_theme_color(dpg.mvThemeCol_Text, [29, 151, 236]) - with dpg.tab_bar() as self.tab_bar: + with dpg.tab_bar(callback=self._tab_selected) as self.tab_bar: self.bot_tab.create_tab(self.tab_bar) self.accounts_tab.create_tab(self.tab_bar) self.config_tab.create_tab(self.tab_bar) @@ -72,6 +72,11 @@ def show(self) -> None: self.terminate.set() dpg.destroy_context() + def _tab_selected(self, sender, app_data, user_data) -> None: + """Callback for tab select""" + if app_data == self.logs_tab.id: + self.logs_tab.create_log_table() + def _gui_updater(self) -> None: """Updates view each frame, displays up-to-date bot info""" if not self.message_queue.empty():