Setting box: add items Mic Record Timeout, Mic Phrase Timeout, Mic Max Phrases and Mic Word Filter
This commit is contained in:
@@ -294,6 +294,9 @@ class SettingBoxGenerator():
|
|||||||
setting_box_entry_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color=self.ctm.SB__BG_COLOR)
|
setting_box_entry_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color=self.ctm.SB__BG_COLOR)
|
||||||
setting_box_entry_frame.grid(row=0, column=1, padx=0, sticky="e")
|
setting_box_entry_frame.grid(row=0, column=1, padx=0, sticky="e")
|
||||||
|
|
||||||
|
def adjusted_command__for_entry_bind__Any_KeyRelease(e):
|
||||||
|
entry_bind__Any_KeyRelease(e.widget.get())
|
||||||
|
|
||||||
entry_widget = CTkEntry(
|
entry_widget = CTkEntry(
|
||||||
setting_box_entry_frame,
|
setting_box_entry_frame,
|
||||||
width=entry_width,
|
width=entry_width,
|
||||||
@@ -301,7 +304,7 @@ class SettingBoxGenerator():
|
|||||||
textvariable=entry_textvariable,
|
textvariable=entry_textvariable,
|
||||||
font=CTkFont(family=self.FONT_FAMILY, size=self.uism.SB__ENTRY_FONT_SIZE, weight="normal"),
|
font=CTkFont(family=self.FONT_FAMILY, size=self.uism.SB__ENTRY_FONT_SIZE, weight="normal"),
|
||||||
)
|
)
|
||||||
entry_widget.bind("<Any-KeyRelease>", entry_bind__Any_KeyRelease)
|
entry_widget.bind("<Any-KeyRelease>", adjusted_command__for_entry_bind__Any_KeyRelease)
|
||||||
setattr(self.config_window, entry_attr_name, entry_widget)
|
setattr(self.config_window, entry_attr_name, entry_widget)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,32 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings):
|
|||||||
print(checkbox_box_widget.get())
|
print(checkbox_box_widget.get())
|
||||||
config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD = checkbox_box_widget.get()
|
config.INPUT_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)
|
||||||
|
|
||||||
|
def entry_input_mic_phrase_timeout_callback(value):
|
||||||
|
print(int(value))
|
||||||
|
config.INPUT_MIC_RECORD_TIMEOUT = int(value)
|
||||||
|
|
||||||
|
def entry_input_mic_max_phrases_callback(value):
|
||||||
|
print(str(value))
|
||||||
|
config.INPUT_MIC_MAX_PHRASES = str(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()
|
||||||
|
|
||||||
|
|
||||||
row=0
|
row=0
|
||||||
# Mic Host と Mic Device は一つの項目として引っ付ける予定
|
# Mic Host と Mic Device は一つの項目として引っ付ける予定
|
||||||
config_window.sb__mic_host = createSettingBoxDropdownMenu(
|
config_window.sb__mic_host = createSettingBoxDropdownMenu(
|
||||||
@@ -146,11 +172,71 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings):
|
|||||||
desc_text="When this feature is selected, it will automatically adjust in a way that works well, based on the set Mic Energy Threshold.",
|
desc_text="When this feature is selected, it will automatically adjust in a way that works well, based on the set Mic Energy Threshold.",
|
||||||
checkbox_attr_name="sb__checkbox_mic_dynamic_energy_threshold",
|
checkbox_attr_name="sb__checkbox_mic_dynamic_energy_threshold",
|
||||||
command=lambda: checkbox_input_mic_dynamic_energy_threshold_callback(config_window.sb__checkbox_mic_dynamic_energy_threshold),
|
command=lambda: checkbox_input_mic_dynamic_energy_threshold_callback(config_window.sb__checkbox_mic_dynamic_energy_threshold),
|
||||||
is_checked=False,
|
is_checked=False
|
||||||
)
|
)
|
||||||
config_window.sb__mic_dynamic_energy_threshold.grid(row=row)
|
config_window.sb__mic_dynamic_energy_threshold.grid(row=row)
|
||||||
row+=1
|
row+=1
|
||||||
|
|
||||||
|
|
||||||
|
# 以下3つも一つの項目にまとめるかもしれない
|
||||||
|
config_window.sb__mic_record_timeout = createSettingBoxEntry(
|
||||||
|
parent_widget=setting_box_wrapper,
|
||||||
|
label_text="Mic Record Timeout",
|
||||||
|
desc_text="(Default: 3)",
|
||||||
|
entry_attr_name="sb__entry_mic_record_timeout",
|
||||||
|
entry_width=settings.uism.SB__ENTRY_WIDTH_100,
|
||||||
|
entry_bind__Any_KeyRelease=lambda value: entry_input_mic_record_timeout_callback(value),
|
||||||
|
entry_textvariable=IntVar(value=config.INPUT_MIC_RECORD_TIMEOUT),
|
||||||
|
)
|
||||||
|
config_window.sb__mic_record_timeout.grid(row=row)
|
||||||
|
row+=1
|
||||||
|
|
||||||
|
config_window.sb__mic_phrase_timeout = createSettingBoxEntry(
|
||||||
|
parent_widget=setting_box_wrapper,
|
||||||
|
label_text="Mic Phrase Timeout",
|
||||||
|
desc_text="It will stop recording and send the recordings when the set second(s) is reached. (Default: 3)",
|
||||||
|
entry_attr_name="sb__entry_mic_phrase_timeout",
|
||||||
|
entry_width=settings.uism.SB__ENTRY_WIDTH_100,
|
||||||
|
entry_bind__Any_KeyRelease=lambda value: entry_input_mic_phrase_timeout_callback(value),
|
||||||
|
entry_textvariable=IntVar(value=config.INPUT_MIC_PHRASE_TIMEOUT),
|
||||||
|
)
|
||||||
|
config_window.sb__mic_phrase_timeout.grid(row=row)
|
||||||
|
row+=1
|
||||||
|
|
||||||
|
config_window.sb__mic_max_phrases = createSettingBoxEntry(
|
||||||
|
parent_widget=setting_box_wrapper,
|
||||||
|
label_text="Mic Max Phrases",
|
||||||
|
desc_text="It will stop recording and send the recordings when the set count of phrase(s) is reached. (Default: 10)",
|
||||||
|
entry_attr_name="sb__entry_mic_max_phrases",
|
||||||
|
entry_width=settings.uism.SB__ENTRY_WIDTH_100,
|
||||||
|
entry_bind__Any_KeyRelease=lambda value: entry_input_mic_max_phrases_callback(value),
|
||||||
|
entry_textvariable=IntVar(value=config.INPUT_MIC_MAX_PHRASES),
|
||||||
|
)
|
||||||
|
config_window.sb__mic_max_phrases.grid(row=row)
|
||||||
|
row+=1
|
||||||
|
# __________
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if len(config.INPUT_MIC_WORD_FILTER) > 0:
|
||||||
|
entry_textvariable=StringVar(value=",".join(config.INPUT_MIC_WORD_FILTER))
|
||||||
|
else:
|
||||||
|
entry_textvariable=None
|
||||||
|
config_window.sb__mic_word_filter = createSettingBoxEntry(
|
||||||
|
parent_widget=setting_box_wrapper,
|
||||||
|
label_text="Mic Max Phrases",
|
||||||
|
desc_text="It will not send the sentence if the word(s) included in the set list of words.\nHow to set: e.g. AAA,BBB,CCC",
|
||||||
|
entry_attr_name="sb__entry_mic_word_filter",
|
||||||
|
entry_width=settings.uism.SB__ENTRY_WIDTH_100,
|
||||||
|
entry_bind__Any_KeyRelease=lambda value: entry_input_mic_word_filters_callback(value),
|
||||||
|
entry_textvariable=entry_textvariable,
|
||||||
|
)
|
||||||
|
config_window.sb__mic_word_filter.grid(row=row)
|
||||||
|
row+=1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# config_window.sb__switch_1 = createSettingBoxSwitch(
|
# config_window.sb__switch_1 = createSettingBoxSwitch(
|
||||||
# parent_widget=setting_box_wrapper,
|
# parent_widget=setting_box_wrapper,
|
||||||
# label_text="Switch",
|
# label_text="Switch",
|
||||||
|
|||||||
Reference in New Issue
Block a user