From 8dd1ddd6acd64b89581fa7249f5668eee635e0b6 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:30:56 +0900 Subject: [PATCH 01/10] =?UTF-8?q?[Update(tmp)]=20=E2=80=BBDropdown=20Menu?= =?UTF-8?q?=E9=96=8B=E3=81=8D=E3=81=BE=E3=81=9B=E3=82=93=E3=80=82=20Config?= =?UTF-8?q?=20Window:=20Option=20Menu=E7=B3=BBwidget=E3=82=92=E5=85=A8?= =?UTF-8?q?=E3=81=A6frame=E3=82=92=E4=BD=BF=E3=81=A3=E3=81=9F=E8=87=AA?= =?UTF-8?q?=E4=BD=9Cwidget=E3=81=AB=E3=81=99=E3=82=8A=E6=9B=BF=E3=81=88?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 6 ++-- .../_SettingBoxGenerator.py | 35 ++++++++++++------- vrct_gui/ui_managers/ColorThemeManager.py | 1 + vrct_gui/ui_managers/UiScalingManager.py | 6 ++-- vrct_gui/ui_utils/ui_utils.py | 16 +++++---- 5 files changed, 40 insertions(+), 24 deletions(-) diff --git a/view.py b/view.py index dd32167b..d19acb2b 100644 --- a/view.py +++ b/view.py @@ -692,14 +692,14 @@ class View(): def updateList_MicHost(self, new_mic_host_list:list): self.view_variable.LIST_MIC_HOST = new_mic_host_list - vrct_gui.config_window.sb__optionmenu_mic_host.configure(values=new_mic_host_list) + # vrct_gui.config_window.sb__optionmenu_mic_host.configure(values=new_mic_host_list) def updateSelected_MicHost(self, selected_mic_host_name:str): self.view_variable.VAR_MIC_HOST.set(selected_mic_host_name) def updateList_MicDevice(self, new_mic_device_list): self.view_variable.LIST_MIC_DEVICE = new_mic_device_list - vrct_gui.config_window.sb__optionmenu_mic_device.configure(values=new_mic_device_list) + # vrct_gui.config_window.sb__optionmenu_mic_device.configure(values=new_mic_device_list) def updateSelected_MicDevice(self, default_selected_mic_device_name:str): self.view_variable.VAR_MIC_DEVICE.set(default_selected_mic_device_name) @@ -716,7 +716,7 @@ class View(): def updateList_SpeakerDevice(self, new_speaker_device_list): self.view_variable.LIST_SPEAKER_DEVICE = new_speaker_device_list - vrct_gui.config_window.sb__optionmenu_speaker_device.configure(values=new_speaker_device_list) + # vrct_gui.config_window.sb__optionmenu_speaker_device.configure(values=new_speaker_device_list) @staticmethod def updateSetProgressBar_SpeakerEnergy(new_speaker_energy): 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 051e09eb..fc53e23f 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 @@ -3,7 +3,7 @@ from typing import Union from customtkinter import CTkOptionMenu, CTkFont, CTkFrame, CTkLabel, CTkRadioButton, CTkEntry, CTkSlider, CTkSwitch, CTkCheckBox, CTkProgressBar -from vrct_gui.ui_utils import createButtonWithImage, getLatestWidth +from vrct_gui.ui_utils import createButtonWithImage, getLatestWidth, createOptionMenuBox SETTING_BOX_COLUMN = 1 @@ -76,19 +76,30 @@ class _SettingBoxGenerator(): def createSettingBoxDropdownMenu(self, for_var_label_text, for_var_desc_text, optionmenu_attr_name, command, variable=None, dropdown_menu_values=None): (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text) - option_menu_widget = CTkOptionMenu( - setting_box_item_frame, - height=self.settings.uism.SB__OPTIONMENU_HEIGHT, - width=self.settings.uism.SB__OPTIONMENU_WIDTH, - values=dropdown_menu_values, - button_color=self.settings.ctm.SB__OPTIONMENU_BG_COLOR, - button_hover_color=self.settings.ctm.SB__OPTIONMENU_HOVERED_BG_COLOR, - fg_color=self.settings.ctm.SB__OPTIONMENU_BG_COLOR, - font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__OPTION_MENU_FONT_SIZE, weight="normal"), + option_menu_widget = createOptionMenuBox( + parent_widget=setting_box_item_frame, + optionmenu_bg_color=self.settings.ctm.SB__OPTIONMENU_BG_COLOR, + optionmenu_hovered_bg_color=self.settings.ctm.SB__OPTIONMENU_HOVERED_BG_COLOR, + optionmenu_clicked_bg_color=self.settings.ctm.SB__OPTIONMENU_CLICKED_BG_COLOR, + optionmenu_ipadx=(8,8), + optionmenu_ipady=2, + optionmenu_ipady_between_img=8, + optionmenu_min_height=self.settings.uism.SB__OPTIONMENU_MIN_HEIGHT, + optionmenu_min_width=self.settings.uism.SB__OPTIONMENU_MIN_WIDTH, variable=variable, - command=command, - anchor="w", + font_family=self.settings.FONT_FAMILY, + font_size=self.settings.uism.SB__OPTION_MENU_FONT_SIZE, + text_color=self.settings.ctm.LABELS_TEXT_COLOR, + image_file=self.settings.image_file.ARROW_LEFT.rotate(90), + image_size=(14,14), + command=lambda _e: print(_e), + # command=open_selectable_language_window_command, + + # optionmenu_position="center", + # setattr_widget=main_window, + # image_widget_attr_name=arrow_img_attr_name, ) + option_menu_widget.grid(row=1, column=SETTING_BOX_COLUMN, sticky="e") setattr(self.config_window, optionmenu_attr_name, option_menu_widget) diff --git a/vrct_gui/ui_managers/ColorThemeManager.py b/vrct_gui/ui_managers/ColorThemeManager.py index a94f5f8f..124b2a01 100644 --- a/vrct_gui/ui_managers/ColorThemeManager.py +++ b/vrct_gui/ui_managers/ColorThemeManager.py @@ -232,6 +232,7 @@ class ColorThemeManager(): self.config_window.SB__OPTIONMENU_BG_COLOR = self.DARK_925_COLOR self.config_window.SB__OPTIONMENU_HOVERED_BG_COLOR = self.DARK_850_COLOR + self.config_window.SB__OPTIONMENU_CLICKED_BG_COLOR = self.DARK_950_COLOR self.config_window.SB__SLIDER_BUTTON_COLOR = self.DARK_700_COLOR self.config_window.SB__SLIDER_BUTTON_HOVERED_COLOR = self.DARK_600_COLOR diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index 902951b5..bf16839f 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -146,9 +146,9 @@ class UiScalingManager(): self.config_window.SB__OPTION_MENU_FONT_SIZE = self.config_window.SB__SELECTOR_FONT_SIZE - self.config_window.SB__OPTIONMENU_HEIGHT = self._calculateUiSize(30) - self.config_window.SB__OPTIONMENU_WIDTH = self._calculateUiSize(200) - self.config_window.SB__DROPDOWN_MENU_WIDTH = self.config_window.SB__OPTIONMENU_WIDTH + self.config_window.SB__OPTIONMENU_MIN_HEIGHT = self._calculateUiSize(30) + self.config_window.SB__OPTIONMENU_MIN_WIDTH = self._calculateUiSize(200) + self.config_window.SB__DROPDOWN_MENU_WIDTH = self.config_window.SB__OPTIONMENU_MIN_WIDTH self.config_window.SB__DROPDOWN_MENU_MAX_BUTTON_HEIGHT = int(self.config_window.SB__OPTION_MENU_FONT_SIZE + self._calculateUiSize(6)) self.config_window.SB__DROPDOWN_MENU_FRAME_CORNER_RADIUS = self._calculateUiSize(10) self.config_window.SB__DROPDOWN_MENU_FRAME_MAX_HEIGHT = self._calculateUiSize(200) diff --git a/vrct_gui/ui_utils/ui_utils.py b/vrct_gui/ui_utils/ui_utils.py index a68d1743..254c6c41 100644 --- a/vrct_gui/ui_utils/ui_utils.py +++ b/vrct_gui/ui_utils/ui_utils.py @@ -142,14 +142,18 @@ def createButtonWithImage(parent_widget, button_fg_color, button_enter_color, bu return button_wrapper -def createOptionMenuBox(parent_widget, optionmenu_bg_color, optionmenu_hovered_bg_color, optionmenu_clicked_bg_color, optionmenu_ipadx, optionmenu_ipady, variable, font_family, font_size, text_color, image_file, image_size, command, optionmenu_position=None, setattr_widget=None, image_widget_attr_name=None): +def createOptionMenuBox(parent_widget, optionmenu_bg_color, optionmenu_hovered_bg_color, optionmenu_clicked_bg_color, optionmenu_ipadx, optionmenu_ipady, variable, font_family, font_size, text_color, image_file, image_size, command, optionmenu_position=None, optionmenu_ipady_between_img=0, optionmenu_min_height=None, optionmenu_min_width=None, setattr_widget=None, image_widget_attr_name=None): - option_menu_box = CTkFrame(parent_widget, corner_radius=4, fg_color=optionmenu_bg_color, cursor="hand2") + option_menu_box = CTkFrame(parent_widget, corner_radius=6, fg_color=optionmenu_bg_color, cursor="hand2") + + option_menu_box.grid_rowconfigure(0, weight=1) + if optionmenu_min_height is not None: option_menu_box.grid_rowconfigure(0, minsize=optionmenu_min_height) option_menu_box.grid_columnconfigure(0, weight=1) - option_menu_box.grid_rowconfigure(0, weight=1) + if optionmenu_min_width is not None: option_menu_box.grid_columnconfigure(0, minsize=optionmenu_min_width) + optionmenu_label_wrapper = CTkFrame(option_menu_box, corner_radius=0, fg_color=optionmenu_bg_color) - optionmenu_label_wrapper.grid(row=0, column=0, sticky="ew") + optionmenu_label_wrapper.grid(row=0, column=0, padx=(optionmenu_ipadx[0],0), pady=optionmenu_ipady, sticky="ew") LABEL_COLUMN=0 if optionmenu_position == "center": @@ -163,7 +167,7 @@ def createOptionMenuBox(parent_widget, optionmenu_bg_color, optionmenu_hovered_b font=CTkFont(family=font_family, size=font_size, weight="normal"), text_color=text_color ) - optionmenu_label_widget.grid(row=0, column=LABEL_COLUMN, padx=optionmenu_ipadx, pady=optionmenu_ipady) + optionmenu_label_widget.grid(row=0, column=LABEL_COLUMN, padx=(0, optionmenu_ipady_between_img)) optionmenu_img_widget = CTkLabel( @@ -177,7 +181,7 @@ def createOptionMenuBox(parent_widget, optionmenu_bg_color, optionmenu_hovered_b if image_widget_attr_name is not None: setattr(setattr_widget, image_widget_attr_name, optionmenu_img_widget) - optionmenu_img_widget.grid(row=0, column=1, padx=0, pady=0) + optionmenu_img_widget.grid(row=0, column=1, padx=(0, optionmenu_ipadx[1]), pady=optionmenu_ipady) bindEnterAndLeaveColor([optionmenu_label_wrapper, option_menu_box, optionmenu_label_widget, optionmenu_img_widget], optionmenu_hovered_bg_color, optionmenu_bg_color) From 7e33f04baa478d4481c1beeaa5e50d07e7fcfc7f Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 8 Oct 2023 11:13:18 +0900 Subject: [PATCH 02/10] =?UTF-8?q?[Update]=20Config=20Window:=20DropdownMen?= =?UTF-8?q?u=E8=BF=BD=E5=8A=A0=E3=80=82=E5=89=8D=E5=9B=9E=E3=82=B3?= =?UTF-8?q?=E3=83=9F=E3=83=83=E3=83=88=E3=81=A7=E3=81=AFOption=20Menu?= =?UTF-8?q?=E3=82=92=E3=82=AF=E3=83=AA=E3=83=83=E3=82=AF=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=82=82=E4=BD=95=E3=82=82=E8=B5=B7=E3=81=93=E3=82=89=E3=81=AA?= =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=9F=E3=81=8C=E3=80=81DropdownMenu?= =?UTF-8?q?=E3=81=A8=E3=81=97=E3=81=A6=E9=81=B8=E6=8A=9E=E8=82=A2=E3=82=92?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=80=82=E9=81=B8=E6=8A=9E=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=9F=E9=9A=9B=E3=81=AE=E6=A9=9F=E8=83=BD=E3=82=82=E4=BB=8A?= =?UTF-8?q?=E3=81=BE=E3=81=A7=E9=80=9A=E3=82=8A=E3=80=82=20grab=5Fset?= =?UTF-8?q?=E5=BB=83=E6=AD=A2=E3=80=82focus=5Fset=E3=82=84lift=E3=82=92?= =?UTF-8?q?=E4=BD=BF=E3=81=A3=E3=81=A6=E3=81=93=E3=81=A1=E3=82=89=E3=81=A7?= =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=88=E3=83=AD=E3=83=BC=E3=83=AB=E3=80=82?= =?UTF-8?q?=20=E7=90=86=E7=94=B1=E3=81=AF=E3=80=81=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E4=B8=8A=E3=81=A7=E6=96=B0=E3=81=9F=E3=81=AB?= =?UTF-8?q?Dropdown=20Menu=20Window=E3=82=92=E7=94=9F=E6=88=90=E3=81=97?= =?UTF-8?q?=E3=80=81=E9=81=B8=E6=8A=9E=E8=82=A2=E3=82=92=E3=82=AF=E3=83=AA?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=81=99=E3=82=8B=E9=9A=9B=E9=82=AA=E9=AD=94?= =?UTF-8?q?=E3=81=AB=E3=81=AA=E3=82=8B=E3=81=9F=E3=82=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 19 +- vrct_gui/_CreateDropdownMenuWindow.py | 268 ++++++++++++++++++ .../_SettingBoxGenerator.py | 30 +- .../createSidebarLanguagesSettings.py | 2 +- vrct_gui/ui_managers/ColorThemeManager.py | 7 + vrct_gui/ui_utils/ui_utils.py | 4 +- vrct_gui/vrct_gui.py | 17 +- 7 files changed, 330 insertions(+), 17 deletions(-) create mode 100644 vrct_gui/_CreateDropdownMenuWindow.py diff --git a/view.py b/view.py index d19acb2b..9d256518 100644 --- a/view.py +++ b/view.py @@ -692,14 +692,20 @@ class View(): def updateList_MicHost(self, new_mic_host_list:list): self.view_variable.LIST_MIC_HOST = new_mic_host_list - # vrct_gui.config_window.sb__optionmenu_mic_host.configure(values=new_mic_host_list) + vrct_gui.dropdown_menu_window.updateDropdownMenuValues( + dropdown_menu_widget_id="sb__optionmenu_mic_host", + dropdown_menu_values=new_mic_host_list, + ) def updateSelected_MicHost(self, selected_mic_host_name:str): self.view_variable.VAR_MIC_HOST.set(selected_mic_host_name) - def updateList_MicDevice(self, new_mic_device_list): + def updateList_MicDevice(self, new_mic_device_list:list): self.view_variable.LIST_MIC_DEVICE = new_mic_device_list - # vrct_gui.config_window.sb__optionmenu_mic_device.configure(values=new_mic_device_list) + vrct_gui.dropdown_menu_window.updateDropdownMenuValues( + dropdown_menu_widget_id="sb__optionmenu_mic_device", + dropdown_menu_values=new_mic_device_list, + ) def updateSelected_MicDevice(self, default_selected_mic_device_name:str): self.view_variable.VAR_MIC_DEVICE.set(default_selected_mic_device_name) @@ -714,9 +720,12 @@ class View(): vrct_gui.config_window.sb__progressbar_x_slider__progressbar_mic_energy_threshold.set(0) - def updateList_SpeakerDevice(self, new_speaker_device_list): + def updateList_SpeakerDevice(self, new_speaker_device_list:list): self.view_variable.LIST_SPEAKER_DEVICE = new_speaker_device_list - # vrct_gui.config_window.sb__optionmenu_speaker_device.configure(values=new_speaker_device_list) + vrct_gui.dropdown_menu_window.updateDropdownMenuValues( + dropdown_menu_widget_id="sb__optionmenu_speaker_device", + dropdown_menu_values=new_speaker_device_list, + ) @staticmethod def updateSetProgressBar_SpeakerEnergy(new_speaker_energy): diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py new file mode 100644 index 00000000..25b10479 --- /dev/null +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -0,0 +1,268 @@ +from types import SimpleNamespace + +from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont, CTkScrollableFrame +from time import sleep + +from .ui_utils import bindButtonReleaseFunction, bindEnterAndLeaveColor, bindButtonPressColor, getLatestWidth, getLatestHeight +from functools import partial + +class _CreateDropdownMenuWindow(CTkToplevel): + def __init__(self, settings, view_variable): + super().__init__() + self.withdraw() + self.hide = True + + self.title("") + self.overrideredirect(True) + + self.wm_attributes("-alpha", 0) + self.wm_attributes("-toolwindow", True) + + self.resizable(width=False, height=False) + + + self.settings = settings + self.attach_widget = None + self._view_variable = view_variable + self.wrapper_widget = None + + self.dropdown_menu_widgets = {} + self.active_dropdown_menu_widget = None + + + + self.attach_widget_width = None + self.attach_widget_height = None + self.attach_widget_x_pos = None + self.attach_widget_y_pos = None + self.x_pos = None + self.y_pos = None + + + + # self.rowconfigure(0,weight=1) + # self.columnconfigure(0,weight=1) + + # The color code [#bb4448] is a mixture of [#a9555c] and [#cc3333] (for a redder shade). + + def updateDropdownMenuValues(self, dropdown_menu_widget_id, dropdown_menu_values): + self.dropdown_menu_widgets[dropdown_menu_widget_id].widget.destroy() + self.createDropdownMenuBox( + dropdown_menu_widget_id=dropdown_menu_widget_id, + dropdown_menu_values=dropdown_menu_values, + command=self.dropdown_menu_widgets[dropdown_menu_widget_id].command, + wrapper_widget=self.dropdown_menu_widgets[dropdown_menu_widget_id].wrapper_widget, + ) + + + def createDropdownMenuBox(self, dropdown_menu_widget_id, dropdown_menu_values, command, wrapper_widget): + self.wrapper_widget = wrapper_widget + + self.dropdown_menu_container = CTkFrame(self, corner_radius=0, fg_color="#bb4448", width=0, height=0) + self.dropdown_menu_container.grid(row=0, column=0, sticky="nsew") + self.dropdown_menu_container.grid_remove() + + self.dropdown_menu_widgets[dropdown_menu_widget_id] = SimpleNamespace() + + self.dropdown_menu_widgets[dropdown_menu_widget_id] = SimpleNamespace( + widget=self.dropdown_menu_container, + command=command, + wrapper_widget=wrapper_widget, + ) + + + self.scroll_frame_container = CTkScrollableFrame( + self.dropdown_menu_container, + corner_radius=0, + fg_color=self.settings.ctm.SB__DROPDOWN_MENU_WINDOW_BG_COLOR, + width=0, + height=0, + border_color=self.settings.ctm.SB__DROPDOWN_MENU_WINDOW_BORDER_COLOR, + border_width=1, + ) + self.scroll_frame_container.grid(row=0, column=0, sticky="nsew") + self.scroll_frame_container._scrollbar.grid_configure(padx=3) + self.scroll_frame_container.grid_columnconfigure(0, weight=1) + + self.dropdown_menu_values_box = CTkFrame(self.scroll_frame_container, corner_radius=0, fg_color=self.settings.ctm.SB__DROPDOWN_MENU_WINDOW_BG_COLOR, width=0, height=0) + self.dropdown_menu_values_box.grid(row=0, column=0, sticky="nsew") + self.dropdown_menu_values_box.grid_columnconfigure(0, weight=1) + + self._createDropdownMenuValues(dropdown_menu_widget_id, dropdown_menu_values, command) + + def _createDropdownMenuValues(self, dropdown_menu_widget_id, dropdown_menu_values, command): + + # self.dropdown_menu_values_wrapper = CTkFrame(self.scroll_frame_container, corner_radius=0, fg_color="red", width=0, height=0) + self.dropdown_menu_values_wrapper = CTkFrame(self.scroll_frame_container, corner_radius=0, fg_color=self.settings.ctm.SB__DROPDOWN_MENU_WINDOW_BG_COLOR) + self.dropdown_menu_values_wrapper.grid(row=0, column=0, sticky="nsew") + self.dropdown_menu_values_wrapper.grid_columnconfigure(0, weight=1) + + # for get to the height__________________ + __dropdown_menu_value_wrapper = CTkFrame(self.dropdown_menu_values_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__DROPDOWN_MENU_BG_COLOR, width=0, height=0) + __dropdown_menu_value_wrapper.grid(row=0, column=0, ipadx=6, ipady=6, sticky="nsew") + setattr(self, f"{dropdown_menu_widget_id}__{0}", __dropdown_menu_value_wrapper) + + + __dropdown_menu_value_wrapper.grid_rowconfigure((0,2), weight=1) + __dropdown_menu_value_wrapper.grid_columnconfigure(0, weight=1) + __label_widget = CTkLabel( + __dropdown_menu_value_wrapper, + text="Aa", + height=0, + corner_radius=0, + font=CTkFont(family=self.settings.FONT_FAMILY, size=14, weight="normal"), + anchor="w", + text_color=self.settings.ctm.BASIC_TEXT_COLOR, + ) + # setattr(self, f"l", __label_widget) + + __label_widget.grid(row=1, column=0, padx=(8,0), sticky="w") + label_height = getLatestHeight(__dropdown_menu_value_wrapper) + # ______________________________________ + + dropdown_menu_values_length = len(dropdown_menu_values) + if dropdown_menu_values_length <= 3: + self.scroll_frame_container.configure(width=200, height=int(dropdown_menu_values_length * label_height)) + # self.geometry("{}x{}".format(300, int(dropdown_menu_values_length * label_height))) + # self.geometry("{}x{}".format(300, int(dropdown_menu_values_length * label_height))) + # self.scroll_frame_container._parent_canvas.configure(height=20) + else: + self.scroll_frame_container.configure(width=200, height=200) + # self.geometry("{}x{}".format(200, 200)) + # self.scroll_frame_container._parent_canvas.configure(height=20) + + # This is for CustomTkinter's spec change or bug fix. + self.scroll_frame_container._scrollbar.configure(height=0) + + + + row=0 + for dropdown_menu_value in dropdown_menu_values: + + dropdown_menu_value_wrapper = CTkFrame(self.dropdown_menu_values_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__DROPDOWN_MENU_BG_COLOR, width=0, height=0) + dropdown_menu_value_wrapper.grid(row=row, column=0, ipadx=6, ipady=6, sticky="nsew") + setattr(self, f"{dropdown_menu_widget_id}__{row}", dropdown_menu_value_wrapper) + + + + dropdown_menu_value_wrapper.grid_rowconfigure((0,2), weight=1) + dropdown_menu_value_wrapper.grid_columnconfigure(0, weight=1) + label_widget = CTkLabel( + dropdown_menu_value_wrapper, + text=dropdown_menu_value, + height=0, + corner_radius=0, + font=CTkFont(family=self.settings.FONT_FAMILY, size=14, weight="normal"), + anchor="w", + text_color=self.settings.ctm.BASIC_TEXT_COLOR, + ) + # setattr(self, f"l", label_widget) + + label_widget.grid(row=1, column=0, padx=(8,0), sticky="w") + + + + bindEnterAndLeaveColor([dropdown_menu_value_wrapper, label_widget], self.settings.ctm.SB__DROPDOWN_MENU_HOVERED_BG_COLOR, self.settings.ctm.SB__DROPDOWN_MENU_BG_COLOR) + bindButtonPressColor([dropdown_menu_value_wrapper, label_widget], self.settings.ctm.SB__DROPDOWN_MENU_CLICKED_BG_COLOR, self.settings.ctm.SB__DROPDOWN_MENU_BG_COLOR) + + + + def optimizedCommand(value, _e): + command(value) + self._withdraw() + + callback = partial(optimizedCommand, dropdown_menu_value) + bindButtonReleaseFunction([dropdown_menu_value_wrapper, label_widget], callback) + + row+=1 + + + + def show(self, dropdown_menu_widget_id, target_widget): + if self.hide is False: return + self.wm_attributes("-alpha", 0) + + + self.attach_widget = target_widget + + if self.active_dropdown_menu_widget is not None: + self.active_dropdown_menu_widget.grid_remove() + + target_Widget = self.dropdown_menu_widgets[dropdown_menu_widget_id].widget + target_Widget.grid() + self.active_dropdown_menu_widget = target_Widget + + self.deiconify() + self._adjustToTargetWidgetGeometry() + self.BIND_CONFIGURE_FUNC_ID = self.attach_widget.winfo_toplevel().bind("", self._adjustToTargetWidgetGeometry, "+") + self.BIND_UNMAP_FUNC_ID = self.attach_widget.bind("", self._withdraw, "+") + + self.BIND_BUTTON_1_FUNC_ID = self.attach_widget.winfo_toplevel().bind("", self._withdraw, "+") + + + self.hide = False + + + + for i in range(0,91,10): + if not self.winfo_exists(): + break + self.attributes("-alpha", i/100) + self.update() + sleep(1/100) + self.wm_attributes("-alpha", 1) + self.update() + + + + def _withdraw(self, e=None): + self.withdraw() + self.attach_widget.winfo_toplevel().unbind("", self.BIND_CONFIGURE_FUNC_ID) + self.attach_widget.unbind("", self.BIND_UNMAP_FUNC_ID) + self.attach_widget.winfo_toplevel().unbind("", self.BIND_BUTTON_1_FUNC_ID) + self.hide = True + + + def _adjustToTargetWidgetGeometry(self, e=None): + if not self.attach_widget.winfo_exists(): + return + self.attach_widget.update_idletasks() + + + + self.update() + if self.attach_widget_x_pos == self.attach_widget.winfo_rootx() and self.attach_widget_y_pos == self.attach_widget.winfo_rooty(): + self.lift() + return + + self.wrapper_widget_y_pos = self.wrapper_widget.winfo_rooty() + self.wrapper_widget_bottom_y_pos = self.wrapper_widget_y_pos + self.wrapper_widget.winfo_height() + + self.attach_widget_width = self.attach_widget.winfo_width() + self.attach_widget_height = self.attach_widget.winfo_height() + self.attach_widget_x_pos = self.attach_widget.winfo_rootx() + self.attach_widget_y_pos = self.attach_widget.winfo_rooty() + + + self.y_pos = int(self.attach_widget_y_pos + self.attach_widget_height + 4) + + if self.wrapper_widget_y_pos > self.y_pos or self.y_pos > self.wrapper_widget_bottom_y_pos: + self.hideTemporarily() + else: + if self.winfo_exists(): + self.deiconify() + + + if self.winfo_width() >= self.attach_widget_width: + self.x_pos = int(self.attach_widget_x_pos - (self.winfo_width() - self.attach_widget_width)) + else: + self.x_pos = self.attach_widget_x_pos + + self.geometry("+{}+{}".format(self.x_pos, self.y_pos)) + + self.lift() + + def hideTemporarily(self): + self.withdraw() + + 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 fc53e23f..014761d3 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 @@ -4,6 +4,7 @@ from typing import Union from customtkinter import CTkOptionMenu, CTkFont, CTkFrame, CTkLabel, CTkRadioButton, CTkEntry, CTkSlider, CTkSwitch, CTkCheckBox, CTkProgressBar from vrct_gui.ui_utils import createButtonWithImage, getLatestWidth, createOptionMenuBox +from vrct_gui import vrct_gui SETTING_BOX_COLUMN = 1 @@ -14,6 +15,14 @@ class _SettingBoxGenerator(): self.parent_widget = parent_widget self.settings = settings + self.dropdown_menu_window = vrct_gui.vrct_gui.dropdown_menu_window + + # self.dropdown_menu_window = _CreateDropdownMenuWindow( + # settings=self.settings, + # view_variable=self.view_variable, + # wrapper_widget=self.config_window.main_bg_container, + # ) + def _createSettingBoxFrame(self, for_var_label_text, for_var_desc_text): setting_box_frame = CTkFrame(self.parent_widget, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) @@ -76,6 +85,17 @@ class _SettingBoxGenerator(): def createSettingBoxDropdownMenu(self, for_var_label_text, for_var_desc_text, optionmenu_attr_name, command, variable=None, dropdown_menu_values=None): (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text) + def adjustedCommand(value): + variable.set(value) + command(value) + + self.dropdown_menu_window.createDropdownMenuBox( + dropdown_menu_widget_id=optionmenu_attr_name, + dropdown_menu_values=dropdown_menu_values, + command=adjustedCommand, + wrapper_widget=self.config_window.main_bg_container, + ) + option_menu_widget = createOptionMenuBox( parent_widget=setting_box_item_frame, optionmenu_bg_color=self.settings.ctm.SB__OPTIONMENU_BG_COLOR, @@ -92,12 +112,10 @@ class _SettingBoxGenerator(): text_color=self.settings.ctm.LABELS_TEXT_COLOR, image_file=self.settings.image_file.ARROW_LEFT.rotate(90), image_size=(14,14), - command=lambda _e: print(_e), - # command=open_selectable_language_window_command, - - # optionmenu_position="center", - # setattr_widget=main_window, - # image_widget_attr_name=arrow_img_attr_name, + optionmenu_clicked_command=lambda _e: self.dropdown_menu_window.show( + dropdown_menu_widget_id=optionmenu_attr_name, + target_widget=option_menu_widget, + ), ) option_menu_widget.grid(row=1, column=SETTING_BOX_COLUMN, sticky="e") diff --git a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py index 2ebf4d04..0f22ffae 100644 --- a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py +++ b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py @@ -93,7 +93,7 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable): text_color=settings.ctm.LABELS_TEXT_COLOR, image_file=settings.image_file.ARROW_LEFT.rotate(180), image_size=(20,20), - command=open_selectable_language_window_command, + optionmenu_clicked_command=open_selectable_language_window_command, optionmenu_position="center", setattr_widget=main_window, diff --git a/vrct_gui/ui_managers/ColorThemeManager.py b/vrct_gui/ui_managers/ColorThemeManager.py index 124b2a01..8aed18f6 100644 --- a/vrct_gui/ui_managers/ColorThemeManager.py +++ b/vrct_gui/ui_managers/ColorThemeManager.py @@ -41,6 +41,7 @@ class ColorThemeManager(): self.DARK_450_COLOR = "#b8b9bd" self.DARK_500_COLOR = "#a9aaae" self.DARK_600_COLOR = "#7f8084" + # self.DARK_650_COLOR = "#75767a" self.DARK_700_COLOR = "#6a6c6f" self.DARK_725_COLOR = "#636467" self.DARK_750_COLOR = "#5b5c5f" @@ -233,6 +234,12 @@ class ColorThemeManager(): self.config_window.SB__OPTIONMENU_BG_COLOR = self.DARK_925_COLOR self.config_window.SB__OPTIONMENU_HOVERED_BG_COLOR = self.DARK_850_COLOR self.config_window.SB__OPTIONMENU_CLICKED_BG_COLOR = self.DARK_950_COLOR + self.config_window.SB__DROPDOWN_MENU_WINDOW_BG_COLOR = self.config_window.MAIN_BG_COLOR + self.config_window.SB__DROPDOWN_MENU_WINDOW_BORDER_COLOR = self.DARK_600_COLOR + # self.config_window.SB__DROPDOWN_MENU_WINDOW_BG_COLOR = self.DARK_700_COLOR + self.config_window.SB__DROPDOWN_MENU_BG_COLOR = self.DARK_875_COLOR + self.config_window.SB__DROPDOWN_MENU_HOVERED_BG_COLOR = self.DARK_800_COLOR + self.config_window.SB__DROPDOWN_MENU_CLICKED_BG_COLOR = self.DARK_900_COLOR self.config_window.SB__SLIDER_BUTTON_COLOR = self.DARK_700_COLOR self.config_window.SB__SLIDER_BUTTON_HOVERED_COLOR = self.DARK_600_COLOR diff --git a/vrct_gui/ui_utils/ui_utils.py b/vrct_gui/ui_utils/ui_utils.py index 254c6c41..da1d1648 100644 --- a/vrct_gui/ui_utils/ui_utils.py +++ b/vrct_gui/ui_utils/ui_utils.py @@ -142,7 +142,7 @@ def createButtonWithImage(parent_widget, button_fg_color, button_enter_color, bu return button_wrapper -def createOptionMenuBox(parent_widget, optionmenu_bg_color, optionmenu_hovered_bg_color, optionmenu_clicked_bg_color, optionmenu_ipadx, optionmenu_ipady, variable, font_family, font_size, text_color, image_file, image_size, command, optionmenu_position=None, optionmenu_ipady_between_img=0, optionmenu_min_height=None, optionmenu_min_width=None, setattr_widget=None, image_widget_attr_name=None): +def createOptionMenuBox(parent_widget, optionmenu_bg_color, optionmenu_hovered_bg_color, optionmenu_clicked_bg_color, optionmenu_ipadx, optionmenu_ipady, variable, font_family, font_size, text_color, image_file, image_size, optionmenu_clicked_command, optionmenu_position=None, optionmenu_ipady_between_img=0, optionmenu_min_height=None, optionmenu_min_width=None, setattr_widget=None, image_widget_attr_name=None): option_menu_box = CTkFrame(parent_widget, corner_radius=6, fg_color=optionmenu_bg_color, cursor="hand2") @@ -189,6 +189,6 @@ def createOptionMenuBox(parent_widget, optionmenu_bg_color, optionmenu_hovered_b - bindButtonReleaseFunction([optionmenu_label_wrapper, option_menu_box, optionmenu_label_widget, optionmenu_img_widget], command) + bindButtonReleaseFunction([optionmenu_label_wrapper, option_menu_box, optionmenu_label_widget, optionmenu_img_widget], optionmenu_clicked_command) return option_menu_box \ No newline at end of file diff --git a/vrct_gui/vrct_gui.py b/vrct_gui/vrct_gui.py index bd167560..9f722671 100644 --- a/vrct_gui/vrct_gui.py +++ b/vrct_gui/vrct_gui.py @@ -6,6 +6,7 @@ from ._CreateSelectableLanguagesWindow import _CreateSelectableLanguagesWindow from ._CreateModalWindow import _CreateModalWindow from ._CreateErrorWindow import _CreateErrorWindow +from ._CreateDropdownMenuWindow import _CreateDropdownMenuWindow from ._changeMainWindowWidgetsStatus import _changeMainWindowWidgetsStatus from ._changeConfigWindowWidgetsStatus import _changeConfigWindowWidgetsStatus from ._printToTextbox import _printToTextbox @@ -21,6 +22,7 @@ class VRCT_GUI(CTk): super().__init__() self.adjusted_event=None self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID=None + self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID=None def createGUI(self, settings, view_variable): @@ -33,6 +35,11 @@ class VRCT_GUI(CTk): view_variable=self._view_variable ) + self.dropdown_menu_window = _CreateDropdownMenuWindow( + settings=self.settings.config_window, + view_variable=self._view_variable, + ) + self.config_window = ConfigWindow( vrct_gui=self, settings=self.settings.config_window, @@ -74,20 +81,20 @@ class VRCT_GUI(CTk): self.adjustToMainWindowGeometry() self.modal_window.deiconify() - self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID = self.bind("", self.adjustToMainWindowGeometry) + self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID = self.bind("", self.adjustToMainWindowGeometry, "+") + self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID = self.modal_window.bind("", lambda _e: self.config_window.lift(), "+") self.config_window.deiconify() self.config_window.focus_set() - self.config_window.grab_set() def closeConfigWindow(self): callFunctionIfCallable(self._view_variable.CALLBACK_CLOSE_CONFIG_WINDOW) self.config_window.withdraw() - self.config_window.grab_release() self.modal_window.withdraw() self.unbind("", self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID) + self.modal_window.unbind("", self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID) self.adjusted_event=None @@ -200,6 +207,10 @@ class VRCT_GUI(CTk): self.after(150, lambda: self.config_window.lift()) elif self.adjusted_event is None: self.after(150, lambda: self.config_window.lift()) + else: + pass + + self.config_window.focus_set() if e is not None: self.adjusted_event=str(e) From b47738b424f561fd4ef435b5e65260ff01ca4b99 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 8 Oct 2023 12:36:17 +0900 Subject: [PATCH 03/10] [bugfix] Config Window: Dropdown Menu Window. Set the maximum height to be 8 times the label's height, and adjust it if the value's length is less than 8. --- vrct_gui/_CreateDropdownMenuWindow.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py index 25b10479..32dbf738 100644 --- a/vrct_gui/_CreateDropdownMenuWindow.py +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -43,8 +43,6 @@ class _CreateDropdownMenuWindow(CTkToplevel): # self.rowconfigure(0,weight=1) # self.columnconfigure(0,weight=1) - # The color code [#bb4448] is a mixture of [#a9555c] and [#cc3333] (for a redder shade). - def updateDropdownMenuValues(self, dropdown_menu_widget_id, dropdown_menu_values): self.dropdown_menu_widgets[dropdown_menu_widget_id].widget.destroy() self.createDropdownMenuBox( @@ -121,15 +119,16 @@ class _CreateDropdownMenuWindow(CTkToplevel): # ______________________________________ dropdown_menu_values_length = len(dropdown_menu_values) - if dropdown_menu_values_length <= 3: - self.scroll_frame_container.configure(width=200, height=int(dropdown_menu_values_length * label_height)) - # self.geometry("{}x{}".format(300, int(dropdown_menu_values_length * label_height))) - # self.geometry("{}x{}".format(300, int(dropdown_menu_values_length * label_height))) - # self.scroll_frame_container._parent_canvas.configure(height=20) + new_height = 200 + new_width = 200 + max_display_length = 8 + if dropdown_menu_values_length < max_display_length: + new_height = int(dropdown_menu_values_length * label_height) + # new_width = 200 else: - self.scroll_frame_container.configure(width=200, height=200) - # self.geometry("{}x{}".format(200, 200)) - # self.scroll_frame_container._parent_canvas.configure(height=20) + new_height = int(max_display_length * label_height) + + self.scroll_frame_container.configure(width=new_width, height=new_height) # This is for CustomTkinter's spec change or bug fix. self.scroll_frame_container._scrollbar.configure(height=0) From 39472e64c4f5c28d7d29bc3e7e8c4d54f7b9c130 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 8 Oct 2023 14:15:20 +0900 Subject: [PATCH 04/10] =?UTF-8?q?[Refactor]=20UiScalingManager:=20?= =?UTF-8?q?=E5=A4=89=E6=95=B0=E5=90=8D=E5=A4=89=E6=9B=B4=E3=80=81=E6=B1=8E?= =?UTF-8?q?=E7=94=A8=E5=8C=96=E3=80=82Entry=20widget=E4=BB=A5=E5=A4=96?= =?UTF-8?q?=E3=81=A7=E3=82=82=E4=BD=BF=E3=81=84=E3=81=9F=E3=81=8F=E3=81=AA?= =?UTF-8?q?=E3=81=A3=E3=81=9F=E3=81=AE=E3=81=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../createSettingBox_AdvancedSettings.py | 4 ++-- .../setting_box_others/createSettingBox_Others.py | 2 +- .../setting_box_transcription/createSettingBox_Mic.py | 8 ++++---- .../createSettingBox_Speaker.py | 6 +++--- .../createSettingBox_Translation.py | 2 +- vrct_gui/ui_managers/UiScalingManager.py | 11 ++++++----- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py index 6dcdca4e..fb7a679f 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py @@ -18,7 +18,7 @@ def createSettingBox_AdvancedSettings(setting_box_wrapper, config_window, settin for_var_label_text=view_variable.VAR_LABEL_OSC_IP_ADDRESS, for_var_desc_text=view_variable.VAR_DESC_OSC_IP_ADDRESS, entry_attr_name="sb__entry_ip_address", - entry_width=settings.uism.SB__ENTRY_WIDTH_150, + entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_150, entry_bind__Any_KeyRelease=lambda value: entry_ip_address_callback(value), entry_textvariable=view_variable.VAR_OSC_IP_ADDRESS, ) @@ -30,7 +30,7 @@ def createSettingBox_AdvancedSettings(setting_box_wrapper, config_window, settin for_var_label_text=view_variable.VAR_LABEL_OSC_PORT, for_var_desc_text=view_variable.VAR_DESC_OSC_PORT, entry_attr_name="sb__entry_port", - entry_width=settings.uism.SB__ENTRY_WIDTH_150, + entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_150, entry_bind__Any_KeyRelease=lambda value: entry_port_callback(value), entry_textvariable=view_variable.VAR_OSC_PORT, ) 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 d6be70b4..2953809e 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 @@ -66,7 +66,7 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v for_var_label_text=view_variable.VAR_LABEL_MESSAGE_FORMAT, for_var_desc_text=view_variable.VAR_DESC_MESSAGE_FORMAT, entry_attr_name="sb__entry_message_format", - entry_width=settings.uism.SB__ENTRY_WIDTH_250, + entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_250, entry_bind__Any_KeyRelease=lambda value: entry_message_format_callback(value), entry_textvariable=view_variable.VAR_MESSAGE_FORMAT, ) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py index a02bc583..3842e392 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py @@ -107,7 +107,7 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari for_var_label_text=view_variable.VAR_LABEL_MIC_RECORD_TIMEOUT, for_var_desc_text=view_variable.VAR_DESC_MIC_RECORD_TIMEOUT, entry_attr_name="sb__entry_mic_record_timeout", - entry_width=settings.uism.SB__ENTRY_WIDTH_100, + entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_100, entry_bind__Any_KeyRelease=lambda value: entry_input_mic_record_timeout_callback(value), entry_textvariable=view_variable.VAR_MIC_RECORD_TIMEOUT, entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_MIC_RECORD_TIMEOUT, @@ -119,7 +119,7 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari for_var_label_text=view_variable.VAR_LABEL_MIC_PHRASE_TIMEOUT, for_var_desc_text=view_variable.VAR_DESC_MIC_PHRASE_TIMEOUT, entry_attr_name="sb__entry_mic_phrase_timeout", - entry_width=settings.uism.SB__ENTRY_WIDTH_100, + entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_100, entry_bind__Any_KeyRelease=lambda value: entry_input_mic_phrase_timeout_callback(value), entry_textvariable=view_variable.VAR_MIC_PHRASE_TIMEOUT, entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_MIC_PHRASE_TIMEOUT, @@ -131,7 +131,7 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari for_var_label_text=view_variable.VAR_LABEL_MIC_MAX_PHRASES, for_var_desc_text=view_variable.VAR_DESC_MIC_MAX_PHRASES, entry_attr_name="sb__entry_mic_max_phrases", - entry_width=settings.uism.SB__ENTRY_WIDTH_100, + entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_100, entry_bind__Any_KeyRelease=lambda value: entry_input_mic_max_phrases_callback(value), entry_textvariable=view_variable.VAR_MIC_MAX_PHRASES, entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_MIC_MAX_PHRASES, @@ -145,7 +145,7 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari for_var_label_text=view_variable.VAR_LABEL_MIC_WORD_FILTER, for_var_desc_text=view_variable.VAR_DESC_MIC_WORD_FILTER, entry_attr_name="sb__entry_mic_word_filter", - entry_width=settings.uism.SB__ENTRY_WIDTH_300, + entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_300, entry_bind__Any_KeyRelease=lambda value: entry_input_mic_word_filters_callback(value), entry_textvariable=view_variable.VAR_MIC_WORD_FILTER, ) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py index 5ebae1b5..90a382a9 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py @@ -90,7 +90,7 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_ for_var_label_text=view_variable.VAR_LABEL_SPEAKER_RECORD_TIMEOUT, for_var_desc_text=view_variable.VAR_DESC_SPEAKER_RECORD_TIMEOUT, entry_attr_name="sb__entry_speaker_record_timeout", - entry_width=settings.uism.SB__ENTRY_WIDTH_100, + entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_100, entry_bind__Any_KeyRelease=lambda value: entry_input_speaker_record_timeout_callback(value), entry_textvariable=view_variable.VAR_SPEAKER_RECORD_TIMEOUT, entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_SPEAKER_RECORD_TIMEOUT, @@ -102,7 +102,7 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_ for_var_label_text=view_variable.VAR_LABEL_SPEAKER_PHRASE_TIMEOUT, for_var_desc_text=view_variable.VAR_DESC_SPEAKER_PHRASE_TIMEOUT, entry_attr_name="sb__entry_speaker_phrase_timeout", - entry_width=settings.uism.SB__ENTRY_WIDTH_100, + entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_100, entry_bind__Any_KeyRelease=lambda value: entry_input_speaker_phrase_timeout_callback(value), entry_textvariable=view_variable.VAR_SPEAKER_PHRASE_TIMEOUT, entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_SPEAKER_PHRASE_TIMEOUT, @@ -114,7 +114,7 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_ for_var_label_text=view_variable.VAR_LABEL_SPEAKER_MAX_PHRASES, for_var_desc_text=view_variable.VAR_DESC_SPEAKER_MAX_PHRASES, entry_attr_name="sb__entry_speaker_max_phrases", - entry_width=settings.uism.SB__ENTRY_WIDTH_100, + entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_100, entry_bind__Any_KeyRelease=lambda value: entry_input_speaker_max_phrases_callback(value), entry_textvariable=view_variable.VAR_SPEAKER_MAX_PHRASES, entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_SPEAKER_MAX_PHRASES, diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py index 343f309d..014cee3e 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py @@ -16,7 +16,7 @@ def createSettingBox_Translation(setting_box_wrapper, config_window, settings, v for_var_label_text=view_variable.VAR_LABEL_DEEPL_AUTH_KEY, for_var_desc_text=view_variable.VAR_DESC_DEEPL_AUTH_KEY, entry_attr_name="sb__entry_deepl_authkey", - entry_width=settings.uism.SB__ENTRY_WIDTH_300, + entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_300, entry_bind__Any_KeyRelease=lambda value: deepl_authkey_callback(value), entry_textvariable=view_variable.VAR_DEEPL_AUTH_KEY, ) diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index bf16839f..78f892bb 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -15,6 +15,11 @@ class UiScalingManager(): def _calculatedUiSizes(self): # Common + # RESPONSIVE_UI_SIZE_INT_10 ... RESPONSIVE_UI_SIZE_INT_300 + for i in range(10, 301, 10): + setattr(self.main, f"RESPONSIVE_UI_SIZE_INT_{i}", self._calculateUiSize(i)) + setattr(self.config_window, f"RESPONSIVE_UI_SIZE_INT_{i}", self._calculateUiSize(i)) + # Main self.main.TEXTBOX_PADX = self._calculateUiSize(16) @@ -166,12 +171,8 @@ class UiScalingManager(): self.config_window.SB__ENTRY_FONT_SIZE = self.config_window.SB__SELECTOR_FONT_SIZE self.config_window.SB__ENTRY_HEIGHT = self._calculateUiSize(30) - # SB__ENTRY_WIDTH_10 ... SB__ENTRY_WIDTH_200 - for i in range(10, 301, 10): - setattr(self.config_window, f'SB__ENTRY_WIDTH_{i}', self._calculateUiSize(i)) - - self.config_window.SB__PROGRESSBAR_X_SLIDER__ENTRY_WIDTH = self.config_window.SB__ENTRY_WIDTH_50 + self.config_window.SB__PROGRESSBAR_X_SLIDER__ENTRY_WIDTH = self.config_window.RESPONSIVE_UI_SIZE_INT_50 self.config_window.SB__PROGRESSBAR_X_SLIDER__ENTRY_HEIGHT = self.config_window.SB__ENTRY_HEIGHT self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_HEIGHT = self._calculateUiSize(40) self.config_window.SB__PROGRESSBAR_X_SLIDER__SLIDER_BUTTON_LENGTH = self._calculateUiSize(2) From 95758919bd76b21650f0737f23ae78909365acf1 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 8 Oct 2023 20:03:55 +0900 Subject: [PATCH 05/10] =?UTF-8?q?[Update]=20Config=20Window:=20Dropdown=20?= =?UTF-8?q?Menu=20Window.=20Width=E6=8C=87=E5=AE=9A=E3=80=82=E3=83=95?= =?UTF-8?q?=E3=82=A9=E3=83=B3=E3=83=88=E3=82=84=E3=83=87=E3=83=90=E3=82=A4?= =?UTF-8?q?=E3=82=B9=E3=81=AA=E3=81=A9=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=81=8C=E9=95=B7=E3=81=8F=E3=81=AA=E3=82=8B=E3=82=82=E3=81=AE?= =?UTF-8?q?=E3=81=AF=E5=B9=85=E3=82=92=E5=BA=83=E3=82=81=E3=81=AB=E3=80=82?= =?UTF-8?q?(=E5=8F=AF=E5=A4=89=E3=81=AF=E9=9B=A3=E3=81=97=E3=81=84?= =?UTF-8?q?=E3=81=AE=E3=81=A7=E4=BB=8A=E3=81=AF=E6=8C=87=E5=AE=9A=E5=9E=8B?= =?UTF-8?q?=E3=81=AB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vrct_gui/_CreateDropdownMenuWindow.py | 34 ++++++++++++++----- .../_SettingBoxGenerator.py | 3 +- .../createSettingBox_Appearance.py | 1 + .../createSettingBox_Mic.py | 1 + .../createSettingBox_Speaker.py | 1 + 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py index 32dbf738..ccbfda32 100644 --- a/vrct_gui/_CreateDropdownMenuWindow.py +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -38,6 +38,14 @@ class _CreateDropdownMenuWindow(CTkToplevel): self.x_pos = None self.y_pos = None + self.init_height = 200 + self.new_height = self.init_height + self.init_width = 200 + self.new_width = self.init_width + + self.init_max_display_length = 8 + self.max_display_length = self.init_max_display_length + # self.rowconfigure(0,weight=1) @@ -50,10 +58,19 @@ class _CreateDropdownMenuWindow(CTkToplevel): dropdown_menu_values=dropdown_menu_values, command=self.dropdown_menu_widgets[dropdown_menu_widget_id].command, wrapper_widget=self.dropdown_menu_widgets[dropdown_menu_widget_id].wrapper_widget, + + dropdown_menu_width=self.dropdown_menu_widgets[dropdown_menu_widget_id].dropdown_menu_settings.dropdown_menu_width, + dropdown_menu_height=self.dropdown_menu_widgets[dropdown_menu_widget_id].dropdown_menu_settings.dropdown_menu_height, + max_display_length=self.dropdown_menu_widgets[dropdown_menu_widget_id].dropdown_menu_settings.max_display_length, ) - def createDropdownMenuBox(self, dropdown_menu_widget_id, dropdown_menu_values, command, wrapper_widget): + def createDropdownMenuBox(self, dropdown_menu_widget_id, dropdown_menu_values, command, wrapper_widget, dropdown_menu_width=None, dropdown_menu_height=None, max_display_length=None): + self.new_width = dropdown_menu_width if dropdown_menu_width is not None else self.init_width + self.new_height = dropdown_menu_height if dropdown_menu_height is not None else self.init_height + self.max_display_length = max_display_length if max_display_length is not None else self.init_max_display_length + + self.wrapper_widget = wrapper_widget self.dropdown_menu_container = CTkFrame(self, corner_radius=0, fg_color="#bb4448", width=0, height=0) @@ -66,6 +83,11 @@ class _CreateDropdownMenuWindow(CTkToplevel): widget=self.dropdown_menu_container, command=command, wrapper_widget=wrapper_widget, + dropdown_menu_settings=SimpleNamespace( + dropdown_menu_width=dropdown_menu_width, + dropdown_menu_height=dropdown_menu_height, + max_display_length=max_display_length, + ) ) @@ -119,16 +141,12 @@ class _CreateDropdownMenuWindow(CTkToplevel): # ______________________________________ dropdown_menu_values_length = len(dropdown_menu_values) - new_height = 200 - new_width = 200 - max_display_length = 8 - if dropdown_menu_values_length < max_display_length: + if dropdown_menu_values_length < self.max_display_length: new_height = int(dropdown_menu_values_length * label_height) - # new_width = 200 else: - new_height = int(max_display_length * label_height) + new_height = int(self.max_display_length * label_height) - self.scroll_frame_container.configure(width=new_width, height=new_height) + self.scroll_frame_container.configure(width=self.new_width, height=new_height) # This is for CustomTkinter's spec change or bug fix. self.scroll_frame_container._scrollbar.configure(height=0) 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 014761d3..4d7798ea 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 @@ -82,7 +82,7 @@ class _SettingBoxGenerator(): self.config_window.additional_widgets.append(setting_box_desc) - def createSettingBoxDropdownMenu(self, for_var_label_text, for_var_desc_text, optionmenu_attr_name, command, variable=None, dropdown_menu_values=None): + def createSettingBoxDropdownMenu(self, for_var_label_text, for_var_desc_text, optionmenu_attr_name, command, dropdown_menu_width=None, variable=None, dropdown_menu_values=None): (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_desc_text) def adjustedCommand(value): @@ -94,6 +94,7 @@ class _SettingBoxGenerator(): dropdown_menu_values=dropdown_menu_values, command=adjustedCommand, wrapper_widget=self.config_window.main_bg_container, + dropdown_menu_width=dropdown_menu_width, ) option_menu_widget = createOptionMenuBox( diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py index 7109496e..89c17d81 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py @@ -68,6 +68,7 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings, vi for_var_desc_text=view_variable.VAR_DESC_FONT_FAMILY, optionmenu_attr_name="sb__optionmenu_font_family", dropdown_menu_values=view_variable.LIST_FONT_FAMILY, + dropdown_menu_width=settings.uism.RESPONSIVE_UI_SIZE_INT_300, command=lambda value: optionmenu_font_family_callback(value), variable=view_variable.VAR_FONT_FAMILY, ) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py index 3842e392..ba06c763 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py @@ -58,6 +58,7 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari for_var_desc_text=view_variable.VAR_DESC_MIC_DEVICE, optionmenu_attr_name="sb__optionmenu_mic_device", dropdown_menu_values=view_variable.LIST_MIC_DEVICE, + dropdown_menu_width=settings.uism.RESPONSIVE_UI_SIZE_INT_300, command=lambda value: optionmenu_input_mic_device_callback(value), variable=view_variable.VAR_MIC_DEVICE, ) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py index 90a382a9..06571644 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py @@ -41,6 +41,7 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_ for_var_desc_text=view_variable.VAR_DESC_SPEAKER_DEVICE, optionmenu_attr_name="sb__optionmenu_speaker_device", dropdown_menu_values=view_variable.LIST_SPEAKER_DEVICE, + dropdown_menu_width=settings.uism.RESPONSIVE_UI_SIZE_INT_300, command=lambda value: optionmenu_input_speaker_device_callback(value), variable=view_variable.VAR_SPEAKER_DEVICE, ) From e80ba886d76989dc8b5df5212005ed98cbd18bdb Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 8 Oct 2023 20:08:56 +0900 Subject: [PATCH 06/10] =?UTF-8?q?[Chore]=20Config=20Window:=20Setting=20Bo?= =?UTF-8?q?x.=20=E3=83=9B=E3=83=90=E3=83=BC=E6=99=82=E3=81=AEOption=20Menu?= =?UTF-8?q?=E3=81=AE=E8=89=B2=E3=81=8C=E6=98=8E=E3=82=8B=E3=81=99=E3=81=8E?= =?UTF-8?q?=E3=82=8B=E6=B0=97=E3=81=8C=E3=81=97=E3=81=9F=E3=81=AE=E3=81=A7?= =?UTF-8?q?=E5=B0=91=E3=81=97=E3=81=A0=E3=81=91=E6=9A=97=E3=81=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vrct_gui/ui_managers/ColorThemeManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vrct_gui/ui_managers/ColorThemeManager.py b/vrct_gui/ui_managers/ColorThemeManager.py index 8aed18f6..18c73d0b 100644 --- a/vrct_gui/ui_managers/ColorThemeManager.py +++ b/vrct_gui/ui_managers/ColorThemeManager.py @@ -389,7 +389,7 @@ class ColorThemeManager(): self.config_window.SB__BG_COLOR = self.DARK_888_COLOR self.config_window.SB__OPTIONMENU_BG_COLOR = self.DARK_925_COLOR - self.config_window.SB__OPTIONMENU_HOVERED_BG_COLOR = self.DARK_850_COLOR + self.config_window.SB__OPTIONMENU_HOVERED_BG_COLOR = self.DARK_875_COLOR self.config_window.SB__SLIDER_BUTTON_COLOR = self.DARK_700_COLOR self.config_window.SB__SLIDER_BUTTON_HOVERED_COLOR = self.DARK_600_COLOR From 1e220281ba5839e426cc3e2aae608264e6bec8b0 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 8 Oct 2023 20:24:32 +0900 Subject: [PATCH 07/10] [Update] Dropdown Window and Selectable Language WIndow: add cursor=hand2. and the color when it is hovered and clicked. [Chore] remove the CTkFrame widget that was meaningless. --- vrct_gui/_CreateDropdownMenuWindow.py | 2 +- vrct_gui/_CreateSelectableLanguagesWindow.py | 17 +++++++++-------- vrct_gui/ui_managers/ColorThemeManager.py | 4 +++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py index ccbfda32..73342d5f 100644 --- a/vrct_gui/_CreateDropdownMenuWindow.py +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -156,7 +156,7 @@ class _CreateDropdownMenuWindow(CTkToplevel): row=0 for dropdown_menu_value in dropdown_menu_values: - dropdown_menu_value_wrapper = CTkFrame(self.dropdown_menu_values_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__DROPDOWN_MENU_BG_COLOR, width=0, height=0) + dropdown_menu_value_wrapper = CTkFrame(self.dropdown_menu_values_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__DROPDOWN_MENU_BG_COLOR, width=0, height=0, cursor="hand2") dropdown_menu_value_wrapper.grid(row=row, column=0, ipadx=6, ipady=6, sticky="nsew") setattr(self, f"{dropdown_menu_widget_id}__{row}", dropdown_menu_value_wrapper) diff --git a/vrct_gui/_CreateSelectableLanguagesWindow.py b/vrct_gui/_CreateSelectableLanguagesWindow.py index 5892f7d1..44b48555 100644 --- a/vrct_gui/_CreateSelectableLanguagesWindow.py +++ b/vrct_gui/_CreateSelectableLanguagesWindow.py @@ -80,15 +80,11 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): self.top_container.rowconfigure((0,2), weight=1) self.top_container.columnconfigure(1, weight=1) - self.go_back_button_container = CTkFrame(self.top_container, corner_radius=0, fg_color=self.settings.ctm.GO_BACK_BUTTON_BG_COLOR, width=0, height=0) + self.go_back_button_container = CTkFrame(self.top_container, corner_radius=0, fg_color=self.settings.ctm.GO_BACK_BUTTON_BG_COLOR, width=0, height=0, cursor="hand2") self.go_back_button_container.grid(row=1, column=0) - self.go_back_button_label_wrapper = CTkFrame(self.go_back_button_container, corner_radius=0, fg_color=self.settings.ctm.GO_BACK_BUTTON_BG_COLOR, width=0, height=0) - self.go_back_button_label_wrapper.grid(row=0, column=0) - - self.go_back_button_label = CTkLabel( - self.go_back_button_label_wrapper, + self.go_back_button_container, textvariable=self._view_variable.VAR_GO_BACK_LABEL_SELECTABLE_LANGUAGE, height=0, corner_radius=0, @@ -98,7 +94,12 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): ) self.go_back_button_label.grid(row=0, column=0, padx=10, pady=8) - bindButtonReleaseFunction([self.go_back_button_label_wrapper, self.go_back_button_label], lambda _e: self.vrct_gui.closeSelectableLanguagesWindow()) + + bindEnterAndLeaveColor([self.go_back_button_container, self.go_back_button_label], self.settings.ctm.GO_BACK_BUTTON_BG_HOVERED_COLOR, self.settings.ctm.GO_BACK_BUTTON_BG_COLOR) + bindButtonPressColor([self.go_back_button_container, self.go_back_button_label], self.settings.ctm.GO_BACK_BUTTON_BG_CLICKED_COLOR, self.settings.ctm.GO_BACK_BUTTON_BG_COLOR) + + + bindButtonReleaseFunction([self.go_back_button_container, self.go_back_button_label], lambda _e: self.vrct_gui.closeSelectableLanguagesWindow()) @@ -137,7 +138,7 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): column=0 for selectable_language_name in self._view_variable.LIST_SELECTABLE_LANGUAGES: - self.wrapper = CTkFrame(self.container, corner_radius=0, fg_color=self.settings.ctm.LANGUAGE_BUTTON_BG_COLOR, width=0, height=0) + self.wrapper = CTkFrame(self.container, corner_radius=0, fg_color=self.settings.ctm.LANGUAGE_BUTTON_BG_COLOR, width=0, height=0, cursor="hand2") self.wrapper.grid(row=row, column=column, ipadx=6, ipady=6, sticky="nsew") setattr(self, f"{row}_{column}", self.wrapper) diff --git a/vrct_gui/ui_managers/ColorThemeManager.py b/vrct_gui/ui_managers/ColorThemeManager.py index 18c73d0b..50ed0b17 100644 --- a/vrct_gui/ui_managers/ColorThemeManager.py +++ b/vrct_gui/ui_managers/ColorThemeManager.py @@ -199,12 +199,14 @@ class ColorThemeManager(): self.selectable_language_window.MAIN_BG_COLOR = self.DARK_875_COLOR - self.selectable_language_window.LANGUAGE_BUTTON_BG_COLOR = self.selectable_language_window.MAIN_BG_COLOR self.selectable_language_window.GO_BACK_BUTTON_BG_COLOR = self.DARK_800_COLOR + self.selectable_language_window.GO_BACK_BUTTON_BG_HOVERED_COLOR = self.DARK_750_COLOR + self.selectable_language_window.GO_BACK_BUTTON_BG_CLICKED_COLOR = self.DARK_875_COLOR self.selectable_language_window.TOP_BG_COLOR = self.main.SIDEBAR_BG_COLOR self.selectable_language_window.TITLE_TEXT_COLOR = self.DARK_400_COLOR + self.selectable_language_window.LANGUAGE_BUTTON_BG_COLOR = self.selectable_language_window.MAIN_BG_COLOR self.selectable_language_window.LANGUAGE_BUTTON_BG_HOVERED_COLOR = self.DARK_825_COLOR self.selectable_language_window.LANGUAGE_BUTTON_BG_CLICKED_COLOR = self.DARK_888_COLOR From 9fce7f6a94ee282fbd56a9be6d74c964c5a64f5c Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 8 Oct 2023 20:49:17 +0900 Subject: [PATCH 08/10] =?UTF-8?q?[bugfix]=20Config=20Window:=20Dropdown=20?= =?UTF-8?q?Menu=20Window.=20=E3=82=B9=E3=82=AF=E3=83=AD=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=83=90=E3=83=BC=E5=B9=85=E3=81=8C=E5=B7=A6=E5=8F=B3=E3=81=A7?= =?UTF-8?q?=E9=81=95=E3=81=A3=E3=81=A6=E3=81=84=E3=81=9F=E3=81=AE=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E3=80=82=20=E5=90=84Window=E3=81=AB1px?= =?UTF-8?q?=E3=83=90=E3=82=B0=E6=A4=9C=E5=87=BA=E7=94=A8=E8=89=B2=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=81=A8=E8=AA=BF=E6=95=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vrct_gui/_CreateDropdownMenuWindow.py | 6 +++--- vrct_gui/_CreateErrorWindow.py | 2 ++ vrct_gui/_CreateModalWindow.py | 2 +- vrct_gui/_CreateSelectableLanguagesWindow.py | 3 +-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py index 73342d5f..e07a89a5 100644 --- a/vrct_gui/_CreateDropdownMenuWindow.py +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -18,6 +18,7 @@ class _CreateDropdownMenuWindow(CTkToplevel): self.wm_attributes("-alpha", 0) self.wm_attributes("-toolwindow", True) + self.configure(fg_color="#ff7f50") self.resizable(width=False, height=False) @@ -73,7 +74,7 @@ class _CreateDropdownMenuWindow(CTkToplevel): self.wrapper_widget = wrapper_widget - self.dropdown_menu_container = CTkFrame(self, corner_radius=0, fg_color="#bb4448", width=0, height=0) + self.dropdown_menu_container = CTkFrame(self, corner_radius=0, fg_color="#ff7f50", width=0, height=0) self.dropdown_menu_container.grid(row=0, column=0, sticky="nsew") self.dropdown_menu_container.grid_remove() @@ -101,7 +102,7 @@ class _CreateDropdownMenuWindow(CTkToplevel): border_width=1, ) self.scroll_frame_container.grid(row=0, column=0, sticky="nsew") - self.scroll_frame_container._scrollbar.grid_configure(padx=3) + self.scroll_frame_container._scrollbar.grid_configure(padx=(1, 2)) self.scroll_frame_container.grid_columnconfigure(0, weight=1) self.dropdown_menu_values_box = CTkFrame(self.scroll_frame_container, corner_radius=0, fg_color=self.settings.ctm.SB__DROPDOWN_MENU_WINDOW_BG_COLOR, width=0, height=0) @@ -112,7 +113,6 @@ class _CreateDropdownMenuWindow(CTkToplevel): def _createDropdownMenuValues(self, dropdown_menu_widget_id, dropdown_menu_values, command): - # self.dropdown_menu_values_wrapper = CTkFrame(self.scroll_frame_container, corner_radius=0, fg_color="red", width=0, height=0) self.dropdown_menu_values_wrapper = CTkFrame(self.scroll_frame_container, corner_radius=0, fg_color=self.settings.ctm.SB__DROPDOWN_MENU_WINDOW_BG_COLOR) self.dropdown_menu_values_wrapper.grid(row=0, column=0, sticky="nsew") self.dropdown_menu_values_wrapper.grid_columnconfigure(0, weight=1) diff --git a/vrct_gui/_CreateErrorWindow.py b/vrct_gui/_CreateErrorWindow.py index 24a33c27..8c576a1a 100644 --- a/vrct_gui/_CreateErrorWindow.py +++ b/vrct_gui/_CreateErrorWindow.py @@ -13,6 +13,8 @@ class _CreateErrorWindow(CTkToplevel): self.wm_attributes("-alpha", 0) self.wm_attributes("-toolwindow", True) + self.configure(fg_color="#fff") + self.settings = settings self.attach_widget = None self._view_variable = view_variable diff --git a/vrct_gui/_CreateModalWindow.py b/vrct_gui/_CreateModalWindow.py index b54bad76..8aa6cb64 100644 --- a/vrct_gui/_CreateModalWindow.py +++ b/vrct_gui/_CreateModalWindow.py @@ -15,7 +15,7 @@ class _CreateModalWindow(CTkToplevel): self.attach_window = attach_window - self.configure(fg_color="black") + self.configure(fg_color="#ff7f50") self.protocol("WM_DELETE_WINDOW", lambda e: self.withdraw()) self.settings = settings diff --git a/vrct_gui/_CreateSelectableLanguagesWindow.py b/vrct_gui/_CreateSelectableLanguagesWindow.py index 44b48555..dbac7fc9 100644 --- a/vrct_gui/_CreateSelectableLanguagesWindow.py +++ b/vrct_gui/_CreateSelectableLanguagesWindow.py @@ -18,8 +18,7 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): self.attach = vrct_gui.main_bg_container self.vrct_gui = vrct_gui - - self.configure(fg_color="black") + self.configure(fg_color="#ff7f50") self.protocol("WM_DELETE_WINDOW", vrct_gui.closeSelectableLanguagesWindow) self.settings = settings From c87c3fa4da52c64723f06c68fc9da1a5dda7e730 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 8 Oct 2023 20:58:10 +0900 Subject: [PATCH 09/10] =?UTF-8?q?[Chore]=20Config=20Window:=20=E5=90=84?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E9=A0=85=E7=9B=AE=E3=81=AE=E4=B8=80=E7=95=AA?= =?UTF-8?q?=E6=9C=80=E5=BE=8C=E3=81=AE=E8=A6=81=E7=B4=A0=20border=20bottom?= =?UTF-8?q?=E6=B6=88=E3=81=97=E3=80=82=20=E9=A0=85=E7=9B=AE=E3=81=AE?= =?UTF-8?q?=E7=A7=BB=E5=8B=95=E3=82=84=E8=BF=BD=E5=8A=A0=E3=81=AA=E3=81=A9?= =?UTF-8?q?=E3=81=A7=E6=AF=8E=E5=9B=9E=E6=8C=87=E5=AE=9A=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=AE=E3=81=8C=E6=89=8B=E9=96=93=E3=81=AA=E3=81=AE=E3=81=A7?= =?UTF-8?q?=E5=BE=8C=E5=9B=9E=E3=81=97=E3=81=AB=E3=81=97=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=81=9F=E3=81=8C=E3=80=81=E3=83=AA=E3=83=AA=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E3=81=AB=E5=90=91=E3=81=91=E3=81=A6=E4=BB=8A=E5=9B=9E=E3=81=99?= =?UTF-8?q?=E3=81=B9=E3=81=A6=E6=8C=87=E5=AE=9A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../createSettingBox_AdvancedSettings.py | 2 +- .../setting_box_appearance/createSettingBox_Appearance.py | 2 +- .../setting_box_others/createSettingBox_Others.py | 2 +- .../setting_box_transcription/createSettingBox_Mic.py | 2 +- .../setting_box_transcription/createSettingBox_Speaker.py | 2 +- .../setting_box_translation/createSettingBox_Translation.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py index fb7a679f..4c6ef337 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_advanced_settings/createSettingBox_AdvancedSettings.py @@ -34,5 +34,5 @@ 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) + config_window.sb__port.grid(row=row, pady=0) row+=1 diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py index 89c17d81..e745bc3f 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_appearance/createSettingBox_Appearance.py @@ -84,5 +84,5 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings, vi command=lambda value: optionmenu_ui_language_callback(value), variable=view_variable.VAR_UI_LANGUAGE, ) - config_window.sb__ui_language.grid(row=row) + config_window.sb__ui_language.grid(row=row, pady=0) row+=1 \ No newline at end of file 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 2953809e..4fb6aeed 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 @@ -91,6 +91,6 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings, view_v command=lambda: checkbox_startup_osc_enabled_check_callback(config_window.sb__checkbox_startup_osc_enabled_check), variable=view_variable.VAR_STARTUP_OSC_ENABLED_CHECK, ) - config_window.sb__startup_osc_enabled_check.grid(row=row) + config_window.sb__startup_osc_enabled_check.grid(row=row, pady=0) row+=1 diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py index ba06c763..026c6539 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Mic.py @@ -150,5 +150,5 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari entry_bind__Any_KeyRelease=lambda value: entry_input_mic_word_filters_callback(value), entry_textvariable=view_variable.VAR_MIC_WORD_FILTER, ) - config_window.sb__mic_word_filter.grid(row=row) + config_window.sb__mic_word_filter.grid(row=row, pady=0) row+=1 \ No newline at end of file diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py index 06571644..1e97eaee 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_transcription/createSettingBox_Speaker.py @@ -120,6 +120,6 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_ entry_textvariable=view_variable.VAR_SPEAKER_MAX_PHRASES, entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_SPEAKER_MAX_PHRASES, ) - config_window.sb__speaker_max_phrases.grid(row=row) + config_window.sb__speaker_max_phrases.grid(row=row, pady=0) row+=1 # __________ \ No newline at end of file diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py index 014cee3e..d2975d0d 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py @@ -20,5 +20,5 @@ def createSettingBox_Translation(setting_box_wrapper, config_window, settings, v entry_bind__Any_KeyRelease=lambda value: deepl_authkey_callback(value), entry_textvariable=view_variable.VAR_DEEPL_AUTH_KEY, ) - config_window.sb__deepl_authkey.grid(row=row) + config_window.sb__deepl_authkey.grid(row=row, pady=0) row+=1 \ No newline at end of file From 7be50d0010cc557425496a59c8bf81119895283d Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 8 Oct 2023 21:05:25 +0900 Subject: [PATCH 10/10] [Chore] remove the code that is no longer in use --- vrct_gui/_CreateDropdownMenuWindow.py | 4 ---- .../setting_box_containers/_SettingBoxGenerator.py | 7 ------- vrct_gui/vrct_gui.py | 3 --- 3 files changed, 14 deletions(-) diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py index e07a89a5..d11a991c 100644 --- a/vrct_gui/_CreateDropdownMenuWindow.py +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -48,10 +48,6 @@ class _CreateDropdownMenuWindow(CTkToplevel): self.max_display_length = self.init_max_display_length - - # self.rowconfigure(0,weight=1) - # self.columnconfigure(0,weight=1) - def updateDropdownMenuValues(self, dropdown_menu_widget_id, dropdown_menu_values): self.dropdown_menu_widgets[dropdown_menu_widget_id].widget.destroy() self.createDropdownMenuBox( 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 4d7798ea..e07f116c 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 @@ -17,13 +17,6 @@ class _SettingBoxGenerator(): self.dropdown_menu_window = vrct_gui.vrct_gui.dropdown_menu_window - # self.dropdown_menu_window = _CreateDropdownMenuWindow( - # settings=self.settings, - # view_variable=self.view_variable, - # wrapper_widget=self.config_window.main_bg_container, - # ) - - def _createSettingBoxFrame(self, for_var_label_text, for_var_desc_text): setting_box_frame = CTkFrame(self.parent_widget, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0) diff --git a/vrct_gui/vrct_gui.py b/vrct_gui/vrct_gui.py index 9f722671..b3a1d59c 100644 --- a/vrct_gui/vrct_gui.py +++ b/vrct_gui/vrct_gui.py @@ -1,7 +1,5 @@ from customtkinter import CTk, CTkImage -# from window_help_and_info import ToplevelWindowInformation - from ._CreateSelectableLanguagesWindow import _CreateSelectableLanguagesWindow from ._CreateModalWindow import _CreateModalWindow @@ -45,7 +43,6 @@ class VRCT_GUI(CTk): settings=self.settings.config_window, view_variable=self._view_variable ) - # self.information_window = ToplevelWindowInformation(self) self.selectable_languages_window = _CreateSelectableLanguagesWindow( vrct_gui=self,