Config Window: Transcription Tab Thresholdチェック(Mic, Speaker)のCallback関数をmain.pyから呼べるように。
各設定項目がちゃんとmain.pyで呼ばれているか確認するためにprint文追加。おかげで指定し忘れなどが分かったのでその修正。 起動時OSCチェック処理のコメントアウト戻すのを忘れていたのを修正(開発上しいながよくやる)
This commit is contained in:
76
main.py
76
main.py
@@ -224,30 +224,31 @@ def callbackDisableConfigWindowCompactMode():
|
||||
|
||||
# Appearance Tab
|
||||
def callbackSetTransparency(value):
|
||||
print(int(value))
|
||||
# self.parent.wm_attributes("-alpha", int(value/100))
|
||||
print("callbackSetTransparency", int(value))
|
||||
config.TRANSPARENCY = int(value)
|
||||
# self.parent.wm_attributes("-alpha", int(value/100))
|
||||
|
||||
def callbackSetAppearance(value):
|
||||
print(value)
|
||||
print("callbackSetAppearance", value)
|
||||
config.APPEARANCE_THEME = value
|
||||
|
||||
def callbackSetUiScaling(value):
|
||||
print(value)
|
||||
print("callbackSetUiScaling", value)
|
||||
config.UI_SCALING = value
|
||||
new_scaling_float = int(value.replace("%", "")) / 100
|
||||
print("callbackSetUiScaling_new_scaling_float", new_scaling_float)
|
||||
|
||||
def callbackSetFontFamily(value):
|
||||
print(value)
|
||||
print("callbackSetFontFamily", value)
|
||||
config.FONT_FAMILY = value
|
||||
|
||||
def callbackSetUiLanguage(value):
|
||||
print(value)
|
||||
print("callbackSetUiLanguage", value)
|
||||
config.UI_LANGUAGE = value
|
||||
|
||||
# Translation Tab
|
||||
def callbackSetDeeplAuthkey(value):
|
||||
print(str(value))
|
||||
print("callbackSetDeeplAuthkey", str(value))
|
||||
# config.AUTH_KEYS["DeepL(auth)"] = str(value)
|
||||
# if len(value) > 0:
|
||||
# if model.authenticationTranslator(choice_translator="DeepL(auth)", auth_key=value) is True:
|
||||
@@ -258,38 +259,48 @@ def callbackSetDeeplAuthkey(value):
|
||||
|
||||
# Transcription Tab (Mic)
|
||||
def callbackSetMicHost(value):
|
||||
print(value)
|
||||
print("callbackSetMicHost", value)
|
||||
config.CHOICE_MIC_HOST = value
|
||||
|
||||
def callbackSetMicDevice(value):
|
||||
print(value)
|
||||
print("callbackSetMicDevice", value)
|
||||
config.CHOICE_MIC_DEVICE = value
|
||||
|
||||
def callbackSetMicEnergyThreshold(value):
|
||||
print(int(value))
|
||||
print("callbackSetMicEnergyThreshold", int(value))
|
||||
config.INPUT_MIC_ENERGY_THRESHOLD = int(value)
|
||||
|
||||
def callbackSetMicDynamicEnergyThreshold(value):
|
||||
print(value)
|
||||
print("callbackSetMicDynamicEnergyThreshold", value)
|
||||
config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD = value
|
||||
|
||||
def callbackCheckMicThreshold(is_turned_on):
|
||||
print("callbackCheckMicThreshold", is_turned_on)
|
||||
if is_turned_on is True:
|
||||
# UIの処理あり
|
||||
pass
|
||||
else:
|
||||
# UIの処理あり
|
||||
pass
|
||||
|
||||
def callbackSetMicRecordTimeout(value):
|
||||
print(int(value))
|
||||
print("callbackSetMicRecordTimeout", int(value))
|
||||
config.INPUT_MIC_RECORD_TIMEOUT = int(value)
|
||||
|
||||
def callbackSetMicPhraseTimeout(value):
|
||||
print(int(value))
|
||||
print("callbackSetMicPhraseTimeout", int(value))
|
||||
config.INPUT_MIC_PHRASE_TIMEOUT = int(value)
|
||||
|
||||
def callbackSetMicMaxPhrases(value):
|
||||
print(int(value))
|
||||
print("callbackSetMicMaxPhrases", int(value))
|
||||
config.INPUT_MIC_MAX_PHRASES = int(value)
|
||||
|
||||
def callbackSetMicWordFilter(value):
|
||||
print("callbackSetMicWordFilter", value)
|
||||
word_filter = str(value)
|
||||
word_filter = [w.strip() for w in word_filter.split(",") if len(w.strip()) > 0]
|
||||
word_filter = ",".join(word_filter)
|
||||
print(word_filter)
|
||||
print("callbackSetMicWordFilter_afterSplitting", word_filter)
|
||||
if len(word_filter) > 0:
|
||||
config.INPUT_MIC_WORD_FILTER = word_filter.split(",")
|
||||
else:
|
||||
@@ -299,52 +310,61 @@ def callbackSetMicWordFilter(value):
|
||||
|
||||
# Transcription Tab (Speaker)
|
||||
def callbackSetSpeakerDevice(value):
|
||||
print(value)
|
||||
print("callbackSetSpeakerDevice", value)
|
||||
config.CHOICE_SPEAKER_DEVICE = value
|
||||
|
||||
def callbackSetSpeakerEnergyThreshold(value):
|
||||
print(int(value))
|
||||
print("callbackSetSpeakerEnergyThreshold", int(value))
|
||||
config.INPUT_SPEAKER_ENERGY_THRESHOLD = int(value)
|
||||
|
||||
def callbackSetSpeakerDynamicEnergyThreshold(value):
|
||||
print(value)
|
||||
print("callbackSetSpeakerDynamicEnergyThreshold", value)
|
||||
config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = value
|
||||
|
||||
def callbackCheckSpeakerThreshold(is_turned_on):
|
||||
print("callbackCheckSpeakerThreshold", is_turned_on)
|
||||
if is_turned_on is True:
|
||||
# UIの処理あり
|
||||
pass
|
||||
else:
|
||||
# UIの処理あり
|
||||
pass
|
||||
|
||||
def callbackSetSpeakerRecordTimeout(value):
|
||||
print(int(value))
|
||||
print("callbackSetSpeakerRecordTimeout", int(value))
|
||||
config.INPUT_SPEAKER_RECORD_TIMEOUT = int(value)
|
||||
|
||||
def callbackSetSpeakerPhraseTimeout(value):
|
||||
print(int(value))
|
||||
print("callbackSetSpeakerPhraseTimeout", int(value))
|
||||
config.INPUT_SPEAKER_PHRASE_TIMEOUT = int(value)
|
||||
|
||||
def callbackSetSpeakerMaxPhrases(value):
|
||||
print(int(value))
|
||||
print("callbackSetSpeakerMaxPhrases", int(value))
|
||||
config.INPUT_SPEAKER_MAX_PHRASES = int(value)
|
||||
|
||||
|
||||
# Others Tab
|
||||
def callbackSetEnableAutoClearChatbox(value):
|
||||
print(value)
|
||||
print("callbackSetEnableAutoClearChatbox", value)
|
||||
config.ENABLE_AUTO_CLEAR_CHATBOX = value
|
||||
|
||||
def callbackSetEnableNoticeXsoverlay(value):
|
||||
print(value)
|
||||
print("callbackSetEnableNoticeXsoverlay", value)
|
||||
config.ENABLE_NOTICE_XSOVERLAY = value
|
||||
|
||||
def callbackSetMessageFormat(value):
|
||||
print(value)
|
||||
print("callbackSetMessageFormat", value)
|
||||
if len(value) > 0:
|
||||
config.MESSAGE_FORMAT = value
|
||||
|
||||
|
||||
# Advanced Settings Tab
|
||||
def callbackSetOscIpAddress(value):
|
||||
print(value)
|
||||
print("callbackSetOscIpAddress", value)
|
||||
config.OSC_IP_ADDRESS = value
|
||||
|
||||
def callbackSetOscPort(value):
|
||||
print(int(value))
|
||||
print("callbackSetOscPort", int(value))
|
||||
config.OSC_PORT = int(value)
|
||||
|
||||
|
||||
@@ -361,7 +381,7 @@ if model.authenticationTranslator() is False:
|
||||
model.addKeywords()
|
||||
|
||||
# check OSC started
|
||||
# model.checkOSCStarted()
|
||||
model.checkOSCStarted()
|
||||
|
||||
# check Software Updated
|
||||
model.checkSoftwareUpdated()
|
||||
@@ -410,6 +430,7 @@ view.register(
|
||||
"callback_set_mic_device": callbackSetMicDevice,
|
||||
"callback_set_mic_energy_threshold": callbackSetMicEnergyThreshold,
|
||||
"callback_set_mic_dynamic_energy_threshold": callbackSetMicDynamicEnergyThreshold,
|
||||
"callback_check_mic_threshold": callbackCheckMicThreshold,
|
||||
"callback_set_mic_record_timeout": callbackSetMicRecordTimeout,
|
||||
"callback_set_mic_phrase_timeout": callbackSetMicPhraseTimeout,
|
||||
"callback_set_mic_max_phrases": callbackSetMicMaxPhrases,
|
||||
@@ -419,6 +440,7 @@ view.register(
|
||||
"callback_set_speaker_device": callbackSetSpeakerDevice,
|
||||
"callback_set_speaker_energy_threshold": callbackSetSpeakerEnergyThreshold,
|
||||
"callback_set_speaker_dynamic_energy_threshold": callbackSetSpeakerDynamicEnergyThreshold,
|
||||
"callback_check_speaker_threshold": callbackCheckSpeakerThreshold,
|
||||
"callback_set_speaker_record_timeout": callbackSetSpeakerRecordTimeout,
|
||||
"callback_set_speaker_phrase_timeout": callbackSetSpeakerPhraseTimeout,
|
||||
"callback_set_speaker_max_phrases": callbackSetSpeakerMaxPhrases,
|
||||
|
||||
2
view.py
2
view.py
@@ -86,6 +86,7 @@ class View():
|
||||
vrct_gui.config_window.CALLBACK_SET_MIC_DEVICE = config_window["callback_set_mic_device"]
|
||||
vrct_gui.config_window.CALLBACK_SET_MIC_ENERGY_THRESHOLD = config_window["callback_set_mic_energy_threshold"]
|
||||
vrct_gui.config_window.CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD = config_window["callback_set_mic_dynamic_energy_threshold"]
|
||||
vrct_gui.config_window.CALLBACK_CHECK_MIC_THRESHOLD = config_window["callback_check_mic_threshold"]
|
||||
vrct_gui.config_window.CALLBACK_SET_MIC_RECORD_TIMEOUT = config_window["callback_set_mic_record_timeout"]
|
||||
vrct_gui.config_window.CALLBACK_SET_MIC_PHRASE_TIMEOUT = config_window["callback_set_mic_phrase_timeout"]
|
||||
vrct_gui.config_window.CALLBACK_SET_MIC_MAX_PHRASES = config_window["callback_set_mic_max_phrases"]
|
||||
@@ -95,6 +96,7 @@ class View():
|
||||
vrct_gui.config_window.CALLBACK_SET_SPEAKER_DEVICE = config_window["callback_set_speaker_device"]
|
||||
vrct_gui.config_window.CALLBACK_SET_SPEAKER_ENERGY_THRESHOLD = config_window["callback_set_speaker_energy_threshold"]
|
||||
vrct_gui.config_window.CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = config_window["callback_set_speaker_dynamic_energy_threshold"]
|
||||
vrct_gui.config_window.CALLBACK_CHECK_SPEAKER_THRESHOLD = config_window["callback_check_speaker_threshold"]
|
||||
vrct_gui.config_window.CALLBACK_SET_SPEAKER_RECORD_TIMEOUT = config_window["callback_set_speaker_record_timeout"]
|
||||
vrct_gui.config_window.CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT = config_window["callback_set_speaker_phrase_timeout"]
|
||||
vrct_gui.config_window.CALLBACK_SET_SPEAKER_MAX_PHRASES = config_window["callback_set_speaker_max_phrases"]
|
||||
|
||||
@@ -35,6 +35,7 @@ class ConfigWindow(CTkToplevel):
|
||||
self.CALLBACK_SET_MIC_DEVICE = None
|
||||
self.CALLBACK_SET_MIC_ENERGY_THRESHOLD = None
|
||||
self.CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD = None
|
||||
self.CALLBACK_CHECK_MIC_THRESHOLD = None
|
||||
self.CALLBACK_SET_MIC_RECORD_TIMEOUT = None
|
||||
self.CALLBACK_SET_MIC_PHRASE_TIMEOUT = None
|
||||
self.CALLBACK_SET_MIC_MAX_PHRASES = None
|
||||
@@ -44,6 +45,7 @@ class ConfigWindow(CTkToplevel):
|
||||
self.CALLBACK_SET_SPEAKER_DEVICE = None
|
||||
self.CALLBACK_SET_SPEAKER_ENERGY_THRESHOLD = None
|
||||
self.CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = None
|
||||
self.CALLBACK_CHECK_SPEAKER_THRESHOLD = None
|
||||
self.CALLBACK_SET_SPEAKER_RECORD_TIMEOUT = None
|
||||
self.CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT = None
|
||||
self.CALLBACK_SET_SPEAKER_MAX_PHRASES = None
|
||||
|
||||
@@ -16,7 +16,7 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings):
|
||||
|
||||
# 関数名 chatbox から messagebox に変える予定 config.ENABLE_AUTO_CLEAR_CHATBOX も MESSAGEBOXに変えるかな。
|
||||
def checkbox_auto_clear_chatbox_callback(checkbox_box_widget):
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_DEEPL_AUTHKEY, checkbox_box_widget.get())
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_ENABLE_AUTO_CLEAR_CHATBOX, checkbox_box_widget.get())
|
||||
|
||||
def checkbox_notice_xsoverlay_callback(checkbox_box_widget):
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, checkbox_box_widget.get())
|
||||
|
||||
@@ -16,8 +16,8 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings):
|
||||
createSettingBoxEntry = sbg.createSettingBoxEntry
|
||||
|
||||
|
||||
def checkbox_input_speaker_threshold_check_callback(e, passive_button_wrapper_widget, active_button_wrapper_widget, is_turned_on):
|
||||
print("is_turned_on", is_turned_on)
|
||||
def checkbox_input_mic_threshold_check_callback(e, passive_button_wrapper_widget, active_button_wrapper_widget, is_turned_on):
|
||||
callFunctionIfCallable(config_window.CALLBACK_CHECK_MIC_THRESHOLD, is_turned_on)
|
||||
|
||||
if is_turned_on is True:
|
||||
passive_button_widget = passive_button_wrapper_widget.children["!ctklabel"]
|
||||
@@ -112,14 +112,14 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings):
|
||||
progressbar_attr_name="sb__progressbar_x_slider__progressbar_mic_energy_threshold",
|
||||
|
||||
passive_button_attr_name="sb__progressbar_x_slider__passive_button_mic_energy_threshold",
|
||||
passive_button_command=lambda e: checkbox_input_speaker_threshold_check_callback(
|
||||
passive_button_command=lambda e: checkbox_input_mic_threshold_check_callback(
|
||||
e,
|
||||
config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold,
|
||||
config_window.sb__progressbar_x_slider__active_button_mic_energy_threshold,
|
||||
is_turned_on=True,
|
||||
),
|
||||
active_button_attr_name="sb__progressbar_x_slider__active_button_mic_energy_threshold",
|
||||
active_button_command=lambda e: checkbox_input_speaker_threshold_check_callback(
|
||||
active_button_command=lambda e: checkbox_input_mic_threshold_check_callback(
|
||||
e,
|
||||
config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold,
|
||||
config_window.sb__progressbar_x_slider__active_button_mic_energy_threshold,
|
||||
|
||||
@@ -17,7 +17,7 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings):
|
||||
|
||||
|
||||
def checkbox_input_speaker_threshold_check_callback(e, passive_button_wrapper_widget, active_button_wrapper_widget, is_turned_on):
|
||||
print("is_turned_on", is_turned_on)
|
||||
callFunctionIfCallable(config_window.CALLBACK_CHECK_SPEAKER_THRESHOLD, is_turned_on)
|
||||
|
||||
if is_turned_on is True:
|
||||
passive_button_widget = passive_button_wrapper_widget.children["!ctklabel"]
|
||||
|
||||
Reference in New Issue
Block a user