diff --git a/controller.py b/controller.py index b7ed3c2a..90ebf0ac 100644 --- a/controller.py +++ b/controller.py @@ -487,12 +487,9 @@ def callbackSetUseTranslationFeature(value): print("callbackSetUseTranslationFeature", value) config.USE_TRANSLATION_FEATURE = value if config.USE_TRANSLATION_FEATURE is True: - view.setLatestCTranslate2WeightType() - view.openCtranslate2WeightTypeWidget() - view.setTranslationSwitchStatus("normal", release_locked_state=True) + view.useTranslationFeatureProcess("Normal") else: - view.closeCtranslate2WeightTypeWidget() - view.setTranslationSwitchStatus("disabled", to_lock_state=True) + view.useTranslationFeatureProcess("Disable") def callbackSetCtranslate2WeightType(value): print("callbackSetCtranslate2WeightType", value) diff --git a/view.py b/view.py index 8159120b..d2a5a47f 100644 --- a/view.py +++ b/view.py @@ -650,10 +650,9 @@ class View(): self.setMainWindowMessageBoxRatio(config.MESSAGE_BOX_RATIO) if config.USE_TRANSLATION_FEATURE is True: - self.openCtranslate2WeightTypeWidget() + self.useTranslationFeatureProcess("Normal") else: - self.setTranslationSwitchStatus("disabled", to_lock_state=True) - self.closeCtranslate2WeightTypeWidget() + self.useTranslationFeatureProcess("Disable") if config.CHOICE_MIC_HOST == "NoHost": self.view_variable.VAR_MIC_HOST.set("No Mic Host Detected") @@ -879,6 +878,17 @@ class View(): config._SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT["Large"]: i18n.t("config_window.ctranslate2_weight_type.large", capacity="1.2GB"), } + def useTranslationFeatureProcess(self, state:str): + if state == "Normal": + self.setLatestCTranslate2WeightType() + self.openCtranslate2WeightTypeWidget() + self.setTranslationSwitchStatus("normal", release_locked_state=True) + vrct_gui.sls__box_translation_optionmenu_wrapper.grid() + elif state == "Disable": + view.closeCtranslate2WeightTypeWidget() + view.setTranslationSwitchStatus("disabled", to_lock_state=True) + vrct_gui.sls__box_translation_optionmenu_wrapper.grid_remove() + # Open Webpage Functions def openWebPage_Booth(self): self.openWebPage(config.BOOTH_URL) diff --git a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py index f529898f..e85e084a 100644 --- a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py +++ b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py @@ -344,11 +344,11 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable): - sls__box_translation_optionmenu_wrapper = CTkFrame(main_window.sls__box_frame, corner_radius=0, fg_color=settings.ctm.SLS__BG_COLOR, width=0, height=0) - sls__box_translation_optionmenu_wrapper.grid(row=5, column=0, pady=settings.uism.SLS__SELECTABLE_TRANSLATION_PADY, sticky="ew") + main_window.sls__box_translation_optionmenu_wrapper = CTkFrame(main_window.sls__box_frame, corner_radius=0, fg_color=settings.ctm.SLS__BG_COLOR, width=0, height=0) + main_window.sls__box_translation_optionmenu_wrapper.grid(row=5, column=0, pady=settings.uism.SLS__SELECTABLE_TRANSLATION_PADY, sticky="ew") - sls__box_translation_optionmenu_wrapper.grid_columnconfigure((0,2), weight=0, minsize=settings.uism.SLS__SELECTABLE_TRANSLATION_MIN_PADX) - sls__box_translation_optionmenu_wrapper.grid_columnconfigure(1, weight=1) + main_window.sls__box_translation_optionmenu_wrapper.grid_columnconfigure((0,2), weight=0, minsize=settings.uism.SLS__SELECTABLE_TRANSLATION_MIN_PADX) + main_window.sls__box_translation_optionmenu_wrapper.grid_columnconfigure(1, weight=1) @@ -361,12 +361,12 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable): dropdown_menu_values=[], command=adjustedCommand, wrapper_widget=main_window, - attach_widget=sls__box_translation_optionmenu_wrapper, + attach_widget=main_window.sls__box_translation_optionmenu_wrapper, dropdown_menu_min_width=settings.uism.SIDEBAR_MIN_WIDTH, ) (sls__selected_translation_engine_box, label_button_label_widget) = createLabelButton( - parent_widget=sls__box_translation_optionmenu_wrapper, + parent_widget=main_window.sls__box_translation_optionmenu_wrapper, label_button_bg_color=settings.ctm.SLS__BG_COLOR, label_button_hovered_bg_color=settings.ctm.SLS__OPTIONMENU_HOVERED_BG_COLOR, label_button_clicked_bg_color=settings.ctm.SLS__OPTIONMENU_CLICKED_BG_COLOR,