Skip to content

Commit

Permalink
Add reload binding
Browse files Browse the repository at this point in the history
  • Loading branch information
NCBM authored and DetachHead committed Aug 31, 2024
1 parent 07806f8 commit b629677
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion based_build/localization_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -173,14 +174,17 @@ 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()
tree.temp_comp = 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()
Expand Down

0 comments on commit b629677

Please sign in to comment.