[Update] Config Window: Add VR Tab. Add Item, Enable OpenVR Switch.

This commit is contained in:
Sakamoto Shiina
2024-04-19 08:59:31 +09:00
parent 192b48accc
commit d715f0b6d6
6 changed files with 64 additions and 0 deletions

View File

@@ -858,6 +858,11 @@ def callbackSetWhisperWeightType(value):
config.SELECTED_TRANSCRIPTION_ENGINE = "Google"
view.showRestartButtonIfRequired()
# VR Tab
def callbackSetEnableOverlayUi(value):
print("callbackSetEnableOverlayUi", value)
config.ENABLE_NOTICE_OVERLAY = value
# Others Tab
def callbackSetEnableAutoClearMessageBox(value):
print("callbackSetEnableAutoClearMessageBox", value)
@@ -1098,6 +1103,9 @@ def createMainWindow(splash):
"callback_set_use_whisper_feature": callbackSetUserWhisperFeature,
"callback_set_whisper_weight_type": callbackSetWhisperWeightType,
# VR Tab
"callback_set_enable_overlay_ui": callbackSetEnableOverlayUi,
# Others Tab
"callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox,
"callback_set_send_only_translated_messages": callbackSetEnableSendOnlyTranslatedMessages,

View File

@@ -81,6 +81,7 @@ config_window:
transcription_mic: Mic
transcription_speaker: Speaker
transcription_internal_model: Transcription Model
vr: VR
others: Others
others_send_message_formats: Message Formats (Send)
others_received_message_formats: Message Formats (XSOverlay & Speaker2Chatbox)
@@ -205,6 +206,11 @@ config_window:
model_template: "%{model_name} model (%{capacity})"
recommended_model_template: "%{model_name} model (%{capacity}) (Recommended)"
enable_overlay_ui:
label: OpenVR
# desc:
auto_clear_the_message_box:
label: Auto Clear The Message Box

11
view.py
View File

@@ -220,6 +220,7 @@ class View():
VAR_SECOND_TITLE_TRANSCRIPTION_MIC=StringVar(value=i18n.t("config_window.side_menu_labels.transcription_mic")),
VAR_SECOND_TITLE_TRANSCRIPTION_SPEAKER=StringVar(value=i18n.t("config_window.side_menu_labels.transcription_speaker")),
VAR_SECOND_TITLE_TRANSCRIPTION_INTERNAL_MODEL=StringVar(value=i18n.t("config_window.side_menu_labels.transcription_internal_model")),
VAR_SIDE_MENU_LABEL_VR=StringVar(value=i18n.t("config_window.side_menu_labels.vr")),
VAR_SIDE_MENU_LABEL_OTHERS=StringVar(value=i18n.t("config_window.side_menu_labels.others")),
VAR_SIDE_MENU_LABEL_ADVANCED_SETTINGS=StringVar(value=i18n.t("config_window.side_menu_labels.advanced_settings")),
@@ -416,6 +417,14 @@ class View():
VAR_WHISPER_WEIGHT_TYPE=StringVar(value=self.getSelectableWhisperWeightTypeDict()[config.WHISPER_WEIGHT_TYPE]),
# VR Tab
VAR_LABEL_ENABLE_OVERLAY_UI=StringVar(value=i18n.t("config_window.enable_overlay_ui.label")),
VAR_DESC_ENABLE_OVERLAY_UI=None,
# VAR_DESC_ENABLE_OVERLAY_UI=StringVar(value=i18n.t("config_window.enable_overlay_ui.desc")),
CALLBACK_SET_ENABLE_OVERLAY_UI=None,
VAR_ENABLE_OVERLAY_UI=BooleanVar(value=config.ENABLE_NOTICE_OVERLAY),
# Others Tab
VAR_LABEL_ENABLE_AUTO_CLEAR_MESSAGE_BOX=StringVar(value=i18n.t("config_window.auto_clear_the_message_box.label")),
VAR_DESC_ENABLE_AUTO_CLEAR_MESSAGE_BOX=None,
@@ -680,6 +689,8 @@ class View():
self.view_variable.CALLBACK_SET_USE_WHISPER_FEATURE=config_window_registers.get("callback_set_use_whisper_feature", None)
self.view_variable.CALLBACK_SET_WHISPER_WEIGHT_TYPE=config_window_registers.get("callback_set_whisper_weight_type", None)
# VR Tab
self.view_variable.CALLBACK_SET_ENABLE_OVERLAY_UI=config_window_registers.get("callback_set_enable_overlay_ui", None)
# Others Tab
self.view_variable.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX=config_window_registers.get("callback_set_enable_auto_clear_chatbox", None)

View File

@@ -11,6 +11,7 @@ from .setting_box_containers.setting_box_transcription import createSettingBox_M
from .setting_box_containers.setting_box_others import createSettingBox_Others, createSettingBox_Others_SendMessageFormats, createSettingBox_Others_ReceivedMessageFormats, createSettingBox_Others_Additional
from .setting_box_containers.setting_box_advanced_settings import createSettingBox_AdvancedSettings
from .setting_box_containers.setting_box_translation import createSettingBox_Translation
from .setting_box_containers.setting_box_vr import createSettingBox_Vr
from .setting_box_containers.setting_box_about_vrct import createSettingBox_AboutVrct
@@ -103,6 +104,21 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
]
},
},
{
"side_menu_tab_attr_name": "side_menu_tab_vr",
"label_attr_name": "label_vr",
"selected_mark_attr_name": "selected_mark_vr",
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_VR,
"setting_box_container_settings": {
"setting_box_container_attr_name": "setting_box_container_vr",
"setting_boxes": [
{
"var_section_title": None,
"setting_box": createSettingBox_Vr
}
]
},
},
{
"side_menu_tab_attr_name": "side_menu_tab_others",
"label_attr_name": "label_others",

View File

@@ -0,0 +1 @@
from .createSettingBox_Vr import createSettingBox_Vr

View File

@@ -0,0 +1,22 @@
from utils import callFunctionIfCallable
from .._SettingBoxGenerator import _SettingBoxGenerator
def createSettingBox_Vr(setting_box_wrapper, config_window, settings, view_variable):
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
createSettingBoxSwitch = sbg.createSettingBoxSwitch
def switchEnableOverlayUiCallback(switch_widget):
callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_OVERLAY_UI, switch_widget.get())
row=0
config_window.sb__enable_overlay_ui = createSettingBoxSwitch(
for_var_label_text=view_variable.VAR_LABEL_ENABLE_OVERLAY_UI,
for_var_desc_text=view_variable.VAR_DESC_ENABLE_OVERLAY_UI,
switch_attr_name="sb__switch_enable_overlay_ui",
command=lambda: switchEnableOverlayUiCallback(config_window.sb__switch_enable_overlay_ui),
variable=view_variable.VAR_ENABLE_OVERLAY_UI
)
config_window.sb__enable_overlay_ui.grid(row=row, pady=0)
row+=1