diff --git a/locales/en.yml b/locales/en.yml index 9718045e..2951af23 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -66,6 +66,17 @@ selectable_language_window: go_back_button: Go Back +overlay_settings: + restore_default_settings: Restore Default Settings + opacity: Opacity + ui_scaling: UI Scaling + x_position: X-axis (left-right) + y_position: Y-axis (up-down) + depth: Z-axis (front-back) + display_duration: Display duration + fadeout_duration: Fadeout duration + + config_window: config_title: Settings compact_mode: Compact Mode @@ -208,8 +219,9 @@ config_window: enable_overlay_small_log: - label: OpenVR + label: Enable Overlay # desc: + open_overlay_settings: Open Overlay Customized Settings auto_clear_the_message_box: label: Auto Clear The Message Box @@ -224,7 +236,7 @@ config_window: show_and_disable_enter_key: Show and disable to send when pressed enter key notice_xsoverlay: - label: Notification XSOverlay (VR Only) + label: Notification XSOverlay desc: Notify received messages by using XSOverlay's notification feature. auto_export_message_logs: diff --git a/locales/ja.yml b/locales/ja.yml index e89bfdba..bd550712 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -65,6 +65,17 @@ selectable_language_window: go_back_button: 戻る +overlay_settings: + restore_default_settings: 初期値に戻す + opacity: 透明度 + ui_scaling: サイズ + x_position: X軸(左右) + y_position: Y軸(上下) + depth: Z軸(前後) + display_duration: 表示時間 + fadeout_duration: フェードアウト時間 + + config_window: config_title: 設定 compact_mode: コンパクトモード @@ -204,6 +215,13 @@ config_window: recommended_model_template: "%{model_name} モデル (%{capacity}) (推奨)" + enable_overlay_small_log: + label: Overlay機能を有効 + # desc: + open_overlay_settings: Overlay詳細設定を開く + + + auto_clear_the_message_box: label: 送信後はチャットボックスを空にする @@ -217,7 +235,7 @@ config_window: show_and_disable_enter_key: 表示し、エンターキーでの送信を無効 notice_xsoverlay: - label: XSOverlayでの通知受け取り機能を有効 (VR限定) + label: XSOverlayでの通知受け取り機能を有効 desc: 文字起こし (受信) されたメッセージをXSOverlayの機能を使って通知として受け取れます。 auto_export_message_logs: diff --git a/locales/ko.yml b/locales/ko.yml index 06cfcb65..ed8f8ddf 100644 --- a/locales/ko.yml +++ b/locales/ko.yml @@ -217,7 +217,7 @@ config_window: show_and_disable_enter_key: 표시 (Enter 키 전송 비활성화) notice_xsoverlay: - label: XSOverlay에서 알림 수신 기능 활성화 (VR 전용) + label: XSOverlay에서 알림 수신 기능 활성화 desc: 수신된 메시지를 XSOverlay의 기능을 통해 알림으로 받아볼 수 있습니다. auto_export_message_logs: diff --git a/view.py b/view.py index 989847b9..db7f58f8 100644 --- a/view.py +++ b/view.py @@ -139,18 +139,20 @@ class View(): - # VR Settings - VAR_VR_SETTINGS=StringVar(value="VR Settings"), - CALLBACK_SET_CALLBACK_OPEN_VR_SETTINGS_WINDOW=self._openVrSettingsWindow, + # Overlay Settings + VAR_OVERLAY_SETTINGS=StringVar(value="Overlay Settings"), + CALLBACK_SET_OPEN_OVERLAY_SETTINGS_WINDOW=self._openVrSettingsWindow, + VAR_TO_DEFAULT_OVERLAY_SETTINGS=StringVar(value=i18n.t("overlay_settings.restore_default_settings")), + CALLBACK_SET_TO_DEFAULT_OVERLAY_SETTINGS=self._toDefaultOverlaySettings, - VAR_LABEL_OVERLAY_OPACITY=StringVar(value="Opacity"), + VAR_LABEL_OVERLAY_OPACITY=StringVar(value=i18n.t("overlay_settings.opacity")), SLIDER_RANGE_OVERLAY_OPACITY=(0.1, 1.0), NUMBER_OF_STEPS_OVERLAY_OPACITY=18, VAR_OVERLAY_OPACITY=DoubleVar(value=config.OVERLAY_SETTINGS["opacity"]), VAR_CURRENT_VALUE_OVERLAY_OPACITY=StringVar(value=floatToPctStr(config.OVERLAY_SETTINGS["opacity"])), - VAR_LABEL_OVERLAY_UI_SCALING=StringVar(value="Ui Scaling"), + VAR_LABEL_OVERLAY_UI_SCALING=StringVar(value=i18n.t("overlay_settings.ui_scaling")), SLIDER_RANGE_OVERLAY_UI_SCALING=(0.4, 2.0), NUMBER_OF_STEPS_OVERLAY_UI_SCALING=16, VAR_OVERLAY_UI_SCALING=DoubleVar(value=config.OVERLAY_SETTINGS["ui_scaling"]), @@ -160,31 +162,31 @@ class View(): CALLBACK_SET_OVERLAY_SMALL_LOG_SETTINGS=None, - VAR_LABEL_OVERLAY_SMALL_LOG_X_POS=StringVar(value="X_position"), + VAR_LABEL_OVERLAY_SMALL_LOG_X_POS=StringVar(value=i18n.t("overlay_settings.x_position")), SLIDER_RANGE_OVERLAY_SMALL_LOG_X_POS=(-0.5, 0.5), NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_X_POS=100, VAR_OVERLAY_SMALL_LOG_X_POS=DoubleVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"]), VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_X_POS=StringVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"]), - VAR_LABEL_OVERLAY_SMALL_LOG_Y_POS=StringVar(value="Y_position"), - SLIDER_RANGE_OVERLAY_SMALL_LOG_Y_POS=(-0.5, 0.5), - NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_Y_POS=100, + VAR_LABEL_OVERLAY_SMALL_LOG_Y_POS=StringVar(value=i18n.t("overlay_settings.y_position")), + SLIDER_RANGE_OVERLAY_SMALL_LOG_Y_POS=(-0.8, 0.8), + NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_Y_POS=160, VAR_OVERLAY_SMALL_LOG_Y_POS=DoubleVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"]), VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_Y_POS=StringVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"]), - VAR_LABEL_OVERLAY_SMALL_LOG_DEPTH=StringVar(value="Depth"), + VAR_LABEL_OVERLAY_SMALL_LOG_DEPTH=StringVar(value=i18n.t("overlay_settings.depth")), SLIDER_RANGE_OVERLAY_SMALL_LOG_DEPTH=(0.5, 1.5), NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_DEPTH=100, VAR_OVERLAY_SMALL_LOG_DEPTH=DoubleVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["depth"]), VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_DEPTH=StringVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["depth"]), - VAR_LABEL_OVERLAY_SMALL_LOG_DISPLAY_DURATION=StringVar(value="Display Duration"), + VAR_LABEL_OVERLAY_SMALL_LOG_DISPLAY_DURATION=StringVar(value=i18n.t("overlay_settings.display_duration")), SLIDER_RANGE_OVERLAY_SMALL_LOG_DISPLAY_DURATION=(1, 60), NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_DISPLAY_DURATION=59, VAR_OVERLAY_SMALL_LOG_DISPLAY_DURATION=IntVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"]), VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_DISPLAY_DURATION=StringVar(value=f"{config.OVERLAY_SMALL_LOG_SETTINGS['display_duration']} second(s)"), - VAR_LABEL_OVERLAY_SMALL_LOG_FADEOUT_DURATION=StringVar(value="Fadeout Duration"), + VAR_LABEL_OVERLAY_SMALL_LOG_FADEOUT_DURATION=StringVar(value=i18n.t("overlay_settings.fadeout_duration")), SLIDER_RANGE_OVERLAY_SMALL_LOG_FADEOUT_DURATION=(0, 5), NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_FADEOUT_DURATION=5, VAR_OVERLAY_SMALL_LOG_FADEOUT_DURATION=IntVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"]), @@ -482,6 +484,7 @@ class View(): # VAR_DESC_ENABLE_OVERLAY_SMALL_LOG=StringVar(value=i18n.t("config_window.enable_overlay_small_log.desc")), CALLBACK_SET_ENABLE_OVERLAY_SMALL_LOG=None, VAR_ENABLE_OVERLAY_SMALL_LOG=BooleanVar(value=config.ENABLE_OVERLAY_SMALL_LOG), + VAR_OPEN_OVERLAY_SETTINGS_BUTTON=StringVar(value=i18n.t("config_window.enable_overlay_small_log.open_overlay_settings")), # Others Tab @@ -1110,6 +1113,34 @@ class View(): DICT_DATA["large-v3"]: callI18n("large-v3", "2.87GB"), } + + def _toDefaultOverlaySettings(self): + INIT_OVERLAY_SETTINGS = { + "opacity": 1.0, + "ui_scaling": 1.0, + } + INIT_OVERLAY_SMALL_LOG_SETTINGS = { + "x_pos": 0.0, + "y_pos": -0.41, + "depth": 1.0, + "display_duration": 5, + "fadeout_duration": 2, + } + for key in INIT_OVERLAY_SETTINGS.keys(): + callFunctionIfCallable(self.view_variable.CALLBACK_SET_OVERLAY_SETTINGS, INIT_OVERLAY_SETTINGS[key], key) + + for key in INIT_OVERLAY_SMALL_LOG_SETTINGS.keys(): + callFunctionIfCallable(self.view_variable.CALLBACK_SET_OVERLAY_SMALL_LOG_SETTINGS, INIT_OVERLAY_SMALL_LOG_SETTINGS[key], key) + + self.setLatestConfigVariable("OverlayOpacity") + self.setLatestConfigVariable("OverlayUiScaling") + + self.setLatestConfigVariable("OverlaySmallLogXPos") + self.setLatestConfigVariable("OverlaySmallLogYPos") + self.setLatestConfigVariable("OverlaySmallLogDepth") + self.setLatestConfigVariable("OverlaySmallLogDisplayDuration") + self.setLatestConfigVariable("OverlaySmallLogFadeoutDuration") + # Open Webpage Functions def openWebPage_Booth(self): self.openWebPage(config.BOOTH_URL) @@ -1159,9 +1190,13 @@ class View(): url = "https://github.com/misyaguziya/VRCT" case ("CONTACT_US"): url = "https://docs.google.com/forms/d/e/1FAIpQLSei-xoydOY60ivXqhOjaTzNN8PiBQIDcNhzfy6cw2sjYkcg_g/viewform" + case ("SUPPORTER_REGISTRATION"): url = "https://docs.google.com/forms/d/e/1FAIpQLSepLzdEOTJQFVHdOOxAA0dix3zCmnNBlmH4XWon5FldXkIiqw/viewform" + case ("POSTER_CONTACT_US"): + url = "https://docs.google.com/forms/d/e/1FAIpQLScwt19eX4Lkj_4w9J5H_3a-bkzXs6rkOc0B-0ZTVVfHKyiU7g/viewform" + case ("X_SHIINA_POSTER_SHOWCASE_POST"): if arg is None: @@ -1823,6 +1858,37 @@ class View(): case "ReceivedMessageFormatWithT": self.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T) + + + case "OverlayOpacity": + self.view_variable.VAR_OVERLAY_OPACITY.set(config.OVERLAY_SETTINGS["opacity"]) + self.view_variable.VAR_CURRENT_VALUE_OVERLAY_OPACITY.set(floatToPctStr(config.OVERLAY_SETTINGS["opacity"])) + + case "OverlayUiScaling": + self.view_variable.VAR_OVERLAY_UI_SCALING.set(config.OVERLAY_SETTINGS["ui_scaling"]) + self.view_variable.VAR_CURRENT_VALUE_OVERLAY_UI_SCALING.set(floatToPctStr(config.OVERLAY_SETTINGS["ui_scaling"])) + + + case "OverlaySmallLogXPos": + self.view_variable.VAR_OVERLAY_SMALL_LOG_X_POS.set(config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"]) + self.view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_X_POS.set(config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"]) + + case "OverlaySmallLogYPos": + self.view_variable.VAR_OVERLAY_SMALL_LOG_Y_POS.set(config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"]) + self.view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_Y_POS.set(config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"]) + + case "OverlaySmallLogDepth": + self.view_variable.VAR_OVERLAY_SMALL_LOG_DEPTH.set(config.OVERLAY_SMALL_LOG_SETTINGS["depth"]) + self.view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_DEPTH.set(config.OVERLAY_SMALL_LOG_SETTINGS["depth"]) + + case "OverlaySmallLogDisplayDuration": + self.view_variable.VAR_OVERLAY_SMALL_LOG_DISPLAY_DURATION.set(config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"]) + self.view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_DISPLAY_DURATION.set(f"{config.OVERLAY_SMALL_LOG_SETTINGS['display_duration']} second(s)") + + case "OverlaySmallLogFadeoutDuration": + self.view_variable.VAR_OVERLAY_SMALL_LOG_FADEOUT_DURATION.set(config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"]) + self.view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_FADEOUT_DURATION.set(f"{config.OVERLAY_SMALL_LOG_SETTINGS['fadeout_duration']} second(s)") + case _: raise ValueError(f"No matching case for target_name: {target_name}") diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py index 60386162..751211fc 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py @@ -998,6 +998,72 @@ class _SettingBoxGenerator(): + def createSettingBox_Overlay(self, + for_var_label_text, for_var_desc_text, + switch_attr_name, + variable, + command, + for_var_button_label, + label_button_clicked_command, + ): + + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(switch_attr_name, for_var_label_text, for_var_desc_text) + + + all_wrapper = CTkFrame(setting_box_item_frame, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) + all_wrapper.grid(row=1, column=0, sticky="ew") + + all_wrapper.grid_columnconfigure(1, weight=1) + + + + + switch_widget = CTkSwitch( + all_wrapper, + text=None, + height=0, + width=0, + corner_radius=int(self.settings.uism.SB__SWITCH_BOX_HEIGHT/2), + border_width=0, + switch_height=self.settings.uism.SB__SWITCH_BOX_HEIGHT, + 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, + progress_color=self.settings.ctm.SB__SWITCH_BOX_ACTIVE_BG_COLOR, + button_color=self.settings.ctm.SB__SWITCH_BOX_BUTTON_COLOR, + button_hover_color=self.settings.ctm.SB__SWITCH_BOX_BUTTON_HOVERED_COLOR, + ) + setattr(self.config_window, switch_attr_name, switch_widget) + + self.config_window.sb__widgets[switch_attr_name].switch_box = switch_widget + + switch_widget.grid(row=0, pady=20, column=SETTING_BOX_COLUMN) + + + (open_page_button, label_button_label_widget) = createLabelButton( + parent_widget=all_wrapper, + label_button_bg_color=self.settings.ctm.SB__BUTTON_COLOR, + label_button_hovered_bg_color=self.settings.ctm.SB__BUTTON_HOVERED_COLOR, + label_button_clicked_bg_color=self.settings.ctm.SB__BUTTON_CLICKED_COLOR, + label_button_ipadx=self.settings.uism.SB__AUTHKEY_WEBPAGE_BUTTON_IPADX, + label_button_ipady=self.settings.uism.SB__AUTHKEY_WEBPAGE_BUTTON_IPADY, + variable=for_var_button_label, + font_family=self.settings.FONT_FAMILY, + font_size=self.settings.uism.SB__AUTHKEY_WEBPAGE_BUTTON_LABEL_FONT_SIZE, + text_color=self.settings.ctm.LABELS_TEXT_COLOR, + label_button_clicked_command=label_button_clicked_command, + + label_button_position="center", + ) + open_page_button.grid(row=1, column=SETTING_BOX_COLUMN, pady=(self.settings.uism.SB__OPEN_OVERLAY_SETTINGS_WINDOW,0)) + + + return setting_box_frame + + def createSettingBoxButtonWithImage( self, for_var_label_text, for_var_desc_text, diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_about_vrct/createSettingBox_AboutVrct.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_about_vrct/createSettingBox_AboutVrct.py index a8acee73..261a4a79 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_about_vrct/createSettingBox_AboutVrct.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_about_vrct/createSettingBox_AboutVrct.py @@ -589,7 +589,7 @@ def createSettingBox_AboutVrct(setting_box_wrapper, config_window, settings, vie poster_tell_us_message = createTellUsButton( parent_frame=poster_showcase_contents_wrapper, image_file_name=settings.about_vrct.image_file.POSTER_TELL_US_MESSAGE, - callback=lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "TEMP"), + callback=lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_ABOUT_VRCT, "POSTER_CONTACT_US"), ) poster_tell_us_message.grid(column=0, row=1, columnspan=2, padx=0, pady=(about_vrct_uism.POSTER_TELL_US_MESSAGE_TOP_PADY,0), sticky="nse") diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py index b32116fe..8f3f9bf3 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_others/createSettingBox_Others.py @@ -18,9 +18,6 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v def checkboxSendMessageButtonTypeCallback(): callFunctionIfCallable(view_variable.CALLBACK_SET_SEND_MESSAGE_BUTTON_TYPE, view_variable.VAR_SEND_MESSAGE_BUTTON_TYPE.get()) - def checkboxNoticeXsoverlayCallback(checkbox_box_widget): - callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, checkbox_box_widget.get()) - def checkboxAutoExportMessageLogsCallback(checkbox_box_widget): callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_AUTO_EXPORT_MESSAGE_LOGS, checkbox_box_widget.get()) @@ -63,16 +60,6 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v config_window.sb__send_message_button_type.grid(row=row) row+=1 - config_window.sb__notice_xsoverlay = createSettingBoxCheckbox( - for_var_label_text=view_variable.VAR_LABEL_ENABLE_NOTICE_XSOVERLAY, - for_var_desc_text=view_variable.VAR_DESC_ENABLE_NOTICE_XSOVERLAY, - checkbox_attr_name="sb__checkbox_notice_xsoverlay", - command=lambda: checkboxNoticeXsoverlayCallback(config_window.sb__checkbox_notice_xsoverlay), - variable=view_variable.VAR_ENABLE_NOTICE_XSOVERLAY, - ) - config_window.sb__notice_xsoverlay.grid(row=row) - row+=1 - config_window.sb__auto_export_message_logs = createSettingBoxAutoExportMessageLogs( for_var_label_text=view_variable.VAR_LABEL_ENABLE_AUTO_EXPORT_MESSAGE_LOGS, 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 index 9ecf6f93..0f73595d 100644 --- 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 @@ -4,18 +4,43 @@ 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 + createSettingBox_Overlay = sbg.createSettingBox_Overlay + createSettingBoxCheckbox = sbg.createSettingBoxCheckbox def switchEnableOverlayUiCallback(switch_widget): callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_OVERLAY_SMALL_LOG, switch_widget.get()) + def buttonOpenOverlaySettingsWindow(_e): + print(_e) + callFunctionIfCallable(view_variable.CALLBACK_SET_OPEN_OVERLAY_SETTINGS_WINDOW) + + + def checkboxNoticeXsoverlayCallback(checkbox_box_widget): + callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY, checkbox_box_widget.get()) + + row=0 - config_window.sb__enable_overlay_small_log = createSettingBoxSwitch( + config_window.sb__enable_overlay_small_log = createSettingBox_Overlay( for_var_label_text=view_variable.VAR_LABEL_ENABLE_OVERLAY_SMALL_LOG, for_var_desc_text=view_variable.VAR_DESC_ENABLE_OVERLAY_SMALL_LOG, switch_attr_name="sb__switch_enable_overlay_small_log", command=lambda: switchEnableOverlayUiCallback(config_window.sb__switch_enable_overlay_small_log), - variable=view_variable.VAR_ENABLE_OVERLAY_SMALL_LOG + variable=view_variable.VAR_ENABLE_OVERLAY_SMALL_LOG, + for_var_button_label=view_variable.VAR_OPEN_OVERLAY_SETTINGS_BUTTON, + label_button_clicked_command=buttonOpenOverlaySettingsWindow, ) config_window.sb__enable_overlay_small_log.grid(row=row) + row+=1 + + + + + config_window.sb__notice_xsoverlay = createSettingBoxCheckbox( + for_var_label_text=view_variable.VAR_LABEL_ENABLE_NOTICE_XSOVERLAY, + for_var_desc_text=view_variable.VAR_DESC_ENABLE_NOTICE_XSOVERLAY, + checkbox_attr_name="sb__checkbox_notice_xsoverlay", + command=lambda: checkboxNoticeXsoverlayCallback(config_window.sb__checkbox_notice_xsoverlay), + variable=view_variable.VAR_ENABLE_NOTICE_XSOVERLAY, + ) + config_window.sb__notice_xsoverlay.grid(row=row, pady=0) row+=1 \ No newline at end of file diff --git a/vrct_gui/main_window/createMainWindowWidgets.py b/vrct_gui/main_window/createMainWindowWidgets.py index ff9f5ef3..447dfb1d 100644 --- a/vrct_gui/main_window/createMainWindowWidgets.py +++ b/vrct_gui/main_window/createMainWindowWidgets.py @@ -48,53 +48,53 @@ def createMainWindowWidgets(vrct_gui, settings, view_variable): # start from 3 main_topbar_column=3 - # VR Settings Button - vrct_gui.vr_settings_container = CTkFrame( + # Overlay Settings Button + vrct_gui.overlay_settings_container = CTkFrame( vrct_gui.main_topbar_container, corner_radius=settings.uism.UPDATE_AVAILABLE_BUTTON_CORNER_RADIUS, fg_color=settings.ctm.MAIN_BG_COLOR, cursor="hand2", ) - vrct_gui.vr_settings_container.grid(row=0, column=main_topbar_column, padx=settings.uism.UPDATE_AVAILABLE_BUTTON_PADX, pady=settings.uism.TOP_BAR_BUTTON_PADY, sticky="nsw") - # vrct_gui.vr_settings_container.grid_remove() + vrct_gui.overlay_settings_container.grid(row=0, column=main_topbar_column, padx=settings.uism.UPDATE_AVAILABLE_BUTTON_PADX, pady=settings.uism.TOP_BAR_BUTTON_PADY, sticky="nsw") + # vrct_gui.overlay_settings_container.grid_remove() - vrct_gui.vr_settings_container.grid_rowconfigure((0,2), weight=1) + vrct_gui.overlay_settings_container.grid_rowconfigure((0,2), weight=1) - vrct_gui.vr_settings_icon = CTkLabel( - vrct_gui.vr_settings_container, + vrct_gui.overlay_settings_icon = CTkLabel( + vrct_gui.overlay_settings_container, text=None, corner_radius=0, height=0, - image=CTkImage(settings.image_file.CONFIGURATION_ICON, size=settings.uism.UPDATE_AVAILABLE_BUTTON_SIZE) + image=CTkImage(settings.image_file.CONFIGURATION_ICON_DISABLED, size=settings.uism.UPDATE_AVAILABLE_BUTTON_SIZE) ) - vrct_gui.vr_settings_icon.grid(row=1, column=0, padx=(settings.uism.UPDATE_AVAILABLE_BUTTON_IPADX, settings.uism.UPDATE_AVAILABLE_PADX_BETWEEN_LABEL_AND_ICON), pady=0) + vrct_gui.overlay_settings_icon.grid(row=1, column=0, padx=(settings.uism.UPDATE_AVAILABLE_BUTTON_IPADX, settings.uism.UPDATE_AVAILABLE_PADX_BETWEEN_LABEL_AND_ICON), pady=0) - vrct_gui.vr_settings_label = CTkLabel( - vrct_gui.vr_settings_container, - textvariable=view_variable.VAR_VR_SETTINGS, + vrct_gui.overlay_settings_label = CTkLabel( + vrct_gui.overlay_settings_container, + textvariable=view_variable.VAR_OVERLAY_SETTINGS, height=0, corner_radius=0, font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.UPDATE_AVAILABLE_BUTTON_FONT_SIZE, weight="normal"), anchor="e", - text_color="#fff", + text_color=settings.ctm.TOP_BAR_BUTTON_TEXT_COLOR, # text_color=settings.ctm.UPDATE_AVAILABLE_BUTTON_TEXT_COLOR, ) # This "right padx +1" is for fixing a bug that sticks out from the frame. I don't know why that happens... - vrct_gui.vr_settings_label.grid(row=1, column=1, padx=(0,settings.uism.UPDATE_AVAILABLE_BUTTON_IPADX+1), pady=0) + vrct_gui.overlay_settings_label.grid(row=1, column=1, padx=(0,settings.uism.UPDATE_AVAILABLE_BUTTON_IPADX+1), pady=0) bindButtonFunctionAndColor( target_widgets=[ - vrct_gui.vr_settings_container, - vrct_gui.vr_settings_label, - vrct_gui.vr_settings_icon, + vrct_gui.overlay_settings_container, + vrct_gui.overlay_settings_label, + vrct_gui.overlay_settings_icon, ], enter_color=settings.ctm.TOP_BAR_BUTTON_HOVERED_BG_COLOR, leave_color=settings.ctm.TOP_BAR_BUTTON_BG_COLOR, clicked_color=settings.ctm.TOP_BAR_BUTTON_CLICKED_BG_COLOR, - buttonReleasedFunction=lambda e: callFunctionIfCallable(view_variable.CALLBACK_SET_CALLBACK_OPEN_VR_SETTINGS_WINDOW), + buttonReleasedFunction=lambda e: callFunctionIfCallable(view_variable.CALLBACK_SET_OPEN_OVERLAY_SETTINGS_WINDOW), ) diff --git a/vrct_gui/quick_settings_window/QuickSettingsWindow.py b/vrct_gui/quick_settings_window/QuickSettingsWindow.py index e4f95446..0d294b8e 100644 --- a/vrct_gui/quick_settings_window/QuickSettingsWindow.py +++ b/vrct_gui/quick_settings_window/QuickSettingsWindow.py @@ -1,7 +1,7 @@ from utils import callFunctionIfCallable, floatToPctStr from customtkinter import CTkImage, CTkLabel, CTkToplevel, CTkProgressBar, CTkFrame, CTkSlider -from ..ui_utils import getImagePath, setGeometryToCenterOfScreen, fadeInAnimation +from ..ui_utils import getImagePath, setGeometryToCenterOfScreen, fadeInAnimation, createLabelButton from ._CreateQuickSettingBox import _CreateQuickSettingBox @@ -9,29 +9,31 @@ class QuickSettingsWindow(CTkToplevel): def __init__(self, vrct_gui, settings, view_variable): super().__init__() self.withdraw() - # self.overrideredirect(True) - self.configure(fg_color="#292a2d") - self.title("Quick Settings") - # self.wm_attributes("-toolwindow", True) + self.title("Overlay Settings") self.protocol("WM_DELETE_WINDOW", self.withdraw) self.after(200, lambda: self.iconbitmap(getImagePath("vrct_logo_mark_black.ico"))) self.settings = settings - BG_HEIGHT= 220 - BG_WIDTH= 450 + self.configure(fg_color=self.settings.ctm.SB__BG_COLOR) + BG_HEX_COLOR = "#292a2d" self.grid_columnconfigure(0, weight=1, minsize=400) self.grid_rowconfigure(0, weight=1) - self.qsw_background = CTkFrame(self, corner_radius=0, fg_color=BG_HEX_COLOR) - self.qsw_background.grid(sticky="nsew") + self.qsw_background = CTkFrame(self, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR) + self.qsw_background.grid(row=0, column=0, pady=(0,18), sticky="nsew") self.qsw_background.grid_columnconfigure(0, weight=1) + self.qsw_setting_box = CTkFrame(self.qsw_background, corner_radius=0, fg_color=BG_HEX_COLOR) + self.qsw_setting_box.grid(row=0, column=0, sticky="nsew") + self.qsw_setting_box.grid_columnconfigure(0, weight=1) - cqsb = _CreateQuickSettingBox(self.qsw_background, vrct_gui, settings, view_variable) + + cqsb = _CreateQuickSettingBox(self.qsw_setting_box, vrct_gui, settings, view_variable) createSettingBoxSlider = cqsb.createSettingBoxSlider + createSettingBoxSwitch = cqsb.createSettingBoxSwitch @@ -39,6 +41,19 @@ class QuickSettingsWindow(CTkToplevel): # Overlay General Settings row=0 + def switchCallback(switch_widget): + callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_OVERLAY_SMALL_LOG, switch_widget.get()) + + self.qsb__enable_overlay_small_log = createSettingBoxSwitch( + for_var_label_text=view_variable.VAR_LABEL_ENABLE_OVERLAY_SMALL_LOG, + switch_attr_name="qsb__enable_overlay_small_log_switch", + command=lambda: switchCallback(vrct_gui.qsb__enable_overlay_small_log_switch), + variable=view_variable.VAR_ENABLE_OVERLAY_SMALL_LOG, + ) + self.qsb__enable_overlay_small_log.grid(row=row) + + + row+=1 def sliderCallback(e): value = round(e,2) callFunctionIfCallable(view_variable.CALLBACK_SET_OVERLAY_SETTINGS, value, "opacity") @@ -75,9 +90,23 @@ class QuickSettingsWindow(CTkToplevel): + # Overlay Small Log Settings + + # row+=1 + # def switchCallback(switch_widget): + # callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_OVERLAY_SMALL_LOG, switch_widget.get()) + + # self.qsb__enable_overlay_small_log = createSettingBoxSwitch( + # for_var_label_text=view_variable.VAR_LABEL_ENABLE_OVERLAY_SMALL_LOG, + # switch_attr_name="qsb__enable_overlay_small_log_switch", + # command=lambda: switchCallback(vrct_gui.qsb__enable_overlay_small_log_switch), + # variable=view_variable.VAR_ENABLE_OVERLAY_SMALL_LOG, + # ) + # self.qsb__enable_overlay_small_log.grid(row=row) + + row+=1 - # Overlay Small Log Settings def sliderCallback(e): value = round(e,2) callFunctionIfCallable(view_variable.CALLBACK_SET_OVERLAY_SMALL_LOG_SETTINGS, value, "x_pos") @@ -172,6 +201,42 @@ class QuickSettingsWindow(CTkToplevel): + + + + self.qsw_setting_box_bottom = CTkFrame(self.qsw_background, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR) + self.qsw_setting_box_bottom.grid(row=1, column=0, sticky="nsew") + + self.qsw_setting_box_bottom.grid_columnconfigure((0,2), weight=1) + self.qsw_setting_box_bottom.grid_rowconfigure((0,2), weight=1) + + self.qsw_setting_box_bottom_restore_default_button = CTkFrame(self.qsw_setting_box_bottom, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR) + self.qsw_setting_box_bottom_restore_default_button.grid(row=1, column=1, sticky="nsew") + + + def toDefaultOverlaySettingsCallback(_e): + callFunctionIfCallable(view_variable.CALLBACK_SET_TO_DEFAULT_OVERLAY_SETTINGS) + + + + (restore_default_settings_button, label_button_label_widget) = createLabelButton( + parent_widget=self.qsw_setting_box_bottom_restore_default_button, + label_button_bg_color=self.settings.ctm.SB__BUTTON_COLOR, + label_button_hovered_bg_color=self.settings.ctm.SB__BUTTON_HOVERED_COLOR, + label_button_clicked_bg_color=self.settings.ctm.SB__BUTTON_CLICKED_COLOR, + label_button_ipadx=self.settings.uism.SB__AUTHKEY_WEBPAGE_BUTTON_IPADX, + label_button_ipady=self.settings.uism.SB__AUTHKEY_WEBPAGE_BUTTON_IPADY, + variable=view_variable.VAR_TO_DEFAULT_OVERLAY_SETTINGS, + font_family=self.settings.FONT_FAMILY, + font_size=self.settings.uism.SB__AUTHKEY_WEBPAGE_BUTTON_LABEL_FONT_SIZE, + text_color=self.settings.ctm.LABELS_TEXT_COLOR, + label_button_clicked_command=toDefaultOverlaySettingsCallback, + + label_button_position="center", + ) + restore_default_settings_button.grid(row=0, column=0, pady=self.settings.uism.QSB__RESTORE_DEFAULT_SETTINGS_BUTTON_PADY) + + def show(self): self.attributes("-alpha", 0) self.deiconify() diff --git a/vrct_gui/quick_settings_window/_CreateQuickSettingBox.py b/vrct_gui/quick_settings_window/_CreateQuickSettingBox.py index 01bb931a..e2bbe271 100644 --- a/vrct_gui/quick_settings_window/_CreateQuickSettingBox.py +++ b/vrct_gui/quick_settings_window/_CreateQuickSettingBox.py @@ -2,7 +2,7 @@ from typing import Union from utils import callFunctionIfCallable -from customtkinter import CTkImage, CTkLabel, CTkToplevel, CTkProgressBar, CTkFrame, CTkSlider, CTkFont +from customtkinter import CTkImage, CTkLabel, CTkToplevel, CTkProgressBar, CTkFrame, CTkSlider, CTkFont, CTkSwitch from ..ui_utils import openImageKeepAspectRatio, getImageFileFromUiUtils, setGeometryToCenterOfScreen, fadeInAnimation class _CreateQuickSettingBox(): @@ -23,18 +23,18 @@ class _CreateQuickSettingBox(): def _createSettingBoxFrame(self, for_var_label_text=None, for_var_current_value=None): setting_box_frame = CTkFrame(self.parent_frame, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) - setting_box_frame.grid(row=0, column=0, sticky="ew") + setting_box_frame.grid(row=0, column=0, pady=(0,1), sticky="ew") setting_box_frame.grid_columnconfigure(0, weight=1) setting_box_frame_wrapper = CTkFrame(setting_box_frame, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) - setting_box_frame_wrapper.grid(row=0, column=0, padx=self.settings.uism.SB__IPADX, pady=self.settings.uism.SB__IPADY, sticky="nsew") + setting_box_frame_wrapper.grid(row=0, column=0, padx=self.settings.uism.QSB__IPADX, pady=self.settings.uism.QSB__IPADY, sticky="nsew") setting_box_frame_wrapper.grid_columnconfigure(0, weight=1) # Labels 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") + setting_box_labels_frame.grid(row=0, column=0, padx=0, pady=(0,self.settings.uism.QSB__LABEL_BOTTOM_PADY), sticky="nsew") setting_box_labels_frame.grid_rowconfigure((0,2), weight=1) setting_box_labels_frame.grid_columnconfigure(1, weight=1) @@ -49,16 +49,16 @@ class _CreateQuickSettingBox(): setting_box_label.grid(row=1, column=0, padx=0, pady=0, sticky="nse") - - setting_box_label = CTkLabel( - setting_box_labels_frame, - textvariable=for_var_current_value, - anchor="w", - height=0, - font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__LABEL_FONT_SIZE, weight="normal"), - text_color=self.settings.ctm.LABELS_TEXT_COLOR - ) - setting_box_label.grid(row=1, column=2, padx=0, pady=0, sticky="nsw") + if for_var_current_value is not None: + setting_box_label = CTkLabel( + setting_box_labels_frame, + textvariable=for_var_current_value, + anchor="w", + height=0, + font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__LABEL_FONT_SIZE, weight="normal"), + text_color=self.settings.ctm.LABELS_TEXT_COLOR + ) + setting_box_label.grid(row=1, column=2, padx=0, pady=0, sticky="nsw") @@ -140,4 +140,46 @@ class _CreateQuickSettingBox(): slider_bind__ButtonRelease() slider_widget.bind("", adjusted_slider_bind__ButtonRelease, "+") + return setting_box_frame + + + + + + + + def createSettingBoxSwitch( + self, + for_var_label_text, + switch_attr_name, + variable, + command, + for_var_current_value=None, + ): + + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_current_value) + + switch_widget = CTkSwitch( + setting_box_item_frame, + text=None, + height=0, + width=0, + corner_radius=int(self.settings.uism.SB__SWITCH_BOX_HEIGHT/2), + border_width=0, + switch_height=self.settings.uism.SB__SWITCH_BOX_HEIGHT, + 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, + progress_color=self.settings.ctm.SB__SWITCH_BOX_ACTIVE_BG_COLOR, + button_color=self.settings.ctm.SB__SWITCH_BOX_BUTTON_COLOR, + button_hover_color=self.settings.ctm.SB__SWITCH_BOX_BUTTON_HOVERED_COLOR, + ) + setattr(self.vrct_gui, switch_attr_name, switch_widget) + + + switch_widget.grid(row=1, column=1, sticky="w") + return setting_box_frame \ No newline at end of file diff --git a/vrct_gui/ui_managers/Themes/_darkTheme.py b/vrct_gui/ui_managers/Themes/_darkTheme.py index 7cfe6890..c90a8e5f 100644 --- a/vrct_gui/ui_managers/Themes/_darkTheme.py +++ b/vrct_gui/ui_managers/Themes/_darkTheme.py @@ -110,6 +110,7 @@ def _darkTheme(base_color): TOP_BAR_BUTTON_BG_COLOR = base_color.DARK_888_COLOR, TOP_BAR_BUTTON_HOVERED_BG_COLOR = base_color.DARK_850_COLOR, TOP_BAR_BUTTON_CLICKED_BG_COLOR = base_color.DARK_900_COLOR, + TOP_BAR_BUTTON_TEXT_COLOR = base_color.DARK_BASIC_TEXT_COLOR, UPDATE_AVAILABLE_BUTTON_BG_COLOR = base_color.DARK_888_COLOR, UPDATE_AVAILABLE_BUTTON_HOVERED_BG_COLOR = base_color.DARK_850_COLOR, diff --git a/vrct_gui/ui_managers/Themes/_lightTheme.py b/vrct_gui/ui_managers/Themes/_lightTheme.py index fbaf1201..503be63a 100644 --- a/vrct_gui/ui_managers/Themes/_lightTheme.py +++ b/vrct_gui/ui_managers/Themes/_lightTheme.py @@ -110,6 +110,7 @@ def _lightTheme(base_color): TOP_BAR_BUTTON_BG_COLOR = base_color.LIGHT_175_COLOR, TOP_BAR_BUTTON_HOVERED_BG_COLOR = base_color.LIGHT_300_COLOR, TOP_BAR_BUTTON_CLICKED_BG_COLOR = base_color.LIGHT_350_COLOR, + TOP_BAR_BUTTON_TEXT_COLOR = base_color.LIGHT_BASIC_TEXT_COLOR, UPDATE_AVAILABLE_BUTTON_TEXT_COLOR = base_color.PRIMARY_400_COLOR, ), diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index 55ad0c43..b7e5f5e3 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -192,6 +192,16 @@ class UiScalingManager(): # Dropdown Menu Window self.dropdown_menu_window.MARGIN_WIDTH = self._calculateUiSize(16) + + + # Quick Settings Box + self.config_window.QSB__IPADX = self._calculateUiSize(20) + self.config_window.QSB__IPADY = (self._calculateUiSize(14), self._calculateUiSize(8)) + self.config_window.QSB__LABEL_BOTTOM_PADY = self._calculateUiSize(6) + self.config_window.QSB__RESTORE_DEFAULT_SETTINGS_BUTTON_PADY = (self._calculateUiSize(40),0) + + + # Config Window self.config_window.DEFAULT_WIDTH = self._calculateUiSize(1080) self.config_window.DEFAULT_HEIGHT = self._calculateUiSize(680) @@ -361,6 +371,8 @@ class UiScalingManager(): self.config_window.SB__AUTHKEY_WEBPAGE_PADX_BETWEEN_LABEL_AND_ICON = self._calculateUiSize(10) self.config_window.SB__AUTHKEY_WEBPAGE_BUTTON_TOP_PADY = self._calculateUiSize(10) + self.config_window.SB__OPEN_OVERLAY_SETTINGS_WINDOW = self._calculateUiSize(28) + self.config_window.SB__BUTTON_IPADXY = self._calculateUiSize(16) self.config_window.SB__BUTTON_ICON_SIZE = self._calculateUiSize(24)