diff --git a/controller.py b/controller.py index cf3aa39e..d8f9efac 100644 --- a/controller.py +++ b/controller.py @@ -489,40 +489,36 @@ def callbackSetUseTranslationFeature(value): if config.USE_TRANSLATION_FEATURE is True: view.useTranslationFeatureProcess("Normal") if model.checkCTranslatorCTranslate2ModelWeight(): + config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False def callback(): - config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False - view.showRestartButtonIfRequired() model.changeTranslatorCTranslate2Model() th_callback = Thread(target=callback) th_callback.daemon = True th_callback.start() else: config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = True - view.showRestartButtonIfRequired() view.useTranslationFeatureProcess("Restart") else: config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False - view.showRestartButtonIfRequired() view.useTranslationFeatureProcess("Disable") + view.showRestartButtonIfRequired() def callbackSetCtranslate2WeightType(value): print("callbackSetCtranslate2WeightType", value) config.WEIGHT_TYPE = str(value) view.updateSelectedCtranslate2WeightType(config.WEIGHT_TYPE) if model.checkCTranslatorCTranslate2ModelWeight(): + config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False def callback(): - config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False - view.showRestartButtonIfRequired() model.changeTranslatorCTranslate2Model() - view.showRestartButtonIfRequired() view.useTranslationFeatureProcess("Normal") th_callback = Thread(target=callback) th_callback.daemon = True th_callback.start() else: config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = True - view.showRestartButtonIfRequired() view.useTranslationFeatureProcess("Restart") + view.showRestartButtonIfRequired() def callbackSetDeeplAuthkey(value): print("callbackSetDeeplAuthkey", str(value)) diff --git a/view.py b/view.py index 093d5e60..20b9678e 100644 --- a/view.py +++ b/view.py @@ -1013,8 +1013,7 @@ class View(): def _showRestartButton(self, locale:Union[None,str]=None): self.view_variable.VAR_CONFIG_WINDOW_RESTART_BUTTON_LABEL.set(i18n.t("config_window.restart_message", locale=locale)) - # This .after() func is for fixing bug that it can't be shown the label widget after changing the weight type. - vrct_gui.config_window.after(100, vrct_gui.config_window.restart_button_container.grid) + vrct_gui.config_window.restart_button_container.grid() def _hideRestartButton(self): vrct_gui.config_window.restart_button_container.grid_remove()