Merge branch 'view' into UI_2.0
This commit is contained in:
@@ -300,9 +300,9 @@ def callbackOpenConfigWindow():
|
||||
def callbackCloseConfigWindow():
|
||||
model.stopCheckMicEnergy()
|
||||
model.stopCheckSpeakerEnergy()
|
||||
view.replaceMicThresholdCheckButton_Passive()
|
||||
view.initMicThresholdCheckButton()
|
||||
# view.initProgressBar_MicEnergy() # ProgressBarに0をセットしたい
|
||||
view.replaceSpeakerThresholdCheckButton_Passive()
|
||||
view.initSpeakerThresholdCheckButton()
|
||||
# view.initProgressBar_SpeakerEnergy() # ProgressBarに0をセットしたい
|
||||
|
||||
if config.ENABLE_TRANSCRIPTION_SEND is True:
|
||||
@@ -319,18 +319,18 @@ def callbackCloseConfigWindow():
|
||||
def callbackEnableConfigWindowCompactMode():
|
||||
config.IS_CONFIG_WINDOW_COMPACT_MODE = True
|
||||
model.stopCheckMicEnergy()
|
||||
view.replaceMicThresholdCheckButton_Passive()
|
||||
view.initMicThresholdCheckButton()
|
||||
model.stopCheckSpeakerEnergy()
|
||||
view.replaceSpeakerThresholdCheckButton_Passive()
|
||||
view.initSpeakerThresholdCheckButton()
|
||||
|
||||
view.enableConfigWindowCompactMode()
|
||||
|
||||
def callbackDisableConfigWindowCompactMode():
|
||||
config.IS_CONFIG_WINDOW_COMPACT_MODE = False
|
||||
model.stopCheckMicEnergy()
|
||||
view.replaceMicThresholdCheckButton_Passive()
|
||||
view.initMicThresholdCheckButton()
|
||||
model.stopCheckSpeakerEnergy()
|
||||
view.replaceSpeakerThresholdCheckButton_Passive()
|
||||
view.initSpeakerThresholdCheckButton()
|
||||
|
||||
view.disableConfigWindowCompactMode()
|
||||
|
||||
@@ -410,6 +410,10 @@ def callbackSetMicEnergyThreshold(value):
|
||||
def callbackSetMicDynamicEnergyThreshold(value):
|
||||
print("callbackSetMicDynamicEnergyThreshold", value)
|
||||
config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD = value
|
||||
if config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD is True:
|
||||
view.closeMicEnergyThresholdWidget()
|
||||
else:
|
||||
view.openMicEnergyThresholdWidget()
|
||||
|
||||
def setProgressBarMicEnergy(energy):
|
||||
view.updateSetProgressBar_MicEnergy(energy)
|
||||
@@ -417,12 +421,12 @@ def setProgressBarMicEnergy(energy):
|
||||
def callbackCheckMicThreshold(is_turned_on):
|
||||
print("callbackCheckMicThreshold", is_turned_on)
|
||||
if is_turned_on is True:
|
||||
view.setWidgetsStatus_ThresholdCheckButton_Disabled()
|
||||
view.replaceMicThresholdCheckButton_Disabled()
|
||||
model.startCheckMicEnergy(setProgressBarMicEnergy, view.initProgressBar_MicEnergy)
|
||||
view.replaceMicThresholdCheckButton_Active()
|
||||
view.setWidgetsStatus_ThresholdCheckButton_Normal()
|
||||
else:
|
||||
view.setWidgetsStatus_ThresholdCheckButton_Disabled()
|
||||
view.replaceMicThresholdCheckButton_Disabled()
|
||||
model.stopCheckMicEnergy()
|
||||
view.replaceMicThresholdCheckButton_Passive()
|
||||
view.setWidgetsStatus_ThresholdCheckButton_Normal()
|
||||
@@ -503,6 +507,11 @@ def callbackSetSpeakerEnergyThreshold(value):
|
||||
def callbackSetSpeakerDynamicEnergyThreshold(value):
|
||||
print("callbackSetSpeakerDynamicEnergyThreshold", value)
|
||||
config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = value
|
||||
if config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD is True:
|
||||
view.closeSpeakerEnergyThresholdWidget()
|
||||
else:
|
||||
view.openSpeakerEnergyThresholdWidget()
|
||||
|
||||
|
||||
def setProgressBarSpeakerEnergy(energy):
|
||||
view.updateSetProgressBar_SpeakerEnergy(energy)
|
||||
@@ -510,12 +519,12 @@ def setProgressBarSpeakerEnergy(energy):
|
||||
def callbackCheckSpeakerThreshold(is_turned_on):
|
||||
print("callbackCheckSpeakerThreshold", is_turned_on)
|
||||
if is_turned_on is True:
|
||||
view.setWidgetsStatus_ThresholdCheckButton_Disabled()
|
||||
view.replaceSpeakerThresholdCheckButton_Disabled()
|
||||
model.startCheckSpeakerEnergy(setProgressBarSpeakerEnergy, view.initProgressBar_SpeakerEnergy)
|
||||
view.replaceSpeakerThresholdCheckButton_Active()
|
||||
view.setWidgetsStatus_ThresholdCheckButton_Normal()
|
||||
else:
|
||||
view.setWidgetsStatus_ThresholdCheckButton_Disabled()
|
||||
view.replaceSpeakerThresholdCheckButton_Disabled()
|
||||
model.stopCheckSpeakerEnergy()
|
||||
view.replaceSpeakerThresholdCheckButton_Passive()
|
||||
view.setWidgetsStatus_ThresholdCheckButton_Normal()
|
||||
|
||||
@@ -40,7 +40,7 @@ config_window:
|
||||
label: Transparency
|
||||
desc: Change the main window's transparency.
|
||||
appearance_theme:
|
||||
label: Theme
|
||||
label: Theme [Under development]
|
||||
desc: Change the color theme. If you selected "System", it will adjust based on your Windows theme.
|
||||
ui_size:
|
||||
label: UI Size
|
||||
@@ -56,12 +56,9 @@ config_window:
|
||||
label: Mic Host/Driver
|
||||
mic_device:
|
||||
label: Mic Device
|
||||
mic_energy_threshold:
|
||||
label: Mic Energy Threshold
|
||||
desc: Slider to modify the threshold for activating voice input. Press the microphone button to initiate input and speak, allowing you to adjust it while monitoring the actual volume.
|
||||
mic_dynamic_energy_threshold:
|
||||
label: Mic Dynamic Energy Threshold
|
||||
desc: When this feature is selected, it will automatically adjust in a way that works well, based on the set Mic Energy Threshold.
|
||||
label: Mic Energy Threshold (Automatic)
|
||||
desc: Enabling this option will automatically adjust the microphone's input sensitivity. If you disable it, you can manually set the input sensitivity using the slider. Press the microphone icon to input your voice and adjust the sensitivity while monitoring the actual volume.
|
||||
mic_record_timeout:
|
||||
label: Mic Record Timeout
|
||||
mic_phrase_timeout:
|
||||
@@ -75,12 +72,9 @@ config_window:
|
||||
|
||||
speaker_device:
|
||||
label: Speaker Device
|
||||
speaker_energy_threshold:
|
||||
label: Speaker Energy Threshold
|
||||
desc: Slider to modify the threshold for activating voice input. Press the headphones mark button to start input and speak something, so you can adjust it while monitoring the actual volume.
|
||||
speaker_dynamic_energy_threshold:
|
||||
label: Speaker Dynamic Energy Threshold
|
||||
desc: When this feature is selected, it will automatically adjust in a way that works well, based on the set Speaker Energy Threshold.
|
||||
label: Speaker Energy Threshold (Automatic)
|
||||
desc: Enabling this option will automatically adjust the speaker's input sensitivity. If you disable it, you can manually set the input sensitivity using the slider. Press the headphones icon to listen to the audio and adjust the sensitivity while monitoring the volume.
|
||||
speaker_record_timeout:
|
||||
label: Speaker Record Timeout
|
||||
speaker_phrase_timeout:
|
||||
|
||||
@@ -41,7 +41,7 @@ config_window:
|
||||
label: 透明度
|
||||
desc: メイン画面の透明度を変更できます。
|
||||
appearance_theme:
|
||||
label: 外観テーマ
|
||||
label: 外観テーマ [開発中]
|
||||
desc: カラーテーマを変更できます。「System」を選択した場合、Windowsのテーマに基づいて自動的に「Dark」か「Light」テーマを判断し、適用します。
|
||||
ui_size:
|
||||
label: UIのサイズ
|
||||
@@ -58,12 +58,9 @@ config_window:
|
||||
label: マイク(ホスト/ドライバー)
|
||||
mic_device:
|
||||
label: マイク (デバイス)
|
||||
mic_energy_threshold:
|
||||
label: 音声取得のしきい値
|
||||
desc: スライダーを調整してしきい値を決められます。マイクのアイコンを押すと、実際に声を入力し、音量を確認しながら調節できます。
|
||||
mic_dynamic_energy_threshold:
|
||||
label: 音声取得のしきい値の自動調整
|
||||
desc: 有効にすると、設定されたしきい値に応じて、ある程度自動的に調節されます。
|
||||
label: マイク入力感度の調整(自動)
|
||||
desc: 有効にするとマイクの入力感度が自動的に調節されます。無効の場合は、スライダーを調整して入力感度を手動で決められます。マイクのアイコンを押すと、実際に声を入力し、音量を確認しながら調節できます。
|
||||
mic_record_timeout:
|
||||
label: マイク音声の区切りの無音時間
|
||||
mic_phrase_timeout:
|
||||
@@ -77,12 +74,9 @@ config_window:
|
||||
|
||||
speaker_device:
|
||||
label: スピーカー(デバイス)
|
||||
speaker_energy_threshold:
|
||||
label: 音声取得のしきい値
|
||||
desc: スライダーを調整してしきい値を決められます。スピーカーのアイコンを押すと、設定されたデバイスから音を聞き取り、音量を確認しながら調節できます。
|
||||
speaker_dynamic_energy_threshold:
|
||||
label: 音声取得のしきい値の自動調整
|
||||
desc: 有効にすると、設定されたしきい値に応じて、ある程度自動的に調節されます。
|
||||
label: スピーカー入力感度の調整(自動)
|
||||
desc: 有効にするとスピーカーの入力感度が自動的に調節されます。無効の場合は、スライダーを調整して入力感度を手動で決められます。ヘッドフォンのアイコンを押すと、実際に音声を聞き取り、音量を確認しながら調節できます。
|
||||
speaker_record_timeout:
|
||||
label: スピーカー音声の区切りの無音時間
|
||||
speaker_phrase_timeout:
|
||||
|
||||
108
view.py
108
view.py
@@ -203,18 +203,18 @@ class View():
|
||||
CALLBACK_SET_MIC_DEVICE=None,
|
||||
VAR_MIC_DEVICE=StringVar(value=config.CHOICE_MIC_DEVICE),
|
||||
|
||||
VAR_LABEL_MIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_energy_threshold.label")),
|
||||
VAR_DESC_MIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_energy_threshold.desc")),
|
||||
|
||||
VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_dynamic_energy_threshold.label")),
|
||||
VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_dynamic_energy_threshold.desc")),
|
||||
CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD=None,
|
||||
VAR_MIC_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD),
|
||||
|
||||
SLIDER_RANGE_MIC_ENERGY_THRESHOLD=(0, config.MAX_MIC_ENERGY_THRESHOLD),
|
||||
CALLBACK_CHECK_MIC_THRESHOLD=None,
|
||||
VAR_MIC_ENERGY_THRESHOLD__SLIDER=IntVar(value=config.INPUT_MIC_ENERGY_THRESHOLD),
|
||||
VAR_MIC_ENERGY_THRESHOLD__ENTRY=StringVar(value=config.INPUT_MIC_ENERGY_THRESHOLD),
|
||||
CALLBACK_FOCUS_OUT_MIC_ENERGY_THRESHOLD=self.setLatestConfigVariable_MicEnergyThreshold,
|
||||
|
||||
VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_dynamic_energy_threshold.label")),
|
||||
VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_dynamic_energy_threshold.desc")),
|
||||
CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD=None,
|
||||
VAR_MIC_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD),
|
||||
|
||||
VAR_LABEL_MIC_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.mic_record_timeout.label")),
|
||||
VAR_DESC_MIC_RECORD_TIMEOUT=None,
|
||||
@@ -247,18 +247,18 @@ class View():
|
||||
CALLBACK_SET_SPEAKER_DEVICE=None,
|
||||
VAR_SPEAKER_DEVICE=StringVar(value=config.CHOICE_SPEAKER_DEVICE),
|
||||
|
||||
VAR_LABEL_SPEAKER_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_energy_threshold.label")),
|
||||
VAR_DESC_SPEAKER_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_energy_threshold.desc")),
|
||||
|
||||
VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_dynamic_energy_threshold.label")),
|
||||
VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_dynamic_energy_threshold.desc")),
|
||||
CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=None,
|
||||
VAR_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD),
|
||||
|
||||
SLIDER_RANGE_SPEAKER_ENERGY_THRESHOLD=(0, config.MAX_SPEAKER_ENERGY_THRESHOLD),
|
||||
CALLBACK_CHECK_SPEAKER_THRESHOLD=None,
|
||||
VAR_SPEAKER_ENERGY_THRESHOLD__SLIDER=IntVar(value=config.INPUT_SPEAKER_ENERGY_THRESHOLD),
|
||||
VAR_SPEAKER_ENERGY_THRESHOLD__ENTRY=StringVar(value=config.INPUT_SPEAKER_ENERGY_THRESHOLD),
|
||||
CALLBACK_FOCUS_OUT_SPEAKER_ENERGY_THRESHOLD=self.setLatestConfigVariable_SpeakerEnergyThreshold,
|
||||
|
||||
VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_dynamic_energy_threshold.label")),
|
||||
VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_dynamic_energy_threshold.desc")),
|
||||
CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=None,
|
||||
VAR_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD),
|
||||
|
||||
VAR_LABEL_SPEAKER_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.speaker_record_timeout.label")),
|
||||
VAR_DESC_SPEAKER_RECORD_TIMEOUT=None,
|
||||
@@ -447,6 +447,43 @@ class View():
|
||||
self.enableConfigWindowCompactMode()
|
||||
vrct_gui.config_window.setting_box_compact_mode_switch_box.select()
|
||||
|
||||
|
||||
|
||||
if config.CHOICE_MIC_HOST == "NoHost":
|
||||
self.view_variable.VAR_MIC_HOST.set("No Mic Host Detected")
|
||||
|
||||
if config.CHOICE_MIC_DEVICE == "NoDevice":
|
||||
self.view_variable.VAR_MIC_DEVICE.set("No Mic Device Detected")
|
||||
|
||||
if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice":
|
||||
vrct_gui._changeConfigWindowWidgetsStatus(
|
||||
status="disabled",
|
||||
target_names=[
|
||||
"sb__optionmenu_mic_host",
|
||||
"sb__optionmenu_mic_device",
|
||||
]
|
||||
)
|
||||
self.replaceMicThresholdCheckButton_Disabled()
|
||||
|
||||
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
||||
self.view_variable.VAR_SPEAKER_DEVICE.set("No Speaker Device Detected")
|
||||
vrct_gui._changeConfigWindowWidgetsStatus(
|
||||
status="disabled",
|
||||
target_names=[
|
||||
"sb__optionmenu_speaker_device",
|
||||
]
|
||||
)
|
||||
self.replaceSpeakerThresholdCheckButton_Disabled()
|
||||
|
||||
|
||||
|
||||
if config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD is True:
|
||||
self.closeMicEnergyThresholdWidget()
|
||||
|
||||
if config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD is True:
|
||||
self.closeSpeakerEnergyThresholdWidget()
|
||||
|
||||
|
||||
# Insert sample conversation for testing.
|
||||
# self._insertSampleConversationToTextbox()
|
||||
|
||||
@@ -663,6 +700,24 @@ class View():
|
||||
def setWidgetsStatus_ConfigWindowCompactModeSwitch_Normal():
|
||||
vrct_gui.config_window.setting_box_compact_mode_switch_box.configure(state="normal")
|
||||
|
||||
@staticmethod
|
||||
def openMicEnergyThresholdWidget():
|
||||
vrct_gui.config_window.sb__mic_dynamic_energy_threshold.grid(pady=0)
|
||||
vrct_gui.config_window.sb__mic_energy_threshold.grid()
|
||||
@staticmethod
|
||||
def closeMicEnergyThresholdWidget():
|
||||
vrct_gui.config_window.sb__mic_dynamic_energy_threshold.grid(pady=(0,1))
|
||||
vrct_gui.config_window.sb__mic_energy_threshold.grid_remove()
|
||||
|
||||
@staticmethod
|
||||
def openSpeakerEnergyThresholdWidget():
|
||||
vrct_gui.config_window.sb__speaker_dynamic_energy_threshold.grid(pady=0)
|
||||
vrct_gui.config_window.sb__speaker_energy_threshold.grid()
|
||||
@staticmethod
|
||||
def closeSpeakerEnergyThresholdWidget():
|
||||
vrct_gui.config_window.sb__speaker_dynamic_energy_threshold.grid(pady=(0,1))
|
||||
vrct_gui.config_window.sb__speaker_energy_threshold.grid_remove()
|
||||
|
||||
@staticmethod
|
||||
def setWidgetsStatus_ThresholdCheckButton_Disabled():
|
||||
vrct_gui._changeConfigWindowWidgetsStatus(
|
||||
@@ -683,26 +738,55 @@ class View():
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def initMicThresholdCheckButton(self):
|
||||
if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice":
|
||||
self.replaceMicThresholdCheckButton_Disabled()
|
||||
else:
|
||||
self.replaceMicThresholdCheckButton_Passive()
|
||||
|
||||
@staticmethod
|
||||
def replaceMicThresholdCheckButton_Active():
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold.grid_remove()
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__disabled_button_mic_energy_threshold.grid_remove()
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__active_button_mic_energy_threshold.grid()
|
||||
|
||||
@staticmethod
|
||||
def replaceMicThresholdCheckButton_Disabled():
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold.grid_remove()
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__active_button_mic_energy_threshold.grid_remove()
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__disabled_button_mic_energy_threshold.grid()
|
||||
|
||||
@staticmethod
|
||||
def replaceMicThresholdCheckButton_Passive():
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__active_button_mic_energy_threshold.grid_remove()
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__disabled_button_mic_energy_threshold.grid_remove()
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__passive_button_mic_energy_threshold.grid()
|
||||
|
||||
|
||||
|
||||
def initSpeakerThresholdCheckButton(self):
|
||||
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
||||
self.replaceSpeakerThresholdCheckButton_Disabled()
|
||||
else:
|
||||
self.replaceSpeakerThresholdCheckButton_Passive()
|
||||
|
||||
@staticmethod
|
||||
def replaceSpeakerThresholdCheckButton_Active():
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold.grid_remove()
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__disabled_button_speaker_energy_threshold.grid_remove()
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__active_button_speaker_energy_threshold.grid()
|
||||
|
||||
@staticmethod
|
||||
def replaceSpeakerThresholdCheckButton_Disabled():
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold.grid_remove()
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__active_button_speaker_energy_threshold.grid_remove()
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__disabled_button_speaker_energy_threshold.grid()
|
||||
|
||||
@staticmethod
|
||||
def replaceSpeakerThresholdCheckButton_Passive():
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__active_button_speaker_energy_threshold.grid_remove()
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__disabled_button_speaker_energy_threshold.grid_remove()
|
||||
vrct_gui.config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold.grid()
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,16 @@ def _changeConfigWindowWidgetsStatus(config_window, settings, view_variable, sta
|
||||
target_names = ["mic_energy_threshold_check_button", "speaker_energy_threshold_check_button"]
|
||||
|
||||
|
||||
def disableOptionmenuWidget(target_widget):
|
||||
target_widget.label_widget.configure(text_color=settings.ctm.LABELS_TEXT_DISABLED_COLOR)
|
||||
if target_widget.desc_widget is not None:
|
||||
target_widget.desc_widget.configure(text_color=settings.ctm.LABELS_TEXT_DISABLED_COLOR)
|
||||
target_widget.optionmenu_label_widget.configure(text_color=settings.ctm.LABELS_TEXT_DISABLED_COLOR)
|
||||
target_widget.optionmenu_img_widget.configure(image=CTkImage(settings.image_file.ARROW_LEFT_DISABLED.rotate(90), size=settings.uism.SB__OPTIONMENU_IMG_SIZE))
|
||||
target_widget.optionmenu_box.unbindFunction()
|
||||
target_widget.optionmenu_box.configure(cursor="")
|
||||
|
||||
|
||||
for target_name in target_names:
|
||||
match target_name:
|
||||
case "mic_energy_threshold_check_button":
|
||||
@@ -26,6 +36,22 @@ def _changeConfigWindowWidgetsStatus(config_window, settings, view_variable, sta
|
||||
config_window.sb__progressbar_x_slider__passive_button_speaker_energy_threshold.children["!ctklabel"].configure(fg_color=settings.ctm.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_COLOR)
|
||||
|
||||
|
||||
case "sb__optionmenu_mic_host":
|
||||
if status == "disabled":
|
||||
target_widget = config_window.sb__widgets["sb__optionmenu_mic_host"]
|
||||
disableOptionmenuWidget(target_widget)
|
||||
|
||||
case "sb__optionmenu_mic_device":
|
||||
if status == "disabled":
|
||||
target_widget = config_window.sb__widgets["sb__optionmenu_mic_device"]
|
||||
disableOptionmenuWidget(target_widget)
|
||||
|
||||
case "sb__optionmenu_speaker_device":
|
||||
if status == "disabled":
|
||||
target_widget = config_window.sb__widgets["sb__optionmenu_speaker_device"]
|
||||
disableOptionmenuWidget(target_widget)
|
||||
|
||||
|
||||
case _:
|
||||
raise ValueError(f"No matching case for target_name: {target_name}")
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ class ConfigWindow(CTkToplevel):
|
||||
# When the configuration window's compact mode is turned on, it will call `grid_remove()` on each widget appended to this array. In the opposite case, `grid()` will be called.
|
||||
self.additional_widgets = []
|
||||
|
||||
self.sb__widgets = {}
|
||||
|
||||
createConfigWindowTitle(config_window=self, settings=self.settings, view_variable=self._view_variable)
|
||||
|
||||
createSettingBoxTopBar(config_window=self, settings=self.settings, view_variable=self._view_variable)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from functools import partial
|
||||
from types import SimpleNamespace
|
||||
from typing import Union
|
||||
|
||||
from customtkinter import CTkOptionMenu, CTkFont, CTkFrame, CTkLabel, CTkRadioButton, CTkEntry, CTkSlider, CTkSwitch, CTkCheckBox, CTkProgressBar
|
||||
@@ -17,7 +18,9 @@ class _SettingBoxGenerator():
|
||||
|
||||
self.dropdown_menu_window = vrct_gui.vrct_gui.dropdown_menu_window
|
||||
|
||||
def _createSettingBoxFrame(self, for_var_label_text, for_var_desc_text):
|
||||
def _createSettingBoxFrame(self, sb__attr_name, for_var_label_text=None, for_var_desc_text=None):
|
||||
self.config_window.sb__widgets[sb__attr_name] = SimpleNamespace()
|
||||
|
||||
setting_box_frame = CTkFrame(self.parent_widget, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0)
|
||||
|
||||
# "pady=(0,1)" is for bottom padding. It can be removed(override) when you do like "self.attr_name.grid(row=row, pady=0)"
|
||||
@@ -36,16 +39,21 @@ class _SettingBoxGenerator():
|
||||
setting_box_frame_wrapper_fix_border2 = CTkFrame(setting_box_frame, corner_radius=0, width=0, height=0)
|
||||
setting_box_frame_wrapper_fix_border2.grid(row=0, column=1, sticky="ns")
|
||||
|
||||
self._setSettingBoxLabels(setting_box_frame_wrapper, for_var_label_text, for_var_desc_text)
|
||||
if for_var_label_text is not None:
|
||||
self._setSettingBoxLabels(sb__attr_name, setting_box_frame_wrapper, for_var_label_text, for_var_desc_text)
|
||||
|
||||
# setting_box_item_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color="red")
|
||||
setting_box_item_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color=self.settings.ctm.SB__BG_COLOR)
|
||||
setting_box_item_frame.grid(row=0, column=2, padx=0, sticky="nsew")
|
||||
if for_var_label_text is not None:
|
||||
setting_box_item_frame.grid(row=0, column=2, padx=0, sticky="nsew")
|
||||
else:
|
||||
setting_box_item_frame.grid(row=0, columnspan=3, padx=0, sticky="nsew")
|
||||
setting_box_item_frame.grid_rowconfigure((0,2), weight=1)
|
||||
setting_box_item_frame.grid_columnconfigure(0, weight=1)
|
||||
|
||||
return (setting_box_frame, setting_box_item_frame)
|
||||
|
||||
def _setSettingBoxLabels(self, setting_box_frame_wrapper, for_var_label_text, for_var_desc_text=None):
|
||||
def _setSettingBoxLabels(self, sb__attr_name, setting_box_frame_wrapper, for_var_label_text, for_var_desc_text=None):
|
||||
|
||||
setting_box_labels_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0)
|
||||
setting_box_labels_frame.grid(row=0, column=0, padx=0, pady=0, sticky="nsew")
|
||||
@@ -59,6 +67,8 @@ class _SettingBoxGenerator():
|
||||
text_color=self.settings.ctm.LABELS_TEXT_COLOR
|
||||
)
|
||||
setting_box_label.grid(row=0, column=0, padx=0, pady=0, sticky="ew")
|
||||
self.config_window.sb__widgets[sb__attr_name].label_widget = setting_box_label
|
||||
|
||||
|
||||
if for_var_desc_text is not None:
|
||||
setting_box_desc = CTkLabel(
|
||||
@@ -73,17 +83,22 @@ class _SettingBoxGenerator():
|
||||
)
|
||||
setting_box_desc.grid(row=1, column=0, padx=0, pady=(self.settings.uism.SB__DESC_TOP_PADY,0), sticky="ew")
|
||||
self.config_window.additional_widgets.append(setting_box_desc)
|
||||
self.config_window.sb__widgets[sb__attr_name].desc_widget=setting_box_desc
|
||||
else:
|
||||
self.config_window.sb__widgets[sb__attr_name].desc_widget=None
|
||||
|
||||
|
||||
|
||||
|
||||
def createSettingBoxDropdownMenu(self, for_var_label_text, for_var_desc_text, optionmenu_attr_name, command, dropdown_menu_width=None, variable=None, dropdown_menu_values=None):
|
||||
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text)
|
||||
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(optionmenu_attr_name, for_var_label_text, for_var_desc_text)
|
||||
|
||||
def adjustedCommand(value):
|
||||
variable.set(value)
|
||||
command(value)
|
||||
|
||||
|
||||
option_menu_widget = createOptionMenuBox(
|
||||
(option_menu_widget, optionmenu_label_widget, optionmenu_img_widget) = createOptionMenuBox(
|
||||
parent_widget=setting_box_item_frame,
|
||||
optionmenu_bg_color=self.settings.ctm.SB__OPTIONMENU_BG_COLOR,
|
||||
optionmenu_hovered_bg_color=self.settings.ctm.SB__OPTIONMENU_HOVERED_BG_COLOR,
|
||||
@@ -104,6 +119,12 @@ class _SettingBoxGenerator():
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
self.config_window.sb__widgets[optionmenu_attr_name].optionmenu_box = option_menu_widget
|
||||
self.config_window.sb__widgets[optionmenu_attr_name].optionmenu_label_widget = optionmenu_label_widget
|
||||
self.config_window.sb__widgets[optionmenu_attr_name].optionmenu_img_widget = optionmenu_img_widget
|
||||
|
||||
|
||||
option_menu_widget.grid(row=1, column=SETTING_BOX_COLUMN, sticky="e")
|
||||
setattr(self.config_window, optionmenu_attr_name, option_menu_widget)
|
||||
|
||||
@@ -121,8 +142,8 @@ class _SettingBoxGenerator():
|
||||
|
||||
|
||||
|
||||
def createSettingBoxSwitch(self, for_var_label_text, for_var_desc_text, switch_attr_name, is_checked, command):
|
||||
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text)
|
||||
def createSettingBoxSwitch(self, for_var_label_text, for_var_desc_text, switch_attr_name, variable, command):
|
||||
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(switch_attr_name, for_var_label_text, for_var_desc_text)
|
||||
|
||||
switch_widget = CTkSwitch(
|
||||
setting_box_item_frame,
|
||||
@@ -135,6 +156,7 @@ class _SettingBoxGenerator():
|
||||
switch_width=self.settings.uism.SB__SWITCH_BOX_WIDTH,
|
||||
onvalue=True,
|
||||
offvalue=False,
|
||||
variable=variable,
|
||||
command=command,
|
||||
fg_color=self.settings.ctm.SB__SWITCH_BOX_BG_COLOR,
|
||||
# bg_color="red",
|
||||
@@ -142,8 +164,6 @@ class _SettingBoxGenerator():
|
||||
)
|
||||
setattr(self.config_window, switch_attr_name, switch_widget)
|
||||
|
||||
switch_widget.select() if is_checked else switch_widget.deselect()
|
||||
|
||||
switch_widget.grid(row=1, column=SETTING_BOX_COLUMN, sticky="e")
|
||||
|
||||
return setting_box_frame
|
||||
@@ -151,7 +171,7 @@ class _SettingBoxGenerator():
|
||||
|
||||
|
||||
def createSettingBoxCheckbox(self, for_var_label_text, for_var_desc_text, checkbox_attr_name, variable, command):
|
||||
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text)
|
||||
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(checkbox_attr_name, for_var_label_text, for_var_desc_text)
|
||||
|
||||
checkbox_widget = CTkCheckBox(
|
||||
setting_box_item_frame,
|
||||
@@ -185,7 +205,7 @@ class _SettingBoxGenerator():
|
||||
|
||||
|
||||
def createSettingBoxSlider(self, for_var_label_text, for_var_desc_text, slider_attr_name, slider_range, command, variable, slider_number_of_steps: Union[int, None] = None):
|
||||
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text)
|
||||
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(slider_attr_name, for_var_label_text, for_var_desc_text)
|
||||
|
||||
# print(self.settings.uism.SB__SLIDER_WIDTH)
|
||||
# print(self.settings.uism.SB__SLIDER_HEIGHT)
|
||||
@@ -212,12 +232,13 @@ class _SettingBoxGenerator():
|
||||
|
||||
def createSettingBoxProgressbarXSlider(
|
||||
self,
|
||||
for_var_label_text, for_var_desc_text, command,
|
||||
command, progressbar_x_slider_attr_name,
|
||||
entry_attr_name, entry_bind__FocusOut,
|
||||
slider_attr_name, slider_range,
|
||||
progressbar_attr_name,
|
||||
passive_button_attr_name, passive_button_command,
|
||||
active_button_attr_name, active_button_command,
|
||||
disabled_button_attr_name, disabled_button_image_file,
|
||||
button_image_file,
|
||||
|
||||
entry_variable,
|
||||
@@ -227,22 +248,18 @@ class _SettingBoxGenerator():
|
||||
):
|
||||
|
||||
|
||||
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text)
|
||||
|
||||
ENTRY_WIDTH = self.settings.uism.SB__PROGRESSBAR_X_SLIDER__ENTRY_WIDTH
|
||||
BAR_WIDTH = self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BAR_WIDTH
|
||||
|
||||
BAR_PADDING = int(ENTRY_WIDTH + self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BAR_RIGHT_PADX)
|
||||
BUTTON_PADDING = int(BAR_WIDTH + BAR_PADDING + self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BUTTON_RIGHT_PADX)
|
||||
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(progressbar_x_slider_attr_name)
|
||||
|
||||
def adjusted_command__for_entry_bind__Any_KeyRelease(e):
|
||||
command(e.widget.get())
|
||||
def adjusted_command__for_slider(value):
|
||||
command(value)
|
||||
|
||||
setting_box_item_frame.grid_columnconfigure((0,2), weight=0)
|
||||
setting_box_item_frame.grid_columnconfigure(1, weight=1)
|
||||
entry_widget = CTkEntry(
|
||||
setting_box_item_frame,
|
||||
width=ENTRY_WIDTH,
|
||||
width=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__ENTRY_WIDTH,
|
||||
height=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__ENTRY_HEIGHT,
|
||||
textvariable=entry_variable,
|
||||
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__ENTRY_FONT_SIZE, weight="normal"),
|
||||
@@ -252,7 +269,7 @@ class _SettingBoxGenerator():
|
||||
if entry_bind__FocusOut is not None:
|
||||
entry_widget.bind("<FocusOut>", entry_bind__FocusOut, "+")
|
||||
|
||||
entry_widget.grid(row=1, column=SETTING_BOX_COLUMN, padx=0, pady=0, sticky="e")
|
||||
entry_widget.grid(row=1, column=2, padx=0, pady=0, sticky="e")
|
||||
setattr(self.config_window, entry_attr_name, entry_widget)
|
||||
|
||||
|
||||
@@ -268,7 +285,6 @@ class _SettingBoxGenerator():
|
||||
command=adjusted_command__for_slider,
|
||||
variable=slider_variable,
|
||||
height=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__SLIDER_HEIGHT,
|
||||
width=BAR_WIDTH,
|
||||
border_width=0,
|
||||
button_length=SLIDER_BORDER_WIDTH,
|
||||
button_corner_radius=SLIDER_BUTTON_LENGTH,
|
||||
@@ -279,7 +295,7 @@ class _SettingBoxGenerator():
|
||||
progress_color=self.settings.ctm.SB__BG_COLOR,
|
||||
border_color=self.settings.ctm.SB__BG_COLOR,
|
||||
)
|
||||
slider_widget.grid(row=1, column=SETTING_BOX_COLUMN, padx=(0, BAR_PADDING), sticky="e")
|
||||
slider_widget.grid(row=1, column=1, padx=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BAR_PADX, sticky="ew")
|
||||
setattr(self.config_window, slider_attr_name, slider_widget)
|
||||
|
||||
|
||||
@@ -287,12 +303,11 @@ class _SettingBoxGenerator():
|
||||
|
||||
progressbar_widget = CTkProgressBar(
|
||||
setting_box_item_frame,
|
||||
width=BAR_WIDTH,
|
||||
height=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_HEIGHT,
|
||||
corner_radius=0,
|
||||
)
|
||||
setattr(self.config_window, progressbar_attr_name, progressbar_widget)
|
||||
progressbar_widget.grid(row=1, column=SETTING_BOX_COLUMN, padx=(0, BAR_PADDING), sticky="e")
|
||||
progressbar_widget.grid(row=1, column=1, padx=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BAR_PADX, sticky="ew")
|
||||
progressbar_widget.set(0)
|
||||
|
||||
|
||||
@@ -301,16 +316,23 @@ class _SettingBoxGenerator():
|
||||
passive_button_wrapper = self._createPassiveButtonForProgressbarXSlider(setting_box_item_frame, passive_button_command, button_image_file)
|
||||
setattr(self.config_window, passive_button_attr_name, passive_button_wrapper)
|
||||
|
||||
disabled_button_wrapper = self._createDisabledButtonForProgressbarXSlider(setting_box_item_frame, disabled_button_image_file)
|
||||
setattr(self.config_window, disabled_button_attr_name, disabled_button_wrapper)
|
||||
|
||||
active_button_wrapper = self._createActiveButtonForProgressbarXSlider(setting_box_item_frame, active_button_command, button_image_file)
|
||||
setattr(self.config_window, active_button_attr_name, active_button_wrapper)
|
||||
|
||||
passive_button_wrapper.grid(row=1, column=SETTING_BOX_COLUMN, padx=(0,BUTTON_PADDING), sticky="e")
|
||||
passive_button_wrapper.grid(row=1, column=0, padx=0, sticky="w")
|
||||
passive_button_wrapper.configure(corner_radius=int(getLatestWidth(passive_button_wrapper)/2))
|
||||
|
||||
active_button_wrapper.grid(row=1, column=SETTING_BOX_COLUMN, padx=(0,BUTTON_PADDING), sticky="e")
|
||||
disabled_button_wrapper.grid(row=1, column=0, padx=0, sticky="w")
|
||||
disabled_button_wrapper.configure(corner_radius=int(getLatestWidth(passive_button_wrapper)/2))
|
||||
|
||||
active_button_wrapper.grid(row=1, column=0, padx=0, sticky="w")
|
||||
active_button_wrapper.configure(corner_radius=int(getLatestWidth(passive_button_wrapper)/2))
|
||||
|
||||
passive_button_wrapper.grid_remove()
|
||||
disabled_button_wrapper.grid_remove()
|
||||
active_button_wrapper.grid_remove()
|
||||
|
||||
passive_button_wrapper.grid()
|
||||
@@ -320,7 +342,7 @@ class _SettingBoxGenerator():
|
||||
|
||||
|
||||
def createSettingBoxEntry(self, for_var_label_text, for_var_desc_text, entry_attr_name, entry_width, entry_bind__Any_KeyRelease, entry_textvariable, entry_bind__FocusOut=None):
|
||||
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text)
|
||||
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(entry_attr_name, for_var_label_text, for_var_desc_text)
|
||||
|
||||
def adjusted_command__for_entry_bind__Any_KeyRelease(e):
|
||||
entry_bind__Any_KeyRelease(e.widget.get())
|
||||
@@ -469,4 +491,17 @@ class _SettingBoxGenerator():
|
||||
button_ipadxy=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BUTTON_IPADXY,
|
||||
button_command=button_command,
|
||||
)
|
||||
return button_wrapper
|
||||
|
||||
|
||||
|
||||
def _createDisabledButtonForProgressbarXSlider(self, setting_box_progressbar_x_slider_frame, button_image_file):
|
||||
button_wrapper = createButtonWithImage(
|
||||
parent_widget=setting_box_progressbar_x_slider_frame,
|
||||
button_fg_color=self.settings.ctm.SB__PROGRESSBAR_X_SLIDER__PASSIVE_BUTTON_DISABLED_COLOR,
|
||||
button_image_file=button_image_file,
|
||||
button_image_size=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BUTTON_ICON_SIZE,
|
||||
button_ipadxy=self.settings.uism.SB__PROGRESSBAR_X_SLIDER__BUTTON_IPADXY,
|
||||
no_bind=True,
|
||||
)
|
||||
return button_wrapper
|
||||
@@ -5,7 +5,7 @@ from .._SettingBoxGenerator import _SettingBoxGenerator
|
||||
def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_variable):
|
||||
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
|
||||
createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu
|
||||
createSettingBoxCheckbox = sbg.createSettingBoxCheckbox
|
||||
createSettingBoxSwitch = sbg.createSettingBoxSwitch
|
||||
createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider
|
||||
createSettingBoxEntry = sbg.createSettingBoxEntry
|
||||
|
||||
@@ -65,11 +65,19 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari
|
||||
config_window.sb__mic_device.grid(row=row)
|
||||
row+=1
|
||||
|
||||
config_window.sb__mic_dynamic_energy_threshold = createSettingBoxSwitch(
|
||||
for_var_label_text=view_variable.VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD,
|
||||
for_var_desc_text=view_variable.VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD,
|
||||
switch_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),
|
||||
variable=view_variable.VAR_MIC_DYNAMIC_ENERGY_THRESHOLD
|
||||
)
|
||||
config_window.sb__mic_dynamic_energy_threshold.grid(row=row, pady=0)
|
||||
row+=1
|
||||
|
||||
config_window.sb__mic_energy_threshold = createSettingBoxProgressbarXSlider(
|
||||
for_var_label_text=view_variable.VAR_LABEL_MIC_ENERGY_THRESHOLD,
|
||||
for_var_desc_text=view_variable.VAR_DESC_MIC_ENERGY_THRESHOLD,
|
||||
command=slider_input_mic_energy_threshold_callback,
|
||||
progressbar_x_slider_attr_name="sb__mic_energy_threshold",
|
||||
|
||||
entry_attr_name="sb__progressbar_x_slider__entry_mic_energy_threshold",
|
||||
entry_variable=view_variable.VAR_MIC_ENERGY_THRESHOLD__ENTRY,
|
||||
@@ -86,22 +94,13 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari
|
||||
passive_button_command=lambda _e: checkbox_input_mic_threshold_check_callback(True),
|
||||
active_button_attr_name="sb__progressbar_x_slider__active_button_mic_energy_threshold",
|
||||
active_button_command=lambda _e: checkbox_input_mic_threshold_check_callback(False),
|
||||
button_image_file=settings.image_file.MIC_ICON
|
||||
button_image_file=settings.image_file.MIC_ICON,
|
||||
disabled_button_attr_name="sb__progressbar_x_slider__disabled_button_mic_energy_threshold",
|
||||
disabled_button_image_file=settings.image_file.MIC_ICON_DISABLED,
|
||||
)
|
||||
config_window.sb__mic_energy_threshold.grid(row=row)
|
||||
row+=1
|
||||
|
||||
# Mic Dynamic Energy Thresholdも上に引っ付ける予定
|
||||
config_window.sb__mic_dynamic_energy_threshold = createSettingBoxCheckbox(
|
||||
for_var_label_text=view_variable.VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD,
|
||||
for_var_desc_text=view_variable.VAR_DESC_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),
|
||||
variable=view_variable.VAR_MIC_DYNAMIC_ENERGY_THRESHOLD
|
||||
)
|
||||
config_window.sb__mic_dynamic_energy_threshold.grid(row=row)
|
||||
row+=1
|
||||
|
||||
|
||||
# 以下3つも一つの項目にまとめるかもしれない
|
||||
config_window.sb__mic_record_timeout = createSettingBoxEntry(
|
||||
|
||||
@@ -5,7 +5,7 @@ from .._SettingBoxGenerator import _SettingBoxGenerator
|
||||
def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_variable):
|
||||
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
|
||||
createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu
|
||||
createSettingBoxCheckbox = sbg.createSettingBoxCheckbox
|
||||
createSettingBoxSwitch = sbg.createSettingBoxSwitch
|
||||
createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider
|
||||
createSettingBoxEntry = sbg.createSettingBoxEntry
|
||||
|
||||
@@ -48,11 +48,19 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_
|
||||
config_window.sb__speaker_device.grid(row=row)
|
||||
row+=1
|
||||
|
||||
config_window.sb__speaker_dynamic_energy_threshold = createSettingBoxSwitch(
|
||||
for_var_label_text=view_variable.VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
||||
for_var_desc_text=view_variable.VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
||||
switch_attr_name="sb__checkbox_speaker_dynamic_energy_threshold",
|
||||
command=lambda: checkbox_input_speaker_dynamic_energy_threshold_callback(config_window.sb__checkbox_speaker_dynamic_energy_threshold),
|
||||
variable=view_variable.VAR_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
||||
)
|
||||
config_window.sb__speaker_dynamic_energy_threshold.grid(row=row, pady=0)
|
||||
row+=1
|
||||
|
||||
config_window.sb__speaker_energy_threshold = createSettingBoxProgressbarXSlider(
|
||||
for_var_label_text=view_variable.VAR_LABEL_SPEAKER_ENERGY_THRESHOLD,
|
||||
for_var_desc_text=view_variable.VAR_DESC_SPEAKER_ENERGY_THRESHOLD,
|
||||
command=slider_input_speaker_energy_threshold_callback,
|
||||
progressbar_x_slider_attr_name="sb__speaker_energy_threshold",
|
||||
|
||||
entry_variable=view_variable.VAR_SPEAKER_ENERGY_THRESHOLD__ENTRY,
|
||||
entry_attr_name="sb__progressbar_x_slider__entry_speaker_energy_threshold",
|
||||
@@ -69,22 +77,13 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_
|
||||
passive_button_command=lambda _e: checkbox_input_speaker_threshold_check_callback(True),
|
||||
active_button_attr_name="sb__progressbar_x_slider__active_button_speaker_energy_threshold",
|
||||
active_button_command=lambda _e: checkbox_input_speaker_threshold_check_callback(False),
|
||||
button_image_file=settings.image_file.HEADPHONES_ICON
|
||||
button_image_file=settings.image_file.HEADPHONES_ICON,
|
||||
disabled_button_attr_name="sb__progressbar_x_slider__disabled_button_speaker_energy_threshold",
|
||||
disabled_button_image_file=settings.image_file.HEADPHONES_ICON_DISABLED,
|
||||
)
|
||||
config_window.sb__speaker_energy_threshold.grid(row=row)
|
||||
row+=1
|
||||
|
||||
# Speaker Dynamic Energy Thresholdも上に引っ付ける予定
|
||||
config_window.sb__speaker_dynamic_energy_threshold = createSettingBoxCheckbox(
|
||||
for_var_label_text=view_variable.VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
||||
for_var_desc_text=view_variable.VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
||||
checkbox_attr_name="sb__checkbox_speaker_dynamic_energy_threshold",
|
||||
command=lambda: checkbox_input_speaker_dynamic_energy_threshold_callback(config_window.sb__checkbox_speaker_dynamic_energy_threshold),
|
||||
variable=view_variable.VAR_MIC_DYNAMIC_ENERGY_THRESHOLD,
|
||||
)
|
||||
config_window.sb__speaker_dynamic_energy_threshold.grid(row=row)
|
||||
row+=1
|
||||
|
||||
|
||||
# 以下3つも一つの項目にまとめるかもしれない
|
||||
config_window.sb__speaker_record_timeout = createSettingBoxEntry(
|
||||
|
||||
@@ -80,7 +80,7 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
|
||||
sls__box_optionmenu_wrapper.grid(row=1, column=0, sticky="ew")
|
||||
|
||||
sls__box_optionmenu_wrapper.grid_columnconfigure(0, weight=1)
|
||||
sls__selected_language_box = createOptionMenuBox(
|
||||
(sls__selected_language_box, optionmenu_label_widget, optionmenu_img_widget) = createOptionMenuBox(
|
||||
parent_widget=sls__box_optionmenu_wrapper,
|
||||
optionmenu_bg_color=settings.ctm.SLS__OPTIONMENU_BG_COLOR,
|
||||
optionmenu_hovered_bg_color=settings.ctm.SLS__OPTIONMENU_HOVERED_BG_COLOR,
|
||||
|
||||
@@ -220,6 +220,8 @@ class ColorThemeManager():
|
||||
self.config_window.LABELS_TEXT_COLOR = self.config_window.BASIC_TEXT_COLOR
|
||||
self.config_window.LABELS_DESC_TEXT_COLOR = self.DARK_500_COLOR
|
||||
|
||||
self.config_window.LABELS_TEXT_DISABLED_COLOR = self.DARK_600_COLOR
|
||||
|
||||
|
||||
# Top bar
|
||||
self.config_window.TOP_BAR_BG_COLOR = self.DARK_850_COLOR
|
||||
|
||||
@@ -240,12 +240,10 @@ class UiScalingManager():
|
||||
self.config_window.SB__PROGRESSBAR_X_SLIDER__ENTRY_WIDTH = self.config_window.RESPONSIVE_UI_SIZE_INT_50
|
||||
self.config_window.SB__PROGRESSBAR_X_SLIDER__ENTRY_HEIGHT = self.config_window.SB__ENTRY_HEIGHT
|
||||
self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_HEIGHT = self._calculateUiSize(40)
|
||||
self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_LENGTH = self._calculateUiSize(2)
|
||||
self.config_window.SB__PROGRESSBAR_X_SLIDER__BAR_WIDTH = self._calculateUiSize(200)
|
||||
self.config_window.SB__PROGRESSBAR_X_SLIDER__PROGRESSBAR_HEIGHT = self._calculateUiSize(8)
|
||||
self.config_window.SB__PROGRESSBAR_X_SLIDER__BAR_RIGHT_PADX = self._calculateUiSize(20)
|
||||
self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_LENGTH = self._calculateUiSize(2)
|
||||
self.config_window.SB__PROGRESSBAR_X_SLIDER__BAR_PADX = (self._calculateUiSize(30), self._calculateUiSize(30))
|
||||
|
||||
self.config_window.SB__PROGRESSBAR_X_SLIDER__BUTTON_RIGHT_PADX = self._calculateUiSize(20)
|
||||
self.config_window.SB__PROGRESSBAR_X_SLIDER__BUTTON_IPADXY = self._calculateUiSize(10)
|
||||
self.config_window.SB__PROGRESSBAR_X_SLIDER__BUTTON_ICON_SIZE = self._calculateUiSize(20)
|
||||
|
||||
|
||||
@@ -78,6 +78,11 @@ def bindButtonFunctionAndColor(target_widgets, enter_color, leave_color, clicked
|
||||
bindButtonPressColor(target_widgets, clicked_color, enter_color)
|
||||
bindButtonReleaseFunction(target_widgets, buttonReleasedFunction)
|
||||
|
||||
def unbindEnterLEaveButtonPressButtonReleaseFunction(target_widgets):
|
||||
for target_widget in target_widgets:
|
||||
for event_name in ["<Enter>", "<Leave>", "<ButtonPress>", "<ButtonRelease>"]:
|
||||
target_widget.unbind(event_name)
|
||||
|
||||
def unbindEventFromActiveTabWidget(active_tab_widget):
|
||||
for event_name in ["<Enter>", "<Leave>", "<ButtonPress>", "<ButtonRelease>"]:
|
||||
active_tab_widget.unbind(event_name)
|
||||
@@ -121,17 +126,19 @@ def switchTabsColor(target_widget, tab_buttons, active_bg_color, active_text_col
|
||||
|
||||
|
||||
|
||||
def createButtonWithImage(parent_widget, button_fg_color, button_enter_color, button_clicked_color, button_image_file, button_image_size, button_ipadxy, button_command, corner_radius: int = 0):
|
||||
button_wrapper = CTkFrame(parent_widget, corner_radius=corner_radius, fg_color=button_fg_color, height=0, width=0, cursor="hand2")
|
||||
def createButtonWithImage(parent_widget, button_image_size, button_ipadxy, button_fg_color, button_enter_color=None, button_clicked_color=None, button_image_file=None, button_command=None, corner_radius:int=0, no_bind:bool=False):
|
||||
button_wrapper = CTkFrame(parent_widget, corner_radius=corner_radius, fg_color=button_fg_color, height=0, width=0)
|
||||
|
||||
button_widget = CTkLabel(
|
||||
button_wrapper,
|
||||
text=None,
|
||||
height=0,
|
||||
image=CTkImage((button_image_file),size=(button_image_size,button_image_size)),
|
||||
)
|
||||
button_widget.grid(row=0, column=0, padx=button_ipadxy, pady=button_ipadxy)
|
||||
button_widget = CTkLabel(
|
||||
button_wrapper,
|
||||
text=None,
|
||||
height=0,
|
||||
image=CTkImage((button_image_file),size=(button_image_size,button_image_size)),
|
||||
)
|
||||
button_widget.grid(row=0, column=0, padx=button_ipadxy, pady=button_ipadxy)
|
||||
|
||||
if no_bind is False:
|
||||
button_wrapper.configure(cursor="hand2")
|
||||
bindButtonFunctionAndColor(
|
||||
target_widgets=[button_wrapper, button_widget],
|
||||
enter_color=button_enter_color,
|
||||
@@ -140,7 +147,7 @@ def createButtonWithImage(parent_widget, button_fg_color, button_enter_color, bu
|
||||
buttonReleasedFunction=button_command,
|
||||
)
|
||||
|
||||
return button_wrapper
|
||||
return button_wrapper
|
||||
|
||||
|
||||
def createOptionMenuBox(parent_widget, optionmenu_bg_color, optionmenu_hovered_bg_color, optionmenu_clicked_bg_color, optionmenu_ipadx, optionmenu_ipady, variable, font_family, font_size, text_color, image_file, image_size, optionmenu_clicked_command, optionmenu_position=None, optionmenu_padx_between_img=0, optionmenu_min_height=None, optionmenu_min_width=None, setattr_widget=None, image_widget_attr_name=None):
|
||||
@@ -192,7 +199,13 @@ def createOptionMenuBox(parent_widget, optionmenu_bg_color, optionmenu_hovered_b
|
||||
|
||||
bindButtonReleaseFunction([optionmenu_label_wrapper, option_menu_box, optionmenu_label_widget, optionmenu_img_widget], optionmenu_clicked_command)
|
||||
|
||||
return option_menu_box
|
||||
def unbindEventFromWidgets():
|
||||
unbindEnterLEaveButtonPressButtonReleaseFunction([optionmenu_label_wrapper, option_menu_box, optionmenu_label_widget, optionmenu_img_widget])
|
||||
|
||||
option_menu_box.unbindFunction = unbindEventFromWidgets
|
||||
|
||||
|
||||
return (option_menu_box, optionmenu_label_widget, optionmenu_img_widget)
|
||||
|
||||
|
||||
def applyUiScalingAndFixTheBugScrollBar(scrollbar_widget, padx, width):
|
||||
|
||||
Reference in New Issue
Block a user