[WIP/TEST] Controller : CTranslate2のモデル変更時処理を実装
This commit is contained in:
@@ -491,8 +491,8 @@ def callbackSetUseTranslationFeature(value):
|
||||
if model.checkCTranslatorCTranslate2ModelWeight():
|
||||
model.changeTranslatorCTranslate2Model()
|
||||
else:
|
||||
view.useTranslationFeatureProcess("Disable")
|
||||
# CTranslate2 weight is not downloaded
|
||||
view.showRestartButtonIfRequired()
|
||||
view.useTranslationFeatureProcess("Restart")
|
||||
else:
|
||||
view.useTranslationFeatureProcess("Disable")
|
||||
|
||||
@@ -502,9 +502,11 @@ def callbackSetCtranslate2WeightType(value):
|
||||
view.updateSelectedCtranslate2WeightType(config.WEIGHT_TYPE)
|
||||
if model.checkCTranslatorCTranslate2ModelWeight():
|
||||
model.changeTranslatorCTranslate2Model()
|
||||
view.showRestartButtonIfRequired()
|
||||
view.useTranslationFeatureProcess("Normal")
|
||||
else:
|
||||
view.useTranslationFeatureProcess("Disable")
|
||||
# CTranslate2 weight is not downloaded
|
||||
view.showRestartButtonIfRequired()
|
||||
view.useTranslationFeatureProcess("Restart")
|
||||
|
||||
def callbackSetDeeplAuthkey(value):
|
||||
print("callbackSetDeeplAuthkey", str(value))
|
||||
|
||||
13
view.py
13
view.py
@@ -28,6 +28,8 @@ class View():
|
||||
ui_scaling=config.UI_SCALING,
|
||||
font_family=config.FONT_FAMILY,
|
||||
ui_language=config.UI_LANGUAGE,
|
||||
use_translation_feature=config.USE_TRANSLATION_FEATURE,
|
||||
ctranslate2_weight_type=config.WEIGHT_TYPE,
|
||||
)
|
||||
|
||||
if config.ENABLE_SPEAKER2CHATBOX is False:
|
||||
@@ -891,6 +893,13 @@ class View():
|
||||
vrct_gui.sls__box_translation_optionmenu_wrapper.grid_remove()
|
||||
vrct_gui.config_window.after(200, vrct_gui.config_window.lift)
|
||||
|
||||
elif state == "Restart":
|
||||
view.setLatestCTranslate2WeightType()
|
||||
view.setTranslationSwitchStatus("disabled", to_lock_state=True)
|
||||
vrct_gui.sls__box_translation_optionmenu_wrapper.grid()
|
||||
vrct_gui.config_window.after(200, vrct_gui.config_window.lift)
|
||||
|
||||
|
||||
# Open Webpage Functions
|
||||
def openWebPage_Booth(self):
|
||||
self.openWebPage(config.BOOTH_URL)
|
||||
@@ -984,7 +993,9 @@ class View():
|
||||
self.restart_required_configs_pre_data.appearance_theme == config.APPEARANCE_THEME and
|
||||
self.restart_required_configs_pre_data.ui_scaling == config.UI_SCALING and
|
||||
self.restart_required_configs_pre_data.font_family == config.FONT_FAMILY and
|
||||
self.restart_required_configs_pre_data.ui_language == config.UI_LANGUAGE
|
||||
self.restart_required_configs_pre_data.ui_language == config.UI_LANGUAGE and
|
||||
self.restart_required_configs_pre_data.use_translation_feature == config.USE_TRANSLATION_FEATURE and
|
||||
self.restart_required_configs_pre_data.ctranslate2_weight_type == config.WEIGHT_TYPE
|
||||
)
|
||||
|
||||
if locale is None:
|
||||
|
||||
@@ -326,9 +326,11 @@ class _CreateDropdownMenuWindow(CTkToplevel):
|
||||
|
||||
def _withdraw(self, e=None):
|
||||
self.withdraw()
|
||||
self.attach_widget.winfo_toplevel().unbind("<Configure>", self.BIND_CONFIGURE_FUNC_ID)
|
||||
if self.BIND_CONFIGURE_FUNC_ID in self.attach_widget.winfo_toplevel().bind():
|
||||
self.attach_widget.winfo_toplevel().unbind("<Configure>", self.BIND_CONFIGURE_FUNC_ID)
|
||||
self.attach_widget.unbind("<Unmap>", self.BIND_UNMAP_FUNC_ID)
|
||||
self.attach_widget.winfo_toplevel().unbind("<Button-1>", self.BIND_BUTTON_1_FUNC_ID)
|
||||
if self.BIND_BUTTON_1_FUNC_ID in self.attach_widget.winfo_toplevel().bind():
|
||||
self.attach_widget.winfo_toplevel().unbind("<Button-1>", self.BIND_BUTTON_1_FUNC_ID)
|
||||
self.hide = True
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user