From b62967710e6d630d4c59fc689a694f0342989b0b Mon Sep 17 00:00:00 2001 From: worldmozara Date: Sat, 31 Aug 2024 09:24:42 +0800 Subject: [PATCH] Add reload binding --- based_build/localization_helper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/based_build/localization_helper.py b/based_build/localization_helper.py index 6c926da8b8..8cf5715cc1 100644 --- a/based_build/localization_helper.py +++ b/based_build/localization_helper.py @@ -147,6 +147,7 @@ class HelperTUI(App[None]): ("q", "quit()", "Quit program"), ("d", "toggle_dark", "Toggle dark mode"), ("c", "popup_keydiff", "Compare message keys differences"), + ("r", "reload_tree", "Reload messages"), ] TITLE = "BasedPyright Localization Helper" @@ -173,7 +174,7 @@ async def action_popup_keydiff(self) -> None: await self.push_screen_wait(keydiff) _ = self.uninstall_screen(keydiff) # pyright: ignore[reportUnknownMemberType] - def on_tabs_tab_activated(self) -> None: + def action_reload_tree(self) -> None: tree = self.query_one(LocDataTree) if tree.temp_comp: tree.temp_comp.remove() @@ -181,6 +182,9 @@ def on_tabs_tab_activated(self) -> None: tabs = self.query_one(Tabs) tree.load_data(tabs.active_tab.label_text if tabs.active_tab else "en-us") + def on_tabs_tab_activated(self) -> None: + self.action_reload_tree() + if __name__ == "__main__": app = HelperTUI()