🐛[bugfix] Controller : リスタートボタンの表示タイミングを修正

This commit is contained in:
misyaguziya
2024-01-22 01:45:18 +09:00
parent 59079def6a
commit 6ed71f1a4a
2 changed files with 5 additions and 10 deletions

View File

@@ -489,40 +489,36 @@ def callbackSetUseTranslationFeature(value):
if config.USE_TRANSLATION_FEATURE is True: if config.USE_TRANSLATION_FEATURE is True:
view.useTranslationFeatureProcess("Normal") view.useTranslationFeatureProcess("Normal")
if model.checkCTranslatorCTranslate2ModelWeight(): if model.checkCTranslatorCTranslate2ModelWeight():
config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False
def callback(): def callback():
config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False
view.showRestartButtonIfRequired()
model.changeTranslatorCTranslate2Model() model.changeTranslatorCTranslate2Model()
th_callback = Thread(target=callback) th_callback = Thread(target=callback)
th_callback.daemon = True th_callback.daemon = True
th_callback.start() th_callback.start()
else: else:
config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = True config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = True
view.showRestartButtonIfRequired()
view.useTranslationFeatureProcess("Restart") view.useTranslationFeatureProcess("Restart")
else: else:
config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False
view.showRestartButtonIfRequired()
view.useTranslationFeatureProcess("Disable") view.useTranslationFeatureProcess("Disable")
view.showRestartButtonIfRequired()
def callbackSetCtranslate2WeightType(value): def callbackSetCtranslate2WeightType(value):
print("callbackSetCtranslate2WeightType", value) print("callbackSetCtranslate2WeightType", value)
config.WEIGHT_TYPE = str(value) config.WEIGHT_TYPE = str(value)
view.updateSelectedCtranslate2WeightType(config.WEIGHT_TYPE) view.updateSelectedCtranslate2WeightType(config.WEIGHT_TYPE)
if model.checkCTranslatorCTranslate2ModelWeight(): if model.checkCTranslatorCTranslate2ModelWeight():
config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False
def callback(): def callback():
config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False
view.showRestartButtonIfRequired()
model.changeTranslatorCTranslate2Model() model.changeTranslatorCTranslate2Model()
view.showRestartButtonIfRequired()
view.useTranslationFeatureProcess("Normal") view.useTranslationFeatureProcess("Normal")
th_callback = Thread(target=callback) th_callback = Thread(target=callback)
th_callback.daemon = True th_callback.daemon = True
th_callback.start() th_callback.start()
else: else:
config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = True config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = True
view.showRestartButtonIfRequired()
view.useTranslationFeatureProcess("Restart") view.useTranslationFeatureProcess("Restart")
view.showRestartButtonIfRequired()
def callbackSetDeeplAuthkey(value): def callbackSetDeeplAuthkey(value):
print("callbackSetDeeplAuthkey", str(value)) print("callbackSetDeeplAuthkey", str(value))

View File

@@ -1013,8 +1013,7 @@ class View():
def _showRestartButton(self, locale:Union[None,str]=None): 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)) 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.restart_button_container.grid()
vrct_gui.config_window.after(100, vrct_gui.config_window.restart_button_container.grid)
def _hideRestartButton(self): def _hideRestartButton(self):
vrct_gui.config_window.restart_button_container.grid_remove() vrct_gui.config_window.restart_button_container.grid_remove()