[Update] Config Window: 再起動が必要な変更がある場合に、再起動ボタンを表示。(現状、設定が変わらなくても変更しようとすると表示される状態ではある。例: UI size 100%からもう一度100%を選択した場合など)
This commit is contained in:
@@ -11,8 +11,6 @@ def callbackUpdateSoftware():
|
|||||||
model.updateSoftware()
|
model.updateSoftware()
|
||||||
|
|
||||||
def callbackRestartSoftware():
|
def callbackRestartSoftware():
|
||||||
print("callbackRestartSoftware")
|
|
||||||
# model.updateSoftware(restart=True)
|
|
||||||
model.reStartSoftware()
|
model.reStartSoftware()
|
||||||
|
|
||||||
# func transcription send message
|
# func transcription send message
|
||||||
@@ -343,22 +341,26 @@ def callbackSetTransparency(value):
|
|||||||
def callbackSetAppearance(value):
|
def callbackSetAppearance(value):
|
||||||
print("callbackSetAppearance", value)
|
print("callbackSetAppearance", value)
|
||||||
config.APPEARANCE_THEME = value
|
config.APPEARANCE_THEME = value
|
||||||
|
view.showRestartButton()
|
||||||
|
|
||||||
def callbackSetUiScaling(value):
|
def callbackSetUiScaling(value):
|
||||||
print("callbackSetUiScaling", value)
|
print("callbackSetUiScaling", value)
|
||||||
config.UI_SCALING = value
|
config.UI_SCALING = value
|
||||||
new_scaling_float = int(value.replace("%", "")) / 100
|
new_scaling_float = int(value.replace("%", "")) / 100
|
||||||
print("callbackSetUiScaling_new_scaling_float", new_scaling_float)
|
print("callbackSetUiScaling_new_scaling_float", new_scaling_float)
|
||||||
|
view.showRestartButton()
|
||||||
|
|
||||||
def callbackSetFontFamily(value):
|
def callbackSetFontFamily(value):
|
||||||
print("callbackSetFontFamily", value)
|
print("callbackSetFontFamily", value)
|
||||||
config.FONT_FAMILY = value
|
config.FONT_FAMILY = value
|
||||||
|
view.showRestartButton()
|
||||||
|
|
||||||
def callbackSetUiLanguage(value):
|
def callbackSetUiLanguage(value):
|
||||||
print("callbackSetUiLanguage", value)
|
print("callbackSetUiLanguage", value)
|
||||||
value = get_key_by_value(selectable_languages, value)
|
value = get_key_by_value(selectable_languages, value)
|
||||||
print("callbackSetUiLanguage__after_get_key_by_value", value)
|
print("callbackSetUiLanguage__after_get_key_by_value", value)
|
||||||
config.UI_LANGUAGE = value
|
config.UI_LANGUAGE = value
|
||||||
|
view.showRestartButton()
|
||||||
|
|
||||||
# Translation Tab
|
# Translation Tab
|
||||||
def callbackSetDeeplAuthkey(value):
|
def callbackSetDeeplAuthkey(value):
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ config_window:
|
|||||||
config_title: Settings
|
config_title: Settings
|
||||||
compact_mode: Compact Mode
|
compact_mode: Compact Mode
|
||||||
version: version %{version}
|
version: version %{version}
|
||||||
|
restart_message: Apply changes with a restart.
|
||||||
side_menu_labels:
|
side_menu_labels:
|
||||||
appearance: Appearance
|
appearance: Appearance
|
||||||
translation: Translation
|
translation: Translation
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ config_window:
|
|||||||
config_title: 設定
|
config_title: 設定
|
||||||
compact_mode: コンパクトモード
|
compact_mode: コンパクトモード
|
||||||
version: バージョン %{version}
|
version: バージョン %{version}
|
||||||
|
restart_message: 再起動して変更を適用する。
|
||||||
side_menu_labels:
|
side_menu_labels:
|
||||||
appearance: デザイン
|
appearance: デザイン
|
||||||
translation: 翻訳
|
translation: 翻訳
|
||||||
|
|||||||
6
view.py
6
view.py
@@ -139,6 +139,7 @@ class View():
|
|||||||
VAR_VERSION=StringVar(value=i18n.t("config_window.version", version=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_TITLE=StringVar(value=i18n.t("config_window.config_title")),
|
||||||
VAR_CONFIG_WINDOW_COMPACT_MODE_LABEL=StringVar(value=i18n.t("config_window.compact_mode")),
|
VAR_CONFIG_WINDOW_COMPACT_MODE_LABEL=StringVar(value=i18n.t("config_window.compact_mode")),
|
||||||
|
VAR_CONFIG_WINDOW_RESTART_BUTTON_LABEL=StringVar(value=i18n.t("config_window.restart_message")),
|
||||||
|
|
||||||
|
|
||||||
# Side Menu Labels
|
# Side Menu Labels
|
||||||
@@ -710,6 +711,11 @@ class View():
|
|||||||
|
|
||||||
|
|
||||||
# Config Window
|
# Config Window
|
||||||
|
def showRestartButton(self):
|
||||||
|
vrct_gui.config_window.restart_button_container.grid()
|
||||||
|
def hideRestartButton(self):
|
||||||
|
vrct_gui.config_window.restart_button_container.grid_remove()
|
||||||
|
|
||||||
def _updateActiveSettingBoxTabNo(self, active_setting_box_tab_attr_name:str):
|
def _updateActiveSettingBoxTabNo(self, active_setting_box_tab_attr_name:str):
|
||||||
self.view_variable.ACTIVE_SETTING_BOX_TAB_ATTR_NAME = active_setting_box_tab_attr_name
|
self.view_variable.ACTIVE_SETTING_BOX_TAB_ATTR_NAME = active_setting_box_tab_attr_name
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
from customtkinter import CTkFont, CTkFrame, CTkLabel
|
||||||
|
from utils import callFunctionIfCallable
|
||||||
|
from ....ui_utils import bindButtonFunctionAndColor
|
||||||
|
|
||||||
|
def _createRestartButton(parent_widget, config_window, settings, view_variable, column_num):
|
||||||
|
|
||||||
|
parent_widget.grid_columnconfigure(0, weight=1)
|
||||||
|
config_window.restart_button_container = CTkFrame(parent_widget, corner_radius=20, fg_color=settings.ctm.RESTART_BUTTON_BG_COLOR, width=0, height=0, cursor="hand2")
|
||||||
|
config_window.restart_button_container.grid(row=0, column=column_num, padx=settings.uism.RESTART_BUTTON_PADX, sticky="ew")
|
||||||
|
|
||||||
|
|
||||||
|
config_window.restart_button_container.grid_rowconfigure(0, weight=1)
|
||||||
|
config_window.restart_button_label = CTkLabel(
|
||||||
|
config_window.restart_button_container,
|
||||||
|
height=0,
|
||||||
|
textvariable=view_variable.VAR_CONFIG_WINDOW_RESTART_BUTTON_LABEL,
|
||||||
|
anchor="w",
|
||||||
|
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.RESTART_BUTTON_LABEL_FONT_SIZE, weight="normal"),
|
||||||
|
text_color=settings.ctm.LABELS_TEXT_COLOR
|
||||||
|
)
|
||||||
|
config_window.restart_button_label.grid(row=0, column=0, padx=20, pady=10)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bindButtonFunctionAndColor(
|
||||||
|
target_widgets=[
|
||||||
|
config_window.restart_button_container,
|
||||||
|
config_window.restart_button_label,
|
||||||
|
],
|
||||||
|
enter_color=settings.ctm.RESTART_BUTTON_HOVERED_BG_COLOR,
|
||||||
|
leave_color=settings.ctm.RESTART_BUTTON_BG_COLOR,
|
||||||
|
clicked_color=settings.ctm.RESTART_BUTTON_CLICKED_BG_COLOR,
|
||||||
|
buttonReleasedFunction=lambda _e: callFunctionIfCallable(view_variable.CALLBACK_RESTART_SOFTWARE),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
config_window.restart_button_container.grid_remove()
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
from customtkinter import CTkFont, CTkFrame, CTkLabel
|
from customtkinter import CTkFont, CTkFrame, CTkLabel
|
||||||
|
|
||||||
from ._createSettingBoxTitle import _createSettingBoxTitle
|
from ._createSettingBoxTitle import _createSettingBoxTitle
|
||||||
|
from ._createRestartButton import _createRestartButton
|
||||||
from ._createSettingBoxCompactModeButton import _createSettingBoxCompactModeButton
|
from ._createSettingBoxCompactModeButton import _createSettingBoxCompactModeButton
|
||||||
|
|
||||||
from ....ui_utils import getLatestHeight, getLatestWidth
|
from ....ui_utils import getLatestHeight, getLatestWidth
|
||||||
@@ -22,6 +23,10 @@ def createSettingBoxTopBar(config_window, settings, view_variable):
|
|||||||
config_window.setting_box_top_bar.grid_columnconfigure(column_num, weight=1)
|
config_window.setting_box_top_bar.grid_columnconfigure(column_num, weight=1)
|
||||||
column_num+=1
|
column_num+=1
|
||||||
|
|
||||||
|
# Restart Button(Tmp)
|
||||||
|
_createRestartButton(parent_widget=config_window.setting_box_top_bar, config_window=config_window, settings=settings, view_variable=view_variable, column_num=column_num)
|
||||||
|
column_num+=1
|
||||||
|
|
||||||
_createSettingBoxCompactModeButton(parent_widget=config_window.setting_box_top_bar, config_window=config_window, settings=settings, view_variable=view_variable, column_num=column_num)
|
_createSettingBoxCompactModeButton(parent_widget=config_window.setting_box_top_bar, config_window=config_window, settings=settings, view_variable=view_variable, column_num=column_num)
|
||||||
column_num+=1
|
column_num+=1
|
||||||
|
|
||||||
|
|||||||
@@ -43,22 +43,6 @@ def createMainWindowWidgets(vrct_gui, settings, view_variable):
|
|||||||
# Main Top Bar Container - Right Side
|
# Main Top Bar Container - Right Side
|
||||||
# start from 3
|
# start from 3
|
||||||
main_topbar_column=3
|
main_topbar_column=3
|
||||||
# Restart Button(Tmp)
|
|
||||||
vrct_gui.restart_button_container = createButtonWithImage(
|
|
||||||
parent_widget=vrct_gui.main_topbar_container,
|
|
||||||
button_fg_color=settings.ctm.HELP_AND_INFO_BUTTON_BG_COLOR,
|
|
||||||
button_enter_color=settings.ctm.HELP_AND_INFO_BUTTON_HOVERED_BG_COLOR,
|
|
||||||
button_clicked_color=settings.ctm.HELP_AND_INFO_BUTTON_CLICKED_BG_COLOR,
|
|
||||||
button_image_file=settings.image_file.VRCT_LOGO_MARK,
|
|
||||||
button_image_size=settings.uism.HELP_AND_INFO_BUTTON_SIZE,
|
|
||||||
button_ipadxy=settings.uism.HELP_AND_INFO_BUTTON_IPADXY,
|
|
||||||
button_command=lambda e: callFunctionIfCallable(view_variable.CALLBACK_RESTART_SOFTWARE),
|
|
||||||
corner_radius=settings.uism.HELP_AND_INFO_BUTTON_CORNER_RADIUS,
|
|
||||||
)
|
|
||||||
vrct_gui.restart_button_container.grid(row=0, column=main_topbar_column, padx=settings.uism.HELP_AND_INFO_BUTTON_PADX, pady=settings.uism.TOP_BAR_BUTTON_PADY, sticky="e")
|
|
||||||
main_topbar_column+=1
|
|
||||||
|
|
||||||
|
|
||||||
# Update Available Button
|
# Update Available Button
|
||||||
vrct_gui.update_available_container = CTkFrame(
|
vrct_gui.update_available_container = CTkFrame(
|
||||||
vrct_gui.main_topbar_container,
|
vrct_gui.main_topbar_container,
|
||||||
|
|||||||
@@ -225,6 +225,13 @@ class ColorThemeManager():
|
|||||||
|
|
||||||
# Top bar
|
# Top bar
|
||||||
self.config_window.TOP_BAR_BG_COLOR = self.DARK_850_COLOR
|
self.config_window.TOP_BAR_BG_COLOR = self.DARK_850_COLOR
|
||||||
|
|
||||||
|
# Restart Button
|
||||||
|
self.config_window.RESTART_BUTTON_BG_COLOR = self.PRIMARY_600_COLOR
|
||||||
|
self.config_window.RESTART_BUTTON_HOVERED_BG_COLOR = self.PRIMARY_500_COLOR
|
||||||
|
self.config_window.RESTART_BUTTON_CLICKED_BG_COLOR = self.PRIMARY_700_COLOR
|
||||||
|
|
||||||
|
|
||||||
# Compact Mode
|
# Compact Mode
|
||||||
self.config_window.COMPACT_MODE_SWITCH_BOX_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR
|
self.config_window.COMPACT_MODE_SWITCH_BOX_ACTIVE_BG_COLOR = self.main.SF__SWITCH_BOX_ACTIVE_BG_COLOR
|
||||||
|
|
||||||
|
|||||||
@@ -155,6 +155,10 @@ class UiScalingManager():
|
|||||||
self.config_window.TOP_BAR_SIDE__CONFIG_TITLE_LEFT_PADX = int(self.config_window.TOP_BAR_SIDE__CONFIG_TITLE_FONT_SIZE + self._calculateUiSize(16))
|
self.config_window.TOP_BAR_SIDE__CONFIG_TITLE_LEFT_PADX = int(self.config_window.TOP_BAR_SIDE__CONFIG_TITLE_FONT_SIZE + self._calculateUiSize(16))
|
||||||
self.config_window.TOP_BAR_SIDE__TITLE_PADX= self._calculateUiSize(30)
|
self.config_window.TOP_BAR_SIDE__TITLE_PADX= self._calculateUiSize(30)
|
||||||
|
|
||||||
|
# Restart Button
|
||||||
|
self.config_window.RESTART_BUTTON_LABEL_FONT_SIZE = self._calculateUiSize(12)
|
||||||
|
self.config_window.RESTART_BUTTON_PADX = (0, self._calculateUiSize(20))
|
||||||
|
|
||||||
# Compact Mode
|
# Compact Mode
|
||||||
self.config_window.COMPACT_MODE_PADX = (0, self._calculateUiSize(20))
|
self.config_window.COMPACT_MODE_PADX = (0, self._calculateUiSize(20))
|
||||||
self.config_window.COMPACT_MODE_LABEL_FONT_SIZE = self._calculateUiSize(12)
|
self.config_window.COMPACT_MODE_LABEL_FONT_SIZE = self._calculateUiSize(12)
|
||||||
|
|||||||
Reference in New Issue
Block a user