diff --git a/app/tui_app.py b/app/tui_app.py index 5a06b60..3ead6ad 100644 --- a/app/tui_app.py +++ b/app/tui_app.py @@ -147,13 +147,25 @@ class DownloadManagerApp(App[None]): self._format_selection_line("video", self.selected_video) ) - self.query_one("#select-parts-btn", Button).label = t( - "button.select_parts", default="Select parts" - ) - self.query_one("#start-download-btn", Button).label = t( - "button.start_download", default="Start download" - ) - self.query_one("#exit-btn", Button).label = t("button.exit", default="Exit") + select_parts_btn = self.query_one("#select-parts-btn", Button) + select_parts_btn.label = t("button.select_parts", default="Select parts") + select_parts_btn.refresh(layout=True) + + start_download_btn = self.query_one("#start-download-btn", Button) + start_download_btn.label = t("button.start_download", default="Start download") + start_download_btn.refresh(layout=True) + + exit_btn = self.query_one("#exit-btn", Button) + exit_btn.label = t("button.exit", default="Exit") + exit_btn.refresh(layout=True) + + # Buttons auto-size to their label, but changing `.label` alone + # doesn't retrigger that sizing — without this, a button keeps its + # old (English) width after switching to a language with longer or + # shorter text. Refreshing the row (and the screen) forces the + # whole layout to recompute around the new label widths. + self.query_one("#button-row").refresh(layout=True) + self.screen.refresh(layout=True) # Only clobber the progress text with "Idle" while nothing is # running; an in-progress download keeps updating it anyway.