Merge branch 'view' into UI_2.0
This commit is contained in:
@@ -340,26 +340,26 @@ def callbackSetTransparency(value):
|
||||
def callbackSetAppearance(value):
|
||||
print("callbackSetAppearance", value)
|
||||
config.APPEARANCE_THEME = value
|
||||
view.showRestartButton()
|
||||
view.showRestartButtonIfRequired()
|
||||
|
||||
def callbackSetUiScaling(value):
|
||||
print("callbackSetUiScaling", value)
|
||||
config.UI_SCALING = value
|
||||
new_scaling_float = int(value.replace("%", "")) / 100
|
||||
print("callbackSetUiScaling_new_scaling_float", new_scaling_float)
|
||||
view.showRestartButton()
|
||||
view.showRestartButtonIfRequired()
|
||||
|
||||
def callbackSetFontFamily(value):
|
||||
print("callbackSetFontFamily", value)
|
||||
config.FONT_FAMILY = value
|
||||
view.showRestartButton()
|
||||
view.showRestartButtonIfRequired()
|
||||
|
||||
def callbackSetUiLanguage(value):
|
||||
print("callbackSetUiLanguage", value)
|
||||
value = get_key_by_value(selectable_languages, value)
|
||||
print("callbackSetUiLanguage__after_get_key_by_value", value)
|
||||
config.UI_LANGUAGE = value
|
||||
view.showRestartButton(locale=config.UI_LANGUAGE)
|
||||
view.showRestartButtonIfRequired(locale=config.UI_LANGUAGE)
|
||||
|
||||
# Transcription Tab (Mic)
|
||||
def callbackSetMicHost(value):
|
||||
|
||||
29
view.py
29
view.py
@@ -30,6 +30,14 @@ class View():
|
||||
|
||||
i18n.set("locale", config.UI_LANGUAGE)
|
||||
|
||||
self.restart_required_configs_pre_data = SimpleNamespace(
|
||||
appearance_theme=config.APPEARANCE_THEME,
|
||||
ui_scaling=config.UI_SCALING,
|
||||
font_family=config.FONT_FAMILY,
|
||||
ui_language=config.UI_LANGUAGE,
|
||||
)
|
||||
|
||||
|
||||
common_args = {
|
||||
"image_file": image_file,
|
||||
"FONT_FAMILY": config.FONT_FAMILY,
|
||||
@@ -698,10 +706,27 @@ class View():
|
||||
|
||||
|
||||
# Config Window
|
||||
def showRestartButton(self, locale:Union[None,str]=None):
|
||||
def showRestartButtonIfRequired(self, locale:Union[None,str]=None):
|
||||
is_restart_required = not (
|
||||
self.restart_required_configs_pre_data.appearance_theme == config.APPEARANCE_THEME and
|
||||
self.restart_required_configs_pre_data.ui_scaling == config.UI_SCALING and
|
||||
self.restart_required_configs_pre_data.font_family == config.FONT_FAMILY and
|
||||
self.restart_required_configs_pre_data.ui_language == config.UI_LANGUAGE
|
||||
)
|
||||
|
||||
if locale is None:
|
||||
locale = config.UI_LANGUAGE
|
||||
|
||||
if is_restart_required is True:
|
||||
self._showRestartButton(locale)
|
||||
else:
|
||||
self._hideRestartButton()
|
||||
|
||||
|
||||
def _showRestartButton(self, locale:Union[None,str]=None):
|
||||
self.view_variable.VAR_CONFIG_WINDOW_RESTART_BUTTON_LABEL.set(i18n.t("config_window.restart_message", locale=locale))
|
||||
vrct_gui.config_window.restart_button_container.grid()
|
||||
def hideRestartButton(self):
|
||||
def _hideRestartButton(self):
|
||||
vrct_gui.config_window.restart_button_container.grid_remove()
|
||||
|
||||
def _updateActiveSettingBoxTabNo(self, active_setting_box_tab_attr_name:str):
|
||||
|
||||
@@ -132,12 +132,6 @@ class _CreateDropdownMenuWindow(CTkToplevel):
|
||||
|
||||
|
||||
|
||||
|
||||
self.dropdown_menu_values_box = CTkFrame(self.scroll_frame_container, corner_radius=0, fg_color=self.window_bg_color, width=0, height=0)
|
||||
self.dropdown_menu_values_box.grid(row=0, column=0, sticky="nsew")
|
||||
self.dropdown_menu_values_box.grid_columnconfigure(0, weight=1)
|
||||
|
||||
|
||||
self._createDropdownMenuValues(dropdown_menu_widget_id, dropdown_menu_values, command)
|
||||
|
||||
applyUiScalingAndFixTheBugScrollBar(
|
||||
|
||||
@@ -32,15 +32,14 @@ def getLatestHeight(target_widget):
|
||||
target_widget.update_idletasks()
|
||||
return target_widget.winfo_height()
|
||||
|
||||
def getLongestText(settings):
|
||||
max_length = max(len(item["text"]) for item in settings)
|
||||
def getLongestText(text_list:list):
|
||||
max_length = 0
|
||||
longest_text = ""
|
||||
|
||||
for item in settings:
|
||||
if len(item["text"]) > max_length:
|
||||
max_length = len(item["text"])
|
||||
longest_text = item["text"]
|
||||
for text in text_list:
|
||||
if len(text) > max_length:
|
||||
max_length = len(text)
|
||||
longest_text = text
|
||||
return longest_text
|
||||
|
||||
def bindEnterAndLeaveColor(target_widgets, enter_color, leave_color):
|
||||
|
||||
Reference in New Issue
Block a user