From f48581dcd8149e9966b51ffbd98f717c8689a440 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Fri, 19 Jan 2024 18:27:27 +0900 Subject: [PATCH] =?UTF-8?q?[WIP/TEST]=20Controller=20:=20=E3=83=A2?= =?UTF-8?q?=E3=83=87=E3=83=AB=E3=81=AE=E3=83=AD=E3=83=BC=E3=83=89=E5=87=A6?= =?UTF-8?q?=E7=90=86=E3=82=92=E3=82=B9=E3=83=AC=E3=83=83=E3=83=89=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・モデルの切り替え時や翻訳機能有効時にリスタートボタンの表示タイミングが微妙な為改修の必要あり --- controller.py | 16 ++++++++++++---- vrct_gui/_CreateDropdownMenuWindow.py | 13 ++++++++++--- 2 files changed, 22 insertions(+), 7 deletions(-) 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