[bugfix/chore] Main Window: Selectable Translation Engines.

・ドロップダウンメニューの文言修正。(CTranslate2の表示修正と、デフォルトである旨を追加)
・幅が規定値より超えた時の処理でエラーが発生するのを修正
This commit is contained in:
Sakamoto Shiina
2024-01-14 19:11:09 +09:00
parent 22e24514e0
commit 6cd56991c3
6 changed files with 35 additions and 27 deletions

View File

@@ -10,7 +10,7 @@ main_window:
swap_button_label: Swap Languages
target_language: Target Language
translator: Translator
translator_ctranslate2: Internal
translator_ctranslate2: Internal (Default)
textbox_tab_all: All
textbox_tab_sent: Sent

View File

@@ -10,7 +10,7 @@ main_window:
swap_button_label: 言語を入れ替え
target_language: 相手の言語
translator: 翻訳エンジン
translator_ctranslate2: オフライン翻訳
translator_ctranslate2: オフライン翻訳(デフォルト)
textbox_tab_all: 全て
textbox_tab_sent: 送信

View File

@@ -89,6 +89,12 @@ class View():
**common_args
)
self.settings.dropdown_menu_window = SimpleNamespace(
# ctm=all_ctm.dropdown_menu_window,
uism=all_uism.dropdown_menu_window,
**common_args
)
self.view_variable = SimpleNamespace(
# Common
CALLBACK_RESTART_SOFTWARE=None,
@@ -906,7 +912,7 @@ class View():
def updateSelectableTranslationEngineList(self, selectable_translation_engines_list):
translation_dict = {item: item for item in selectable_translation_engines_list}
translation_dict["CTranslate2"] = self.TEXT_TRANSLATOR_CTRANSLATE2
translation_dict["CTranslate2"] = i18n.t("main_window.translator_ctranslate2")
vrct_gui.translation_engine_dropdown_menu_window.updateDropdownMenuValues(
dropdown_menu_widget_id="translation_engine_dropdown_menu",

View File

@@ -352,28 +352,6 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
main_window.translation_engine_dropdown_menu_window = _CreateDropdownMenuWindow(
settings=settings,
view_variable=main_window._view_variable,
window_additional_y_pos=4,
window_border_width=1,
scrollbar_ipadx=(2,2),
scrollbar_width=16,
value_ipadx=(8,0),
value_ipady=(6,6),
value_pady=0,
value_font_size=14,
dropdown_menu_default_min_width=200,
window_bg_color="#1f2022",
window_border_color="#7f8084",
values_bg_color="#323336",
values_hovered_bg_color="#4b4c4f",
values_clicked_bg_color="#292a2d",
values_text_color=settings.ctm.BASIC_TEXT_COLOR,
)
# main_window.translation_engine_dropdown_menu_window = _CreateDropdownMenuWindow(
# settings=settings.config_window,
# view_variable=main_window._view_variable,

View File

@@ -13,6 +13,7 @@ class UiScalingManager():
self.main_window_cover = SimpleNamespace()
self.error_message_window = SimpleNamespace()
self.confirmation_modal = SimpleNamespace()
self.dropdown_menu_window = SimpleNamespace()
self._calculatedUiSizes()
@@ -170,7 +171,7 @@ class UiScalingManager():
self.confirmation_modal.BUTTONS_IPADY = self._calculateUiSize(6)
# Dropdown Menu Window
self.config_window.MARGIN_WIDTH = self._calculateUiSize(16)
self.dropdown_menu_window.MARGIN_WIDTH = self._calculateUiSize(16)
# Config Window
self.config_window.DEFAULT_WIDTH = self._calculateUiSize(1080)

View File

@@ -71,14 +71,37 @@ class VRCT_GUI(CTk):
self.settings = settings
self._view_variable = view_variable
self.translation_engine_dropdown_menu_window = _CreateDropdownMenuWindow(
settings=settings.dropdown_menu_window,
view_variable=self._view_variable,
window_additional_y_pos=4,
window_border_width=1,
scrollbar_ipadx=(2,2),
scrollbar_width=16,
value_ipadx=(8,0),
value_ipady=(6,6),
value_pady=0,
value_font_size=14,
dropdown_menu_default_min_width=200,
window_bg_color="#1f2022",
window_border_color="#7f8084",
values_bg_color="#323336",
values_hovered_bg_color="#4b4c4f",
values_clicked_bg_color="#292a2d",
values_text_color=settings.main.ctm.BASIC_TEXT_COLOR,
)
createMainWindowWidgets(
vrct_gui=self,
settings=self.settings.main,
view_variable=self._view_variable
)
# For Config Window
self.dropdown_menu_window = _CreateDropdownMenuWindow(
settings=self.settings.config_window,
settings=self.settings.dropdown_menu_window,
view_variable=self._view_variable,
window_additional_y_pos=self.settings.config_window.uism.SB__DROPDOWN_MENU_WINDOW_ADDITIONAL_Y_POS,