[Update] Overlay Settings:

有効無効スイッチ追加。
VR Settingsではなく、Overlay Settingsに。
Lightテーマに一部対応。
This commit is contained in:
Sakamoto Shiina
2024-04-26 22:34:19 +09:00
parent 2feb1a6fba
commit 0026102f45
6 changed files with 104 additions and 35 deletions

View File

@@ -2,7 +2,7 @@ from typing import Union
from utils import callFunctionIfCallable
from customtkinter import CTkImage, CTkLabel, CTkToplevel, CTkProgressBar, CTkFrame, CTkSlider, CTkFont
from customtkinter import CTkImage, CTkLabel, CTkToplevel, CTkProgressBar, CTkFrame, CTkSlider, CTkFont, CTkSwitch
from ..ui_utils import openImageKeepAspectRatio, getImageFileFromUiUtils, setGeometryToCenterOfScreen, fadeInAnimation
class _CreateQuickSettingBox():
@@ -49,16 +49,16 @@ class _CreateQuickSettingBox():
setting_box_label.grid(row=1, column=0, padx=0, pady=0, sticky="nse")
setting_box_label = CTkLabel(
setting_box_labels_frame,
textvariable=for_var_current_value,
anchor="w",
height=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__LABEL_FONT_SIZE, weight="normal"),
text_color=self.settings.ctm.LABELS_TEXT_COLOR
)
setting_box_label.grid(row=1, column=2, padx=0, pady=0, sticky="nsw")
if for_var_current_value is not None:
setting_box_label = CTkLabel(
setting_box_labels_frame,
textvariable=for_var_current_value,
anchor="w",
height=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__LABEL_FONT_SIZE, weight="normal"),
text_color=self.settings.ctm.LABELS_TEXT_COLOR
)
setting_box_label.grid(row=1, column=2, padx=0, pady=0, sticky="nsw")
@@ -140,4 +140,46 @@ class _CreateQuickSettingBox():
slider_bind__ButtonRelease()
slider_widget.bind("<ButtonRelease>", adjusted_slider_bind__ButtonRelease, "+")
return setting_box_frame
def createSettingBoxSwitch(
self,
for_var_label_text,
switch_attr_name,
variable,
command,
for_var_current_value=None,
):
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(for_var_label_text, for_var_current_value)
switch_widget = CTkSwitch(
setting_box_item_frame,
text=None,
height=0,
width=0,
corner_radius=int(self.settings.uism.SB__SWITCH_BOX_HEIGHT/2),
border_width=0,
switch_height=self.settings.uism.SB__SWITCH_BOX_HEIGHT,
switch_width=self.settings.uism.SB__SWITCH_BOX_WIDTH,
onvalue=True,
offvalue=False,
variable=variable,
command=command,
fg_color=self.settings.ctm.SB__SWITCH_BOX_BG_COLOR,
progress_color=self.settings.ctm.SB__SWITCH_BOX_ACTIVE_BG_COLOR,
button_color=self.settings.ctm.SB__SWITCH_BOX_BUTTON_COLOR,
button_hover_color=self.settings.ctm.SB__SWITCH_BOX_BUTTON_HOVERED_COLOR,
)
setattr(self.vrct_gui, switch_attr_name, switch_widget)
switch_widget.grid(row=1, column=1, sticky="w")
return setting_box_frame