From 01245d9c630317a13a3a17329b32f850cf1540b5 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 2 Sep 2023 18:44:48 +0900 Subject: [PATCH] =?UTF-8?q?Main=20Window:=20Sidebar=20Features=E7=B3=BB?= =?UTF-8?q?=E3=81=AELABEL=E5=A4=89=E6=95=B0=E3=82=92=E4=BD=9C=E6=88=90?= =?UTF-8?q?=E3=80=82=20=E4=B8=8D=E8=A6=81=E3=81=AA=E9=96=A2=E6=95=B0?= =?UTF-8?q?=E7=A7=BB=E5=8B=95=E3=81=A8=E5=89=8A=E9=99=A4:=20switch=20toggl?= =?UTF-8?q?e=E9=96=A2=E6=95=B0=E3=82=92lambda=E3=81=AB=E3=81=97=E3=81=A6?= =?UTF-8?q?=E4=BD=9C=E6=88=90=E6=99=82=E3=81=AB=E3=81=9D=E3=81=AE=E3=81=BE?= =?UTF-8?q?=E3=81=BE=E6=8C=87=E5=AE=9A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 7 ++++ .../main_window/widgets/create_sidebar.py | 33 ++++++------------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/view.py b/view.py index 5c113939..2dfc44ce 100644 --- a/view.py +++ b/view.py @@ -39,9 +39,16 @@ class View(): self.view_variable = SimpleNamespace( # Main Window # Sidebar Features + VAR_LABEL_TRANSLATION=StringVar(value="Translation"), CALLBACK_TOGGLE_TRANSLATION=None, + + VAR_LABEL_TRANSCRIPTION_SEND=StringVar(value="Voice2Chatbox"), CALLBACK_TOGGLE_TRANSCRIPTION_SEND=None, + + VAR_LABEL_TRANSCRIPTION_RECEIVE=StringVar(value="Speaker2Log"), CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE=None, + + VAR_LABEL_FOREGROUND=StringVar(value="Foreground"), CALLBACK_TOGGLE_FOREGROUND=None, # Language Settings diff --git a/vrct_gui/main_window/widgets/create_sidebar.py b/vrct_gui/main_window/widgets/create_sidebar.py index 5bdb4721..f6ce7e9d 100644 --- a/vrct_gui/main_window/widgets/create_sidebar.py +++ b/vrct_gui/main_window/widgets/create_sidebar.py @@ -34,19 +34,6 @@ def createSidebar(settings, main_window): - def toggleTranslationSwitchBox(e): - main_window.translation_switch_box.toggle() - - def toggleTranscriptionSendSwitchBox(e): - main_window.transcription_send_switch_box.toggle() - - def toggleTranscriptionReceiveSwitchBox(e): - main_window.transcription_receive_switch_box.toggle() - - def toggleForegroundSwitchBox(e): - main_window.foreground_switch_box.toggle() - - def changeSidebarFeaturesColorByEvents(ww, event_name): target_frame_widget = getattr(main_window, ww) if event_name == "enter": @@ -233,44 +220,44 @@ def createSidebar(settings, main_window): "frame_attr_name": "translation_frame", "command": toggleTranslationFeature, "switch_box_attr_name": "translation_switch_box", - "toggle_switch_box_command": toggleTranslationSwitchBox, + "toggle_switch_box_command": lambda e: main_window.translation_switch_box.toggle(), "label_attr_name": "label_translation", "compact_mode_icon_attr_name": "translation_compact_mode_icon", "selected_mark_attr_name": "translation_selected_mark", - "text": "Translation", + "var_label_text": main_window.view_variable.VAR_LABEL_TRANSLATION, "icon_file_name": settings.image_filename.TRANSLATION_ICON, }, { "frame_attr_name": "transcription_send_frame", "command": toggleTranscriptionSendFeature, "switch_box_attr_name": "transcription_send_switch_box", - "toggle_switch_box_command": toggleTranscriptionSendSwitchBox, + "toggle_switch_box_command": lambda e: main_window.transcription_send_switch_box.toggle(), "label_attr_name": "label_transcription_send", "compact_mode_icon_attr_name": "transcription_send_compact_mode_icon", "selected_mark_attr_name": "transcription_send_selected_mark", - "text": "Voice2Chatbox", + "var_label_text": main_window.view_variable.VAR_LABEL_TRANSCRIPTION_SEND, "icon_file_name": settings.image_filename.MIC_ICON, }, { "frame_attr_name": "transcription_receive_frame", "command": toggleTranscriptionReceiveFeature, "switch_box_attr_name": "transcription_receive_switch_box", - "toggle_switch_box_command": toggleTranscriptionReceiveSwitchBox, + "toggle_switch_box_command": lambda e: main_window.transcription_receive_switch_box.toggle(), "label_attr_name": "label_transcription_receive", "compact_mode_icon_attr_name": "transcription_receive_compact_mode_icon", "selected_mark_attr_name": "transcription_receive_selected_mark", - "text": "Speaker2Log", + "var_label_text": main_window.view_variable.VAR_LABEL_TRANSCRIPTION_RECEIVE, "icon_file_name": settings.image_filename.HEADPHONES_ICON, }, { "frame_attr_name": "foreground_frame", "command": toggleForegroundFeature, "switch_box_attr_name": "foreground_switch_box", - "toggle_switch_box_command": toggleForegroundSwitchBox, + "toggle_switch_box_command": lambda e: main_window.foreground_switch_box.toggle(), "label_attr_name": "label_foreground", "compact_mode_icon_attr_name": "foreground_compact_mode_icon", "selected_mark_attr_name": "foreground_selected_mark", - "text": "Foreground", + "var_label_text": main_window.view_variable.VAR_LABEL_FOREGROUND, "icon_file_name": settings.image_filename.FOREGROUND_ICON, }, ] @@ -286,7 +273,7 @@ def createSidebar(settings, main_window): label_attr_name = sfs["label_attr_name"] compact_mode_icon_attr_name = sfs["compact_mode_icon_attr_name"] selected_mark_attr_name = sfs["selected_mark_attr_name"] - text = sfs["text"] + var_label_text = sfs["var_label_text"] icon_file_name = sfs["icon_file_name"] frame_widget = CTkFrame(main_window.sidebar_features_container, corner_radius=0, fg_color=settings.ctm.SF__BG_COLOR, cursor="hand2", width=0, height=0) @@ -297,7 +284,7 @@ def createSidebar(settings, main_window): label_widget = CTkLabel( frame_widget, - text=text, + textvariable=var_label_text, height=0, corner_radius=0, font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SF__LABEL_FONT_SIZE, weight="normal"),