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] =?UTF-8?q?[Update]=20Config=20Window:=20Dropdown=20Menu?= =?UTF-8?q?=20Window.=20Width=E6=8C=87=E5=AE=9A=E3=80=82=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=82=84=E3=83=87=E3=83=90=E3=82=A4=E3=82=B9?= =?UTF-8?q?=E3=81=AA=E3=81=A9=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88=E3=81=8C?= =?UTF-8?q?=E9=95=B7=E3=81=8F=E3=81=AA=E3=82=8B=E3=82=82=E3=81=AE=E3=81=AF?= =?UTF-8?q?=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=E3=81=AE?= =?UTF-8?q?=E3=81=A7=E4=BB=8A=E3=81=AF=E6=8C=87=E5=AE=9A=E5=9E=8B=E3=81=AB?= =?UTF-8?q?)?= 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, )