Setting box: add Advanced Settings tab (formerly Parameters). add items OSC IP Address and OSC Port.

This commit is contained in:
Sakamoto Shiina
2023-08-29 19:53:09 +09:00
parent 47b80da502
commit fcb66fa0c8
4 changed files with 64 additions and 14 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, createSettingBox_Others from .setting_box_containers import createSettingBox_Appearance, createSettingBox_Mic, createSettingBox_Speaker, createSettingBox_Others, createSettingBox_AdvancedSettings
def createSideMenuAndSettingsBoxContainers(config_window, settings): def createSideMenuAndSettingsBoxContainers(config_window, settings):
@@ -81,18 +81,6 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings):
] ]
}, },
}, },
{
"side_menu_tab_attr_name": "side_menu_tab_parameters",
"label_attr_name": "label_parameters",
"selected_mark_attr_name": "selected_mark_foreground",
"text": "Parameters",
"setting_box_container_settings": {
"setting_box_container_attr_name": "setting_box_container_parameters",
"setting_boxes": [
{ "section_title": None, "setting_box": None },
]
},
},
{ {
"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",
@@ -104,6 +92,18 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings):
{ "section_title": None, "setting_box": createSettingBox_Others }, { "section_title": None, "setting_box": createSettingBox_Others },
] ]
}, },
},
{
"side_menu_tab_attr_name": "side_menu_tab_advanced",
"label_attr_name": "label_advanced",
"selected_mark_attr_name": "selected_mark_advanced",
"text": "Advanced Settings",
"setting_box_container_settings": {
"setting_box_container_attr_name": "setting_box_container_advanced",
"setting_boxes": [
{ "section_title": None, "setting_box": createSettingBox_AdvancedSettings },
]
},
"activate_by_default": True, "activate_by_default": True,
}, },
] ]

View File

@@ -1,3 +1,4 @@
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 from .setting_box_others import createSettingBox_Others
from .setting_box_advanced_settings import createSettingBox_AdvancedSettings

View File

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

View File

@@ -0,0 +1,48 @@
from time import sleep
from customtkinter import StringVar, IntVar
from ..SettingBoxGenerator import SettingBoxGenerator
from config import config
def createSettingBox_AdvancedSettings(setting_box_wrapper, config_window, settings):
sbg = SettingBoxGenerator(config_window, settings)
createSettingBoxEntry = sbg.createSettingBoxEntry
def entry_ip_address_callback(value):
config.OSC_IP_ADDRESS = str(value)
def entry_port_callback(value):
config.OSC_PORT = int(value)
row=0
config_window.sb__ip_address = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="OSC IP Address",
desc_text="(Default: 127.0.0.1)",
entry_attr_name="sb__entry_ip_address",
entry_width=settings.uism.SB__ENTRY_WIDTH_150,
entry_bind__Any_KeyRelease=lambda value: entry_ip_address_callback(value),
entry_textvariable=StringVar(value=config.OSC_IP_ADDRESS),
)
config_window.sb__ip_address.grid(row=row)
row+=1
config_window.sb__port = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="OSC Port",
desc_text="(Default: 9000)",
entry_attr_name="sb__entry_port",
entry_width=settings.uism.SB__ENTRY_WIDTH_150,
entry_bind__Any_KeyRelease=lambda value: entry_port_callback(value),
entry_textvariable=IntVar(value=config.OSC_PORT),
)
config_window.sb__port.grid(row=row)
row+=1