Setting box: add Others tab. add items Auto Clear The Message Box, Notification XSOverlay and Message Format.

This commit is contained in:
Sakamoto Shiina
2023-08-29 16:54:51 +09:00
parent 4b9a90e6d3
commit 246409fe2c
5 changed files with 80 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ from .addConfigSideMenuItem import addConfigSideMenuItem
from .createSettingBoxContainer import createSettingBoxContainer from .createSettingBoxContainer import createSettingBoxContainer
from .setting_box_containers import createSettingBox_Appearance, createSettingBox_Mic, createSettingBox_Speaker from .setting_box_containers import createSettingBox_Appearance, createSettingBox_Mic, createSettingBox_Speaker, createSettingBox_Others
def createSideMenuAndSettingsBoxContainers(config_window, settings): def createSideMenuAndSettingsBoxContainers(config_window, settings):
@@ -80,7 +80,6 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings):
{ "section_title": "Speaker", "setting_box": createSettingBox_Speaker }, { "section_title": "Speaker", "setting_box": createSettingBox_Speaker },
] ]
}, },
"activate_by_default": True,
}, },
{ {
"side_menu_tab_attr_name": "side_menu_tab_parameters", "side_menu_tab_attr_name": "side_menu_tab_parameters",
@@ -97,14 +96,15 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings):
{ {
"side_menu_tab_attr_name": "side_menu_tab_others", "side_menu_tab_attr_name": "side_menu_tab_others",
"label_attr_name": "label_others", "label_attr_name": "label_others",
"selected_mark_attr_name": "selected_mark_foreground", "selected_mark_attr_name": "selected_mark_others",
"text": "Others", "text": "Others",
"setting_box_container_settings": { "setting_box_container_settings": {
"setting_box_container_attr_name": "setting_box_container_others", "setting_box_container_attr_name": "setting_box_container_others",
"setting_boxes": [ "setting_boxes": [
{ "section_title": None, "setting_box": None }, { "section_title": None, "setting_box": createSettingBox_Others },
] ]
}, },
"activate_by_default": True,
}, },
] ]

View File

@@ -1,2 +1,3 @@
from .setting_box_appearance import createSettingBox_Appearance from .setting_box_appearance import createSettingBox_Appearance
from .setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker from .setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker
from .setting_box_others import createSettingBox_Others

View File

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

View File

@@ -0,0 +1,72 @@
from time import sleep
from customtkinter import StringVar, IntVar
from ..SettingBoxGenerator import SettingBoxGenerator
from config import config
def createSettingBox_Others(setting_box_wrapper, config_window, settings):
sbg = SettingBoxGenerator(config_window, settings)
createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu
createSettingBoxSwitch = sbg.createSettingBoxSwitch
createSettingBoxCheckbox = sbg.createSettingBoxCheckbox
createSettingBoxSlider = sbg.createSettingBoxSlider
createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider
createSettingBoxEntry = sbg.createSettingBoxEntry
# 関数名 chatbox から messagebox に変える予定 config.ENABLE_AUTO_CLEAR_CHATBOX も MESSAGEBOXに変えるかな。
def checkbox_auto_clear_chatbox_callback(checkbox_box_widget):
print(checkbox_box_widget.get())
config.ENABLE_AUTO_CLEAR_CHATBOX = checkbox_box_widget.get()
def checkbox_notice_xsoverlay_callback(checkbox_box_widget):
print(checkbox_box_widget.get())
config.ENABLE_NOTICE_XSOVERLAY = checkbox_box_widget.get()
def entry_message_format_callback(value):
if len(value) > 0:
config.MESSAGE_FORMAT = value
row=0
config_window.sb__auto_clear_chatbox = createSettingBoxCheckbox(
parent_widget=setting_box_wrapper,
label_text="Auto Clear The Message Box",
desc_text="Clear the message box after sending your message.",
checkbox_attr_name="sb__checkbox_auto_clear_chatbox",
command=lambda: checkbox_auto_clear_chatbox_callback(config_window.sb__checkbox_auto_clear_chatbox),
is_checked=False
)
config_window.sb__auto_clear_chatbox.grid(row=row)
row+=1
config_window.sb__notice_xsoverlay = createSettingBoxCheckbox(
parent_widget=setting_box_wrapper,
label_text="Notification XSOverlay (VR Only)",
desc_text="Notify received messages by using XSOverlay's notification feature.",
checkbox_attr_name="sb__checkbox_notice_xsoverlay",
command=lambda: checkbox_notice_xsoverlay_callback(config_window.sb__checkbox_notice_xsoverlay),
is_checked=False
)
config_window.sb__notice_xsoverlay.grid(row=row)
row+=1
config_window.sb__message_format = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="Message Format",
desc_text="You can change the decoration of the message you want to send. (Default: \"[message]([translation])\" )",
entry_attr_name="sb__entry_message_format",
entry_width=settings.uism.SB__ENTRY_WIDTH_250,
entry_bind__Any_KeyRelease=lambda value: entry_message_format_callback(value),
entry_textvariable=StringVar(value=config.MESSAGE_FORMAT),
)
config_window.sb__message_format.grid(row=row)
row+=1

View File

@@ -157,7 +157,7 @@ class UiScalingManager():
self.config_window.SB__ENTRY_HEIGHT = self._calculateUiSize(30) self.config_window.SB__ENTRY_HEIGHT = self._calculateUiSize(30)
# SB__ENTRY_WIDTH_10 ... SB__ENTRY_WIDTH_200 # SB__ENTRY_WIDTH_10 ... SB__ENTRY_WIDTH_200
for i in range(10, 201, 10): for i in range(10, 301, 10):
setattr(self.config_window, f'SB__ENTRY_WIDTH_{i}', self._calculateUiSize(i)) setattr(self.config_window, f'SB__ENTRY_WIDTH_{i}', self._calculateUiSize(i))