mirror of
https://github.com/yusufipk/dikte.git
synced 2026-09-11 19:06:11 +00:00
Rebuild the settings window when the language changes
Saving already switched the language everywhere strings are made at the moment they are shown: the tray is rebuilt, the indicator and the message box translate as they speak. The settings window is the one place written once, at construction, so the window that took the new language was the one place still showing the old one, and a tooltip asked for a restart. Now the window remembers the language it was built in, and a save that changed it has the app replace the window: a fresh one comes up where the old one stood, on the same tab. The restart tooltip goes, having nothing left to excuse. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5
parent
569fe7cea8
commit
c7b14ff84e
@@ -903,6 +903,7 @@ class Dikte:
|
||||
if self.settings_window is None:
|
||||
self.settings_window = SettingsWindow(self.conf, self.meetings)
|
||||
self.settings_window.applied.connect(self._apply_settings)
|
||||
self.settings_window.language_changed.connect(self._reopen_settings)
|
||||
self.settings_window.finished.connect(self._settings_closed)
|
||||
self.settings_window.show()
|
||||
self.settings_window.raise_()
|
||||
@@ -912,6 +913,31 @@ class Dikte:
|
||||
# Don't drop the object while its own signal is still being delivered.
|
||||
QTimer.singleShot(0, lambda: setattr(self, "settings_window", None))
|
||||
|
||||
def _reopen_settings(self):
|
||||
"""Replace the settings window, so a language change reaches it too.
|
||||
|
||||
A save switches the language everywhere strings are made at the moment
|
||||
they are shown: the tray is rebuilt, the indicator and the message box
|
||||
translate as they speak. The settings window is the one place written
|
||||
once, at construction, so the window that took the new language is the
|
||||
one place still showing the old one. A fresh window comes up where the
|
||||
old one stood, on the same tab.
|
||||
"""
|
||||
old = self.settings_window
|
||||
if old is None:
|
||||
return
|
||||
tab = old.tabs.currentIndex()
|
||||
geometry = old.geometry()
|
||||
# Replaced rather than merely closed: left connected, _settings_closed
|
||||
# would drop the reference to the new window a moment after it is made.
|
||||
old.finished.disconnect(self._settings_closed)
|
||||
old.close()
|
||||
old.deleteLater()
|
||||
self.settings_window = None
|
||||
self.open_settings()
|
||||
self.settings_window.tabs.setCurrentIndex(tab)
|
||||
self.settings_window.setGeometry(geometry)
|
||||
|
||||
def _apply_local(self):
|
||||
"""Pass the local settings on, and hold the models ready if asked to.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user