diff --git a/window_config.py b/window_config.py index 95aa0c4c..2b542454 100644 --- a/window_config.py +++ b/window_config.py @@ -33,13 +33,16 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): # tab UI ## slider transparency + row = 0 + padx = 5 + pady = 1 self.label_transparency = customtkinter.CTkLabel( self.tabview_config.tab("UI"), text="Transparency:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_transparency.grid(row=0, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_transparency.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.slider_transparency = customtkinter.CTkSlider( self.tabview_config.tab("UI"), from_=50, @@ -47,16 +50,17 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): command=self.slider_transparency_callback, variable=tk.DoubleVar(value=self.parent.TRANSPARENCY), ) - self.slider_transparency.grid(row=0, column=1, columnspan=1, padx=5, pady=10, sticky="nsew") + self.slider_transparency.grid(row=row, column=1, columnspan=1, padx=padx, pady=10, sticky="nsew") ## optionmenu theme + row += 1 self.label_appearance_theme = customtkinter.CTkLabel( self.tabview_config.tab("UI"), text="Appearance Theme:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_appearance_theme.grid(row=1, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_appearance_theme.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.optionmenu_appearance_theme = customtkinter.CTkOptionMenu( self.tabview_config.tab("UI"), values=["Light", "Dark", "System"], @@ -64,17 +68,18 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): variable=customtkinter.StringVar(value=self.parent.APPEARANCE_THEME), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY), ) - self.optionmenu_appearance_theme.grid(row=1, column=1, columnspan=1, padx=5, pady=5, sticky="nsew") + self.optionmenu_appearance_theme.grid(row=row, column=1, columnspan=1, padx=padx, pady=pady, sticky="nsew") self.optionmenu_appearance_theme._dropdown_menu.configure(font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY)) ## optionmenu UI scaling + row += 1 self.label_ui_scaling = customtkinter.CTkLabel( self.tabview_config.tab("UI"), text="UI Scaling:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_ui_scaling.grid(row=2, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_ui_scaling.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.optionmenu_ui_scaling = customtkinter.CTkOptionMenu( self.tabview_config.tab("UI"), values=["80%", "90%", "100%", "110%", "120%"], @@ -82,17 +87,18 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): variable=customtkinter.StringVar(value=self.parent.UI_SCALING), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY), ) - self.optionmenu_ui_scaling.grid(row=2, column=1, columnspan=1, padx=5, pady=5, sticky="nsew") + self.optionmenu_ui_scaling.grid(row=row, column=1, columnspan=1, padx=padx, pady=pady, sticky="nsew") self.optionmenu_ui_scaling._dropdown_menu.configure(font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY)) ## optionmenu font family + row += 1 self.label_font_family = customtkinter.CTkLabel( self.tabview_config.tab("UI"), text="Font Family:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_font_family.grid(row=3, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_font_family.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") font_families = list(tk.font.families()) self.optionmenu_font_family = customtkinter.CTkOptionMenu( self.tabview_config.tab("UI"), @@ -101,7 +107,7 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): variable=customtkinter.StringVar(value=self.parent.FONT_FAMILY), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY), ) - self.optionmenu_font_family.grid(row=3, column=1, columnspan=1, padx=5, pady=5, sticky="nsew") + self.optionmenu_font_family.grid(row=row, column=1, columnspan=1, padx=padx, pady=pady, sticky="nsew") self.optionmenu_font_family._dropdown_menu.configure(font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY)) # tab Translation @@ -210,13 +216,16 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): # tab Transcription ## optionmenu input mic device + row = 0 + padx = 5 + pady = 1 self.label_input_mic_device = customtkinter.CTkLabel( self.tabview_config.tab("Transcription"), text="Input Mic Device:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_input_mic_device.grid(row=0, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_input_mic_device.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.optionmenu_input_mic_device = customtkinter.CTkOptionMenu( self.tabview_config.tab("Transcription"), values=[device["name"] for device in audio_utils.get_input_device_list()], @@ -224,17 +233,18 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): variable=customtkinter.StringVar(value=self.parent.CHOICE_MIC_DEVICE), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY), ) - self.optionmenu_input_mic_device.grid(row=0, column=1, columnspan=1 ,padx=5, pady=5, sticky="nsew") + self.optionmenu_input_mic_device.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") self.optionmenu_input_mic_device._dropdown_menu.configure(font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY)) ## optionmenu input mic voice language + row +=1 self.label_input_mic_voice_language = customtkinter.CTkLabel( self.tabview_config.tab("Transcription"), text="Input Mic Voice Language:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_input_mic_voice_language.grid(row=1, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_input_mic_voice_language.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.optionmenu_input_mic_voice_language = customtkinter.CTkOptionMenu( self.tabview_config.tab("Transcription"), values=list(languages.transcription_lang.keys()), @@ -242,33 +252,35 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): variable=customtkinter.StringVar(value=self.parent.INPUT_MIC_VOICE_LANGUAGE), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY), ) - self.optionmenu_input_mic_voice_language.grid(row=1, column=1, columnspan=1 ,padx=5, pady=5, sticky="nsew") + self.optionmenu_input_mic_voice_language.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") self.optionmenu_input_mic_voice_language._dropdown_menu.configure(font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY)) ## entry input mic energy threshold + row +=1 self.label_input_mic_energy_threshold = customtkinter.CTkLabel( self.tabview_config.tab("Transcription"), text="Input Mic Energy Threshold:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_input_mic_energy_threshold.grid(row=2, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_input_mic_energy_threshold.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.entry_input_mic_energy_threshold = customtkinter.CTkEntry( self.tabview_config.tab("Transcription"), textvariable=customtkinter.StringVar(value=self.parent.INPUT_MIC_ENERGY_THRESHOLD), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.entry_input_mic_energy_threshold.grid(row=2, column=1, columnspan=1 ,padx=5, pady=10, sticky="nsew") + self.entry_input_mic_energy_threshold.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") self.entry_input_mic_energy_threshold.bind("", self.entry_input_mic_energy_threshold_callback) ## checkbox input mic dynamic energy threshold + row +=1 self.label_input_mic_dynamic_energy_threshold = customtkinter.CTkLabel( self.tabview_config.tab("Transcription"), text="Input Mic Dynamic Energy Threshold:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_input_mic_dynamic_energy_threshold.grid(row=3, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_input_mic_dynamic_energy_threshold.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.checkbox_input_mic_dynamic_energy_threshold = customtkinter.CTkCheckBox( self.tabview_config.tab("Transcription"), text="", @@ -277,36 +289,72 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): command=self.checkbox_input_mic_dynamic_energy_threshold_callback, font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.checkbox_input_mic_dynamic_energy_threshold.grid(row=3, column=1, columnspan=1 ,padx=5, pady=5, sticky="nsew") + self.checkbox_input_mic_dynamic_energy_threshold.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") if self.parent.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD is True: self.checkbox_input_mic_dynamic_energy_threshold.select() else: self.checkbox_input_mic_dynamic_energy_threshold.deselect() ## entry input mic record timeout + row +=1 self.label_input_mic_record_timeout = customtkinter.CTkLabel( self.tabview_config.tab("Transcription"), text="Input Mic Record Timeout:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_input_mic_record_timeout.grid(row=4, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_input_mic_record_timeout.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.entry_input_mic_record_timeout = customtkinter.CTkEntry( self.tabview_config.tab("Transcription"), textvariable=customtkinter.StringVar(value=self.parent.INPUT_MIC_RECORD_TIMEOUT), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.entry_input_mic_record_timeout.grid(row=4, column=1, columnspan=1 ,padx=5, pady=10, sticky="nsew") + self.entry_input_mic_record_timeout.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") self.entry_input_mic_record_timeout.bind("", self.entry_input_mic_record_timeout_callback) + ## entry input mic phrase timeout + row +=1 + self.label_input_mic_phrase_timeout = customtkinter.CTkLabel( + self.tabview_config.tab("Transcription"), + text="Input Mic Phrase Timeout:", + fg_color="transparent", + font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) + ) + self.label_input_mic_phrase_timeout.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") + self.entry_input_mic_phrase_timeout = customtkinter.CTkEntry( + self.tabview_config.tab("Transcription"), + textvariable=customtkinter.StringVar(value=self.parent.INPUT_MIC_PHRASE_TIMEOUT), + font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) + ) + self.entry_input_mic_phrase_timeout.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") + self.entry_input_mic_phrase_timeout.bind("", self.entry_input_mic_phrase_timeout_callback) + + ## entry input mic max phrases + row +=1 + self.label_input_mic_max_phrases = customtkinter.CTkLabel( + self.tabview_config.tab("Transcription"), + text="Input Mic Max Phrases:", + fg_color="transparent", + font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) + ) + self.label_input_mic_max_phrases.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") + self.entry_input_mic_max_phrases = customtkinter.CTkEntry( + self.tabview_config.tab("Transcription"), + textvariable=customtkinter.StringVar(value=self.parent.INPUT_MIC_MAX_PHRASES), + font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) + ) + self.entry_input_mic_max_phrases.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") + self.entry_input_mic_max_phrases.bind("", self.entry_input_mic_max_phrases_callback) + ## optionmenu input speaker device + row +=1 self.label_input_speaker_device = customtkinter.CTkLabel( self.tabview_config.tab("Transcription"), text="Input Speaker Device:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_input_speaker_device.grid(row=5, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_input_speaker_device.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.optionmenu_input_speaker_device = customtkinter.CTkOptionMenu( self.tabview_config.tab("Transcription"), values=[device["name"] for device in audio_utils.get_output_device_list()], @@ -314,17 +362,18 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): variable=customtkinter.StringVar(value=self.parent.CHOICE_SPEAKER_DEVICE), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY), ) - self.optionmenu_input_speaker_device.grid(row=5, column=1, columnspan=1 ,padx=5, pady=5, sticky="nsew") + self.optionmenu_input_speaker_device.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") self.optionmenu_input_speaker_device._dropdown_menu.configure(font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY)) ## optionmenu input speaker voice language + row +=1 self.label_input_speaker_voice_language = customtkinter.CTkLabel( self.tabview_config.tab("Transcription"), text="Input Speaker Voice Language:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_input_speaker_voice_language.grid(row=6, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_input_speaker_voice_language.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.optionmenu_input_speaker_voice_language = customtkinter.CTkOptionMenu( self.tabview_config.tab("Transcription"), values=list(languages.transcription_lang.keys()), @@ -332,33 +381,35 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): variable=customtkinter.StringVar(value=self.parent.INPUT_SPEAKER_VOICE_LANGUAGE), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY), ) - self.optionmenu_input_speaker_voice_language.grid(row=6, column=1, columnspan=1 ,padx=5, pady=5, sticky="nsew") + self.optionmenu_input_speaker_voice_language.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") self.optionmenu_input_speaker_voice_language._dropdown_menu.configure(font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY)) ## entry input speaker energy threshold + row +=1 self.label_input_speaker_energy_threshold = customtkinter.CTkLabel( self.tabview_config.tab("Transcription"), text="Input Speaker Energy Threshold:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_input_speaker_energy_threshold.grid(row=7, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_input_speaker_energy_threshold.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.entry_input_speaker_energy_threshold = customtkinter.CTkEntry( self.tabview_config.tab("Transcription"), textvariable=customtkinter.StringVar(value=self.parent.INPUT_SPEAKER_ENERGY_THRESHOLD), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.entry_input_speaker_energy_threshold.grid(row=7, column=1, columnspan=1 ,padx=5, pady=10, sticky="nsew") + self.entry_input_speaker_energy_threshold.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") self.entry_input_speaker_energy_threshold.bind("", self.entry_input_speaker_energy_threshold_callback) ## checkbox input speaker dynamic energy threshold + row +=1 self.label_input_speaker_dynamic_energy_threshold = customtkinter.CTkLabel( self.tabview_config.tab("Transcription"), text="Input Speaker Dynamic Energy Threshold:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_input_speaker_dynamic_energy_threshold.grid(row=8, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_input_speaker_dynamic_energy_threshold.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.checkbox_input_speaker_dynamic_energy_threshold = customtkinter.CTkCheckBox( self.tabview_config.tab("Transcription"), text="", @@ -367,91 +418,132 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): command=self.checkbox_input_speaker_dynamic_energy_threshold_callback, font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.checkbox_input_speaker_dynamic_energy_threshold.grid(row=8, column=1, columnspan=1 ,padx=5, pady=5, sticky="nsew") + self.checkbox_input_speaker_dynamic_energy_threshold.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") if self.parent.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD is True: self.checkbox_input_speaker_dynamic_energy_threshold.select() else: self.checkbox_input_speaker_dynamic_energy_threshold.deselect() ## entry input speaker record timeout + row +=1 self.label_input_speaker_record_timeout = customtkinter.CTkLabel( self.tabview_config.tab("Transcription"), text="Input Speaker Record Timeout:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_input_speaker_record_timeout.grid(row=9, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_input_speaker_record_timeout.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.entry_input_speaker_record_timeout = customtkinter.CTkEntry( self.tabview_config.tab("Transcription"), textvariable=customtkinter.StringVar(value=self.parent.INPUT_SPEAKER_RECORD_TIMEOUT), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.entry_input_speaker_record_timeout.grid(row=9, column=1, columnspan=1 ,padx=5, pady=10, sticky="nsew") + self.entry_input_speaker_record_timeout.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") self.entry_input_speaker_record_timeout.bind("", self.entry_input_speaker_record_timeout_callback) + ## entry input speaker phrase timeout + row +=1 + self.label_input_speaker_phrase_timeout = customtkinter.CTkLabel( + self.tabview_config.tab("Transcription"), + text="Input Speaker Phrase Timeout:", + fg_color="transparent", + font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) + ) + self.label_input_speaker_phrase_timeout.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") + self.entry_input_speaker_phrase_timeout = customtkinter.CTkEntry( + self.tabview_config.tab("Transcription"), + textvariable=customtkinter.StringVar(value=self.parent.INPUT_SPEAKER_PHRASE_TIMEOUT), + font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) + ) + self.entry_input_speaker_phrase_timeout.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") + self.entry_input_speaker_phrase_timeout.bind("", self.entry_input_speaker_phrase_timeout_callback) + + ## entry input speaker max phrases + row +=1 + self.label_input_speaker_max_phrases = customtkinter.CTkLabel( + self.tabview_config.tab("Transcription"), + text="Input Speaker Max Phrases:", + fg_color="transparent", + font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) + ) + self.label_input_speaker_max_phrases.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") + self.entry_input_speaker_max_phrases = customtkinter.CTkEntry( + self.tabview_config.tab("Transcription"), + textvariable=customtkinter.StringVar(value=self.parent.INPUT_SPEAKER_MAX_PHRASES), + font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) + ) + self.entry_input_speaker_max_phrases.grid(row=row, column=1, columnspan=1 ,padx=padx, pady=pady, sticky="nsew") + self.entry_input_speaker_max_phrases.bind("", self.entry_input_speaker_max_phrases_callback) + # tab Parameter ## entry ip address + row = 0 + padx = 5 + pady = 1 self.label_ip_address = customtkinter.CTkLabel( self.tabview_config.tab("Parameter"), text="OSC IP address:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_ip_address.grid(row=0, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_ip_address.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.entry_ip_address = customtkinter.CTkEntry( self.tabview_config.tab("Parameter"), textvariable=customtkinter.StringVar(value=self.parent.OSC_IP_ADDRESS), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.entry_ip_address.grid(row=0, column=1, columnspan=1, padx=1, pady=5, sticky="nsew") + self.entry_ip_address.grid(row=row, column=1, columnspan=1, padx=padx, pady=pady, sticky="nsew") self.entry_ip_address.bind("", self.entry_ip_address_callback) ## entry port + row +=1 self.label_port = customtkinter.CTkLabel( self.tabview_config.tab("Parameter"), text="OSC Port:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_port.grid(row=1, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_port.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.entry_port = customtkinter.CTkEntry( self.tabview_config.tab("Parameter"), textvariable=customtkinter.StringVar(value=self.parent.OSC_PORT), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.entry_port.grid(row=1, column=1, columnspan=1, padx=1, pady=5, sticky="nsew") + self.entry_port.grid(row=row, column=1, columnspan=1, padx=padx, pady=pady, sticky="nsew") self.entry_port.bind("", self.entry_port_callback) ## entry authkey + row +=1 self.label_authkey = customtkinter.CTkLabel( self.tabview_config.tab("Parameter"), text="DeepL Auth Key:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_authkey.grid(row=2, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_authkey.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.entry_authkey = customtkinter.CTkEntry( self.tabview_config.tab("Parameter"), textvariable=customtkinter.StringVar(value=self.parent.AUTH_KEYS["DeepL(auth)"]), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.entry_authkey.grid(row=2, column=1, columnspan=1, padx=1, pady=5, sticky="nsew") + self.entry_authkey.grid(row=row, column=1, columnspan=1, padx=padx, pady=pady, sticky="nsew") self.entry_authkey.bind("", self.entry_authkey_callback) ## entry message format + row +=1 self.label_message_format = customtkinter.CTkLabel( self.tabview_config.tab("Parameter"), text="Message Format:", fg_color="transparent", font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.label_message_format.grid(row=3, column=0, columnspan=1, padx=5, pady=5, sticky="nsw") + self.label_message_format.grid(row=row, column=0, columnspan=1, padx=padx, pady=pady, sticky="nsw") self.entry_message_format = customtkinter.CTkEntry( self.tabview_config.tab("Parameter"), textvariable=customtkinter.StringVar(value=self.parent.MESSAGE_FORMAT), font=customtkinter.CTkFont(family=self.parent.FONT_FAMILY) ) - self.entry_message_format.grid(row=3, column=1, columnspan=1, padx=1, pady=5, sticky="nsew") + self.entry_message_format.grid(row=row, column=1, columnspan=1, padx=padx, pady=pady, sticky="nsew") self.entry_message_format.bind("", self.entry_message_format_callback) def slider_transparency_callback(self, value): @@ -624,6 +716,14 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): self.parent.INPUT_MIC_RECORD_TIMEOUT = int(self.entry_input_mic_record_timeout.get()) utils.save_json(self.parent.PATH_CONFIG, "INPUT_MIC_RECORD_TIMEOUT", self.parent.INPUT_MIC_RECORD_TIMEOUT) + def entry_input_mic_phrase_timeout_callback(self, event): + self.parent.INPUT_MIC_PHRASE_TIMEOUT = int(self.entry_input_mic_phrase_timeout.get()) + utils.save_json(self.parent.PATH_CONFIG, "INPUT_MIC_PHRASE_TIMEOUT", self.parent.INPUT_MIC_PHRASE_TIMEOUT) + + def entry_input_mic_max_phrases_callback(self, event): + self.parent.INPUT_MIC_MAX_PHRASES = int(self.entry_input_mic_max_phrases.get()) + utils.save_json(self.parent.PATH_CONFIG, "INPUT_MIC_MAX_PHRASES", self.parent.INPUT_MIC_MAX_PHRASES) + def optionmenu_input_speaker_device_callback(self, choice): self.parent.CHOICE_SPEAKER_DEVICE = choice utils.save_json(self.parent.PATH_CONFIG, "CHOICE_SPEAKER_DEVICE", self.parent.CHOICE_SPEAKER_DEVICE) @@ -645,6 +745,14 @@ class ToplevelWindowConfig(customtkinter.CTkToplevel): self.parent.INPUT_SPEAKER_RECORD_TIMEOUT = int(self.entry_input_speaker_record_timeout.get()) utils.save_json(self.parent.PATH_CONFIG, "INPUT_SPEAKER_RECORD_TIMEOUT", self.parent.INPUT_SPEAKER_RECORD_TIMEOUT) + def entry_input_speaker_phrase_timeout_callback(self, event): + self.parent.INPUT_SPEAKER_PHRASE_TIMEOUT = int(self.entry_input_speaker_phrase_timeout.get()) + utils.save_json(self.parent.PATH_CONFIG, "INPUT_SPEAKER_PHRASE_TIMEOUT", self.parent.INPUT_SPEAKER_PHRASE_TIMEOUT) + + def entry_input_speaker_max_phrases_callback(self, event): + self.parent.INPUT_SPEAKER_MAX_PHRASES = int(self.entry_input_speaker_max_phrases.get()) + utils.save_json(self.parent.PATH_CONFIG, "INPUT_SPEAKER_MAX_PHRASES", self.parent.INPUT_SPEAKER_MAX_PHRASES) + def entry_ip_address_callback(self, event): self.parent.OSC_IP_ADDRESS = self.entry_ip_address.get() utils.save_json(self.parent.PATH_CONFIG, "OSC_IP_ADDRESS", self.parent.OSC_IP_ADDRESS)