From d715f0b6d6bc17c33cb3c776631e57660dc68264 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 19 Apr 2024 08:59:31 +0900 Subject: [PATCH] [Update] Config Window: Add VR Tab. Add Item, Enable OpenVR Switch. --- controller.py | 8 +++++++ locales/en.yml | 6 +++++ view.py | 11 ++++++++++ .../createSideMenuAndSettingsBoxContainers.py | 16 ++++++++++++++ .../setting_box_vr/__init__.py | 1 + .../setting_box_vr/createSettingBox_Vr.py | 22 +++++++++++++++++++ 6 files changed, 64 insertions(+) create mode 100644 vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_vr/__init__.py create mode 100644 vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_vr/createSettingBox_Vr.py diff --git a/controller.py b/controller.py index ef639284..ef3079e8 100644 --- a/controller.py +++ b/controller.py @@ -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, diff --git a/locales/en.yml b/locales/en.yml index 4182b00f..670d488f 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -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 diff --git a/view.py b/view.py index f66a30e9..b8dc7080 100644 --- a/view.py +++ b/view.py @@ -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) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py index b0649e4c..c6f55358 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/createSideMenuAndSettingsBoxContainers.py @@ -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", diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_vr/__init__.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_vr/__init__.py new file mode 100644 index 00000000..78090aef --- /dev/null +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_vr/__init__.py @@ -0,0 +1 @@ +from .createSettingBox_Vr import createSettingBox_Vr \ No newline at end of file diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_vr/createSettingBox_Vr.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_vr/createSettingBox_Vr.py new file mode 100644 index 00000000..97704529 --- /dev/null +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_vr/createSettingBox_Vr.py @@ -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 \ No newline at end of file