Merge branch 'view' into UI_2.0

This commit is contained in:
Sakamoto Shiina
2023-10-13 18:44:28 +09:00
10 changed files with 40 additions and 23 deletions

View File

@@ -27,6 +27,7 @@ selectable_language_window:
config_window:
config_title: Settings
compact_mode: Compact Mode
version: version %{version}
side_menu_labels:
appearance: Appearance
translation: Translation

View File

@@ -28,6 +28,7 @@ selectable_language_window:
config_window:
config_title: 設定
compact_mode: コンパクトモード
version: バージョン %{version}
side_menu_labels:
appearance: デザイン
translation: 翻訳

17
view.py
View File

@@ -16,7 +16,8 @@ from config import config
class View():
def __init__(self):
self.settings = SimpleNamespace()
theme = get_appearance_mode() if config.APPEARANCE_THEME == "System" else config.APPEARANCE_THEME
# theme = get_appearance_mode() if config.APPEARANCE_THEME == "System" else config.APPEARANCE_THEME
theme = "Dark"
all_ctm = ColorThemeManager(theme)
all_uism = UiScalingManager(config.UI_SCALING)
image_file = ImageFileManager(theme)
@@ -135,7 +136,7 @@ class View():
ACTIVE_SETTING_BOX_TAB_ATTR_NAME="side_menu_tab_appearance",
CALLBACK_SELECTED_SETTING_BOX_TAB=None,
VAR_ERROR_MESSAGE=StringVar(value=""),
VAR_VERSION=StringVar(value=config.VERSION),
VAR_VERSION=StringVar(value=i18n.t("config_window.version", version=config.VERSION)),
VAR_CONFIG_WINDOW_TITLE=StringVar(value=i18n.t("config_window.config_title")),
VAR_CONFIG_WINDOW_COMPACT_MODE_LABEL=StringVar(value=i18n.t("config_window.compact_mode")),
@@ -161,9 +162,11 @@ class View():
VAR_LABEL_APPEARANCE_THEME=StringVar(value=i18n.t("config_window.appearance_theme.label")),
VAR_DESC_APPEARANCE_THEME=StringVar(value=i18n.t("config_window.appearance_theme.desc")),
LIST_APPEARANCE_THEME=["Light", "Dark", "System"],
LIST_APPEARANCE_THEME=["Dark"],
# LIST_APPEARANCE_THEME=["Light", "Dark", "System"],
CALLBACK_SET_APPEARANCE_THEME=None,
VAR_APPEARANCE_THEME=StringVar(value=config.APPEARANCE_THEME),
VAR_APPEARANCE_THEME=StringVar(value="Dark"),
# VAR_APPEARANCE_THEME=StringVar(value=config.APPEARANCE_THEME),
VAR_LABEL_UI_SCALING=StringVar(value=i18n.t("config_window.ui_size.label")),
VAR_DESC_UI_SCALING=None,
@@ -450,6 +453,12 @@ class View():
self.enableConfigWindowCompactMode()
vrct_gui.config_window.setting_box_compact_mode_switch_box.select()
vrct_gui._changeConfigWindowWidgetsStatus(
status="disabled",
target_names=[
"sb__optionmenu_appearance_theme",
]
)
if config.CHOICE_MIC_HOST == "NoHost":

View File

@@ -32,6 +32,10 @@ def _changeConfigWindowWidgetsStatus(config_window, settings, view_variable, sta
target_widget = config_window.sb__widgets["sb__optionmenu_speaker_device"]
disableOptionmenuWidget(target_widget)
case "sb__optionmenu_appearance_theme":
if status == "disabled":
target_widget = config_window.sb__widgets["sb__optionmenu_appearance_theme"]
disableOptionmenuWidget(target_widget)
case _:
raise ValueError(f"No matching case for target_name: {target_name}")

View File

@@ -1,7 +1,7 @@
from .widgets import createConfigWindowTitle, createSideMenuAndSettingsBoxContainers, createSettingBoxTopBar
from customtkinter import CTkToplevel, CTkFrame
from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont
from ..ui_utils import getImagePath, getLatestWidth, getLatestHeight
from utils import isEven
@@ -49,4 +49,18 @@ class ConfigWindow(CTkToplevel):
l_width = getLatestWidth(self.side_menu_bg_container)
# VRCT Now Version Label(Tmp)
version_label = CTkLabel(
self.side_menu_bg_container,
textvariable=self._view_variable.VAR_VERSION,
height=0,
corner_radius=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.NOW_VERSION_FONT_SIZE, weight="normal"),
anchor="w",
text_color=self.settings.ctm.NOW_VERSION_TEXT_COLOR,
)
version_label.place(relx=0.05, rely=0.99, anchor="sw")
self.bind_all("<Button-1>", lambda event: event.widget.focus_set(), "+")

View File

@@ -58,6 +58,7 @@ class _SettingBoxGenerator():
setting_box_labels_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR, width=0, height=0)
setting_box_labels_frame.grid(row=0, column=0, padx=0, pady=0, sticky="nsew")
setting_box_labels_frame.grid_rowconfigure((0,3), weight=1)
setting_box_label = CTkLabel(
setting_box_labels_frame,
textvariable=for_var_label_text,
@@ -66,7 +67,7 @@ class _SettingBoxGenerator():
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=0, column=0, padx=0, pady=0, sticky="ew")
setting_box_label.grid(row=1, column=0, padx=0, pady=0, sticky="ew")
self.config_window.sb__widgets[sb__attr_name].label_widget = setting_box_label
@@ -81,7 +82,7 @@ class _SettingBoxGenerator():
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.SB__DESC_FONT_SIZE, weight="normal"),
text_color=self.settings.ctm.LABELS_DESC_TEXT_COLOR
)
setting_box_desc.grid(row=1, column=0, padx=0, pady=(self.settings.uism.SB__DESC_TOP_PADY,0), sticky="ew")
setting_box_desc.grid(row=2, column=0, padx=0, pady=(self.settings.uism.SB__DESC_TOP_PADY,0), sticky="ew")
self.config_window.additional_widgets.append(setting_box_desc)
self.config_window.sb__widgets[sb__attr_name].desc_widget=setting_box_desc
else:

View File

@@ -43,22 +43,6 @@ def createMainWindowWidgets(vrct_gui, settings, view_variable):
# Main Top Bar Container - Right Side
# start from 3
main_topbar_column=3
# VRCT Now Version Label(Tmp)
vrct_gui.version_label = CTkLabel(
vrct_gui.main_topbar_container,
textvariable=view_variable.VAR_VERSION,
height=0,
corner_radius=0,
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.UPDATE_AVAILABLE_BUTTON_FONT_SIZE, weight="normal"),
anchor="e",
text_color="white",
)
vrct_gui.version_label.grid(row=0, column=main_topbar_column, padx=(0,8))
main_topbar_column+=1
# Restart Button(Tmp)
vrct_gui.restart_button_container = createButtonWithImage(
parent_widget=vrct_gui.main_topbar_container,

View File

@@ -8,6 +8,7 @@ class SplashWindow(CTkToplevel):
self.overrideredirect(True)
self.configure(fg_color="#292a2d")
self.title("SplashWindow")
self.wm_attributes("-toolwindow", True)
sw=self.winfo_screenwidth()

View File

@@ -284,6 +284,7 @@ class ColorThemeManager():
self.config_window.SIDE_MENU_SELECTED_MARK_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR
self.config_window.NOW_VERSION_TEXT_COLOR = self.DARK_300_COLOR
# Error Message Window for Config Window
# The color code [#bb4448] is a mixture of [#a9555c] and [#cc3333] (for a redder shade).

View File

@@ -169,6 +169,7 @@ class UiScalingManager():
self.config_window.SIDE_MENU_LABELS_IPADY = self._calculateUiSize(8)
self.config_window.SIDE_MENU_LABELS_FONT_SIZE = self._calculateUiSize(18)
self.config_window.NOW_VERSION_FONT_SIZE = self._calculateUiSize(12)
# Top bar Main
self.config_window.TOP_BAR_MAIN__TITLE_FONT_SIZE = self._calculateUiSize(22)