diff --git a/controller.py b/controller.py index a01fc008..a528db3b 100644 --- a/controller.py +++ b/controller.py @@ -489,7 +489,11 @@ def callbackSetUseTranslationFeature(value): if config.USE_TRANSLATION_FEATURE is True: view.useTranslationFeatureProcess("Normal") if model.checkCTranslatorCTranslate2ModelWeight(): - model.changeTranslatorCTranslate2Model() + def callback(): + model.changeTranslatorCTranslate2Model() + th_callback = Thread(target=callback) + th_callback.daemon = True + th_callback.start() else: view.showRestartButtonIfRequired() view.useTranslationFeatureProcess("Restart") @@ -501,9 +505,13 @@ def callbackSetCtranslate2WeightType(value): config.WEIGHT_TYPE = str(value) view.updateSelectedCtranslate2WeightType(config.WEIGHT_TYPE) if model.checkCTranslatorCTranslate2ModelWeight(): - model.changeTranslatorCTranslate2Model() - view.showRestartButtonIfRequired() - view.useTranslationFeatureProcess("Normal") + def callback(): + model.changeTranslatorCTranslate2Model() + view.showRestartButtonIfRequired() + view.useTranslationFeatureProcess("Normal") + th_callback = Thread(target=callback) + th_callback.daemon = True + th_callback.start() else: view.showRestartButtonIfRequired() view.useTranslationFeatureProcess("Restart") diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py index 7bb233cb..d6853b35 100644 --- a/vrct_gui/_CreateDropdownMenuWindow.py +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -326,11 +326,18 @@ class _CreateDropdownMenuWindow(CTkToplevel): def _withdraw(self, e=None): self.withdraw() - if self.BIND_CONFIGURE_FUNC_ID in self.attach_widget.winfo_toplevel().bind(): + try: self.attach_widget.winfo_toplevel().unbind("", self.BIND_CONFIGURE_FUNC_ID) - self.attach_widget.unbind("", self.BIND_UNMAP_FUNC_ID) - if self.BIND_BUTTON_1_FUNC_ID in self.attach_widget.winfo_toplevel().bind(): + except Exception: + pass + try: + self.attach_widget.unbind("", self.BIND_UNMAP_FUNC_ID) + except Exception: + pass + try: self.attach_widget.winfo_toplevel().unbind("", self.BIND_BUTTON_1_FUNC_ID) + except Exception: + pass self.hide = True