From c1437de575edaedc11ded46aebb54b18580347b6 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:56:58 +0900 Subject: [PATCH 01/10] =?UTF-8?q?[Update]=20Config=20Window:=20DeepL=20Aut?= =?UTF-8?q?h=20Key.=20=E8=AA=8D=E8=A8=BC=E3=82=AD=E3=83=BC=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E6=99=82=E3=81=A8=E5=A4=B1=E6=95=97=E6=99=82=E3=81=AB?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E3=81=A8=E3=81=97=E3=81=A6=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E4=B8=8A=E3=81=AB=E8=A1=A8=E7=A4=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 27 +++++---- locales/en.yml | 2 + locales/ja.yml | 4 +- view.py | 54 +++++++++++------ ...Window.py => _CreateNotificationWindow.py} | 58 +++++++++++-------- .../createSettingBox_Translation.py | 1 + vrct_gui/ui_managers/Themes/_darkTheme.py | 1 + vrct_gui/ui_managers/Themes/_lightTheme.py | 1 + vrct_gui/ui_managers/UiScalingManager.py | 2 +- vrct_gui/vrct_gui.py | 18 +++--- 10 files changed, 105 insertions(+), 63 deletions(-) rename vrct_gui/{_CreateErrorWindow.py => _CreateNotificationWindow.py} (67%) diff --git a/controller.py b/controller.py index 6cef394e..1c7d0765 100644 --- a/controller.py +++ b/controller.py @@ -552,14 +552,17 @@ def callbackSetCtranslate2WeightType(value): def callbackSetDeeplAuthKey(value): print("callbackSetDeeplAuthKey", str(value)) + view.clearNotificationMessage() if len(value) == 39: result = model.authenticationTranslatorDeepLAuthKey(auth_key=value) if result is True: key = value view.printToTextbox_AuthenticationSuccess() + view.showSuccessMessage_DeeplAuthKey() else: key = None view.printToTextbox_AuthenticationError() + view.showErrorMessage_DeeplAuthKey() auth_keys = config.AUTH_KEYS auth_keys["DeepL_API"] = key config.AUTH_KEYS = auth_keys @@ -596,7 +599,7 @@ def callbackSetMicEnergyThreshold(value): try: value = int(value) if 0 <= value and value <= config.MAX_MIC_ENERGY_THRESHOLD: - view.clearErrorMessage() + view.clearNotificationMessage() config.INPUT_MIC_ENERGY_THRESHOLD = value view.setGuiVariable_MicEnergyThreshold(config.INPUT_MIC_ENERGY_THRESHOLD) else: @@ -633,7 +636,7 @@ def callbackSetMicRecordTimeout(value): try: value = int(value) if 0 <= value and value <= config.INPUT_MIC_PHRASE_TIMEOUT: - view.clearErrorMessage() + view.clearNotificationMessage() config.INPUT_MIC_RECORD_TIMEOUT = value view.setGuiVariable_MicRecordTimeout(config.INPUT_MIC_RECORD_TIMEOUT) else: @@ -648,7 +651,7 @@ def callbackSetMicPhraseTimeout(value): try: value = int(value) if 0 <= value and value >= config.INPUT_MIC_RECORD_TIMEOUT: - view.clearErrorMessage() + view.clearNotificationMessage() config.INPUT_MIC_PHRASE_TIMEOUT = value view.setGuiVariable_MicPhraseTimeout(config.INPUT_MIC_PHRASE_TIMEOUT) else: @@ -663,7 +666,7 @@ def callbackSetMicMaxPhrases(value): try: value = int(value) if 0 <= value: - view.clearErrorMessage() + view.clearNotificationMessage() config.INPUT_MIC_MAX_PHRASES = value view.setGuiVariable_MicMaxPhrases(config.INPUT_MIC_MAX_PHRASES) else: @@ -714,7 +717,7 @@ def callbackSetSpeakerEnergyThreshold(value): try: value = int(value) if 0 <= value and value <= config.MAX_SPEAKER_ENERGY_THRESHOLD: - view.clearErrorMessage() + view.clearNotificationMessage() config.INPUT_SPEAKER_ENERGY_THRESHOLD = value view.setGuiVariable_SpeakerEnergyThreshold(config.INPUT_SPEAKER_ENERGY_THRESHOLD) else: @@ -756,7 +759,7 @@ def callbackSetSpeakerRecordTimeout(value): try: value = int(value) if 0 <= value and value <= config.INPUT_SPEAKER_PHRASE_TIMEOUT: - view.clearErrorMessage() + view.clearNotificationMessage() config.INPUT_SPEAKER_RECORD_TIMEOUT = value view.setGuiVariable_SpeakerRecordTimeout(config.INPUT_SPEAKER_RECORD_TIMEOUT) else: @@ -771,7 +774,7 @@ def callbackSetSpeakerPhraseTimeout(value): try: value = int(value) if 0 <= value and value >= config.INPUT_SPEAKER_RECORD_TIMEOUT: - view.clearErrorMessage() + view.clearNotificationMessage() config.INPUT_SPEAKER_PHRASE_TIMEOUT = value view.setGuiVariable_SpeakerPhraseTimeout(config.INPUT_SPEAKER_PHRASE_TIMEOUT) else: @@ -786,7 +789,7 @@ def callbackSetSpeakerMaxPhrases(value): try: value = int(value) if 0 <= value: - view.clearErrorMessage() + view.clearNotificationMessage() config.INPUT_SPEAKER_MAX_PHRASES = value view.setGuiVariable_SpeakerMaxPhrases(config.INPUT_SPEAKER_MAX_PHRASES) else: @@ -860,7 +863,7 @@ def callbackSetSendMessageFormat(value): print("callbackSetSendMessageFormat", value) if isUniqueStrings(["[message]"], value) is True: config.SEND_MESSAGE_FORMAT = value - view.clearErrorMessage() + view.clearNotificationMessage() view.setSendMessageFormat_EntryWidgets(config.SEND_MESSAGE_FORMAT) else: view.showErrorMessage_SendMessageFormat() @@ -871,7 +874,7 @@ def callbackSetSendMessageFormatWithT(value): if len(value) > 0: if isUniqueStrings(["[message]", "[translation]"], value) is True: config.SEND_MESSAGE_FORMAT_WITH_T = value - view.clearErrorMessage() + view.clearNotificationMessage() view.setSendMessageFormatWithT_EntryWidgets(config.SEND_MESSAGE_FORMAT_WITH_T) else: view.showErrorMessage_SendMessageFormatWithT() @@ -882,7 +885,7 @@ def callbackSetReceivedMessageFormat(value): print("callbackSetReceivedMessageFormat", value) if isUniqueStrings(["[message]"], value) is True: config.RECEIVED_MESSAGE_FORMAT = value - view.clearErrorMessage() + view.clearNotificationMessage() view.setReceivedMessageFormat_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT) else: view.showErrorMessage_ReceivedMessageFormat() @@ -893,7 +896,7 @@ def callbackSetReceivedMessageFormatWithT(value): if len(value) > 0: if isUniqueStrings(["[message]", "[translation]"], value) is True: config.RECEIVED_MESSAGE_FORMAT_WITH_T = value - view.clearErrorMessage() + view.clearNotificationMessage() view.setReceivedMessageFormatWithT_EntryWidgets(config.RECEIVED_MESSAGE_FORMAT_WITH_T) else: view.showErrorMessage_ReceivedMessageFormatWithT() diff --git a/locales/en.yml b/locales/en.yml index c885795f..500a00f3 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -130,6 +130,8 @@ config_window: label: DeepL Auth Key desc: Please select %{translator} on the main screen with DeepL_API when using. ※Some languages may not be supported. open_auth_key_webpage: Open DeepL Account Webpage + auth_key_success: Auth key update completed. + auth_key_error: Auth Key is incorrect or Usage limit reached. mic_host: label: Mic Host/Driver diff --git a/locales/ja.yml b/locales/ja.yml index d7d800e1..e9a4492c 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -28,7 +28,7 @@ main_window: disabled_foreground: 最前面への固定を解除しました。 auth_key_success: 認証キーの更新が完了しました。 - auth_key_error: 認証キーが間違っているか、API使用制限が上限に達しています. + auth_key_error: 認証キーが間違っているか、API使用制限が上限に達しています。 no_mic_device_detected_error: マイクデバイスが検出されませんでした。 no_speaker_device_detected_error: スピーカーデバイスが検出されませんでした。 @@ -129,6 +129,8 @@ config_window: label: DeepL 認証キー desc: "使用の際は、メイン画面にある %{translator} をDeepL_APIに変更してください。\n※対応していない言語もあります。" open_auth_key_webpage: DeepLアカウントページを開く + auth_key_success: 認証キーの更新が完了しました。 + auth_key_error: 認証キーが間違っているか、API使用制限が上限に達しています。 mic_host: label: マイク(ホスト/ドライバー) diff --git a/view.py b/view.py index e7962850..54091837 100644 --- a/view.py +++ b/view.py @@ -80,8 +80,8 @@ class View(): **common_args ) - self.settings.error_message_window = SimpleNamespace( - uism=all_uism.error_message_window, + self.settings.notification_message_window = SimpleNamespace( + uism=all_uism.notification_message_window, **common_args ) @@ -297,6 +297,8 @@ class View(): CALLBACK_SET_DEEPL_AUTH_KEY=None, VAR_DEEPL_AUTH_KEY=StringVar(value=config.AUTH_KEYS["DeepL_API"]), VAR_OPEN_DEEPL_WEB_PAGE=StringVar(value=i18n.t( "config_window.deepl_auth_key.open_auth_key_webpage")), + CALLBACK_FOCUS_OUT_DEEPL_AUTH_KEY=self.callbackBindFocusOut_DeeplAuthKey, + # Transcription Tab (Mic) @@ -997,8 +999,8 @@ class View(): def _clearTextBox(entry_widget): entry_widget.delete("1.0", "end") - def clearErrorMessage(self): - vrct_gui._clearErrorMessage() + def clearNotificationMessage(self): + vrct_gui._clearNotificationMessage() @staticmethod @@ -1721,60 +1723,74 @@ class View(): # Callback Bind FocusOut + def callbackBindFocusOut_DeeplAuthKey(self, _e=None): + self.clearNotificationMessage() + def callbackBindFocusOut_MicEnergyThreshold(self, _e=None): self.setLatestConfigVariable("MicEnergyThreshold") - self.clearErrorMessage() + self.clearNotificationMessage() def callbackBindFocusOut_SpeakerEnergyThreshold(self, _e=None): self.setLatestConfigVariable("SpeakerEnergyThreshold") - self.clearErrorMessage() + self.clearNotificationMessage() def callbackBindFocusOut_MicRecordTimeout(self, _e=None): self.setLatestConfigVariable("MicRecordTimeout") - self.clearErrorMessage() + self.clearNotificationMessage() def callbackBindFocusOut_MicPhraseTimeout(self, _e=None): self.setLatestConfigVariable("MicPhraseTimeout") - self.clearErrorMessage() + self.clearNotificationMessage() def callbackBindFocusOut_MicMaxPhrases(self, _e=None): self.setLatestConfigVariable("MicMaxPhrases") - self.clearErrorMessage() + self.clearNotificationMessage() def callbackBindFocusOut_SpeakerRecordTimeout(self, _e=None): self.setLatestConfigVariable("SpeakerRecordTimeout") - self.clearErrorMessage() + self.clearNotificationMessage() def callbackBindFocusOut_SpeakerPhraseTimeout(self, _e=None): self.setLatestConfigVariable("SpeakerPhraseTimeout") - self.clearErrorMessage() + self.clearNotificationMessage() def callbackBindFocusOut_SpeakerMaxPhrases(self, _e=None): self.setLatestConfigVariable("SpeakerMaxPhrases") - self.clearErrorMessage() + self.clearNotificationMessage() def callbackBindFocusOut_SendMessageFormat(self, _e=None): self.setLatestConfigVariable("SendMessageFormat") - self.clearErrorMessage() + self.clearNotificationMessage() def callbackBindFocusOut_SendMessageFormatWithT(self, _e=None): self.setLatestConfigVariable("SendMessageFormatWithT") - self.clearErrorMessage() + self.clearNotificationMessage() def callbackBindFocusOut_ReceivedMessageFormat(self, _e=None): self.setLatestConfigVariable("ReceivedMessageFormat") - self.clearErrorMessage() + self.clearNotificationMessage() def callbackBindFocusOut_ReceivedMessageFormatWithT(self, _e=None): self.setLatestConfigVariable("ReceivedMessageFormatWithT") - self.clearErrorMessage() + self.clearNotificationMessage() -# Show Error Message (Config Window) +# Show Notification Message (Config Window) + def showSuccessMessage_DeeplAuthKey(self): + self._showSuccessMessage( + vrct_gui.config_window.sb__entry_deepl_auth_key, + i18n.t("config_window.deepl_auth_key.auth_key_success") + ) + def showErrorMessage_DeeplAuthKey(self): + self._showErrorMessage( + vrct_gui.config_window.sb__entry_deepl_auth_key, + i18n.t("config_window.deepl_auth_key.auth_key_error") + ) + def showErrorMessage_MicEnergyThreshold(self): self._showErrorMessage( vrct_gui.config_window.sb__progressbar_x_slider__entry_mic_energy_threshold, @@ -1881,6 +1897,10 @@ class View(): def _makeInvalidValueErrorMessage(error_message): return i18n.t("config_window.common_error_message.invalid_value") + "\n" + error_message + def _showSuccessMessage(self, target_widget, message): + self.view_variable.VAR_ERROR_MESSAGE.set(message) + vrct_gui._showSuccessMessage(target_widget=target_widget) + def _showErrorMessage(self, target_widget, message): self.view_variable.VAR_ERROR_MESSAGE.set(message) vrct_gui._showErrorMessage(target_widget=target_widget) diff --git a/vrct_gui/_CreateErrorWindow.py b/vrct_gui/_CreateNotificationWindow.py similarity index 67% rename from vrct_gui/_CreateErrorWindow.py rename to vrct_gui/_CreateNotificationWindow.py index ef7ff5fb..e7fa2226 100644 --- a/vrct_gui/_CreateErrorWindow.py +++ b/vrct_gui/_CreateNotificationWindow.py @@ -5,7 +5,7 @@ from .ui_utils import getLatestWidth, getLatestHeight from utils import isEven -class _CreateErrorWindow(CTkToplevel): +class _CreateNotificationWindow(CTkToplevel): def __init__( self, settings, @@ -16,7 +16,8 @@ class _CreateErrorWindow(CTkToplevel): message_ipady, message_font_size, - message_bg_color, + error_message_bg_color, + success_message_bg_color, message_text_color, ): @@ -34,7 +35,8 @@ class _CreateErrorWindow(CTkToplevel): self.message_ipady = message_ipady self.message_font_size = message_font_size - self.message_bg_color = message_bg_color + self.error_message_bg_color = error_message_bg_color + self.success_message_bg_color = success_message_bg_color self.message_text_color = message_text_color @@ -51,20 +53,16 @@ class _CreateErrorWindow(CTkToplevel): self.wm_attributes("-alpha", 0) self.wm_attributes("-toolwindow", True) - self.configure(fg_color=self.message_bg_color) - - - self.grid_rowconfigure(0,weight=1) self.grid_columnconfigure(0,weight=1) - self.error_message_container = CTkFrame(self, corner_radius=0, fg_color=self.message_bg_color, width=0, height=0) - self.error_message_container.grid(row=0, column=0, sticky="nsew") + self.notification_message_container = CTkFrame(self, corner_radius=0, width=0, height=0) + self.notification_message_container.grid(row=0, column=0, sticky="nsew") - self.error_message_container_label_wrapper = CTkLabel( - self.error_message_container, + self.notification_message_container_label_wrapper = CTkLabel( + self.notification_message_container, # text=message, textvariable=self._view_variable.VAR_ERROR_MESSAGE, height=0, @@ -74,12 +72,19 @@ class _CreateErrorWindow(CTkToplevel): justify="left", text_color=self.message_text_color, ) - self.error_message_container_label_wrapper.grid(row=0, column=0, padx=self.message_ipadx, pady=self.message_ipady, sticky="nsew") + self.notification_message_container_label_wrapper.grid(row=0, column=0, padx=self.message_ipadx, pady=self.message_ipady, sticky="nsew") - def show(self, target_widget): + def show(self, target_widget, message_type): + if message_type == "Error": + self.notification_message_container.configure(fg_color=self.error_message_bg_color) + elif message_type == "Success": + self.notification_message_container.configure(fg_color=self.success_message_bg_color) + else: + raise ValueError("message_type is not selected") + if self.hide is False: return @@ -92,22 +97,23 @@ class _CreateErrorWindow(CTkToplevel): self.hide = False - label_width = getLatestWidth(self.error_message_container_label_wrapper) - label_height = getLatestHeight(self.error_message_container_label_wrapper) + label_width = getLatestWidth(self.notification_message_container_label_wrapper) + label_height = getLatestHeight(self.notification_message_container_label_wrapper) # for fixing 1px bug if isEven(label_width) is False: - self.error_message_container_label_wrapper.grid(padx=(self.message_ipadx[0], self.message_ipadx[1]-1)) + self.notification_message_container_label_wrapper.grid(padx=(self.message_ipadx[0], self.message_ipadx[1]-1)) else: - self.error_message_container_label_wrapper.grid(padx=self.message_ipadx) + self.notification_message_container_label_wrapper.grid(padx=self.message_ipadx) # for fixing 1px bug if isEven(label_height) is False: - self.error_message_container_label_wrapper.grid(pady=(self.message_ipady[0], self.message_ipady[1]-1)) + self.notification_message_container_label_wrapper.grid(pady=(self.message_ipady[0], self.message_ipady[1]-1)) else: - self.error_message_container_label_wrapper.grid(pady=self.message_ipady) + self.notification_message_container_label_wrapper.grid(pady=self.message_ipady) + # First show animation for i in range(0,101,20): if not self.winfo_exists(): break @@ -117,12 +123,14 @@ class _CreateErrorWindow(CTkToplevel): sleep(0.1) - for i in range(0,91,10): - if not self.winfo_exists(): - break - self.attributes("-alpha", i/100) - self.update() - sleep(1/80) + # Blink animation + if message_type == "Error": + for i in range(0,91,10): + if not self.winfo_exists(): + break + self.attributes("-alpha", i/100) + self.update() + sleep(1/80) def _withdraw(self, e=None): diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py index 7e3a9ba5..3350b4d8 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/setting_box_translation/createSettingBox_Translation.py @@ -47,6 +47,7 @@ def createSettingBox_Translation(setting_box_wrapper, config_window, settings, v entry_attr_name="sb__entry_deepl_auth_key", entry_width=settings.uism.RESPONSIVE_UI_SIZE_INT_300, entry_bind__Any_KeyRelease=lambda value: deeplAuthKeyCallback(value), + entry_bind__FocusOut=view_variable.CALLBACK_FOCUS_OUT_DEEPL_AUTH_KEY, entry_textvariable=view_variable.VAR_DEEPL_AUTH_KEY, open_authkey_page_command=lambda _e: callFunctionIfCallable(view_variable.CALLBACK_OPEN_WEBPAGE_DEEPL_AUTH_KEY), open_authkey_text_variable=view_variable.VAR_OPEN_DEEPL_WEB_PAGE, diff --git a/vrct_gui/ui_managers/Themes/_darkTheme.py b/vrct_gui/ui_managers/Themes/_darkTheme.py index 1b5fc339..71cbc292 100644 --- a/vrct_gui/ui_managers/Themes/_darkTheme.py +++ b/vrct_gui/ui_managers/Themes/_darkTheme.py @@ -294,6 +294,7 @@ def _darkTheme(base_color): # Error Message Window for Config Window # The color code [#bb4448] is a mixture of [#a9555c] and [#cc3333] (for a redder shade). SB__ERROR_MESSAGE_BG_COLOR = "#bb4448", + SB__SUCCESS_MESSAGE_BG_COLOR = "#368777", SB__ERROR_MESSAGE_TEXT_COLOR = "#fff", ), diff --git a/vrct_gui/ui_managers/Themes/_lightTheme.py b/vrct_gui/ui_managers/Themes/_lightTheme.py index d953372c..fbaf1201 100644 --- a/vrct_gui/ui_managers/Themes/_lightTheme.py +++ b/vrct_gui/ui_managers/Themes/_lightTheme.py @@ -288,6 +288,7 @@ def _lightTheme(base_color): # Error Message Window for Config Window # Check DarkTheme's this part. Based on the color bb4448, used to source, and pick up the number 600 by the generator (https://m2.material.io/design/color/the-color-system.html#tools-for-picking-colors) SB__ERROR_MESSAGE_BG_COLOR = "#cd4c4f", + SB__SUCCESS_MESSAGE_BG_COLOR = "#cd4c4f", SB__ERROR_MESSAGE_TEXT_COLOR = "#fff", ), diff --git a/vrct_gui/ui_managers/UiScalingManager.py b/vrct_gui/ui_managers/UiScalingManager.py index 85204af7..798f3412 100644 --- a/vrct_gui/ui_managers/UiScalingManager.py +++ b/vrct_gui/ui_managers/UiScalingManager.py @@ -11,7 +11,7 @@ class UiScalingManager(): self.config_window = SimpleNamespace() self.selectable_language_window = SimpleNamespace() self.main_window_cover = SimpleNamespace() - self.error_message_window = SimpleNamespace() + self.notification_message_window = SimpleNamespace() self.confirmation_modal = SimpleNamespace() self.dropdown_menu_window = SimpleNamespace() diff --git a/vrct_gui/vrct_gui.py b/vrct_gui/vrct_gui.py index 25369a6a..0a795436 100644 --- a/vrct_gui/vrct_gui.py +++ b/vrct_gui/vrct_gui.py @@ -3,7 +3,7 @@ from customtkinter import CTk, CTkImage from ._CreateSelectableLanguagesWindow import _CreateSelectableLanguagesWindow from ._CreateWindowCover import _CreateWindowCover -from ._CreateErrorWindow import _CreateErrorWindow +from ._CreateNotificationWindow import _CreateNotificationWindow from ._CreateDropdownMenuWindow import _CreateDropdownMenuWindow from ._changeMainWindowWidgetsStatus import _changeMainWindowWidgetsStatus from ._changeConfigWindowWidgetsStatus import _changeConfigWindowWidgetsStatus @@ -140,8 +140,8 @@ class VRCT_GUI(CTk): view_variable=self._view_variable ) - self.error_message_window = _CreateErrorWindow( - settings=self.settings.error_message_window, + self.notification_message_window = _CreateNotificationWindow( + settings=self.settings.notification_message_window, view_variable=self._view_variable, wrapper_widget=self.config_window.main_bg_container, @@ -149,7 +149,8 @@ class VRCT_GUI(CTk): message_ipady=self.settings.config_window.uism.SB__ERROR_MESSAGE_IPADY, message_font_size=self.settings.config_window.uism.SB__ERROR_MESSAGE_FONT_SIZE, - message_bg_color=self.settings.config_window.ctm.SB__ERROR_MESSAGE_BG_COLOR, + error_message_bg_color=self.settings.config_window.ctm.SB__ERROR_MESSAGE_BG_COLOR, + success_message_bg_color=self.settings.config_window.ctm.SB__SUCCESS_MESSAGE_BG_COLOR, message_text_color=self.settings.config_window.ctm.SB__ERROR_MESSAGE_TEXT_COLOR, ) @@ -298,11 +299,14 @@ class VRCT_GUI(CTk): def _showErrorMessage(self, target_widget): - self.error_message_window.show(target_widget=target_widget) + self.notification_message_window.show(target_widget=target_widget, message_type="Error") - def _clearErrorMessage(self): + def _showSuccessMessage(self, target_widget): + self.notification_message_window.show(target_widget=target_widget, message_type="Success") + + def _clearNotificationMessage(self): try: - self.error_message_window._withdraw() + self.notification_message_window._withdraw() except Exception: pass From 202e459aadef0c806e86347213e05e014f2b9701 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Mon, 4 Mar 2024 17:18:28 +0900 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=90=9B[bugifx]=20Model:=20=E4=B8=AD?= =?UTF-8?q?=E5=9B=BD=E8=AA=9E=E3=80=81=E7=B9=81=E4=BD=93=E5=AD=97=E3=81=8C?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E3=81=9A?= =?UTF-8?q?=E3=80=81=E5=85=A8=E9=83=A8=E7=B0=A1=E4=BD=93=E5=AD=97=E3=81=AB?= =?UTF-8?q?=E3=81=AA=E3=81=A3=E3=81=A6=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../transcription/transcription_languages.py | 12 +- models/translation/translation_languages.py | 311 +++++++++--------- 2 files changed, 166 insertions(+), 157 deletions(-) diff --git a/models/transcription/transcription_languages.py b/models/transcription/transcription_languages.py index 63d92568..c2cfa914 100644 --- a/models/transcription/transcription_languages.py +++ b/models/transcription/transcription_languages.py @@ -85,20 +85,22 @@ transcription_lang = { "Whisper": "ca", }, }, - "Chinese":{ - "Mandarin (Simplified, China)":{ + "Chinese Simplified":{ + "China":{ "Google": "cmn-Hans-CN", "Whisper": "zh", }, - "Mandarin (Simplified, Hong Kong)":{ + "Hong Kong":{ "Google": "cmn-Hans-HK", "Whisper": "zh", }, - "Mandarin (Traditional, Taiwan)":{ + }, + "Chinese Traditional":{ + "Taiwan":{ "Google": "cmn-Hant-TW", "Whisper": "zh", }, - "Cantonese (Traditional Hong Kong)":{ + "Hong Kong":{ "Google": "yue-Hant-HK", "Whisper": "yue", }, diff --git a/models/translation/translation_languages.py b/models/translation/translation_languages.py index 44051f8a..a697960b 100644 --- a/models/translation/translation_languages.py +++ b/models/translation/translation_languages.py @@ -1,40 +1,41 @@ translation_lang = {} dict_deepl_languages = { - 'Arabic':'ar', - 'Bulgarian':'bg', - 'Czech':'cs', - 'Danish':'da', - 'German':'de', - 'Greek':'el', - 'English':'en', - 'Spanish':'es', - 'Estonian':'et', - 'Finnish':'fi', - 'French':'fr', - 'Irish':'ga', - 'Croatian':'hr', - 'Hungarian':'hu', - 'Indonesian':'id', - 'Icelandic':'is', - 'Italian':'it', - 'Japanese':'ja', - 'Korean':'ko', - 'Lithuanian':'lt', - 'Latvian':'lv', - 'Maltese':'mt', - 'Bokmal':'nb', - 'Dutch':'nl', - 'Norwegian':'no', - 'Polish':'pl', - 'Portuguese':'pt', - 'Romanian':'ro', - 'Russian':'ru', - 'Slovak':'sk', - 'Slovenian':'sl', - 'Swedish':'sv', - 'Turkish':'tr', - 'Ukrainian':'uk', - 'Chinese':'zh', + "Arabic":"ar", + "Bulgarian":"bg", + "Czech":"cs", + "Danish":"da", + "German":"de", + "Greek":"el", + "English":"en", + "Spanish":"es", + "Estonian":"et", + "Finnish":"fi", + "French":"fr", + "Irish":"ga", + "Croatian":"hr", + "Hungarian":"hu", + "Indonesian":"id", + "Icelandic":"is", + "Italian":"it", + "Japanese":"ja", + "Korean":"ko", + "Lithuanian":"lt", + "Latvian":"lv", + "Maltese":"mt", + "Bokmal":"nb", + "Dutch":"nl", + "Norwegian":"no", + "Polish":"pl", + "Portuguese":"pt", + "Romanian":"ro", + "Russian":"ru", + "Slovak":"sk", + "Slovenian":"sl", + "Swedish":"sv", + "Turkish":"tr", + "Ukrainian":"uk", + "Chinese Simplified":"zh", + "Chinese Traditional":"zh" } translation_lang["DeepL"] = { "source":dict_deepl_languages, @@ -70,7 +71,8 @@ dict_deepl_api_source_languages = { "Swedish":"sv", "Turkish":"tr", "Ukrainian":"uk", - "Chinese":"zh" + "Chinese Simplified":"zh", + "Chinese Traditional":"zh" } dict_deepl_api_target_languages = { "Japanese":"ja", @@ -104,7 +106,8 @@ dict_deepl_api_target_languages = { "Swedish":"sv", "Turkish":"tr", "Ukrainian":"uk", - "Chinese":"zh" + "Chinese Simplified":"zh", + "Chinese Traditional":"zh" } translation_lang["DeepL_API"] = { "source": dict_deepl_api_source_languages, @@ -114,7 +117,8 @@ translation_lang["DeepL_API"] = { dict_google_languages = { "Japanese":"ja", "English":"en", - "Chinese":"zh", + "Chinese Simplified":"zh", + "Chinese Traditional":"zh-TW", "Arabic":"ar", "Russian":"ru", "French":"fr", @@ -183,7 +187,8 @@ translation_lang["Google"] = { dict_bing_languages = { "Japanese":"ja", "English":"en", - "Chinese":"zh", + "Chinese Simplified":"zh", + "Chinese Traditional":"zh-Hant", "Arabic":"ar", "Russian":"ru", "French":"fr", @@ -248,20 +253,21 @@ translation_lang["Bing"] = { } dict_papago_languages = { - 'German': 'de', - 'English': 'en', - 'Spanish':'es', - 'French': 'fr', - 'Hindi': 'hi', - 'Indonesian': 'id', - 'Italian': 'it', - 'Japanese': 'ja', - 'Korean': 'ko', - 'Portuguese': 'pt', - 'Russian': 'ru', - 'Thai': 'th', - 'Vietnamese': 'vi', - 'Chinese':'zh-CN', + "German": "de", + "English": "en", + "Spanish":"es", + "French": "fr", + "Hindi": "hi", + "Indonesian": "id", + "Italian": "it", + "Japanese": "ja", + "Korean": "ko", + "Portuguese": "pt", + "Russian": "ru", + "Thai": "th", + "Vietnamese": "vi", + "Chinese Simplified":"zh-CN", + "Chinese Traditional":"zh-TW", } translation_lang["Papago"] = { @@ -270,105 +276,106 @@ translation_lang["Papago"] = { } dict_ctranslate2_languages = { - 'English': 'en', - 'Chinese': 'zh', - 'German': 'de', - 'Spanish': 'es', - 'Russian': 'ru', - 'Korean': 'ko', - 'French': 'fr', - 'Japanese': 'ja', - 'Portuguese': 'pt', - 'Turkish': 'tr', - 'Polish': 'pl', - 'Catalan': 'ca', - 'Dutch': 'nl', - 'Arabic': 'ar', - 'Swedish': 'sv', - 'Italian': 'it', - 'Indonesian': 'id', - 'Hindi': 'hi', - 'Finnish': 'fi', - 'Vietnamese': 'vi', - 'Hebrew': 'he', - 'Ukrainian': 'uk', - 'Greek': 'el', - 'Malay': 'ms', - 'Czech': 'cs', - 'Romanian': 'ro', - 'Danish': 'da', - 'Hungarian': 'hu', - 'Tamil': 'ta', - 'Norwegian': 'no', - 'Thai': 'th', - 'Urdu': 'ur', - 'Croatian': 'hr', - 'Bulgarian': 'bg', - 'Lithuanian': 'lt', - 'Latin': 'la', - 'Maori': 'mi', - 'Malayalam': 'ml', - 'Welsh': 'cy', - 'Slovak': 'sk', - 'Telugu': 'te', - 'Persian': 'fa', - 'Latvian': 'lv', - 'Bengali': 'bn', - 'Serbian': 'sr', - 'Azerbaijani': 'az', - 'Slovenian': 'sl', - 'Kannada': 'kn', - 'Estonian': 'et', - 'Macedonian': 'mk', - 'Breton': 'br', - 'Basque': 'eu', - 'Icelandic': 'is', - 'Armenian': 'hy', - 'Nepali': 'ne', - 'Mongolian': 'mn', - 'Bosnian': 'bs', - 'Kazakh': 'kk', - 'Albanian': 'sq', - 'Swahili': 'sw', - 'Galician': 'gl', - 'Marathi': 'mr', - 'Punjabi': 'pa', - 'Sinhala': 'si', - 'Khmer': 'km', - 'Shona': 'sn', - 'Yoruba': 'yo', - 'Somali': 'so', - 'Afrikaans': 'af', - 'Occitan': 'oc', - 'Georgian': 'ka', - 'Belarusian': 'be', - 'Tajik': 'tg', - 'Sindhi': 'sd', - 'Gujarati': 'gu', - 'Amharic': 'am', - 'Yiddish': 'yi', - 'Lao': 'lo', - 'Uzbek': 'uz', - 'Faroese': 'fo', - 'Haitian creole': 'ht', - 'Pashto': 'ps', - 'Turkmen': 'tk', - 'Nynorsk': 'nn', - 'Maltese': 'mt', - 'Sanskrit': 'sa', - 'Luxembourgish': 'lb', - 'Myanmar': 'my', - 'Tibetan': 'bo', - 'Filipino': 'tl', - 'Malagasy': 'mg', - 'Assamese': 'as', - 'Tatar': 'tt', - 'Hawaiian': 'haw', - 'Lingala': 'ln', - 'Hausa': 'ha', - 'Bashkir': 'ba', - 'Javanese': 'jw', - 'Sundanese': 'su' + "English": "en", + "Chinese Simplified": "zh", + "Chinese Traditional":"zh", + "German": "de", + "Spanish": "es", + "Russian": "ru", + "Korean": "ko", + "French": "fr", + "Japanese": "ja", + "Portuguese": "pt", + "Turkish": "tr", + "Polish": "pl", + "Catalan": "ca", + "Dutch": "nl", + "Arabic": "ar", + "Swedish": "sv", + "Italian": "it", + "Indonesian": "id", + "Hindi": "hi", + "Finnish": "fi", + "Vietnamese": "vi", + "Hebrew": "he", + "Ukrainian": "uk", + "Greek": "el", + "Malay": "ms", + "Czech": "cs", + "Romanian": "ro", + "Danish": "da", + "Hungarian": "hu", + "Tamil": "ta", + "Norwegian": "no", + "Thai": "th", + "Urdu": "ur", + "Croatian": "hr", + "Bulgarian": "bg", + "Lithuanian": "lt", + "Latin": "la", + "Maori": "mi", + "Malayalam": "ml", + "Welsh": "cy", + "Slovak": "sk", + "Telugu": "te", + "Persian": "fa", + "Latvian": "lv", + "Bengali": "bn", + "Serbian": "sr", + "Azerbaijani": "az", + "Slovenian": "sl", + "Kannada": "kn", + "Estonian": "et", + "Macedonian": "mk", + "Breton": "br", + "Basque": "eu", + "Icelandic": "is", + "Armenian": "hy", + "Nepali": "ne", + "Mongolian": "mn", + "Bosnian": "bs", + "Kazakh": "kk", + "Albanian": "sq", + "Swahili": "sw", + "Galician": "gl", + "Marathi": "mr", + "Punjabi": "pa", + "Sinhala": "si", + "Khmer": "km", + "Shona": "sn", + "Yoruba": "yo", + "Somali": "so", + "Afrikaans": "af", + "Occitan": "oc", + "Georgian": "ka", + "Belarusian": "be", + "Tajik": "tg", + "Sindhi": "sd", + "Gujarati": "gu", + "Amharic": "am", + "Yiddish": "yi", + "Lao": "lo", + "Uzbek": "uz", + "Faroese": "fo", + "Haitian creole": "ht", + "Pashto": "ps", + "Turkmen": "tk", + "Nynorsk": "nn", + "Maltese": "mt", + "Sanskrit": "sa", + "Luxembourgish": "lb", + "Myanmar": "my", + "Tibetan": "bo", + "Filipino": "tl", + "Malagasy": "mg", + "Assamese": "as", + "Tatar": "tt", + "Hawaiian": "haw", + "Lingala": "ln", + "Hausa": "ha", + "Bashkir": "ba", + "Javanese": "jw", + "Sundanese": "su" } translation_lang["CTranslate2"] = { From d0934cd6b01ea935a7c53407d7d4a72be3f51a17 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Thu, 7 Mar 2024 23:50:13 +0900 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Config=20:=20?= =?UTF-8?q?=E4=B8=AD=E5=9B=BD=E8=AA=9E=E8=A1=A8=E8=A8=98=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=E3=81=AB=E4=BC=B4=E3=81=84=E3=80=81config=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E5=80=A4=E5=8F=AF=E8=83=BD=E3=81=AA=E5=80=A4=E3=81=8C=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=95=E3=82=8C=E3=81=9F=E3=81=9F=E3=82=81=E6=97=A2?= =?UTF-8?q?=E5=AD=98config.json=E3=81=A7=E8=B5=B7=E5=8B=95=E3=81=97?= =?UTF-8?q?=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AB=E7=89=B9=E5=AE=9A=E4=BE=9D?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E3=83=97=E3=83=AD=E3=82=B0=E3=83=A9=E3=83=A0?= =?UTF-8?q?=E3=81=8C=E8=B5=B7=E5=8B=95=E3=81=97=E3=81=AA=E3=81=84=E5=95=8F?= =?UTF-8?q?=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index 772773af..6bb0f4c5 100644 --- a/config.py +++ b/config.py @@ -7,6 +7,7 @@ import tkinter as tk from tkinter import font from models.translation.translation_languages import translation_lang from models.transcription.transcription_utils import getInputDevices, getDefaultInputDevice +from models.transcription.transcription_languages import transcription_lang from utils import generatePercentageStringsList, isUniqueStrings json_serializable_vars = {} @@ -289,7 +290,13 @@ class Config: @SELECTED_TAB_YOUR_LANGUAGES.setter def SELECTED_TAB_YOUR_LANGUAGES(self, value): if isinstance(value, dict): - self._SELECTED_TAB_YOUR_LANGUAGES = value + try: + for k, v in value.items(): + if k not in list(transcription_lang.keys()) or v not in list(transcription_lang[k].keys()): + raise ValueError + self._SELECTED_TAB_YOUR_LANGUAGES = value + except ValueError: + pass saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @property @@ -300,7 +307,13 @@ class Config: @SELECTED_TAB_TARGET_LANGUAGES.setter def SELECTED_TAB_TARGET_LANGUAGES(self, value): if isinstance(value, dict): - self._SELECTED_TAB_TARGET_LANGUAGES = value + try: + for k, v in value.items(): + if k not in list(transcription_lang.keys()) or v not in list(transcription_lang[k].keys()): + raise ValueError + self._SELECTED_TAB_TARGET_LANGUAGES = value + except ValueError: + pass saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @property From 3703406ff7ff9c45894af7a95adae49b5b4f0d62 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Fri, 8 Mar 2024 00:31:46 +0900 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Config=20:=20?= =?UTF-8?q?=E4=B8=AD=E5=9B=BD=E8=AA=9E=E8=A1=A8=E8=A8=98=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=E3=81=AB=E4=BC=B4=E3=81=84=E3=80=81config=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E5=80=A4=E5=8F=AF=E8=83=BD=E3=81=AA=E5=80=A4=E3=81=8C=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=95=E3=82=8C=E3=81=9F=E3=81=9F=E3=82=81=E6=97=A2?= =?UTF-8?q?=E5=AD=98config.json=E3=81=A7=E8=B5=B7=E5=8B=95=E3=81=97?= =?UTF-8?q?=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AB=E7=89=B9=E5=AE=9A=E4=BE=9D?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E3=83=97=E3=83=AD=E3=82=B0=E3=83=A9=E3=83=A0?= =?UTF-8?q?=E3=81=8C=E8=B5=B7=E5=8B=95=E3=81=97=E3=81=AA=E3=81=84=E5=95=8F?= =?UTF-8?q?=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/config.py b/config.py index 6bb0f4c5..226ea190 100644 --- a/config.py +++ b/config.py @@ -290,13 +290,13 @@ class Config: @SELECTED_TAB_YOUR_LANGUAGES.setter def SELECTED_TAB_YOUR_LANGUAGES(self, value): if isinstance(value, dict): - try: - for k, v in value.items(): - if k not in list(transcription_lang.keys()) or v not in list(transcription_lang[k].keys()): - raise ValueError - self._SELECTED_TAB_YOUR_LANGUAGES = value - except ValueError: - pass + value_old = self.SELECTED_TAB_YOUR_LANGUAGES + for k, v in value.items(): + lang, country = v.split("\n") + country = country[1:-1] + if lang not in list(transcription_lang.keys()) or country not in list(transcription_lang[lang].keys()): + value[k] = value_old[k] + self._SELECTED_TAB_YOUR_LANGUAGES = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @property @@ -307,13 +307,13 @@ class Config: @SELECTED_TAB_TARGET_LANGUAGES.setter def SELECTED_TAB_TARGET_LANGUAGES(self, value): if isinstance(value, dict): - try: - for k, v in value.items(): - if k not in list(transcription_lang.keys()) or v not in list(transcription_lang[k].keys()): - raise ValueError - self._SELECTED_TAB_TARGET_LANGUAGES = value - except ValueError: - pass + value_old = self.SELECTED_TAB_TARGET_LANGUAGES + for k, v in value.items(): + lang, country = v.split("\n") + country = country[1:-1] + if lang not in list(transcription_lang.keys()) or country not in list(transcription_lang[lang].keys()): + value[k] = value_old[k] + self._SELECTED_TAB_TARGET_LANGUAGES = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @property From 7791f371b4aa59a2645df6d4936883d1bcc567ec Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Fri, 8 Mar 2024 01:25:54 +0900 Subject: [PATCH 05/10] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Config=20:=20?= =?UTF-8?q?=E8=A8=80=E8=AA=9E=E8=A8=AD=E5=AE=9A=E3=81=AElanguage,=20countr?= =?UTF-8?q?y=E3=81=AE=E8=A1=A8=E7=8F=BE=E6=96=B9=E6=B3=95=E3=82=92?= =?UTF-8?q?=E8=A6=8B=E7=9B=B4=E3=81=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 見直しに伴い、処理方法を修正 --- config.py | 52 +++++++++++--------- controller.py | 12 ++--- model.py | 7 --- view.py | 10 ++-- vrct_gui/_CreateSelectableLanguagesWindow.py | 5 +- 5 files changed, 44 insertions(+), 42 deletions(-) diff --git a/config.py b/config.py index 226ea190..bbcf2370 100644 --- a/config.py +++ b/config.py @@ -289,15 +289,17 @@ class Config: @SELECTED_TAB_YOUR_LANGUAGES.setter def SELECTED_TAB_YOUR_LANGUAGES(self, value): - if isinstance(value, dict): - value_old = self.SELECTED_TAB_YOUR_LANGUAGES - for k, v in value.items(): - lang, country = v.split("\n") - country = country[1:-1] - if lang not in list(transcription_lang.keys()) or country not in list(transcription_lang[lang].keys()): - value[k] = value_old[k] - self._SELECTED_TAB_YOUR_LANGUAGES = value - saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + try: + if isinstance(value, dict): + value_old = self.SELECTED_TAB_YOUR_LANGUAGES + for k, v in value.items(): + lang, country = list(v.items())[0] + if lang not in list(transcription_lang.keys()) or country not in list(transcription_lang[lang].keys()): + value[k] = value_old[k] + self._SELECTED_TAB_YOUR_LANGUAGES = value + except Exception: + pass + saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @property @json_serializable('SELECTED_TAB_TARGET_LANGUAGES') @@ -306,15 +308,17 @@ class Config: @SELECTED_TAB_TARGET_LANGUAGES.setter def SELECTED_TAB_TARGET_LANGUAGES(self, value): - if isinstance(value, dict): - value_old = self.SELECTED_TAB_TARGET_LANGUAGES - for k, v in value.items(): - lang, country = v.split("\n") - country = country[1:-1] - if lang not in list(transcription_lang.keys()) or country not in list(transcription_lang[lang].keys()): - value[k] = value_old[k] - self._SELECTED_TAB_TARGET_LANGUAGES = value - saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + try: + if isinstance(value, dict): + value_old = self.SELECTED_TAB_TARGET_LANGUAGES + for k, v in value.items(): + lang, country = list(v.items())[0] + if lang not in list(transcription_lang.keys()) or country not in list(transcription_lang[lang].keys()): + value[k] = value_old[k] + self._SELECTED_TAB_TARGET_LANGUAGES = value + except Exception: + pass + saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @property @json_serializable('SELECTED_TRANSCRIPTION_ENGINE') @@ -898,14 +902,14 @@ class Config: "3":"CTranslate2", } self._SELECTED_TAB_YOUR_LANGUAGES = { - "1":"Japanese\n(Japan)", - "2":"Japanese\n(Japan)", - "3":"Japanese\n(Japan)", + "1":{"Japanese":"Japan"}, + "2":{"Japanese":"Japan"}, + "3":{"Japanese":"Japan"}, } self._SELECTED_TAB_TARGET_LANGUAGES = { - "1":"English\n(United States)", - "2":"English\n(United States)", - "3":"English\n(United States)", + "1":{"English":"United States"}, + "2":{"English":"United States"}, + "3":{"English":"United States"}, } self._SELECTED_TRANSCRIPTION_ENGINE = "Google" self._IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE = False diff --git a/controller.py b/controller.py index f695ee45..32d7e249 100644 --- a/controller.py +++ b/controller.py @@ -292,11 +292,11 @@ def initSetTranslateEngine(): def initSetLanguageAndCountry(): select = config.SELECTED_TAB_YOUR_LANGUAGES[config.SELECTED_TAB_NO] - language, country = model.getLanguageAndCountry(select) + language, country = list(select.items())[0] config.SOURCE_LANGUAGE = language config.SOURCE_COUNTRY = country select = config.SELECTED_TAB_TARGET_LANGUAGES[config.SELECTED_TAB_NO] - language, country = model.getLanguageAndCountry(select) + language, country = list(select.items())[0] config.TARGET_LANGUAGE = language config.TARGET_COUNTRY = country @@ -316,7 +316,7 @@ def setYourLanguageAndCountry(select): languages = config.SELECTED_TAB_YOUR_LANGUAGES languages[config.SELECTED_TAB_NO] = select config.SELECTED_TAB_YOUR_LANGUAGES = languages - language, country = model.getLanguageAndCountry(select) + language, country = list(select.items())[0] config.SOURCE_LANGUAGE = language config.SOURCE_COUNTRY = country updateTranslationEngineAndEngineList() @@ -326,7 +326,7 @@ def setTargetLanguageAndCountry(select): languages = config.SELECTED_TAB_TARGET_LANGUAGES languages[config.SELECTED_TAB_NO] = select config.SELECTED_TAB_TARGET_LANGUAGES = languages - language, country = model.getLanguageAndCountry(select) + language, country = list(select.items())[0] config.TARGET_LANGUAGE = language config.TARGET_COUNTRY = country updateTranslationEngineAndEngineList() @@ -355,13 +355,13 @@ def callbackSelectedLanguagePresetTab(selected_tab_no): languages = config.SELECTED_TAB_YOUR_LANGUAGES select = languages[config.SELECTED_TAB_NO] - language, country = model.getLanguageAndCountry(select) + language, country = list(select.items())[0] config.SOURCE_LANGUAGE = language config.SOURCE_COUNTRY = country languages = config.SELECTED_TAB_TARGET_LANGUAGES select = languages[config.SELECTED_TAB_NO] - language, country = model.getLanguageAndCountry(select) + language, country = list(select.items())[0] config.TARGET_LANGUAGE = language config.TARGET_COUNTRY = country view.printToTextbox_changedLanguagePresetTab(config.SELECTED_TAB_NO) diff --git a/model.py b/model.py index e39b718f..91adcf4c 100644 --- a/model.py +++ b/model.py @@ -120,13 +120,6 @@ class Model: langs.append(f"{lang}\n({country})") return sorted(langs) - @staticmethod - def getLanguageAndCountry(select): - parts = select.split("\n") - language = parts[0] - country = parts[1][1:-1] - return language, country - def findTranslationEngines(self, source_lang, target_lang): compatible_engines = [] for engine in list(translation_lang.keys()): diff --git a/view.py b/view.py index e7962850..d06e89de 100644 --- a/view.py +++ b/view.py @@ -1508,8 +1508,10 @@ class View(): # Update GuiVariable (view_variable) def updateGuiVariableByPresetTabNo(self, tab_no:str): - self.view_variable.VAR_YOUR_LANGUAGE.set(config.SELECTED_TAB_YOUR_LANGUAGES[tab_no]) - self.view_variable.VAR_TARGET_LANGUAGE.set(config.SELECTED_TAB_TARGET_LANGUAGES[tab_no]) + your_language, your_country = list(config.SELECTED_TAB_YOUR_LANGUAGES[tab_no].items())[0] + self.view_variable.VAR_YOUR_LANGUAGE.set(f"{your_language}\n({your_country})") + target_language, target_country = list(config.SELECTED_TAB_TARGET_LANGUAGES[tab_no].items())[0] + self.view_variable.VAR_TARGET_LANGUAGE.set(f"{target_language}\n({target_country})") def updateList_selectableLanguages(self, new_selectable_language_list:list): @@ -1651,11 +1653,11 @@ class View(): def printToTextbox_selectedYourLanguages(self, selected_your_language): - your_language = selected_your_language.replace("\n", " ") + your_language = ' '.join(f'{k} {v}' for k, v in selected_your_language.items()) self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.selected_your_language", your_language=your_language)) def printToTextbox_selectedTargetLanguages(self, selected_target_language): - target_language = selected_target_language.replace("\n", " ") + target_language = ' '.join(f'{k} {v}' for k, v in selected_target_language.items()) self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.selected_target_language", target_language=target_language)) def printToTextbox_changedLanguagePresetTab(self, tab_no:str): diff --git a/vrct_gui/_CreateSelectableLanguagesWindow.py b/vrct_gui/_CreateSelectableLanguagesWindow.py index dd6c6327..226cfaa6 100644 --- a/vrct_gui/_CreateSelectableLanguagesWindow.py +++ b/vrct_gui/_CreateSelectableLanguagesWindow.py @@ -49,6 +49,9 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): def callbackSelectableLanguages(self, value, _e): + language, country = value.split("\n") + country = country[1:-1] + callback_value = {language: country} if self.selectable_language_window_type == "your_language": callback = self._view_variable.CALLBACK_SELECTED_YOUR_LANGUAGE target_variable = self._view_variable.VAR_YOUR_LANGUAGE @@ -57,7 +60,7 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): target_variable = self._view_variable.VAR_TARGET_LANGUAGE target_variable.set(value) - callFunctionIfCallable(callback, value) + callFunctionIfCallable(callback, callback_value) self.vrct_gui._closeSelectableLanguagesWindow() From cb78942b8d05be4d581c7318f5b27abffa3a5f2e Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Sat, 9 Mar 2024 01:26:10 +0900 Subject: [PATCH 06/10] =?UTF-8?q?=F0=9F=91=8D[Update]=20Model/Veiw/Config?= =?UTF-8?q?=20:=20SELECTED=5FTAB=5FYOUR=5FLANGUAGES/SELECTED=5FTAB=5FTARGE?= =?UTF-8?q?T=5FLANGUAGES=E3=81=AE=E8=A1=A8=E7=8F=BE=E3=81=AE=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=AB=E4=BC=B4=E3=81=84=E5=87=A6=E7=90=86=E3=82=92?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 42 +++++++++++++++----- controller.py | 32 ++++++--------- model.py | 19 +++++---- view.py | 16 ++++++-- vrct_gui/_CreateSelectableLanguagesWindow.py | 13 ++++-- 5 files changed, 78 insertions(+), 44 deletions(-) diff --git a/config.py b/config.py index bbcf2370..c177b833 100644 --- a/config.py +++ b/config.py @@ -293,8 +293,10 @@ class Config: if isinstance(value, dict): value_old = self.SELECTED_TAB_YOUR_LANGUAGES for k, v in value.items(): - lang, country = list(v.items())[0] - if lang not in list(transcription_lang.keys()) or country not in list(transcription_lang[lang].keys()): + data = list(v.items())[0] + language = data["language"] + country = data["country"] + if language not in list(transcription_lang.keys()) or country not in list(transcription_lang[language].keys()): value[k] = value_old[k] self._SELECTED_TAB_YOUR_LANGUAGES = value except Exception: @@ -312,8 +314,10 @@ class Config: if isinstance(value, dict): value_old = self.SELECTED_TAB_TARGET_LANGUAGES for k, v in value.items(): - lang, country = list(v.items())[0] - if lang not in list(transcription_lang.keys()) or country not in list(transcription_lang[lang].keys()): + data = list(v.items())[0] + language = data["language"] + country = data["country"] + if language not in list(transcription_lang.keys()) or country not in list(transcription_lang[language].keys()): value[k] = value_old[k] self._SELECTED_TAB_TARGET_LANGUAGES = value except Exception: @@ -902,14 +906,32 @@ class Config: "3":"CTranslate2", } self._SELECTED_TAB_YOUR_LANGUAGES = { - "1":{"Japanese":"Japan"}, - "2":{"Japanese":"Japan"}, - "3":{"Japanese":"Japan"}, + "1":{ + "language":"Japanese", + "country":"Japan" + }, + "2":{ + "language":"Japanese", + "country":"Japan" + }, + "3":{ + "language":"Japanese", + "country":"Japan" + }, } self._SELECTED_TAB_TARGET_LANGUAGES = { - "1":{"English":"United States"}, - "2":{"English":"United States"}, - "3":{"English":"United States"}, + "1":{ + "language":"English", + "country":"United States" + }, + "2":{ + "language":"English", + "country":"United States" + }, + "3":{ + "language":"English", + "country":"United States" + }, } self._SELECTED_TRANSCRIPTION_ENGINE = "Google" self._IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE = False diff --git a/controller.py b/controller.py index 32d7e249..9af68368 100644 --- a/controller.py +++ b/controller.py @@ -292,13 +292,11 @@ def initSetTranslateEngine(): def initSetLanguageAndCountry(): select = config.SELECTED_TAB_YOUR_LANGUAGES[config.SELECTED_TAB_NO] - language, country = list(select.items())[0] - config.SOURCE_LANGUAGE = language - config.SOURCE_COUNTRY = country + config.SOURCE_LANGUAGE = select["language"] + config.SOURCE_COUNTRY = select["country"] select = config.SELECTED_TAB_TARGET_LANGUAGES[config.SELECTED_TAB_NO] - language, country = list(select.items())[0] - config.TARGET_LANGUAGE = language - config.TARGET_COUNTRY = country + config.TARGET_LANGUAGE = select["language"] + config.TARGET_COUNTRY = select["country"] def setYourTranslateEngine(select): engines = config.SELECTED_TAB_YOUR_TRANSLATOR_ENGINES @@ -316,9 +314,8 @@ def setYourLanguageAndCountry(select): languages = config.SELECTED_TAB_YOUR_LANGUAGES languages[config.SELECTED_TAB_NO] = select config.SELECTED_TAB_YOUR_LANGUAGES = languages - language, country = list(select.items())[0] - config.SOURCE_LANGUAGE = language - config.SOURCE_COUNTRY = country + config.SOURCE_LANGUAGE = select["language"] + config.SOURCE_COUNTRY = select["country"] updateTranslationEngineAndEngineList() view.printToTextbox_selectedYourLanguages(select) @@ -326,9 +323,8 @@ def setTargetLanguageAndCountry(select): languages = config.SELECTED_TAB_TARGET_LANGUAGES languages[config.SELECTED_TAB_NO] = select config.SELECTED_TAB_TARGET_LANGUAGES = languages - language, country = list(select.items())[0] - config.TARGET_LANGUAGE = language - config.TARGET_COUNTRY = country + config.TARGET_LANGUAGE = select["language"] + config.TARGET_COUNTRY = select["country"] updateTranslationEngineAndEngineList() view.printToTextbox_selectedTargetLanguages(select) @@ -355,15 +351,13 @@ def callbackSelectedLanguagePresetTab(selected_tab_no): languages = config.SELECTED_TAB_YOUR_LANGUAGES select = languages[config.SELECTED_TAB_NO] - language, country = list(select.items())[0] - config.SOURCE_LANGUAGE = language - config.SOURCE_COUNTRY = country + config.SOURCE_LANGUAGE = select["language"] + config.SOURCE_COUNTRY = select["country"] languages = config.SELECTED_TAB_TARGET_LANGUAGES select = languages[config.SELECTED_TAB_NO] - language, country = list(select.items())[0] - config.TARGET_LANGUAGE = language - config.TARGET_COUNTRY = country + config.TARGET_LANGUAGE = select["language"] + config.TARGET_COUNTRY = select["country"] view.printToTextbox_changedLanguagePresetTab(config.SELECTED_TAB_NO) updateTranslationEngineAndEngineList() @@ -999,7 +993,7 @@ def createMainWindow(splash): "callback_your_language": setYourLanguageAndCountry, "callback_target_language": setTargetLanguageAndCountry, - "values": model.getListLanguageAndCountry(), + "values": [f"{v['language']} ({v['country']})" for v in model.getListLanguageAndCountry()], "callback_swap_languages": swapYourLanguageAndTargetLanguage, "callback_selected_language_preset_tab": callbackSelectedLanguagePresetTab, diff --git a/model.py b/model.py index 91adcf4c..2af4135a 100644 --- a/model.py +++ b/model.py @@ -106,19 +106,24 @@ class Model: def getListLanguageAndCountry(self): transcription_langs = list(transcription_lang.keys()) - tl_keys = translation_lang.keys() translation_langs = [] - for tl_key in tl_keys: + for tl_key in translation_lang.keys(): for lang in translation_lang[tl_key]["source"]: translation_langs.append(lang) translation_langs = list(set(translation_langs)) supported_langs = list(filter(lambda x: x in transcription_langs, translation_langs)) - langs = [] - for lang in supported_langs: - for country in transcription_lang[lang]: - langs.append(f"{lang}\n({country})") - return sorted(langs) + languages = [] + for language in supported_langs: + for country in transcription_lang[language]: + languages.append( + { + "language" : language, + "country" : country, + } + ) + languages = sorted(languages, key=lambda x: x['language']) + return languages def findTranslationEngines(self, source_lang, target_lang): compatible_engines = [] diff --git a/view.py b/view.py index d06e89de..37897dd9 100644 --- a/view.py +++ b/view.py @@ -1508,9 +1508,13 @@ class View(): # Update GuiVariable (view_variable) def updateGuiVariableByPresetTabNo(self, tab_no:str): - your_language, your_country = list(config.SELECTED_TAB_YOUR_LANGUAGES[tab_no].items())[0] + select = config.SELECTED_TAB_YOUR_LANGUAGES[tab_no] + your_language = select["language"] + your_country = select["country"] self.view_variable.VAR_YOUR_LANGUAGE.set(f"{your_language}\n({your_country})") - target_language, target_country = list(config.SELECTED_TAB_TARGET_LANGUAGES[tab_no].items())[0] + select = config.SELECTED_TAB_TARGET_LANGUAGES[tab_no] + target_language = select["language"] + target_country = select["country"] self.view_variable.VAR_TARGET_LANGUAGE.set(f"{target_language}\n({target_country})") @@ -1653,11 +1657,15 @@ class View(): def printToTextbox_selectedYourLanguages(self, selected_your_language): - your_language = ' '.join(f'{k} {v}' for k, v in selected_your_language.items()) + language = selected_your_language["language"] + country = selected_your_language["country"] + your_language = f"{language} {country}" self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.selected_your_language", your_language=your_language)) def printToTextbox_selectedTargetLanguages(self, selected_target_language): - target_language = ' '.join(f'{k} {v}' for k, v in selected_target_language.items()) + language = selected_target_language["language"] + country = selected_target_language["country"] + target_language = f"{language} {country}" self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.selected_target_language", target_language=target_language)) def printToTextbox_changedLanguagePresetTab(self, tab_no:str): diff --git a/vrct_gui/_CreateSelectableLanguagesWindow.py b/vrct_gui/_CreateSelectableLanguagesWindow.py index 226cfaa6..b3cab8fe 100644 --- a/vrct_gui/_CreateSelectableLanguagesWindow.py +++ b/vrct_gui/_CreateSelectableLanguagesWindow.py @@ -49,9 +49,14 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): def callbackSelectableLanguages(self, value, _e): - language, country = value.split("\n") - country = country[1:-1] - callback_value = {language: country} + language, country = value.split(" (") + country = country[:-1] + callback_value = { + "language" : language, + "country" : country, + } + set_value = f"{language}\n({country})" + if self.selectable_language_window_type == "your_language": callback = self._view_variable.CALLBACK_SELECTED_YOUR_LANGUAGE target_variable = self._view_variable.VAR_YOUR_LANGUAGE @@ -59,7 +64,7 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): callback = self._view_variable.CALLBACK_SELECTED_TARGET_LANGUAGE target_variable = self._view_variable.VAR_TARGET_LANGUAGE - target_variable.set(value) + target_variable.set(set_value) callFunctionIfCallable(callback, callback_value) self.vrct_gui._closeSelectableLanguagesWindow() From 4a85823439e128574193f61f5794d4b8e4fc2e43 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 9 Mar 2024 17:15:06 +0900 Subject: [PATCH 07/10] =?UTF-8?q?[Refactor]=20View:=20=E8=A8=80=E8=AA=9E?= =?UTF-8?q?=E3=83=AA=E3=82=B9=E3=83=88=E3=81=AF=20view=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E3=81=A7=E8=A1=A8=E7=A4=BA=E7=94=A8=E3=81=AF=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E7=94=A8=E3=81=A8=E3=81=97=E3=81=A6=E5=87=A6=E7=90=86=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=80=82=20=E2=80=BBcontro?= =?UTF-8?q?ller.py=E3=81=8B=E3=82=89view.py=E3=81=B8=E8=A8=80=E8=AA=9E?= =?UTF-8?q?=E3=83=AA=E3=82=B9=E3=83=88=E3=82=92=E6=B8=A1=E3=81=99=E6=99=82?= =?UTF-8?q?=E3=80=81=E3=81=9D=E3=81=AE=E5=A0=B4=E3=81=A7=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E7=94=A8=E3=81=AE=E6=96=87=E5=AD=97=E5=88=97=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E3=81=84=E3=81=9F=E3=81=AE=E3=82=92view.py?= =?UTF-8?q?=E5=86=85=E3=81=A7=E5=87=A6=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller.py | 2 +- view.py | 4 ++-- vrct_gui/_CreateSelectableLanguagesWindow.py | 11 +++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/controller.py b/controller.py index 9af68368..fe0ccb6a 100644 --- a/controller.py +++ b/controller.py @@ -993,7 +993,7 @@ def createMainWindow(splash): "callback_your_language": setYourLanguageAndCountry, "callback_target_language": setTargetLanguageAndCountry, - "values": [f"{v['language']} ({v['country']})" for v in model.getListLanguageAndCountry()], + "values": model.getListLanguageAndCountry(), "callback_swap_languages": swapYourLanguageAndTargetLanguage, "callback_selected_language_preset_tab": callbackSelectedLanguagePresetTab, diff --git a/view.py b/view.py index 37897dd9..39ac795f 100644 --- a/view.py +++ b/view.py @@ -1659,13 +1659,13 @@ class View(): def printToTextbox_selectedYourLanguages(self, selected_your_language): language = selected_your_language["language"] country = selected_your_language["country"] - your_language = f"{language} {country}" + your_language = f"{language} ({country})" self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.selected_your_language", your_language=your_language)) def printToTextbox_selectedTargetLanguages(self, selected_target_language): language = selected_target_language["language"] country = selected_target_language["country"] - target_language = f"{language} {country}" + target_language = f"{language} ({country})" self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.selected_target_language", target_language=target_language)) def printToTextbox_changedLanguagePresetTab(self, tab_no:str): diff --git a/vrct_gui/_CreateSelectableLanguagesWindow.py b/vrct_gui/_CreateSelectableLanguagesWindow.py index b3cab8fe..4c5482cd 100644 --- a/vrct_gui/_CreateSelectableLanguagesWindow.py +++ b/vrct_gui/_CreateSelectableLanguagesWindow.py @@ -49,8 +49,8 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): def callbackSelectableLanguages(self, value, _e): - language, country = value.split(" (") - country = country[:-1] + language = value["language"] + country = value["country"] callback_value = { "language" : language, "country" : country, @@ -143,7 +143,7 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): max_row+=1 row=0 column=0 - for selectable_language_name in self._view_variable.LIST_SELECTABLE_LANGUAGES: + for selectable_language_dict in self._view_variable.LIST_SELECTABLE_LANGUAGES: self.wrapper = CTkFrame(self.container, corner_radius=0, fg_color=self.settings.ctm.LANGUAGE_BUTTON_BG_COLOR, width=0, height=0, cursor="hand2") self.wrapper.grid(row=row, column=column, sticky="nsew") @@ -152,10 +152,9 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): self.wrapper.grid_rowconfigure((0,2), weight=1) - selectable_language_name_for_text = selectable_language_name.replace("\n", " ") label_widget = CTkLabel( self.wrapper, - text=selectable_language_name_for_text, + text=f"{selectable_language_dict['language']} ({selectable_language_dict['country']})", height=0, corner_radius=0, font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.VALUES_TEXT_FONT_SIZE, weight="normal"), @@ -172,7 +171,7 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): - callback = partial(self.callbackSelectableLanguages, selectable_language_name) + callback = partial(self.callbackSelectableLanguages, selectable_language_dict) bindButtonReleaseFunction([self.wrapper, label_widget], callback) if row == max_row: From 8056e9d668a731626cf2d61b5f7be304a79c67a6 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 9 Mar 2024 17:44:22 +0900 Subject: [PATCH 08/10] =?UTF-8?q?[bugfix]=20Config:=20=E8=B5=B7=E5=8B=95?= =?UTF-8?q?=E6=99=82=E3=81=AEconfig.json=E3=83=81=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=82=AF=E3=81=A7=E3=80=81=E5=BC=B7=E5=88=B6=E7=9A=84=E3=81=AB?= =?UTF-8?q?=E5=88=9D=E6=9C=9F=E5=8C=96=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82(SELECTED?= =?UTF-8?q?=5FTAB=5FYOUR=5FLANGUAGES,=20SELECTED=5FTAB=5FTARGET=5FLANGUAGE?= =?UTF-8?q?S)=20=E2=80=BB=E4=BF=9D=E5=AD=98=E3=81=99=E3=82=8B=E5=BD=A2?= =?UTF-8?q?=E5=BC=8F=E3=81=8C=E5=A4=89=E3=82=8F=E3=81=A3=E3=81=9F=E3=81=93?= =?UTF-8?q?=E3=81=A8=E3=81=8C=E5=8E=9F=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/config.py b/config.py index c177b833..bbc4ac74 100644 --- a/config.py +++ b/config.py @@ -293,9 +293,8 @@ class Config: if isinstance(value, dict): value_old = self.SELECTED_TAB_YOUR_LANGUAGES for k, v in value.items(): - data = list(v.items())[0] - language = data["language"] - country = data["country"] + language = v["language"] + country = v["country"] if language not in list(transcription_lang.keys()) or country not in list(transcription_lang[language].keys()): value[k] = value_old[k] self._SELECTED_TAB_YOUR_LANGUAGES = value @@ -314,9 +313,8 @@ class Config: if isinstance(value, dict): value_old = self.SELECTED_TAB_TARGET_LANGUAGES for k, v in value.items(): - data = list(v.items())[0] - language = data["language"] - country = data["country"] + language = v["language"] + country = v["country"] if language not in list(transcription_lang.keys()) or country not in list(transcription_lang[language].keys()): value[k] = value_old[k] self._SELECTED_TAB_TARGET_LANGUAGES = value From e698aff97a675c69c058da51ad88694d252fea04 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 9 Mar 2024 23:20:00 +0900 Subject: [PATCH 09/10] =?UTF-8?q?[bugfix]=20Main=20Window.Translation=20En?= =?UTF-8?q?gine=20Dropdown=20Menu=20Window:=20=E6=8C=87=E5=AE=9A=E3=83=9F?= =?UTF-8?q?=E3=82=B9=E3=81=AB=E3=82=88=E3=82=8A=E3=80=81=E6=83=B3=E5=AE=9A?= =?UTF-8?q?=E3=82=88=E3=82=8A=E5=B9=85=E3=81=8C=E5=A4=A7=E3=81=8D=E3=81=8B?= =?UTF-8?q?=E3=81=A3=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widgets/_create_sidebar/createSidebarLanguagesSettings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py index 6678ffd3..d8f37965 100644 --- a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py +++ b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarLanguagesSettings.py @@ -356,7 +356,6 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable): command=adjustedCommand, wrapper_widget=main_window, attach_widget=main_window.sls__box_translation_optionmenu_wrapper, - dropdown_menu_min_width=settings.uism.SIDEBAR_MIN_WIDTH, ) (sls__selected_translation_engine_box, label_button_label_widget) = createLabelButton( From 4d70e18dc1be46afd7d9162e8386090067706ede Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Mon, 11 Mar 2024 11:32:18 +0900 Subject: [PATCH 10/10] =?UTF-8?q?=F0=9F=91=8D[Update]=20Version=202.2.0=20?= =?UTF-8?q?->=202.2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.py b/config.py index bbc4ac74..8c7d8f85 100644 --- a/config.py +++ b/config.py @@ -832,7 +832,7 @@ class Config: def init_config(self): # Read Only - self._VERSION = "2.2.0" + self._VERSION = "2.2.1" self._ENABLE_SPEAKER2CHATBOX = False # Speaker2Chatbox self._ENABLE_SPEAKER2CHATBOX_PASS_CONFIRMATION = "123456789" self._PATH_LOCAL = os_path.dirname(sys.argv[0])