Merge branch 'view' into UI_2.0

This commit is contained in:
Sakamoto Shiina
2023-10-13 21:57:26 +09:00
9 changed files with 126 additions and 63 deletions

View File

@@ -11,8 +11,6 @@ def callbackUpdateSoftware():
model.updateSoftware()
def callbackRestartSoftware():
print("callbackRestartSoftware")
# model.updateSoftware(restart=True)
model.reStartSoftware()
# func transcription send message
@@ -343,22 +341,26 @@ def callbackSetTransparency(value):
def callbackSetAppearance(value):
print("callbackSetAppearance", value)
config.APPEARANCE_THEME = value
view.showRestartButton()
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)
view.showRestartButton()
def callbackSetFontFamily(value):
print("callbackSetFontFamily", value)
config.FONT_FAMILY = value
view.showRestartButton()
def callbackSetUiLanguage(value):
print("callbackSetUiLanguage", value)
value = get_key_by_value(selectable_languages, value)
print("callbackSetUiLanguage__after_get_key_by_value", value)
config.UI_LANGUAGE = value
view.showRestartButton()
# Translation Tab
def callbackSetDeeplAuthkey(value):

View File

@@ -28,6 +28,7 @@ config_window:
config_title: Settings
compact_mode: Compact Mode
version: version %{version}
restart_message: Apply changes with a restart.
side_menu_labels:
appearance: Appearance
translation: Translation
@@ -42,7 +43,7 @@ config_window:
desc: Change the main window's transparency.
appearance_theme:
label: Theme [Under development]
desc: Change the color theme. If you selected "System", it will adjust based on your Windows theme.
desc: Change the color theme. Currently, only the Dark theme is supported. The Light theme is under development.
ui_size:
label: UI Size
font_family:
@@ -58,15 +59,16 @@ config_window:
mic_device:
label: Mic Device
mic_dynamic_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.
label_for_automatic: "Mic Energy Threshold (Current Setting: Automatic)"
desc_for_automatic: "Automatically determine microphone input sensitivity."
label_for_manual: "Mic Energy Threshold (Current Setting: Manual)"
desc_for_manual: "Manually determine the microphone input sensitivity using the slider. Press the microphone icon to input your voice and adjust the sensitivity while monitoring the volume."
mic_record_timeout:
label: Mic Record Timeout
mic_phrase_timeout:
label: Mic Phrase Timeout
mic_max_phrase:
label: Mic Max Phrases
desc: It will stop recording and send the recordings when the set count of phrase(s) is reached.
mic_word_filter:
label: Mic Word Filter
desc: "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"
@@ -74,15 +76,16 @@ config_window:
speaker_device:
label: Speaker Device
speaker_dynamic_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.
label_for_automatic: "Speaker Energy Threshold (Current Setting: Automatic)"
desc_for_automatic: "Automatically determine speaker input sensitivity."
label_for_manual: "Speaker Energy Threshold (Current Setting: Manual)"
desc_for_manual: "Manually determine the speaker 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:
label: Speaker Phrase Timeout
speaker_max_phrase:
label: Speaker Max Phrases
desc: It will stop recording and receive the recordings when the set count of phrase(s) is reached.
auto_clear_the_message_box:
label: Auto Clear The Message Box
@@ -94,10 +97,10 @@ config_window:
desc: Automatically export the conversation messages as a text file.
message_format:
label: Message Format
desc: You can change the decoration of the message you want to send.
desc: "You can change the decoration of the message you want to send.\n[message] will be replaced with the message, and [translation] will be replaced with the translated message."
send_message_to_vrc:
label: Send Message To VRChat
desc: There is a way to use it without sending messages to VRChat. That is not covered by support, though.
desc: There is a way to use it without sending messages to VRChat, but it is not supported. Enable this feature when you intend to send a message to VRChat.
osc_ip_address:
label: OSC IP Address

View File

@@ -1,7 +1,7 @@
main_window:
translation: 翻訳
transcription_send: マイク->チャットボックス
transcription_receive: スピーカー->ログ
transcription_send: 音声認識(マイク)
transcription_receive: 音声認識(スピーカー
foreground: 最前面表示
language_settings: 言語設定
@@ -29,6 +29,7 @@ config_window:
config_title: 設定
compact_mode: コンパクトモード
version: バージョン %{version}
restart_message: 再起動して変更を適用する。
side_menu_labels:
appearance: デザイン
translation: 翻訳
@@ -43,15 +44,14 @@ config_window:
desc: メイン画面の透明度を変更できます。
appearance_theme:
label: 外観テーマ [開発中]
desc: カラーテーマを変更できます。「System」を選択した場合、Windowsのテーマに基づいて自動的に「Dark」か「Lightテーマを判断し、適用します。
desc: カラーテーマを変更できます。現在はDarkテーマのみ対応。Lightテーマは制作中です。
ui_size:
label: UIサイズ
label: UIサイズ
font_family:
label: 使用フォント
ui_language:
label: UIの言語
label: UIの言語 / UI Language
tab_translation: 翻訳
deepl_auth_key:
label: DeepL 認証キー
@@ -60,31 +60,33 @@ config_window:
mic_device:
label: マイク (デバイス)
mic_dynamic_energy_threshold:
label: マイク入力感度の調整(自動)
desc: 有効にするとマイクの入力感度自動的に調節されます。無効の場合は、スライダーを調整して入力感度を手動で決められます。マイクのアイコンを押すと、実際に声を入力し、音量を確認しながら調節できます。
label_for_automatic: "マイク入力感度の調整 (現在の設定: 自動)"
desc_for_automatic: マイクの入力感度自動的に調節す
label_for_manual: "マイク入力感度の調整 (現在の設定: 手動)"
desc_for_manual: スライダーを調整して入力感度を手動で決められます。マイクのアイコンを押すと、実際に声を入力し、音量を確認しながら調節できます。
mic_record_timeout:
label: マイク音声の区切りの無音時間
label: 入力が終了したとみなす無音時間
mic_phrase_timeout:
label: 文字起こしする音声時間の上限
label: 一度に文字起こしする時間の長さ
mic_max_phrase:
label: 保留する単語の上限(マイク)
desc: It will stop recording and send the recordings when the set count of phrase(s) is reached.
label: 送信するまでに保持する単語数
mic_word_filter:
label: ワードフィルタ
label: ワードフィルタ
desc: "設定された単語を検出すると、その文章は送信されません。\n設定の例: AAA,BBB,CCC"
speaker_device:
label: スピーカー(デバイス)
speaker_dynamic_energy_threshold:
label: スピーカー入力感度の調整(自動)
desc: 有効にするとスピーカーの入力感度自動的に調節されます。無効の場合は、スライダーを調整して入力感度を手動で決められます。ヘッドフォンのアイコンを押すと、実際に音声を聞き取り、音量を確認しながら調節できます。
label_for_automatic: "スピーカー入力感度の調整 (現在の設定: 自動)"
desc_for_automatic: スピーカーの入力感度自動的に調節す
label_for_manual: "スピーカー入力感度の調整 (現在の設定: 手動)"
desc_for_manual: スライダーを調整して入力感度を手動で決められます。ヘッドフォンのアイコンを押すと、実実際に音声を聞き取り、音量を確認しながら調節できます。
speaker_record_timeout:
label: スピーカー音声の区切りの無音時間
label: 入力が終了したとみなす無音時間
speaker_phrase_timeout:
label: 文字起こしする音声時間の上限
label: 一度に文字起こしする時間の長さ
speaker_max_phrase:
label: 保留する単語の上限
desc: It will stop recording and receive the recordings when the set count of phrase(s) is reached.
label: ログとして表示するまでに保持する単語
auto_clear_the_message_box:
label: 送信後はチャットボックスを空にする
@@ -93,13 +95,13 @@ config_window:
desc: 文字起こし受信されたメッセージをXSOverlayの機能を使って通知として受け取れます。
auto_export_message_logs:
label: 会話ログを自動的に保存する
desc: テキストファイルとしてログが保存されます。保存先は/logs/...(調整中)
desc: テキストファイルとしてログがlogsフォルダ内に保存されます。
message_format:
label: 送信するメッセージのフォーマット
desc: VRChatで相手に実際に見えるフォーマットを変更できます。
desc: "VRChatで相手に実際に見えるフォーマットを変更できます。\n[message]がメッセージに置換され、\n[translation]が翻訳されたメッセージに置換されます。"
send_message_to_vrc:
label: VRChatにメッセージを送信する
desc: VRChatにメッセージを送信せずに使う方法があります。サポート対象外ですが。
desc: "サポート対象外ですが、VRChatにメッセージを送信せずに使う方法があります。送信したい場合、この機能を有効にする事を忘れないでください。"
osc_ip_address:
label: OSC IP Address

44
view.py
View File

@@ -139,6 +139,7 @@ class View():
VAR_VERSION=StringVar(value=i18n.t("config_window.version", version=config.VERSION)),
VAR_CONFIG_WINDOW_TITLE=StringVar(value=i18n.t("config_window.config_title")),
VAR_CONFIG_WINDOW_COMPACT_MODE_LABEL=StringVar(value=i18n.t("config_window.compact_mode")),
VAR_CONFIG_WINDOW_RESTART_BUTTON_LABEL=StringVar(value=i18n.t("config_window.restart_message")),
# Side Menu Labels
@@ -209,8 +210,8 @@ class View():
VAR_MIC_DEVICE=StringVar(value=config.CHOICE_MIC_DEVICE),
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")),
VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=""),
VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=""),
CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD=None,
VAR_MIC_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD),
@@ -234,7 +235,7 @@ class View():
CALLBACK_FOCUS_OUT_MIC_PHRASE_TIMEOUT=self.setLatestConfigVariable_MicPhraseTimeout,
VAR_LABEL_MIC_MAX_PHRASES=StringVar(value=i18n.t("config_window.mic_max_phrase.label")),
VAR_DESC_MIC_MAX_PHRASES=StringVar(value=i18n.t("config_window.mic_max_phrase.desc")),
VAR_DESC_MIC_MAX_PHRASES=None,
CALLBACK_SET_MIC_MAX_PHRASES=None,
VAR_MIC_MAX_PHRASES=StringVar(value=config.INPUT_MIC_MAX_PHRASES),
CALLBACK_FOCUS_OUT_MIC_MAX_PHRASES=self.setLatestConfigVariable_MicMaxPhrases,
@@ -253,8 +254,8 @@ class View():
VAR_SPEAKER_DEVICE=StringVar(value=config.CHOICE_SPEAKER_DEVICE),
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")),
VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=""),
VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=""),
CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=None,
VAR_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD),
@@ -278,7 +279,7 @@ class View():
CALLBACK_FOCUS_OUT_SPEAKER_PHRASE_TIMEOUT=self.setLatestConfigVariable_SpeakerPhraseTimeout,
VAR_LABEL_SPEAKER_MAX_PHRASES=StringVar(value=i18n.t("config_window.speaker_max_phrase.label")),
VAR_DESC_SPEAKER_MAX_PHRASES=StringVar(value=i18n.t("config_window.speaker_max_phrase.desc")),
VAR_DESC_SPEAKER_MAX_PHRASES=None,
CALLBACK_SET_SPEAKER_MAX_PHRASES=None,
VAR_SPEAKER_MAX_PHRASES=StringVar(value=config.INPUT_SPEAKER_MAX_PHRASES),
CALLBACK_FOCUS_OUT_SPEAKER_MAX_PHRASES=self.setLatestConfigVariable_SpeakerMaxPhrases,
@@ -491,9 +492,13 @@ class View():
if config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD is True:
self.closeMicEnergyThresholdWidget()
else:
self.openMicEnergyThresholdWidget()
if config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD is True:
self.closeSpeakerEnergyThresholdWidget()
else:
self.openSpeakerEnergyThresholdWidget()
# Insert sample conversation for testing.
@@ -710,6 +715,11 @@ class View():
# Config Window
def showRestartButton(self):
vrct_gui.config_window.restart_button_container.grid()
def hideRestartButton(self):
vrct_gui.config_window.restart_button_container.grid_remove()
def _updateActiveSettingBoxTabNo(self, active_setting_box_tab_attr_name:str):
self.view_variable.ACTIVE_SETTING_BOX_TAB_ATTR_NAME = active_setting_box_tab_attr_name
@@ -721,21 +731,27 @@ class View():
def setWidgetsStatus_ConfigWindowCompactModeSwitch_Normal():
vrct_gui.config_window.setting_box_compact_mode_switch_box.configure(state="normal")
@staticmethod
def openMicEnergyThresholdWidget():
def openMicEnergyThresholdWidget(self):
self.view_variable.VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD.set(i18n.t("config_window.mic_dynamic_energy_threshold.label_for_manual"))
self.view_variable.VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD.set(i18n.t("config_window.mic_dynamic_energy_threshold.desc_for_manual"))
vrct_gui.config_window.sb__mic_dynamic_energy_threshold.grid(pady=0)
vrct_gui.config_window.sb__mic_energy_threshold.grid()
@staticmethod
def closeMicEnergyThresholdWidget():
def closeMicEnergyThresholdWidget(self):
self.view_variable.VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD.set(i18n.t("config_window.mic_dynamic_energy_threshold.label_for_automatic"))
self.view_variable.VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD.set(i18n.t("config_window.mic_dynamic_energy_threshold.desc_for_automatic"))
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():
def openSpeakerEnergyThresholdWidget(self):
self.view_variable.VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD.set(i18n.t("config_window.speaker_dynamic_energy_threshold.label_for_manual"))
self.view_variable.VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD.set(i18n.t("config_window.speaker_dynamic_energy_threshold.desc_for_manual"))
vrct_gui.config_window.sb__speaker_dynamic_energy_threshold.grid(pady=0)
vrct_gui.config_window.sb__speaker_energy_threshold.grid()
@staticmethod
def closeSpeakerEnergyThresholdWidget():
def closeSpeakerEnergyThresholdWidget(self):
self.view_variable.VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD.set(i18n.t("config_window.speaker_dynamic_energy_threshold.label_for_automatic"))
self.view_variable.VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD.set(i18n.t("config_window.speaker_dynamic_energy_threshold.desc_for_automatic"))
vrct_gui.config_window.sb__speaker_dynamic_energy_threshold.grid(pady=(0,1))
vrct_gui.config_window.sb__speaker_energy_threshold.grid_remove()

View File

@@ -0,0 +1,37 @@
from customtkinter import CTkFont, CTkFrame, CTkLabel
from utils import callFunctionIfCallable
from ....ui_utils import bindButtonFunctionAndColor
def _createRestartButton(parent_widget, config_window, settings, view_variable, column_num):
parent_widget.grid_columnconfigure(0, weight=1)
config_window.restart_button_container = CTkFrame(parent_widget, corner_radius=settings.uism.RESTART_BUTTON_CORNER_RADIUS, fg_color=settings.ctm.RESTART_BUTTON_BG_COLOR, width=0, height=0, cursor="hand2")
config_window.restart_button_container.grid(row=0, column=column_num, padx=settings.uism.RESTART_BUTTON_PADX, sticky="ew")
config_window.restart_button_container.grid_rowconfigure(0, weight=1)
config_window.restart_button_label = CTkLabel(
config_window.restart_button_container,
height=0,
textvariable=view_variable.VAR_CONFIG_WINDOW_RESTART_BUTTON_LABEL,
anchor="w",
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.RESTART_BUTTON_LABEL_FONT_SIZE, weight="normal"),
text_color=settings.ctm.LABELS_TEXT_COLOR
)
config_window.restart_button_label.grid(row=0, column=0, padx=settings.uism.RESTART_BUTTON_IPADX, pady=settings.uism.RESTART_BUTTON_IPADY)
bindButtonFunctionAndColor(
target_widgets=[
config_window.restart_button_container,
config_window.restart_button_label,
],
enter_color=settings.ctm.RESTART_BUTTON_HOVERED_BG_COLOR,
leave_color=settings.ctm.RESTART_BUTTON_BG_COLOR,
clicked_color=settings.ctm.RESTART_BUTTON_CLICKED_BG_COLOR,
buttonReleasedFunction=lambda _e: callFunctionIfCallable(view_variable.CALLBACK_RESTART_SOFTWARE),
)
config_window.restart_button_container.grid_remove()

View File

@@ -1,6 +1,7 @@
from customtkinter import CTkFont, CTkFrame, CTkLabel
from ._createSettingBoxTitle import _createSettingBoxTitle
from ._createRestartButton import _createRestartButton
from ._createSettingBoxCompactModeButton import _createSettingBoxCompactModeButton
from ....ui_utils import getLatestHeight, getLatestWidth
@@ -22,6 +23,10 @@ def createSettingBoxTopBar(config_window, settings, view_variable):
config_window.setting_box_top_bar.grid_columnconfigure(column_num, weight=1)
column_num+=1
# Restart Button(Tmp)
_createRestartButton(parent_widget=config_window.setting_box_top_bar, config_window=config_window, settings=settings, view_variable=view_variable, column_num=column_num)
column_num+=1
_createSettingBoxCompactModeButton(parent_widget=config_window.setting_box_top_bar, config_window=config_window, settings=settings, view_variable=view_variable, column_num=column_num)
column_num+=1

View File

@@ -43,22 +43,6 @@ def createMainWindowWidgets(vrct_gui, settings, view_variable):
# Main Top Bar Container - Right Side
# start from 3
main_topbar_column=3
# Restart Button(Tmp)
vrct_gui.restart_button_container = createButtonWithImage(
parent_widget=vrct_gui.main_topbar_container,
button_fg_color=settings.ctm.HELP_AND_INFO_BUTTON_BG_COLOR,
button_enter_color=settings.ctm.HELP_AND_INFO_BUTTON_HOVERED_BG_COLOR,
button_clicked_color=settings.ctm.HELP_AND_INFO_BUTTON_CLICKED_BG_COLOR,
button_image_file=settings.image_file.VRCT_LOGO_MARK,
button_image_size=settings.uism.HELP_AND_INFO_BUTTON_SIZE,
button_ipadxy=settings.uism.HELP_AND_INFO_BUTTON_IPADXY,
button_command=lambda e: callFunctionIfCallable(view_variable.CALLBACK_RESTART_SOFTWARE),
corner_radius=settings.uism.HELP_AND_INFO_BUTTON_CORNER_RADIUS,
)
vrct_gui.restart_button_container.grid(row=0, column=main_topbar_column, padx=settings.uism.HELP_AND_INFO_BUTTON_PADX, pady=settings.uism.TOP_BAR_BUTTON_PADY, sticky="e")
main_topbar_column+=1
# Update Available Button
vrct_gui.update_available_container = CTkFrame(
vrct_gui.main_topbar_container,

View File

@@ -225,6 +225,13 @@ class ColorThemeManager():
# Top bar
self.config_window.TOP_BAR_BG_COLOR = self.DARK_850_COLOR
# Restart Button
self.config_window.RESTART_BUTTON_BG_COLOR = self.PRIMARY_600_COLOR
self.config_window.RESTART_BUTTON_HOVERED_BG_COLOR = self.PRIMARY_500_COLOR
self.config_window.RESTART_BUTTON_CLICKED_BG_COLOR = self.PRIMARY_700_COLOR
# Compact Mode
self.config_window.COMPACT_MODE_SWITCH_BOX_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR

View File

@@ -155,6 +155,13 @@ class UiScalingManager():
self.config_window.TOP_BAR_SIDE__CONFIG_TITLE_LEFT_PADX = int(self.config_window.TOP_BAR_SIDE__CONFIG_TITLE_FONT_SIZE + self._calculateUiSize(16))
self.config_window.TOP_BAR_SIDE__TITLE_PADX= self._calculateUiSize(30)
# Restart Button
self.config_window.RESTART_BUTTON_LABEL_FONT_SIZE = self._calculateUiSize(12)
self.config_window.RESTART_BUTTON_PADX = (0, self._calculateUiSize(20))
self.config_window.RESTART_BUTTON_CORNER_RADIUS = self._calculateUiSize(20)
self.config_window.RESTART_BUTTON_IPADX = self._calculateUiSize(20)
self.config_window.RESTART_BUTTON_IPADY = self._calculateUiSize(10)
# Compact Mode
self.config_window.COMPACT_MODE_PADX = (0, self._calculateUiSize(20))
self.config_window.COMPACT_MODE_LABEL_FONT_SIZE = self._calculateUiSize(12)