Merge branch 'config_window' into UI_2.0
This commit is contained in:
12
config.py
12
config.py
@@ -359,13 +359,13 @@ class Config:
|
||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
def ENABLE_AUTO_CLEAR_CHATBOX(self):
|
||||
return self._ENABLE_AUTO_CLEAR_CHATBOX
|
||||
def ENABLE_AUTO_CLEAR_MESSAGE_BOX(self):
|
||||
return self._ENABLE_AUTO_CLEAR_MESSAGE_BOX
|
||||
|
||||
@ENABLE_AUTO_CLEAR_CHATBOX.setter
|
||||
def ENABLE_AUTO_CLEAR_CHATBOX(self, value):
|
||||
@ENABLE_AUTO_CLEAR_MESSAGE_BOX.setter
|
||||
def ENABLE_AUTO_CLEAR_MESSAGE_BOX(self, value):
|
||||
if type(value) is bool:
|
||||
self._ENABLE_AUTO_CLEAR_CHATBOX = value
|
||||
self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = value
|
||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@@ -493,7 +493,7 @@ class Config:
|
||||
"Google(web)": None,
|
||||
}
|
||||
self._MESSAGE_FORMAT = "[message]([translation])"
|
||||
self._ENABLE_AUTO_CLEAR_CHATBOX = False
|
||||
self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = False
|
||||
self._ENABLE_NOTICE_XSOVERLAY = False
|
||||
self._ENABLE_OSC = False
|
||||
self._UPDATE_FLAG = False
|
||||
|
||||
190
main.py
190
main.py
@@ -90,7 +90,7 @@ def sendChatMessage(message):
|
||||
view.printToTextbox_SentMessage(message, translation)
|
||||
|
||||
# delete message in entry message box
|
||||
if config.ENABLE_AUTO_CLEAR_CHATBOX is True:
|
||||
if config.ENABLE_AUTO_CLEAR_MESSAGE_BOX is True:
|
||||
view.clearMessageBox()
|
||||
|
||||
def messageBoxPressKeyEnter(e):
|
||||
@@ -213,6 +213,7 @@ def callbackToggleForeground():
|
||||
|
||||
|
||||
# Config Window
|
||||
# Compact Mode Switch
|
||||
def callbackEnableConfigWindowCompactMode():
|
||||
config.IS_CONFIG_WINDOW_COMPACT_MODE = True
|
||||
view.reloadConfigWindowSettingBoxContainer()
|
||||
@@ -221,6 +222,153 @@ def callbackDisableConfigWindowCompactMode():
|
||||
config.IS_CONFIG_WINDOW_COMPACT_MODE = False
|
||||
view.reloadConfigWindowSettingBoxContainer()
|
||||
|
||||
# Appearance Tab
|
||||
def callbackSetTransparency(value):
|
||||
print("callbackSetTransparency", int(value))
|
||||
config.TRANSPARENCY = int(value)
|
||||
# self.parent.wm_attributes("-alpha", int(value/100))
|
||||
|
||||
def callbackSetAppearance(value):
|
||||
print("callbackSetAppearance", value)
|
||||
config.APPEARANCE_THEME = value
|
||||
|
||||
def callbackSetUiScaling(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("callbackSetFontFamily", value)
|
||||
config.FONT_FAMILY = value
|
||||
|
||||
def callbackSetUiLanguage(value):
|
||||
print("callbackSetUiLanguage", value)
|
||||
config.UI_LANGUAGE = value
|
||||
|
||||
# Translation Tab
|
||||
def callbackSetDeeplAuthkey(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:
|
||||
# print_textbox(self.parent.textbox_message_log, "Auth key update completed", "INFO")
|
||||
# print_textbox(self.parent.textbox_message_system_log, "Auth key update completed", "INFO")
|
||||
# else:
|
||||
# pass
|
||||
|
||||
# Transcription Tab (Mic)
|
||||
def callbackSetMicHost(value):
|
||||
print("callbackSetMicHost", value)
|
||||
config.CHOICE_MIC_HOST = value
|
||||
|
||||
def callbackSetMicDevice(value):
|
||||
print("callbackSetMicDevice", value)
|
||||
config.CHOICE_MIC_DEVICE = value
|
||||
|
||||
def callbackSetMicEnergyThreshold(value):
|
||||
print("callbackSetMicEnergyThreshold", int(value))
|
||||
config.INPUT_MIC_ENERGY_THRESHOLD = int(value)
|
||||
|
||||
def callbackSetMicDynamicEnergyThreshold(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("callbackSetMicRecordTimeout", int(value))
|
||||
config.INPUT_MIC_RECORD_TIMEOUT = int(value)
|
||||
|
||||
def callbackSetMicPhraseTimeout(value):
|
||||
print("callbackSetMicPhraseTimeout", int(value))
|
||||
config.INPUT_MIC_PHRASE_TIMEOUT = int(value)
|
||||
|
||||
def callbackSetMicMaxPhrases(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("callbackSetMicWordFilter_afterSplitting", word_filter)
|
||||
if len(word_filter) > 0:
|
||||
config.INPUT_MIC_WORD_FILTER = word_filter.split(",")
|
||||
else:
|
||||
config.INPUT_MIC_WORD_FILTER = []
|
||||
# model.resetKeywordProcessor()
|
||||
# model.addKeywords()
|
||||
|
||||
# Transcription Tab (Speaker)
|
||||
def callbackSetSpeakerDevice(value):
|
||||
print("callbackSetSpeakerDevice", value)
|
||||
config.CHOICE_SPEAKER_DEVICE = value
|
||||
|
||||
def callbackSetSpeakerEnergyThreshold(value):
|
||||
print("callbackSetSpeakerEnergyThreshold", int(value))
|
||||
config.INPUT_SPEAKER_ENERGY_THRESHOLD = int(value)
|
||||
|
||||
def callbackSetSpeakerDynamicEnergyThreshold(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("callbackSetSpeakerRecordTimeout", int(value))
|
||||
config.INPUT_SPEAKER_RECORD_TIMEOUT = int(value)
|
||||
|
||||
def callbackSetSpeakerPhraseTimeout(value):
|
||||
print("callbackSetSpeakerPhraseTimeout", int(value))
|
||||
config.INPUT_SPEAKER_PHRASE_TIMEOUT = int(value)
|
||||
|
||||
def callbackSetSpeakerMaxPhrases(value):
|
||||
print("callbackSetSpeakerMaxPhrases", int(value))
|
||||
config.INPUT_SPEAKER_MAX_PHRASES = int(value)
|
||||
|
||||
|
||||
# Others Tab
|
||||
def callbackSetEnableAutoClearMessageBox(value):
|
||||
print("callbackSetEnableAutoClearMessageBox", value)
|
||||
config.ENABLE_AUTO_CLEAR_MESSAGE_BOX = value
|
||||
|
||||
def callbackSetEnableNoticeXsoverlay(value):
|
||||
print("callbackSetEnableNoticeXsoverlay", value)
|
||||
config.ENABLE_NOTICE_XSOVERLAY = value
|
||||
|
||||
def callbackSetMessageFormat(value):
|
||||
print("callbackSetMessageFormat", value)
|
||||
if len(value) > 0:
|
||||
config.MESSAGE_FORMAT = value
|
||||
|
||||
|
||||
# Advanced Settings Tab
|
||||
def callbackSetOscIpAddress(value):
|
||||
print("callbackSetOscIpAddress", value)
|
||||
config.OSC_IP_ADDRESS = value
|
||||
|
||||
def callbackSetOscPort(value):
|
||||
print("callbackSetOscPort", int(value))
|
||||
config.OSC_PORT = int(value)
|
||||
|
||||
|
||||
|
||||
# create GUI
|
||||
view.createGUI()
|
||||
|
||||
@@ -263,8 +411,48 @@ view.register(
|
||||
},
|
||||
|
||||
config_window={
|
||||
# Compact Mode Switch
|
||||
"callback_disable_config_window_compact_mode": callbackEnableConfigWindowCompactMode,
|
||||
"callback_enable_config_window_compact_mode": callbackDisableConfigWindowCompactMode,
|
||||
|
||||
# Appearance Tab
|
||||
"callback_set_transparency": callbackSetTransparency,
|
||||
"callback_set_appearance": callbackSetAppearance,
|
||||
"callback_set_ui_scaling": callbackSetUiScaling,
|
||||
"callback_set_font_family": callbackSetFontFamily,
|
||||
"callback_set_ui_language": callbackSetUiLanguage,
|
||||
|
||||
# Translation Tab
|
||||
"callback_set_deepl_authkey": callbackSetDeeplAuthkey,
|
||||
|
||||
# Transcription Tab (Mic)
|
||||
"callback_set_mic_host": callbackSetMicHost,
|
||||
"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,
|
||||
"callback_set_mic_word_filter": callbackSetMicWordFilter,
|
||||
|
||||
# Transcription Tab (Speaker)
|
||||
"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,
|
||||
|
||||
# Others Tab
|
||||
"callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox,
|
||||
"callback_set_enable_notice_xsoverlay": callbackSetEnableNoticeXsoverlay,
|
||||
"callback_set_message_format": callbackSetMessageFormat,
|
||||
|
||||
# Advanced Settings Tab
|
||||
"callback_set_osc_ip_address": callbackSetOscIpAddress,
|
||||
"callback_set_osc_port": callbackSetOscPort,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
5
utils.py
5
utils.py
@@ -9,4 +9,7 @@ def get_key_by_value(dictionary, value):
|
||||
for key, val in dictionary.items():
|
||||
if val == value:
|
||||
return key
|
||||
return None
|
||||
return None
|
||||
|
||||
def callFunctionIfCallable(function, *args):
|
||||
if callable(function) is True: function(*args)
|
||||
41
view.py
41
view.py
@@ -64,10 +64,51 @@ class View():
|
||||
entry_message_box.bind("<FocusOut>", self._foregroundOnForcefully)
|
||||
|
||||
|
||||
# Config Window
|
||||
# Compact Mode Switch
|
||||
vrct_gui.config_window.CALLBACK_ENABLE_CONFIG_WINDOW_COMPACT_MODE = config_window["callback_disable_config_window_compact_mode"]
|
||||
vrct_gui.config_window.CALLBACK_DISABLE_CONFIG_WINDOW_COMPACT_MODE = config_window["callback_enable_config_window_compact_mode"]
|
||||
|
||||
|
||||
# Appearance Tab
|
||||
vrct_gui.config_window.CALLBACK_SET_TRANSPARENCY = config_window["callback_set_transparency"]
|
||||
vrct_gui.config_window.CALLBACK_SET_APPEARANCE = config_window["callback_set_appearance"]
|
||||
vrct_gui.config_window.CALLBACK_SET_UI_SCALING = config_window["callback_set_ui_scaling"]
|
||||
vrct_gui.config_window.CALLBACK_SET_FONT_FAMILY = config_window["callback_set_font_family"]
|
||||
vrct_gui.config_window.CALLBACK_SET_UI_LANGUAGE = config_window["callback_set_ui_language"]
|
||||
|
||||
|
||||
# Translation Tab
|
||||
vrct_gui.config_window.CALLBACK_SET_DEEPL_AUTHKEY = config_window["callback_set_deepl_authkey"]
|
||||
|
||||
# Transcription Tab (Mic)
|
||||
vrct_gui.config_window.CALLBACK_SET_MIC_HOST = config_window["callback_set_mic_host"]
|
||||
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"]
|
||||
vrct_gui.config_window.CALLBACK_SET_MIC_WORD_FILTER = config_window["callback_set_mic_word_filter"]
|
||||
|
||||
# Transcription Tab (Speaker)
|
||||
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"]
|
||||
|
||||
# Others Tab
|
||||
vrct_gui.config_window.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX = config_window["callback_set_enable_auto_clear_chatbox"]
|
||||
vrct_gui.config_window.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY = config_window["callback_set_enable_notice_xsoverlay"]
|
||||
vrct_gui.config_window.CALLBACK_SET_MESSAGE_FORMAT = config_window["callback_set_message_format"]
|
||||
|
||||
# Advanced Settings Tab
|
||||
vrct_gui.config_window.CALLBACK_SET_OSC_IP_ADDRESS = config_window["callback_set_osc_ip_address"]
|
||||
vrct_gui.config_window.CALLBACK_SET_OSC_PORT = config_window["callback_set_osc_port"]
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,46 @@ class ConfigWindow(CTkToplevel):
|
||||
self.settings = settings
|
||||
|
||||
|
||||
# Appearance Tab
|
||||
self.CALLBACK_SET_TRANSPARENCY = None
|
||||
self.CALLBACK_SET_APPEARANCE = None
|
||||
self.CALLBACK_SET_UI_SCALING = None
|
||||
self.CALLBACK_SET_FONT_FAMILY = None
|
||||
self.CALLBACK_SET_UI_LANGUAGE = None
|
||||
|
||||
# Translation Tab
|
||||
self.CALLBACK_SET_DEEPL_AUTHKEY = None
|
||||
|
||||
# Transcription Tab (Mic)
|
||||
self.CALLBACK_SET_MIC_HOST = None
|
||||
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
|
||||
self.CALLBACK_SET_MIC_WORD_FILTER = None
|
||||
|
||||
# Transcription Tab (Speaker)
|
||||
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
|
||||
|
||||
# Others Tab
|
||||
self.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX = None
|
||||
self.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY = None
|
||||
self.CALLBACK_SET_MESSAGE_FORMAT = None
|
||||
|
||||
# Advanced Settings Tab
|
||||
self.CALLBACK_SET_OSC_IP_ADDRESS = None
|
||||
self.CALLBACK_SET_OSC_PORT = None
|
||||
|
||||
|
||||
|
||||
createConfigWindowTitle(config_window=self, settings=settings)
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ def _createSettingBoxContainer(config_window, settings, setting_box_container_se
|
||||
|
||||
return setting_box_wrapper_section_title_frame
|
||||
|
||||
# Common setting
|
||||
|
||||
# Setting box container
|
||||
setting_box_container_widget = CTkFrame(config_window.main_setting_box_bg_wrapper, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=0)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from time import sleep
|
||||
|
||||
from customtkinter import StringVar, IntVar
|
||||
|
||||
from utils import callFunctionIfCallable
|
||||
|
||||
from .._SettingBoxGenerator import _SettingBoxGenerator
|
||||
|
||||
@@ -13,10 +12,10 @@ def createSettingBox_AdvancedSettings(setting_box_wrapper, config_window, settin
|
||||
|
||||
|
||||
def entry_ip_address_callback(value):
|
||||
config.OSC_IP_ADDRESS = str(value)
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_OSC_IP_ADDRESS, value)
|
||||
|
||||
def entry_port_callback(value):
|
||||
config.OSC_PORT = int(value)
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_OSC_PORT, value)
|
||||
|
||||
row=0
|
||||
config_window.sb__ip_address = createSettingBoxEntry(
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
from time import sleep
|
||||
|
||||
from customtkinter import StringVar, IntVar
|
||||
from tkinter import font as tk_font
|
||||
from languages import selectable_languages
|
||||
from utils import get_key_by_value
|
||||
|
||||
from utils import get_key_by_value, callFunctionIfCallable
|
||||
|
||||
from .._SettingBoxGenerator import _SettingBoxGenerator
|
||||
|
||||
@@ -15,28 +12,24 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings):
|
||||
createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu
|
||||
createSettingBoxSlider = sbg.createSettingBoxSlider
|
||||
|
||||
|
||||
# 関数名は変えるかもしれない。
|
||||
# テーマ変更、フォント変更時、 Widget再生成か再起動かは検討中
|
||||
|
||||
|
||||
def slider_transparency_callback(value):
|
||||
# self.parent.wm_attributes("-alpha", int(value/100))
|
||||
config.TRANSPARENCY = int(value)
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_TRANSPARENCY, value)
|
||||
|
||||
def optionmenu_appearance_theme_callback(value):
|
||||
config.APPEARANCE_THEME = value
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_APPEARANCE, value)
|
||||
|
||||
def optionmenu_ui_scaling_callback(value):
|
||||
# self.optionmenu_ui_scaling.set(choice)
|
||||
# new_scaling_float = int(choice.replace("%", "")) / 100
|
||||
config.UI_SCALING = value
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_UI_SCALING, value)
|
||||
|
||||
def optionmenu_font_family_callback(value):
|
||||
config.FONT_FAMILY = value
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_FONT_FAMILY, value)
|
||||
|
||||
def optionmenu_ui_language_callback(value):
|
||||
config.UI_LANGUAGE = get_key_by_value(selectable_languages, value)
|
||||
value = get_key_by_value(selectable_languages, value)
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_UI_LANGUAGE, value)
|
||||
|
||||
|
||||
row=0
|
||||
config_window.sb__transparency = createSettingBoxSlider(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from time import sleep
|
||||
|
||||
from customtkinter import StringVar, IntVar
|
||||
|
||||
from utils import callFunctionIfCallable
|
||||
|
||||
from .._SettingBoxGenerator import _SettingBoxGenerator
|
||||
|
||||
@@ -13,30 +12,27 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings):
|
||||
createSettingBoxEntry = sbg.createSettingBoxEntry
|
||||
|
||||
|
||||
# 関数名 chatbox から messagebox に変える予定 config.ENABLE_AUTO_CLEAR_CHATBOX も MESSAGEBOXに変えるかな。
|
||||
def checkbox_auto_clear_chatbox_callback(checkbox_box_widget):
|
||||
print(checkbox_box_widget.get())
|
||||
config.ENABLE_AUTO_CLEAR_CHATBOX = checkbox_box_widget.get()
|
||||
# 元 checkbox_auto_clear_chatbox_callback
|
||||
def checkbox_auto_clear_message_box_callback(checkbox_box_widget):
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX, checkbox_box_widget.get())
|
||||
|
||||
def checkbox_notice_xsoverlay_callback(checkbox_box_widget):
|
||||
print(checkbox_box_widget.get())
|
||||
config.ENABLE_NOTICE_XSOVERLAY = checkbox_box_widget.get()
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, checkbox_box_widget.get())
|
||||
|
||||
def entry_message_format_callback(value):
|
||||
if len(value) > 0:
|
||||
config.MESSAGE_FORMAT = value
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, value)
|
||||
|
||||
|
||||
row=0
|
||||
config_window.sb__auto_clear_chatbox = createSettingBoxCheckbox(
|
||||
config_window.sb__auto_clear_message_box = createSettingBoxCheckbox(
|
||||
parent_widget=setting_box_wrapper,
|
||||
label_text="Auto Clear The Message Box",
|
||||
desc_text="Clear the message box after sending your message.",
|
||||
checkbox_attr_name="sb__checkbox_auto_clear_chatbox",
|
||||
command=lambda: checkbox_auto_clear_chatbox_callback(config_window.sb__checkbox_auto_clear_chatbox),
|
||||
checkbox_attr_name="sb__checkbox_auto_clear_message_box",
|
||||
command=lambda: checkbox_auto_clear_message_box_callback(config_window.sb__checkbox_auto_clear_message_box),
|
||||
is_checked=False
|
||||
)
|
||||
config_window.sb__auto_clear_chatbox.grid(row=row)
|
||||
config_window.sb__auto_clear_message_box.grid(row=row)
|
||||
row+=1
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ from time import sleep
|
||||
|
||||
from customtkinter import StringVar, IntVar
|
||||
|
||||
from utils import callFunctionIfCallable
|
||||
|
||||
from .._SettingBoxGenerator import _SettingBoxGenerator
|
||||
|
||||
@@ -15,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"]
|
||||
@@ -39,42 +40,29 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings):
|
||||
passive_button_wrapper_widget.grid()
|
||||
|
||||
def optionmenu_mic_host_callback(value):
|
||||
config.CHOICE_MIC_HOST = value
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_MIC_HOST, value)
|
||||
|
||||
def optionmenu_input_mic_device_callback(value):
|
||||
config.CHOICE_MIC_DEVICE = value
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_MIC_DEVICE, value)
|
||||
|
||||
def slider_input_mic_energy_threshold_callback(value):
|
||||
config.INPUT_MIC_ENERGY_THRESHOLD = int(value)
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_MIC_ENERGY_THRESHOLD, value)
|
||||
|
||||
def checkbox_input_mic_dynamic_energy_threshold_callback(checkbox_box_widget):
|
||||
print(checkbox_box_widget.get())
|
||||
config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD = checkbox_box_widget.get()
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD, checkbox_box_widget.get())
|
||||
|
||||
|
||||
def entry_input_mic_record_timeout_callback(value):
|
||||
print(int(value))
|
||||
config.INPUT_MIC_RECORD_TIMEOUT = int(value)
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_MIC_RECORD_TIMEOUT, value)
|
||||
|
||||
def entry_input_mic_phrase_timeout_callback(value):
|
||||
print(int(value))
|
||||
config.INPUT_MIC_PHRASE_TIMEOUT = int(value)
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_MIC_PHRASE_TIMEOUT, value)
|
||||
|
||||
def entry_input_mic_max_phrases_callback(value):
|
||||
print(int(value))
|
||||
config.INPUT_MIC_MAX_PHRASES = int(value)
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_MIC_MAX_PHRASES, value)
|
||||
|
||||
def entry_input_mic_word_filters_callback(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)
|
||||
if len(word_filter) > 0:
|
||||
config.INPUT_MIC_WORD_FILTER = word_filter.split(",")
|
||||
else:
|
||||
config.INPUT_MIC_WORD_FILTER = []
|
||||
# model.resetKeywordProcessor()
|
||||
# model.addKeywords()
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_MIC_WORD_FILTER, value)
|
||||
|
||||
|
||||
row=0
|
||||
@@ -124,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,
|
||||
|
||||
@@ -2,6 +2,7 @@ from time import sleep
|
||||
|
||||
from customtkinter import StringVar, IntVar
|
||||
|
||||
from utils import callFunctionIfCallable
|
||||
|
||||
from .._SettingBoxGenerator import _SettingBoxGenerator
|
||||
|
||||
@@ -16,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"]
|
||||
@@ -39,27 +40,23 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings):
|
||||
passive_button_wrapper_widget.grid()
|
||||
|
||||
def optionmenu_input_speaker_device_callback(value):
|
||||
config.CHOICE_SPEAKER_DEVICE = value
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_SPEAKER_DEVICE, value)
|
||||
|
||||
def slider_input_speaker_energy_threshold_callback(value):
|
||||
config.INPUT_SPEAKER_ENERGY_THRESHOLD = int(value)
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_SPEAKER_ENERGY_THRESHOLD, value)
|
||||
|
||||
def checkbox_input_speaker_dynamic_energy_threshold_callback(checkbox_box_widget):
|
||||
print(checkbox_box_widget.get())
|
||||
config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = checkbox_box_widget.get()
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD, checkbox_box_widget.get())
|
||||
|
||||
|
||||
def entry_input_speaker_record_timeout_callback(value):
|
||||
print(int(value))
|
||||
config.INPUT_SPEAKER_RECORD_TIMEOUT = int(value)
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_SPEAKER_RECORD_TIMEOUT, value)
|
||||
|
||||
def entry_input_speaker_phrase_timeout_callback(value):
|
||||
print(int(value))
|
||||
config.INPUT_SPEAKER_PHRASE_TIMEOUT = int(value)
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT, value)
|
||||
|
||||
def entry_input_speaker_max_phrases_callback(value):
|
||||
print(int(value))
|
||||
config.INPUT_SPEAKER_MAX_PHRASES = int(value)
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_SPEAKER_MAX_PHRASES, value)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from time import sleep
|
||||
|
||||
from customtkinter import StringVar, IntVar
|
||||
|
||||
from utils import callFunctionIfCallable
|
||||
|
||||
from .._SettingBoxGenerator import _SettingBoxGenerator
|
||||
|
||||
@@ -13,14 +12,7 @@ def createSettingBox_Translation(setting_box_wrapper, config_window, settings):
|
||||
|
||||
|
||||
def deepl_authkey_callback(value):
|
||||
print(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:
|
||||
# print_textbox(self.parent.textbox_message_log, "Auth key update completed", "INFO")
|
||||
# print_textbox(self.parent.textbox_message_system_log, "Auth key update completed", "INFO")
|
||||
# else:
|
||||
# pass
|
||||
callFunctionIfCallable(config_window.CALLBACK_SET_DEEPL_AUTHKEY, value)
|
||||
|
||||
|
||||
row=0
|
||||
|
||||
Reference in New Issue
Block a user