[Update] Config Window: Advanced Settings Tab: add Open Config File. add item open file(config.json) button.

This commit is contained in:
Sakamoto Shiina
2023-11-06 12:54:02 +09:00
parent 5d6902c196
commit f21ffea568
6 changed files with 59 additions and 3 deletions

View File

@@ -16,6 +16,9 @@ def callbackRestartSoftware():
def callbackFilepathLogs():
print("callbackFilepathLogs")
def callbackFilepathConfigFile():
print("callbackFilepathConfigFile")
# func transcription send message
def sendMicMessage(message):
if len(message) > 0:
@@ -704,6 +707,7 @@ def createMainWindow():
"callback_update_software": callbackUpdateSoftware,
"callback_restart_software": callbackRestartSoftware,
"callback_filepath_logs": callbackFilepathLogs,
"callback_filepath_config_file": callbackFilepathConfigFile,
},
window_action_registers={

View File

@@ -194,3 +194,6 @@ config_window:
osc_port:
label: OSC Port
open_config_filepath:
label: Open Config File

View File

@@ -193,3 +193,6 @@ config_window:
osc_port:
label: OSC Port
open_config_filepath:
label: 設定ファイルを開く

View File

@@ -83,6 +83,7 @@ class View():
CALLBACK_RESTART_SOFTWARE=None,
CALLBACK_UPDATE_SOFTWARE=None,
CALLBACK_OPEN_FILEPATH_LOGS=None,
CALLBACK_OPEN_FILEPATH_CONFIG_FILE=None,
CALLBACK_QUIT_VRCT=vrct_gui._quitVRCT,
@@ -385,6 +386,9 @@ class View():
VAR_DESC_OSC_PORT=None,
CALLBACK_SET_OSC_PORT=None,
VAR_OSC_PORT=StringVar(value=config.OSC_PORT),
VAR_LABEL_OPEN_CONFIG_FILEPATH=StringVar(value=i18n.t("config_window.open_config_filepath.label")),
VAR_DESC_OPEN_CONFIG_FILEPATH=None,
)
@@ -402,6 +406,7 @@ class View():
self.view_variable.CALLBACK_UPDATE_SOFTWARE=common_registers.get("callback_update_software", None)
self.view_variable.CALLBACK_RESTART_SOFTWARE=common_registers.get("callback_restart_software", None)
self.view_variable.CALLBACK_OPEN_FILEPATH_LOGS=common_registers.get("callback_filepath_logs", None)
self.view_variable.CALLBACK_OPEN_FILEPATH_CONFIG_FILE=common_registers.get("callback_filepath_config_file", None)
if window_action_registers is not None:

View File

@@ -740,6 +740,33 @@ class _SettingBoxGenerator():
def createSettingBoxButtonWithImage(
self,
for_var_label_text, for_var_desc_text,
button_attr_name,
button_image,
button_command,
):
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(button_attr_name, for_var_label_text, for_var_desc_text)
button_with_image_widget = createButtonWithImage(
parent_widget=setting_box_item_frame,
button_fg_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_COLOR,
button_enter_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_HOVERED_COLOR,
button_clicked_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_CLICKED_COLOR,
button_image_file=button_image,
button_image_size=self.settings.uism.SB__ARROW_SWITCH_BUTTON_ICON_SIZE,
button_ipadxy=self.settings.uism.SB__ARROW_SWITCH_BUTTON_IPADXY,
button_command=button_command,
)
button_with_image_widget.grid(row=1, column=SETTING_BOX_COLUMN, padx=self.settings.uism.SB__ARROW_SWITCH_LEFT_PADX, sticky="e")
return setting_box_frame
def createSettingBoxArrowSwitch(
self,

View File

@@ -5,6 +5,7 @@ from .._SettingBoxGenerator import _SettingBoxGenerator
def createSettingBox_AdvancedSettings(setting_box_wrapper, config_window, settings, view_variable):
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
createSettingBoxEntry = sbg.createSettingBoxEntry
createSettingBoxButtonWithImage = sbg.createSettingBoxButtonWithImage
def entry_ip_address_callback(value):
@@ -13,6 +14,9 @@ def createSettingBox_AdvancedSettings(setting_box_wrapper, config_window, settin
def entry_port_callback(value):
callFunctionIfCallable(view_variable.CALLBACK_SET_OSC_PORT, value)
def open_config_filepath_callback():
callFunctionIfCallable(view_variable.CALLBACK_OPEN_FILEPATH_CONFIG_FILE)
row=0
config_window.sb__ip_address = createSettingBoxEntry(
for_var_label_text=view_variable.VAR_LABEL_OSC_IP_ADDRESS,
@@ -34,5 +38,15 @@ def createSettingBox_AdvancedSettings(setting_box_wrapper, config_window, settin
entry_bind__Any_KeyRelease=lambda value: entry_port_callback(value),
entry_textvariable=view_variable.VAR_OSC_PORT,
)
config_window.sb__port.grid(row=row, pady=0)
config_window.sb__port.grid(row=row)
row+=1
config_window.sb__open_config_filepath = createSettingBoxButtonWithImage(
for_var_label_text=view_variable.VAR_LABEL_OPEN_CONFIG_FILEPATH,
for_var_desc_text=view_variable.VAR_DESC_OPEN_CONFIG_FILEPATH,
button_attr_name="sb__button_open_config_filepath",
button_command=lambda _e: open_config_filepath_callback(),
button_image=settings.image_file.FOLDER_OPEN_ICON,
)
config_window.sb__open_config_filepath.grid(row=row, pady=0)
row+=1