[WIP/TEST] Controller : モデルのロード処理をスレッドに変更
・モデルの切り替え時や翻訳機能有効時にリスタートボタンの表示タイミングが微妙な為改修の必要あり
This commit is contained in:
@@ -489,7 +489,11 @@ 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():
|
||||||
model.changeTranslatorCTranslate2Model()
|
def callback():
|
||||||
|
model.changeTranslatorCTranslate2Model()
|
||||||
|
th_callback = Thread(target=callback)
|
||||||
|
th_callback.daemon = True
|
||||||
|
th_callback.start()
|
||||||
else:
|
else:
|
||||||
view.showRestartButtonIfRequired()
|
view.showRestartButtonIfRequired()
|
||||||
view.useTranslationFeatureProcess("Restart")
|
view.useTranslationFeatureProcess("Restart")
|
||||||
@@ -501,9 +505,13 @@ def 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():
|
||||||
model.changeTranslatorCTranslate2Model()
|
def callback():
|
||||||
view.showRestartButtonIfRequired()
|
model.changeTranslatorCTranslate2Model()
|
||||||
view.useTranslationFeatureProcess("Normal")
|
view.showRestartButtonIfRequired()
|
||||||
|
view.useTranslationFeatureProcess("Normal")
|
||||||
|
th_callback = Thread(target=callback)
|
||||||
|
th_callback.daemon = True
|
||||||
|
th_callback.start()
|
||||||
else:
|
else:
|
||||||
view.showRestartButtonIfRequired()
|
view.showRestartButtonIfRequired()
|
||||||
view.useTranslationFeatureProcess("Restart")
|
view.useTranslationFeatureProcess("Restart")
|
||||||
|
|||||||
@@ -326,11 +326,18 @@ class _CreateDropdownMenuWindow(CTkToplevel):
|
|||||||
|
|
||||||
def _withdraw(self, e=None):
|
def _withdraw(self, e=None):
|
||||||
self.withdraw()
|
self.withdraw()
|
||||||
if self.BIND_CONFIGURE_FUNC_ID in self.attach_widget.winfo_toplevel().bind():
|
try:
|
||||||
self.attach_widget.winfo_toplevel().unbind("<Configure>", self.BIND_CONFIGURE_FUNC_ID)
|
self.attach_widget.winfo_toplevel().unbind("<Configure>", self.BIND_CONFIGURE_FUNC_ID)
|
||||||
self.attach_widget.unbind("<Unmap>", self.BIND_UNMAP_FUNC_ID)
|
except Exception:
|
||||||
if self.BIND_BUTTON_1_FUNC_ID in self.attach_widget.winfo_toplevel().bind():
|
pass
|
||||||
|
try:
|
||||||
|
self.attach_widget.unbind("<Unmap>", self.BIND_UNMAP_FUNC_ID)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
self.attach_widget.winfo_toplevel().unbind("<Button-1>", self.BIND_BUTTON_1_FUNC_ID)
|
self.attach_widget.winfo_toplevel().unbind("<Button-1>", self.BIND_BUTTON_1_FUNC_ID)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
self.hide = True
|
self.hide = True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user