[Refactor] Config Window: _SettingBoxGenerator ボタン系サイズと色指定の汎用化

This commit is contained in:
Sakamoto Shiina
2023-11-06 13:10:55 +09:00
parent f21ffea568
commit c8415d8370
3 changed files with 31 additions and 30 deletions

View File

@@ -277,12 +277,12 @@ class _SettingBoxGenerator():
button_widget = createButtonWithImage(
parent_widget=all_wrapper,
button_fg_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_COLOR,
button_enter_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_HOVERED_COLOR,
button_clicked_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_CLICKED_COLOR,
button_fg_color=self.settings.ctm.SB__BUTTON_COLOR,
button_enter_color=self.settings.ctm.SB__BUTTON_HOVERED_COLOR,
button_clicked_color=self.settings.ctm.SB__BUTTON_CLICKED_COLOR,
button_image_file=self.settings.image_file.FOLDER_OPEN_ICON,
button_image_size=self.settings.uism.SB__ARROW_SWITCH_BUTTON_ICON_SIZE,
button_ipadxy=self.settings.uism.SB__ARROW_SWITCH_BUTTON_IPADXY,
button_image_size=self.settings.uism.SB__BUTTON_ICON_SIZE,
button_ipadxy=self.settings.uism.SB__BUTTON_IPADXY,
button_command=button_command,
)
button_widget.grid(row=0, column=0, padx=0, sticky="w")
@@ -753,15 +753,15 @@ class _SettingBoxGenerator():
button_with_image_widget = createButtonWithImage(
parent_widget=setting_box_item_frame,
button_fg_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_COLOR,
button_enter_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_HOVERED_COLOR,
button_clicked_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_CLICKED_COLOR,
button_fg_color=self.settings.ctm.SB__BUTTON_COLOR,
button_enter_color=self.settings.ctm.SB__BUTTON_HOVERED_COLOR,
button_clicked_color=self.settings.ctm.SB__BUTTON_CLICKED_COLOR,
button_image_file=button_image,
button_image_size=self.settings.uism.SB__ARROW_SWITCH_BUTTON_ICON_SIZE,
button_ipadxy=self.settings.uism.SB__ARROW_SWITCH_BUTTON_IPADXY,
button_image_size=self.settings.uism.SB__OPEN_CONFIG_FILE_BUTTON_ICON_SIZE,
button_ipadxy=self.settings.uism.SB__OPEN_CONFIG_FILE_BUTTON_IPADXY,
button_command=button_command,
)
button_with_image_widget.grid(row=1, column=SETTING_BOX_COLUMN, padx=self.settings.uism.SB__ARROW_SWITCH_LEFT_PADX, sticky="e")
button_with_image_widget.grid(row=1, column=SETTING_BOX_COLUMN, sticky="e")
return setting_box_frame
@@ -798,12 +798,12 @@ class _SettingBoxGenerator():
for_opening_button_wrapper = createButtonWithImage(
parent_widget=setting_box_item_frame,
button_fg_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_COLOR,
button_enter_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_HOVERED_COLOR,
button_clicked_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_CLICKED_COLOR,
button_fg_color=self.settings.ctm.SB__BUTTON_COLOR,
button_enter_color=self.settings.ctm.SB__BUTTON_HOVERED_COLOR,
button_clicked_color=self.settings.ctm.SB__BUTTON_CLICKED_COLOR,
button_image_file=self.settings.image_file.ARROW_LEFT.rotate(270),
button_image_size=self.settings.uism.SB__ARROW_SWITCH_BUTTON_ICON_SIZE,
button_ipadxy=self.settings.uism.SB__ARROW_SWITCH_BUTTON_IPADXY,
button_image_size=self.settings.uism.SB__BUTTON_ICON_SIZE,
button_ipadxy=self.settings.uism.SB__BUTTON_IPADXY,
button_command=open_command,
)
for_opening_button_wrapper.grid(row=1, column=ARROW_BUTTON_COLUMN, padx=self.settings.uism.SB__ARROW_SWITCH_LEFT_PADX, sticky="e")
@@ -812,12 +812,12 @@ class _SettingBoxGenerator():
for_closing_button_wrapper = createButtonWithImage(
parent_widget=setting_box_item_frame,
button_fg_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_COLOR,
button_enter_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_HOVERED_COLOR,
button_clicked_color=self.settings.ctm.SB__ARROW_SWITCH_BUTTON_CLICKED_COLOR,
button_fg_color=self.settings.ctm.SB__BUTTON_COLOR,
button_enter_color=self.settings.ctm.SB__BUTTON_HOVERED_COLOR,
button_clicked_color=self.settings.ctm.SB__BUTTON_CLICKED_COLOR,
button_image_file=self.settings.image_file.ARROW_LEFT.rotate(90),
button_image_size=self.settings.uism.SB__ARROW_SWITCH_BUTTON_ICON_SIZE,
button_ipadxy=self.settings.uism.SB__ARROW_SWITCH_BUTTON_IPADXY,
button_image_size=self.settings.uism.SB__BUTTON_ICON_SIZE,
button_ipadxy=self.settings.uism.SB__BUTTON_IPADXY,
button_command=close_command,
)
for_closing_button_wrapper.grid(row=1, column=ARROW_BUTTON_COLUMN, padx=self.settings.uism.SB__ARROW_SWITCH_LEFT_PADX, sticky="e")

View File

@@ -160,6 +160,10 @@ def _darkTheme(base_color):
LABELS_TEXT_DISABLED_COLOR = base_color.DARK_600_COLOR,
SB__BUTTON_COLOR = base_color.DARK_888_COLOR,
SB__BUTTON_HOVERED_COLOR = base_color.DARK_800_COLOR,
SB__BUTTON_CLICKED_COLOR = base_color.DARK_900_COLOR,
# Top bar
TOP_BAR_BG_COLOR = base_color.DARK_850_COLOR,
@@ -231,11 +235,6 @@ def _darkTheme(base_color):
SB__PROGRESSBAR_X_SLIDER__ACTIVE_BUTTON_HOVERED_COLOR = base_color.PRIMARY_500_COLOR,
SB__PROGRESSBAR_X_SLIDER__ACTIVE_BUTTON_CLICKED_COLOR = base_color.PRIMARY_800_COLOR,
SB__ARROW_SWITCH_BUTTON_COLOR = base_color.DARK_888_COLOR,
SB__ARROW_SWITCH_BUTTON_HOVERED_COLOR = base_color.DARK_800_COLOR,
SB__ARROW_SWITCH_BUTTON_CLICKED_COLOR = base_color.DARK_900_COLOR,
SB__ADD_AND_DELETE_ABLE_LIST__ADD_BUTTON_COLOR = base_color.PRIMARY_600_COLOR,
SB__ADD_AND_DELETE_ABLE_LIST__ADD_BUTTON_HOVERED_COLOR = base_color.PRIMARY_500_COLOR,
SB__ADD_AND_DELETE_ABLE_LIST__ADD_BUTTON_CLICKED_COLOR = base_color.PRIMARY_700_COLOR,

View File

@@ -282,10 +282,6 @@ class UiScalingManager():
self.config_window.SB__PROGRESSBAR_X_SLIDER__BUTTON_IPADXY = self._calculateUiSize(10)
self.config_window.SB__PROGRESSBAR_X_SLIDER__BUTTON_ICON_SIZE = self._calculateUiSize(20)
self.config_window.SB__ARROW_SWITCH_BUTTON_IPADXY = self._calculateUiSize(16)
self.config_window.SB__ARROW_SWITCH_BUTTON_ICON_SIZE = self._calculateUiSize(24)
self.config_window.SB__ARROW_SWITCH_DESC_FONT_SIZE = self._calculateUiSize(16)
self.config_window.SB__ARROW_SWITCH_LEFT_PADX = (self._calculateUiSize(20), 0)
@@ -324,6 +320,12 @@ class UiScalingManager():
self.config_window.SB__MESSAGE_FORMAT__ENTRIES_BOTTOM_PADY = (0, self._calculateUiSize(14))
self.config_window.SB__BUTTON_IPADXY = self._calculateUiSize(16)
self.config_window.SB__BUTTON_ICON_SIZE = self._calculateUiSize(24)
self.config_window.SB__OPEN_CONFIG_FILE_BUTTON_IPADXY = self._calculateUiSize(10)
self.config_window.SB__OPEN_CONFIG_FILE_BUTTON_ICON_SIZE = self._calculateUiSize(20)
def _calculateUiSize(self, default_size, is_allowed_odd:bool=False, is_zero_allowed:bool=False):
size = calculateUiSize(default_size, self.SCALING_FLOAT, is_allowed_odd, is_zero_allowed)