From 31ea7ebf8ababee3130d571a0b751e7c6e2560d9 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Oct 2023 08:33:54 +0900 Subject: [PATCH] =?UTF-8?q?[Refactor]=20view=E4=BB=A5=E4=B8=8B=E3=81=AE?= =?UTF-8?q?=E5=BC=95=E6=95=B0=E7=B3=BB=E3=81=AE=E3=82=A4=E3=83=B3=E3=83=87?= =?UTF-8?q?=E3=83=B3=E3=83=88=E8=AA=BF=E6=95=B4=20=E2=80=BB=E3=81=A0?= =?UTF-8?q?=E3=81=84=E3=81=B6=E6=84=9F=E8=A6=9A=E7=9A=84=E3=81=AA=E7=8B=AC?= =?UTF-8?q?=E8=87=AA=E3=83=AB=E3=83=BC=E3=83=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vrct_gui/_CreateDropdownMenuWindow.py | 38 +++++++------- vrct_gui/_CreateErrorWindow.py | 18 +++---- vrct_gui/_changeMainWindowWidgetsStatus.py | 11 +++- vrct_gui/_printToTextbox.py | 10 +++- .../_SettingBoxGenerator.py | 52 ++++++++++++++++--- 5 files changed, 94 insertions(+), 35 deletions(-) diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py index a4f880b0..340beb99 100644 --- a/vrct_gui/_CreateDropdownMenuWindow.py +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -9,26 +9,28 @@ from functools import partial from utils import isEven, makeEven class _CreateDropdownMenuWindow(CTkToplevel): - def __init__(self, - settings, - view_variable, + def __init__( + self, + settings, + view_variable, - window_additional_y_pos, - window_border_width, - scrollbar_ipadx, - scrollbar_width, - value_ipadx, - value_ipady, - value_pady, - value_font_size, + window_additional_y_pos, + window_border_width, + scrollbar_ipadx, + scrollbar_width, + value_ipadx, + value_ipady, + value_pady, + value_font_size, + + window_bg_color, + window_border_color, + values_bg_color, + values_hovered_bg_color, + values_clicked_bg_color, + values_text_color, + ): - window_bg_color, - window_border_color, - values_bg_color, - values_hovered_bg_color, - values_clicked_bg_color, - values_text_color, - ): super().__init__() self.withdraw() self.hide = True diff --git a/vrct_gui/_CreateErrorWindow.py b/vrct_gui/_CreateErrorWindow.py index 5a2cbd7d..f6091453 100644 --- a/vrct_gui/_CreateErrorWindow.py +++ b/vrct_gui/_CreateErrorWindow.py @@ -7,17 +7,17 @@ from utils import isEven class _CreateErrorWindow(CTkToplevel): def __init__( - self, - settings, - view_variable, - wrapper_widget, + self, + settings, + view_variable, + wrapper_widget, - message_ipadx, - message_ipady, - message_font_size, + message_ipadx, + message_ipady, + message_font_size, - message_bg_color, - message_text_color, + message_bg_color, + message_text_color, ): super().__init__() diff --git a/vrct_gui/_changeMainWindowWidgetsStatus.py b/vrct_gui/_changeMainWindowWidgetsStatus.py index e785d810..0f2f7af2 100644 --- a/vrct_gui/_changeMainWindowWidgetsStatus.py +++ b/vrct_gui/_changeMainWindowWidgetsStatus.py @@ -9,7 +9,16 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta - def update_switch_status(widget_frame, widget_label, widget_switch_box, widget_selected_mark, widget_compact_mode_icon, icon_name, disabled_icon_name): + def update_switch_status( + widget_frame, + widget_label, + widget_switch_box, + widget_selected_mark, + widget_compact_mode_icon, + icon_name, + disabled_icon_name, + ): + if status == "disabled": widget_frame.configure(cursor="") widget_label.configure(text_color=settings.ctm.SF__TEXT_DISABLED_COLOR) diff --git a/vrct_gui/_printToTextbox.py b/vrct_gui/_printToTextbox.py index e99ab1c4..943b047d 100644 --- a/vrct_gui/_printToTextbox.py +++ b/vrct_gui/_printToTextbox.py @@ -1,7 +1,15 @@ from datetime import datetime from customtkinter import CTkFont -def _printToTextbox(vrct_gui, settings, target_type, original_message=None, translated_message=None, tags=None, disable_print_to_textbox_all:bool=False): +def _printToTextbox(vrct_gui, + settings, + target_type, + original_message=None, + translated_message=None, + tags=None, + disable_print_to_textbox_all:bool=False, + ): + now_raw_data = datetime.now() # now = now_raw_data.strftime("%H:%M:%S") now_hm = now_raw_data.strftime("%H:%M") 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 db613ad7..e5f7ecd7 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 @@ -91,7 +91,16 @@ class _SettingBoxGenerator(): - 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): + def createSettingBoxDropdownMenu( + self, + for_var_label_text, for_var_desc_text, + optionmenu_attr_name, + command, + dropdown_menu_width=None, + dropdown_menu_values=None, + variable=None, + ): + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(optionmenu_attr_name, for_var_label_text, for_var_desc_text) def adjustedCommand(value): @@ -143,7 +152,13 @@ class _SettingBoxGenerator(): - def createSettingBoxSwitch(self, for_var_label_text, for_var_desc_text, switch_attr_name, variable, command): + def createSettingBoxSwitch(self, + for_var_label_text, for_var_desc_text, + switch_attr_name, + variable, + command, + ): + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(switch_attr_name, for_var_label_text, for_var_desc_text) switch_widget = CTkSwitch( @@ -171,7 +186,13 @@ class _SettingBoxGenerator(): - def createSettingBoxCheckbox(self, for_var_label_text, for_var_desc_text, checkbox_attr_name, variable, command): + def createSettingBoxCheckbox(self, + for_var_label_text, for_var_desc_text, + checkbox_attr_name, + command, + variable, + ): + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(checkbox_attr_name, for_var_label_text, for_var_desc_text) checkbox_widget = CTkCheckBox( @@ -205,7 +226,19 @@ class _SettingBoxGenerator(): - def createSettingBoxSlider(self, for_var_label_text, for_var_desc_text, slider_attr_name, slider_range, command, variable, slider_number_of_steps: Union[int, None] = None, slider_bind__ButtonPress=None, slider_bind__ButtonRelease=None): + def createSettingBoxSlider( + self, + for_var_label_text, for_var_desc_text, + slider_attr_name, + slider_range, + command, + variable, + slider_number_of_steps: Union[int, + None] = None, + slider_bind__ButtonPress=None, + slider_bind__ButtonRelease=None + ): + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(slider_attr_name, for_var_label_text, for_var_desc_text) @@ -258,7 +291,6 @@ class _SettingBoxGenerator(): slider_number_of_steps: Union[int, None] = None, ): - (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(progressbar_x_slider_attr_name) def adjusted_command__for_entry_bind__Any_KeyRelease(e): @@ -352,7 +384,15 @@ class _SettingBoxGenerator(): - def createSettingBoxEntry(self, for_var_label_text, for_var_desc_text, entry_attr_name, entry_width, entry_bind__Any_KeyRelease, entry_textvariable, entry_bind__FocusOut=None): + def createSettingBoxEntry(self, + for_var_label_text, for_var_desc_text, + entry_attr_name, + entry_width, + entry_textvariable, + entry_bind__Any_KeyRelease, + entry_bind__FocusOut=None, + ): + (setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(entry_attr_name, for_var_label_text, for_var_desc_text) def adjusted_command__for_entry_bind__Any_KeyRelease(e):