[Update] 設定画面にて「翻訳機能を使用する」をオフにした時に、メイン画面の翻訳機能をDisabledとしてさわれないようにする処理追加。(その逆も)
This commit is contained in:
@@ -489,8 +489,10 @@ def callbackSetUseTranslationFeature(value):
|
|||||||
if config.USE_TRANSLATION_FEATURE is True:
|
if config.USE_TRANSLATION_FEATURE is True:
|
||||||
view.setLatestCTranslate2WeightType()
|
view.setLatestCTranslate2WeightType()
|
||||||
view.openCtranslate2WeightTypeWidget()
|
view.openCtranslate2WeightTypeWidget()
|
||||||
|
view.setTranslationSwitchStatus("normal", release_locked_state=True)
|
||||||
else:
|
else:
|
||||||
view.closeCtranslate2WeightTypeWidget()
|
view.closeCtranslate2WeightTypeWidget()
|
||||||
|
view.setTranslationSwitchStatus("disabled", to_lock_state=True)
|
||||||
|
|
||||||
def callbackSetCtranslate2WeightType(value):
|
def callbackSetCtranslate2WeightType(value):
|
||||||
print("callbackSetCtranslate2WeightType", value)
|
print("callbackSetCtranslate2WeightType", value)
|
||||||
|
|||||||
6
view.py
6
view.py
@@ -652,6 +652,7 @@ class View():
|
|||||||
if config.USE_TRANSLATION_FEATURE is True:
|
if config.USE_TRANSLATION_FEATURE is True:
|
||||||
self.openCtranslate2WeightTypeWidget()
|
self.openCtranslate2WeightTypeWidget()
|
||||||
else:
|
else:
|
||||||
|
self.setTranslationSwitchStatus("disabled", to_lock_state=True)
|
||||||
self.closeCtranslate2WeightTypeWidget()
|
self.closeCtranslate2WeightTypeWidget()
|
||||||
|
|
||||||
if config.CHOICE_MIC_HOST == "NoHost":
|
if config.CHOICE_MIC_HOST == "NoHost":
|
||||||
@@ -916,6 +917,9 @@ class View():
|
|||||||
def setMainWindowAllWidgetsStatusToDisabled():
|
def setMainWindowAllWidgetsStatusToDisabled():
|
||||||
vrct_gui._changeMainWindowWidgetsStatus("disabled", "All")
|
vrct_gui._changeMainWindowWidgetsStatus("disabled", "All")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def setTranslationSwitchStatus(status:str, to_lock_state:bool=False, release_locked_state:bool=False):
|
||||||
|
vrct_gui._changeMainWindowWidgetsStatus(status, ["translation_switch"], to_lock_state, release_locked_state)
|
||||||
|
|
||||||
def enableMainWindowSidebarCompactMode(self):
|
def enableMainWindowSidebarCompactMode(self):
|
||||||
self.view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE = True
|
self.view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE = True
|
||||||
@@ -1263,7 +1267,7 @@ class View():
|
|||||||
# vrct_gui.translation_frame.markToggleManually(False)
|
# vrct_gui.translation_frame.markToggleManually(False)
|
||||||
|
|
||||||
# # disable translation feature.
|
# # disable translation feature.
|
||||||
# vrct_gui._changeMainWindowWidgetsStatus("disabled", ["translation_switch"], to_hold_state=True)
|
# vrct_gui._changeMainWindowWidgetsStatus("disabled", ["translation_switch"], to_lock_state=True)
|
||||||
|
|
||||||
# # print system message that mention to stopped translation feature.
|
# # print system message that mention to stopped translation feature.
|
||||||
# view.printToTextbox_TranslationEngineLimitError()
|
# view.printToTextbox_TranslationEngineLimitError()
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
from customtkinter import CTkImage
|
from customtkinter import CTkImage
|
||||||
hold_state_list=[]
|
lock_state_list=[]
|
||||||
def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, target_names:list, to_hold_state:bool=False):
|
def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, target_names:list, to_lock_state:bool=False, release_locked_state:bool=False):
|
||||||
global hold_state_list
|
global lock_state_list
|
||||||
if target_names == "All":
|
if target_names == "All":
|
||||||
target_names = ["translation_switch", "transcription_send_switch", "transcription_receive_switch", "foreground_switch", "quick_language_settings", "config_button", "minimize_sidebar_button", "entry_message_box", "send_message_button"]
|
target_names = ["translation_switch", "transcription_send_switch", "transcription_receive_switch", "foreground_switch", "quick_language_settings", "config_button", "minimize_sidebar_button", "entry_message_box", "send_message_button"]
|
||||||
|
|
||||||
|
if release_locked_state is True:
|
||||||
|
for item in target_names:
|
||||||
|
if item in lock_state_list:
|
||||||
|
lock_state_list.remove(item)
|
||||||
|
|
||||||
for item in hold_state_list:
|
for item in lock_state_list:
|
||||||
if item in target_names:
|
if item in target_names:
|
||||||
target_names.remove(item)
|
target_names.remove(item)
|
||||||
|
|
||||||
@@ -158,9 +162,9 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta
|
|||||||
raise ValueError(f"No matching case for target_name: {target_name}")
|
raise ValueError(f"No matching case for target_name: {target_name}")
|
||||||
|
|
||||||
|
|
||||||
if to_hold_state is True:
|
if to_lock_state is True:
|
||||||
for item in target_names:
|
for item in target_names:
|
||||||
if item not in hold_state_list:
|
if item not in lock_state_list:
|
||||||
hold_state_list.append(item)
|
lock_state_list.append(item)
|
||||||
|
|
||||||
vrct_gui.update()
|
vrct_gui.update()
|
||||||
@@ -250,14 +250,15 @@ class VRCT_GUI(CTk):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _changeMainWindowWidgetsStatus(self, status, target_names, to_hold_state:bool=False):
|
def _changeMainWindowWidgetsStatus(self, status, target_names, to_lock_state:bool=False, release_locked_state:bool=False):
|
||||||
_changeMainWindowWidgetsStatus(
|
_changeMainWindowWidgetsStatus(
|
||||||
vrct_gui=self,
|
vrct_gui=self,
|
||||||
settings=self.settings.main,
|
settings=self.settings.main,
|
||||||
view_variable=self._view_variable,
|
view_variable=self._view_variable,
|
||||||
status=status,
|
status=status,
|
||||||
target_names=target_names,
|
target_names=target_names,
|
||||||
to_hold_state=to_hold_state,
|
to_lock_state=to_lock_state,
|
||||||
|
release_locked_state=release_locked_state,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _changeConfigWindowWidgetsStatus(self, status, target_names):
|
def _changeConfigWindowWidgetsStatus(self, status, target_names):
|
||||||
|
|||||||
Reference in New Issue
Block a user