Merge branch 'view' into UI_2.0

This commit is contained in:
Sakamoto Shiina
2023-10-14 19:52:49 +09:00
27 changed files with 258 additions and 152 deletions

View File

@@ -360,7 +360,7 @@ def callbackSetUiLanguage(value):
value = get_key_by_value(selectable_languages, value)
print("callbackSetUiLanguage__after_get_key_by_value", value)
config.UI_LANGUAGE = value
view.showRestartButton()
view.showRestartButton(locale=config.UI_LANGUAGE)
# Translation Tab
def callbackSetDeeplAuthkey(value):

View File

@@ -14,16 +14,40 @@ main_window:
textbox_tab_received: Received
textbox_tab_system: System
textbox_system_message:
enabled_translation: Translation feature is turned on.
disabled_translation: Translation feature is turned off.
enabled_voice2chatbox: Transcription from the microphone has started.
disabled_voice2chatbox: Transcription from the microphone has been stopped.
enabled_speaker2log: Transcription from the speaker has started.
disabled_speaker2log: Transcription from the speaker has been stopped.
enabled_foreground: The screen is fixed in the foreground.
disabled_foreground: The foreground fixation has been released.
auth_key_success: Auth key update completed.
auth_key_error: Auth Key is incorrect or Usage limit reached.
detected_by_word_filter: The word %{detected_message} has not been sent due to detection by the word filter.
selected_your_language: "\"Your Language\" has set to %{your_language}."
selected_target_language: "\"Target Language\" has set to %{target_language}."
switched_language_preset_tab: Switched to Language Preset Tab No.%{tab_no}."
latest_language_setting: "Currently, \"Your Language\" is set to %{your_language}, and \"Target Language\" is set to %{target_language}."
opened_web_page_booth: Opened Booth page in your web browser.
opened_web_page_vrct_documents: "Opened VRCT Documents page in your web browser.\nFor any issues, requests, or inquiries, please feel free to contact us through the links at the bottom of the documents page, the \"Contact Form,\" or via X (formerly Twitter)!"
update_available: New version is here!
modal_message:
opened_config_window: The functionality is temporarily disabled until the settings window is closed.
cover_message: The functionality is temporarily disabled until the settings window is closed.
selectable_language_window:
title_your_language: Select Your Language
title_target_language: Select Target Language
go_back_button: Go Back
config_window:
config_title: Settings
compact_mode: Compact Mode
@@ -65,10 +89,15 @@ config_window:
desc_for_manual: "Manually determine the microphone input sensitivity using the slider. Press the microphone icon to input your voice and adjust the sensitivity while monitoring the volume."
mic_record_timeout:
label: Mic Record Timeout
desc: (Second(s))
# desc: Duration in seconds for detecting silence and determining the end of audio input.
mic_phrase_timeout:
label: Mic Phrase Timeout
desc: (Second(s))
# desc: Duration in seconds for determining the end of audio input and transcribing it in one go.
mic_max_phrase:
label: Mic Max Phrases
# desc: Once the minimum word count for transcription is reached, it will be send.
mic_word_filter:
label: Mic Word Filter
desc: "It will not send the sentence if the word(s) included in the set list of words.\nHow to set: e.g. AAA,BBB,CCC"
@@ -82,8 +111,10 @@ config_window:
desc_for_manual: "Manually determine the speaker input sensitivity using the slider. Press the headphones icon to listen to the audio and adjust the sensitivity while monitoring the volume."
speaker_record_timeout:
label: Speaker Record Timeout
desc: (Second(s))
speaker_phrase_timeout:
label: Speaker Phrase Timeout
desc: (Second(s))
speaker_max_phrase:
label: Speaker Max Phrases

View File

@@ -14,10 +14,32 @@ main_window:
textbox_tab_received: 受信
textbox_tab_system: システム
textbox_system_message:
enabled_translation: 翻訳機能をONにしました。
disabled_translation: 翻訳機能をOFFしました。
enabled_voice2chatbox: マイクからの音声入力、文字起こしを開始します。
disabled_voice2chatbox: マイクからの音声入力、文字起こしを終了しました。
enabled_speaker2log: スピーカーからの音声聞き取り、文字起こしを開始します。
disabled_speaker2log: スピーカーからの音声聞き取り、文字起こしを終了しました。
enabled_foreground: 画面を常に最前面へ固定します。
disabled_foreground: 最前面への固定を解除しました。
auth_key_success: 認証キーの更新が完了しました。
auth_key_error: 認証キーが間違っているか、API使用制限が上限に達しています.
detected_by_word_filter: ワードフィルターに登録されている単語 %{detected_message} が検出されたため送信しませんでした。
selected_your_language: 「あなたの言語」 を %{your_language} に設定しました。
selected_target_language: 「相手の言語」 を %{target_language} に設定しました。
switched_language_preset_tab: 言語プリセット番号 %{tab_no} に切り替わりました。
latest_language_setting: 現在「あなたの言語」は %{your_language}、「相手の言語」は %{target_language} に設定されています。
opened_web_page_booth: お使いのブラウザで、Boothのページを開きました。
opened_web_page_vrct_documents: "お使いのブラウザで、VRCTのドキュメントを開きました。使用方法などはそちらに記載されています。\n不具合、ご要望、その他お問い合わせはドキュメント最下部にあるLinks、「お問合せフォーム」もしくはX(元Twitter)にて気軽にご連絡ください!"
update_available: 新しいバージョンが出ました!
modal_message:
opened_config_window: 設定画面が閉じられるまで、一時的に機能を停止しています。
cover_message: 設定画面が閉じられるまで、一時的に機能を停止しています。
selectable_language_window:
@@ -25,6 +47,7 @@ selectable_language_window:
title_target_language: 相手の言語
go_back_button: 戻る
config_window:
config_title: 設定
compact_mode: コンパクトモード
@@ -66,10 +89,15 @@ config_window:
desc_for_manual: スライダーを調整して入力感度を手動で決められます。マイクのアイコンを押すと、実際に声を入力し、音量を確認しながら調節できます。
mic_record_timeout:
label: 入力が終了したとみなす無音時間
desc: 単位は秒です。
# desc: 無音を検出し、音声入力が終了したとみなす時間の長さです。(秒)
mic_phrase_timeout:
label: 一度に文字起こしする時間の長さ
desc: 単位は秒です。
# desc: 一度に文字起こし処理をする音声時間の長さです。(秒)
mic_max_phrase:
label: 送信するまでに保持する単語数
# desc: 文字起こしされた単語数を保持する最大値で、その数を超えると送信します。
mic_word_filter:
label: ワードフィルター
desc: "設定された単語を検出すると、その文章は送信されません。\n設定の例: AAA,BBB,CCC"
@@ -80,11 +108,13 @@ config_window:
label_for_automatic: "スピーカー入力感度の調整 (現在の設定: 自動)"
desc_for_automatic: スピーカーの入力感度を自動的に調節する。
label_for_manual: "スピーカー入力感度の調整 (現在の設定: 手動)"
desc_for_manual: スライダーを調整して入力感度を手動で決められます。ヘッドフォンのアイコンを押すと、実際に音声を聞き取り、音量を確認しながら調節できます。
desc_for_manual: スライダーを調整して入力感度を手動で決められます。ヘッドフォンのアイコンを押すと、実際に音声を聞き取り、音量を確認しながら調節できます。
speaker_record_timeout:
label: 入力が終了したとみなす無音時間
desc: 単位は秒です。
speaker_phrase_timeout:
label: 一度に文字起こしする時間の長さ
desc: 単位は秒です。
speaker_max_phrase:
label: ログとして表示するまでに保持する単語数

79
view.py
View File

@@ -1,5 +1,5 @@
from os import path as os_path
from typing import Union
from os import path as os_path
from types import SimpleNamespace
from tkinter import font as tk_font
import webbrowser
@@ -54,9 +54,15 @@ class View():
**common_args
)
self.settings.modal_window = SimpleNamespace(
ctm=all_ctm.modal_window,
uism=all_uism.modal_window,
self.settings.main_window_cover = SimpleNamespace(
ctm=all_ctm.main_window_cover,
uism=all_uism.main_window_cover,
**common_args
)
self.settings.error_message_window = SimpleNamespace(
ctm=all_ctm.error_message_window,
uism=all_uism.error_message_window,
**common_args
)
@@ -123,8 +129,8 @@ class View():
VAR_UPDATE_AVAILABLE=StringVar(value=i18n.t("main_window.update_available")),
# Modal Window For Main Window
VAR_LABEL_MODAL_MESSAGE_FOR__MAIN_WINDOW=StringVar(value=i18n.t("main_window.modal_message.opened_config_window")),
# Main Window Cover
VAR_LABEL_MAIN_WINDOW_COVER_MESSAGE=StringVar(value=i18n.t("main_window.cover_message")),
# Selectable Language Window
VAR_TITLE_LABEL_SELECTABLE_LANGUAGE=StringVar(value=""),
@@ -223,13 +229,13 @@ class View():
VAR_LABEL_MIC_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.mic_record_timeout.label")),
VAR_DESC_MIC_RECORD_TIMEOUT=None,
VAR_DESC_MIC_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.mic_record_timeout.desc")),
CALLBACK_SET_MIC_RECORD_TIMEOUT=None,
VAR_MIC_RECORD_TIMEOUT=StringVar(value=config.INPUT_MIC_RECORD_TIMEOUT),
CALLBACK_FOCUS_OUT_MIC_RECORD_TIMEOUT=self.setLatestConfigVariable_MicRecordTimeout,
VAR_LABEL_MIC_PHRASE_TIMEOUT=StringVar(value=i18n.t("config_window.mic_phrase_timeout.label")),
VAR_DESC_MIC_PHRASE_TIMEOUT=None,
VAR_DESC_MIC_PHRASE_TIMEOUT=StringVar(value=i18n.t("config_window.mic_phrase_timeout.desc")),
CALLBACK_SET_MIC_PHRASE_TIMEOUT=None,
VAR_MIC_PHRASE_TIMEOUT=StringVar(value=config.INPUT_MIC_PHRASE_TIMEOUT),
CALLBACK_FOCUS_OUT_MIC_PHRASE_TIMEOUT=self.setLatestConfigVariable_MicPhraseTimeout,
@@ -267,13 +273,13 @@ class View():
VAR_LABEL_SPEAKER_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.speaker_record_timeout.label")),
VAR_DESC_SPEAKER_RECORD_TIMEOUT=None,
VAR_DESC_SPEAKER_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.speaker_record_timeout.desc")),
CALLBACK_SET_SPEAKER_RECORD_TIMEOUT=None,
VAR_SPEAKER_RECORD_TIMEOUT=StringVar(value=config.INPUT_SPEAKER_RECORD_TIMEOUT),
CALLBACK_FOCUS_OUT_SPEAKER_RECORD_TIMEOUT=self.setLatestConfigVariable_SpeakerRecordTimeout,
VAR_LABEL_SPEAKER_PHRASE_TIMEOUT=StringVar(value=i18n.t("config_window.speaker_phrase_timeout.label")),
VAR_DESC_SPEAKER_PHRASE_TIMEOUT=None,
VAR_DESC_SPEAKER_PHRASE_TIMEOUT=StringVar(value=i18n.t("config_window.speaker_phrase_timeout.desc")),
CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT=None,
VAR_SPEAKER_PHRASE_TIMEOUT=StringVar(value=config.INPUT_SPEAKER_PHRASE_TIMEOUT),
CALLBACK_FOCUS_OUT_SPEAKER_PHRASE_TIMEOUT=self.setLatestConfigVariable_SpeakerPhraseTimeout,
@@ -518,11 +524,11 @@ class View():
def openWebPage_Booth(self):
self.openWebPage(config.BOOTH_URL)
self._printToTextbox_Info("Opened Booth page in your web browser.")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.opened_web_page_booth"))
def openWebPage_VrctDocuments(self):
self.openWebPage(config.DOCUMENTS_URL)
self._printToTextbox_Info("Opened the VRCT Documents page in your web browser.")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.opened_web_page_vrct_documents"))
@staticmethod
def showUpdateAvailableButton():
@@ -558,12 +564,12 @@ class View():
@staticmethod
def _openTheCoverOfMainWindow():
vrct_gui.modal_window.show()
vrct_gui.main_window_cover.show()
vrct_gui.config_window.lift()
@staticmethod
def _closeTheCoverOfMainWindow():
vrct_gui.modal_window.withdraw()
vrct_gui.main_window_cover.withdraw()
def enableMainWindowSidebarCompactMode(self):
self.view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE = True
@@ -592,56 +598,54 @@ class View():
def printToTextbox_enableTranslation(self):
self._printToTextbox_Info("翻訳機能をONにしました")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_translation"))
def printToTextbox_disableTranslation(self):
self._printToTextbox_Info("翻訳機能をOFFにしました")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.disabled_translation"))
def printToTextbox_enableTranscriptionSend(self):
self._printToTextbox_Info("Voice2chatbox機能をONにしました")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_voice2chatbox"))
def printToTextbox_disableTranscriptionSend(self):
self._printToTextbox_Info("Voice2chatbox機能をOFFにしました")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.disabled_voice2chatbox"))
def printToTextbox_enableTranscriptionReceive(self):
self._printToTextbox_Info("Speaker2chatbox機能をONにしました")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_speaker2log"))
def printToTextbox_disableTranscriptionReceive(self):
self._printToTextbox_Info("Speaker2chatbox機能をOFFにしました")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.disabled_speaker2log"))
def printToTextbox_enableForeground(self):
self._printToTextbox_Info("Start foreground")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_foreground"))
def printToTextbox_disableForeground(self):
self._printToTextbox_Info("Stop foreground")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.disabled_foreground"))
def printToTextbox_AuthenticationSuccess(self):
self._printToTextbox_Info("Auth key update completed")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.auth_key_success"))
def printToTextbox_AuthenticationError(self):
self._printToTextbox_Info("Auth Key is incorrect or Usage limit reached")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.auth_key_error"))
def printToTextbox_OSCError(self):
self._printToTextbox_Info("OSC is not enabled, please enable OSC and rejoin. or turn off the \"Send Message To VRChat\" setting")
# def printToTextbox_OSCError(self): [Deprecated]
# self._printToTextbox_Info("OSC is not enabled, please enable OSC and rejoin. or turn off the \"Send Message To VRChat\" setting")
def printToTextbox_DetectedByWordFilter(self, detected_message):
self._printToTextbox_Info(f"Detect WordFilter :{detected_message}")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.detected_by_word_filter"), detected_message=detected_message)
def printToTextbox_selectedYourLanguages(self, selected_your_language):
your_language = selected_your_language.replace("\n", " ")
self._printToTextbox_Info(f"Your Language has changed : {your_language}")
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", " ")
self._printToTextbox_Info(f"Target Language has changed : {target_language}")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.selected_target_language", target_language=target_language))
def printToTextbox_changedLanguagePresetTab(self, tab_no:str):
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.switched_language_preset_tab", tab_no=tab_no))
self.printToTextbox_latestSelectedLanguages()
def printToTextbox_latestSelectedLanguages(self):
your_language = self.view_variable.VAR_YOUR_LANGUAGE.get().replace("\n", " ")
target_language = self.view_variable.VAR_TARGET_LANGUAGE.get().replace("\n", " ")
self._printToTextbox_Info(f"Your Language : {your_language} -- Target Language : {target_language}")
def printToTextbox_changedLanguagePresetTab(self, tab_no:str):
your_language = config.SELECTED_TAB_YOUR_LANGUAGES[tab_no].replace("\n", " ")
target_language = config.SELECTED_TAB_TARGET_LANGUAGES[tab_no].replace("\n", " ")
self._printToTextbox_Info(f"Switched Language Preset. No.{tab_no}\nYour Language : {your_language} -- Target Language : {target_language}")
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.latest_language_setting", your_language=your_language, target_language=target_language))
@staticmethod
@@ -715,7 +719,8 @@ class View():
# Config Window
def showRestartButton(self):
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):
vrct_gui.config_window.restart_button_container.grid_remove()

View File

@@ -3,32 +3,34 @@ from types import SimpleNamespace
from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont, CTkScrollableFrame
from time import sleep
from .ui_utils import bindButtonReleaseFunction, bindEnterAndLeaveColor, bindButtonPressColor, getLatestWidth, getLatestHeight, applyUiScalingAndFixTheBugScrollBar
from .ui_utils import bindButtonReleaseFunction, bindEnterAndLeaveColor, bindButtonPressColor, getLatestHeight, applyUiScalingAndFixTheBugScrollBar
from functools import partial
from utils import isEven, makeEven
class _CreateDropdownMenuWindow(CTkToplevel):
def __init__(self,
settings,
view_variable,
def __init__(
self,
settings,
view_variable,
window_additional_y_pos,
window_border_width,
scrollbar_ipadx,
scrollbar_width,
value_ipadx,
value_ipady,
value_pady,
value_font_size,
window_additional_y_pos,
window_border_width,
scrollbar_ipadx,
scrollbar_width,
value_ipadx,
value_ipady,
value_pady,
value_font_size,
window_bg_color,
window_border_color,
values_bg_color,
values_hovered_bg_color,
values_clicked_bg_color,
values_text_color,
):
window_bg_color,
window_border_color,
values_bg_color,
values_hovered_bg_color,
values_clicked_bg_color,
values_text_color,
):
super().__init__()
self.withdraw()
self.hide = True
@@ -237,7 +239,6 @@ class _CreateDropdownMenuWindow(CTkToplevel):
anchor="w",
text_color=self.values_text_color,
)
# setattr(self, f"l", label_widget)
label_widget.grid(row=1, column=0, padx=self.value_ipadx, pady=self.value_ipady, sticky="w")

View File

@@ -7,17 +7,17 @@ from utils import isEven
class _CreateErrorWindow(CTkToplevel):
def __init__(
self,
settings,
view_variable,
wrapper_widget,
self,
settings,
view_variable,
wrapper_widget,
message_ipadx,
message_ipady,
message_font_size,
message_ipadx,
message_ipady,
message_font_size,
message_bg_color,
message_text_color,
message_bg_color,
message_text_color,
):
super().__init__()
@@ -58,12 +58,12 @@ class _CreateErrorWindow(CTkToplevel):
self.grid_rowconfigure(0,weight=1)
self.grid_columnconfigure(0,weight=1)
self.modal_container = CTkFrame(self, corner_radius=0, fg_color=self.message_bg_color, width=0, height=0)
self.modal_container.grid(row=0, column=0, sticky="nsew")
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.modal_container_label_wrapper = CTkLabel(
self.modal_container,
self.error_message_container_label_wrapper = CTkLabel(
self.error_message_container,
# text=message,
textvariable=self._view_variable.VAR_ERROR_MESSAGE,
height=0,
@@ -73,7 +73,7 @@ class _CreateErrorWindow(CTkToplevel):
justify="left",
text_color=self.message_text_color,
)
self.modal_container_label_wrapper.grid(row=0, column=0, padx=self.message_ipadx, pady=self.message_ipady, sticky="nsew")
self.error_message_container_label_wrapper.grid(row=0, column=0, padx=self.message_ipadx, pady=self.message_ipady, sticky="nsew")
@@ -90,20 +90,20 @@ class _CreateErrorWindow(CTkToplevel):
self.hide = False
label_width = getLatestWidth(self.modal_container_label_wrapper)
label_height = getLatestHeight(self.modal_container_label_wrapper)
label_width = getLatestWidth(self.error_message_container_label_wrapper)
label_height = getLatestHeight(self.error_message_container_label_wrapper)
# for fixing 1px bug
if isEven(label_width) is False:
self.modal_container_label_wrapper.grid(padx=(self.message_ipadx[0], self.message_ipadx[1]-1))
self.error_message_container_label_wrapper.grid(padx=(self.message_ipadx[0], self.message_ipadx[1]-1))
else:
self.modal_container_label_wrapper.grid(padx=self.message_ipadx)
self.error_message_container_label_wrapper.grid(padx=self.message_ipadx)
# for fixing 1px bug
if isEven(label_height) is False:
self.modal_container_label_wrapper.grid(pady=(self.message_ipady[0], self.message_ipady[1]-1))
self.error_message_container_label_wrapper.grid(pady=(self.message_ipady[0], self.message_ipady[1]-1))
else:
self.modal_container_label_wrapper.grid(pady=self.message_ipady)
self.error_message_container_label_wrapper.grid(pady=self.message_ipady)
for i in range(0,101,20):

View File

@@ -159,7 +159,6 @@ class _CreateSelectableLanguagesWindow(CTkToplevel):
anchor="w",
text_color=self.settings.ctm.BASIC_TEXT_COLOR,
)
# setattr(self, f"l", label_widget)
label_widget.grid(row=1, column=0, padx=self.settings.uism.VALUES_TEXT_IPADX, pady=self.settings.uism.VALUES_TEXT_IPADY)

View File

@@ -2,7 +2,7 @@ from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont
from .ui_utils import fadeInAnimation
class _CreateModalWindow(CTkToplevel):
class _CreateWindowCover(CTkToplevel):
def __init__(self, attach_window, settings, view_variable):
super().__init__()
self.withdraw()
@@ -11,7 +11,6 @@ class _CreateModalWindow(CTkToplevel):
self.title("")
self.overrideredirect(True)
# self.wm_attributes("-alpha", 0.5)
self.wm_attributes("-toolwindow", True)
self.attach_window = attach_window
@@ -35,20 +34,20 @@ class _CreateModalWindow(CTkToplevel):
self.grid_rowconfigure(0,weight=1)
self.grid_columnconfigure(0,weight=1)
self.modal_container = CTkFrame(self, corner_radius=0, fg_color="black", width=0, height=0)
self.modal_container.grid(row=0, column=0, sticky="nsew")
self.cover_container = CTkFrame(self, corner_radius=0, fg_color="black", width=0, height=0)
self.cover_container.grid(row=0, column=0, sticky="nsew")
self.modal_container_label_wrapper = CTkLabel(
self.modal_container,
textvariable=self._view_variable.VAR_LABEL_MODAL_MESSAGE_FOR__MAIN_WINDOW,
self.cover_container_label_wrapper = CTkLabel(
self.cover_container,
textvariable=self._view_variable.VAR_LABEL_MAIN_WINDOW_COVER_MESSAGE,
height=0,
corner_radius=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.TEXT_FONT_SIZE, weight="normal"),
anchor="w",
text_color=self.settings.ctm.TEXT_COLOR,
)
self.modal_container_label_wrapper.place(relx=0.5, rely=0.5, anchor="center")
self.cover_container_label_wrapper.place(relx=0.5, rely=0.5, anchor="center")
def show(self):

View File

@@ -9,7 +9,16 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta
def update_switch_status(widget_frame, widget_label, widget_switch_box, widget_selected_mark, widget_compact_mode_icon, icon_name, disabled_icon_name):
def update_switch_status(
widget_frame,
widget_label,
widget_switch_box,
widget_selected_mark,
widget_compact_mode_icon,
icon_name,
disabled_icon_name,
):
if status == "disabled":
widget_frame.configure(cursor="")
widget_label.configure(text_color=settings.ctm.SF__TEXT_DISABLED_COLOR)
@@ -84,8 +93,7 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta
vrct_gui.sls__title_text_target_language.configure(text_color=settings.ctm.SF__TEXT_DISABLED_COLOR)
if view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE is False:
vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR_PASSIVE)
# vrct_gui.sls__optionmenu_your_language.configure(state="disabled")
# vrct_gui.sls__optionmenu_target_language.configure(state="disabled")
elif status == "normal":
vrct_gui.sls__container_title.configure(text_color=settings.ctm.LABELS_TEXT_COLOR)
@@ -94,8 +102,7 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta
if view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE is False:
vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR)
vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR)
# vrct_gui.sls__optionmenu_your_language.configure(state="normal")
# vrct_gui.sls__optionmenu_target_language.configure(state="normal")
case "config_button":

View File

@@ -1,7 +1,15 @@
from datetime import datetime
from customtkinter import CTkFont
def _printToTextbox(vrct_gui, settings, target_type, original_message=None, translated_message=None, tags=None, disable_print_to_textbox_all:bool=False):
def _printToTextbox(vrct_gui,
settings,
target_type,
original_message=None,
translated_message=None,
tags=None,
disable_print_to_textbox_all:bool=False,
):
now_raw_data = datetime.now()
# now = now_raw_data.strftime("%H:%M:%S")
now_hm = now_raw_data.strftime("%H:%M")

View File

@@ -3,7 +3,7 @@ from .widgets import createConfigWindowTitle, createSideMenuAndSettingsBoxContai
from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont
from ..ui_utils import getImagePath, getLatestWidth, getLatestHeight
from ..ui_utils import getImagePath, getLatestWidth
from utils import isEven
class ConfigWindow(CTkToplevel):

View File

@@ -18,7 +18,6 @@ def createConfigWindowTitle(config_window, settings, view_variable):
config_window.side_menu_config_window_title_logo_wrapper.grid_rowconfigure(0,weight=1)
config_window.side_menu_config_window_title = CTkLabel(
config_window.side_menu_config_window_title_logo_frame,
# text="Settings",
textvariable=view_variable.VAR_CONFIG_WINDOW_TITLE,
height=0,
anchor="w",

View File

@@ -1,10 +1,10 @@
from customtkinter import CTkFont, CTkFrame, CTkLabel
from customtkinter import CTkFrame
from ._createSettingBoxTitle import _createSettingBoxTitle
from ._createRestartButton import _createRestartButton
from ._createSettingBoxCompactModeButton import _createSettingBoxCompactModeButton
from ....ui_utils import getLatestHeight, getLatestWidth
from ....ui_utils import getLatestHeight
from utils import isEven
def createSettingBoxTopBar(config_window, settings, view_variable):

View File

@@ -28,7 +28,7 @@ def _createSettingBoxContainer(config_window, settings, view_variable, setting_b
setting_box_row=0
for i, setting_box_setting in enumerate(setting_box_container_settings["setting_boxes"]):
for setting_box_setting in setting_box_container_settings["setting_boxes"]:
# Top-Padding that can be container the section title
setting_box_top_padding = CTkFrame(setting_box_container_widget, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=settings.uism.SB__TOP_PADY)
setting_box_top_padding.grid(row=setting_box_row, column=0, sticky="ew", padx=0, pady=0)

View File

@@ -1,6 +1,6 @@
from customtkinter import CTkFrame, CTkScrollableFrame
from ....ui_utils import _setDefaultActiveTab, applyUiScalingAndFixTheBugScrollBar
from ....ui_utils import setDefaultActiveTab, applyUiScalingAndFixTheBugScrollBar
from ._addConfigSideMenuItem import _addConfigSideMenuItem
from ._createSettingBoxContainer import _createSettingBoxContainer
@@ -152,7 +152,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
# Set default active side menu tab
view_variable.VAR_CURRENT_ACTIVE_CONFIG_TITLE.set(sm_and_sbc_setting["textvariable"].get())
config_window.current_active_side_menu_tab = getattr(config_window, sm_and_sbc_setting["side_menu_tab_attr_name"])
_setDefaultActiveTab(
setDefaultActiveTab(
active_tab_widget=config_window.current_active_side_menu_tab,
active_bg_color=settings.ctm.SIDE_MENU_LABELS_BG_COLOR,
active_text_color=settings.ctm.SIDE_MENU_LABELS_SELECTED_TEXT_COLOR

View File

@@ -91,7 +91,16 @@ class _SettingBoxGenerator():
def createSettingBoxDropdownMenu(self, for_var_label_text, for_var_desc_text, optionmenu_attr_name, command, dropdown_menu_width=None, variable=None, dropdown_menu_values=None):
def createSettingBoxDropdownMenu(
self,
for_var_label_text, for_var_desc_text,
optionmenu_attr_name,
command,
dropdown_menu_width=None,
dropdown_menu_values=None,
variable=None,
):
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(optionmenu_attr_name, for_var_label_text, for_var_desc_text)
def adjustedCommand(value):
@@ -143,7 +152,13 @@ class _SettingBoxGenerator():
def createSettingBoxSwitch(self, for_var_label_text, for_var_desc_text, switch_attr_name, variable, command):
def createSettingBoxSwitch(self,
for_var_label_text, for_var_desc_text,
switch_attr_name,
variable,
command,
):
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(switch_attr_name, for_var_label_text, for_var_desc_text)
switch_widget = CTkSwitch(
@@ -171,7 +186,13 @@ class _SettingBoxGenerator():
def createSettingBoxCheckbox(self, for_var_label_text, for_var_desc_text, checkbox_attr_name, variable, command):
def createSettingBoxCheckbox(self,
for_var_label_text, for_var_desc_text,
checkbox_attr_name,
command,
variable,
):
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(checkbox_attr_name, for_var_label_text, for_var_desc_text)
checkbox_widget = CTkCheckBox(
@@ -205,7 +226,19 @@ class _SettingBoxGenerator():
def createSettingBoxSlider(self, for_var_label_text, for_var_desc_text, slider_attr_name, slider_range, command, variable, slider_number_of_steps: Union[int, None] = None, slider_bind__ButtonPress=None, slider_bind__ButtonRelease=None):
def createSettingBoxSlider(
self,
for_var_label_text, for_var_desc_text,
slider_attr_name,
slider_range,
command,
variable,
slider_number_of_steps: Union[int,
None] = None,
slider_bind__ButtonPress=None,
slider_bind__ButtonRelease=None
):
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(slider_attr_name, for_var_label_text, for_var_desc_text)
@@ -258,7 +291,6 @@ class _SettingBoxGenerator():
slider_number_of_steps: Union[int, None] = None,
):
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(progressbar_x_slider_attr_name)
def adjusted_command__for_entry_bind__Any_KeyRelease(e):
@@ -352,7 +384,15 @@ class _SettingBoxGenerator():
def createSettingBoxEntry(self, for_var_label_text, for_var_desc_text, entry_attr_name, entry_width, entry_bind__Any_KeyRelease, entry_textvariable, entry_bind__FocusOut=None):
def createSettingBoxEntry(self,
for_var_label_text, for_var_desc_text,
entry_attr_name,
entry_width,
entry_textvariable,
entry_bind__Any_KeyRelease,
entry_bind__FocusOut=None,
):
(setting_box_frame, setting_box_item_frame) = self._createSettingBoxFrame(entry_attr_name, for_var_label_text, for_var_desc_text)
def adjusted_command__for_entry_bind__Any_KeyRelease(e):

View File

@@ -58,7 +58,7 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings, view_vari
for_var_desc_text=view_variable.VAR_DESC_MIC_DEVICE,
optionmenu_attr_name="sb__optionmenu_mic_device",
dropdown_menu_values=view_variable.LIST_MIC_DEVICE,
dropdown_menu_width=settings.uism.RESPONSIVE_UI_SIZE_INT_300,
dropdown_menu_width=settings.uism.RESPONSIVE_UI_SIZE_INT_500,
command=lambda value: optionmenu_input_mic_device_callback(value),
variable=view_variable.VAR_MIC_DEVICE,
)

View File

@@ -41,7 +41,7 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_
for_var_desc_text=view_variable.VAR_DESC_SPEAKER_DEVICE,
optionmenu_attr_name="sb__optionmenu_speaker_device",
dropdown_menu_values=view_variable.LIST_SPEAKER_DEVICE,
dropdown_menu_width=settings.uism.RESPONSIVE_UI_SIZE_INT_300,
dropdown_menu_width=settings.uism.RESPONSIVE_UI_SIZE_INT_500,
command=lambda value: optionmenu_input_speaker_device_callback(value),
variable=view_variable.VAR_SPEAKER_DEVICE,
)

View File

@@ -214,10 +214,6 @@ def createSidebarFeatures(settings, main_window, view_variable):
bg_color=settings.ctm.SF__BG_COLOR,
progress_color=settings.ctm.SF__SWITCH_BOX_ACTIVE_BG_COLOR,
)
# # if sfs["is_checked"] is True:
# # target_attr.select()
# # else:
# # target_attr.deselect()
setattr(main_window, switch_box_attr_name, switch_box_widget)

View File

@@ -1,6 +1,6 @@
from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkImage
from ....ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, switchActiveTabAndPassiveTab, switchTabsColor, createOptionMenuBox, getLatestWidth
from ....ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, switchActiveTabAndPassiveTab, switchTabsColor, createOptionMenuBox
from utils import callFunctionIfCallable

View File

@@ -55,16 +55,6 @@ def createSidebar(settings, main_window, view_variable):
main_window.sidebar_config_button.grid(row=0, column=0, padx=0, pady=settings.uism.SIDEBAR_CONFIG_BUTTON_IPADY)
# main_window.sidebar_config_button_update_badge = CTkFrame(
# main_window.sidebar_config_button,
# corner_radius=3,
# fg_color="#ca5361",
# width=6,
# height=6,
# )
# main_window.sidebar_config_button_update_badge.place(relx=0.9, rely=0.1, anchor="center")
bindButtonFunctionAndColor(
target_widgets=[main_window.sidebar_config_button_wrapper, main_window.sidebar_config_button],
enter_color=settings.ctm.CONFIG_BUTTON_HOVERED_BG_COLOR,

View File

@@ -1,6 +1,6 @@
from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkTextbox
from ...ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, _setDefaultActiveTab, switchActiveTabAndPassiveTab, switchTabsColor
from ...ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, setDefaultActiveTab, switchActiveTabAndPassiveTab, switchTabsColor
def createTextbox(settings, main_window, view_variable):
@@ -152,7 +152,7 @@ def createTextbox(settings, main_window, view_variable):
# Set default active textbox tab
main_window.current_active_textbox_tab = getattr(main_window, "textbox_tab_all")
_setDefaultActiveTab(
setDefaultActiveTab(
active_tab_widget=main_window.current_active_textbox_tab,
active_bg_color=settings.ctm.TEXTBOX_TAB_BG_ACTIVE_COLOR,
active_text_color=settings.ctm.TEXTBOX_TAB_TEXT_ACTIVE_COLOR

View File

@@ -5,7 +5,8 @@ class ColorThemeManager():
self.main = SimpleNamespace()
self.config_window = SimpleNamespace()
self.selectable_language_window = SimpleNamespace()
self.modal_window = SimpleNamespace()
self.main_window_cover = SimpleNamespace()
self.error_message_window = SimpleNamespace()
# old one. But leave it here for now.
# self.PRIMARY_100_COLOR = "#c4eac1"
@@ -212,7 +213,7 @@ class ColorThemeManager():
# Modal Window (Main Window)
self.modal_window.TEXT_COLOR = self.LIGHT_100_COLOR
self.main_window_cover.TEXT_COLOR = self.LIGHT_100_COLOR
# Common

View File

@@ -8,7 +8,8 @@ class UiScalingManager():
self.main = SimpleNamespace()
self.config_window = SimpleNamespace()
self.selectable_language_window = SimpleNamespace()
self.modal_window = SimpleNamespace()
self.main_window_cover = SimpleNamespace()
self.error_message_window = SimpleNamespace()
self._calculatedUiSizes()
@@ -21,7 +22,7 @@ class UiScalingManager():
self.common.SCROLLBAR_IPADX = (self._calculateUiSize(2), self._calculateUiSize(2))
self.common.SCROLLBAR_WIDTH = self._calculateUiSize(16)
for i in range(10, 301, 10):
for i in range(10, 501, 10):
setattr(self.main, f"RESPONSIVE_UI_SIZE_INT_{i}", self._calculateUiSize(i))
setattr(self.config_window, f"RESPONSIVE_UI_SIZE_INT_{i}", self._calculateUiSize(i))
@@ -138,7 +139,7 @@ class UiScalingManager():
self.selectable_language_window.VALUES_TEXT_IPADY = self._calculateUiSize(8)
self.modal_window.TEXT_FONT_SIZE = self._calculateUiSize(20)
self.main_window_cover.TEXT_FONT_SIZE = self._calculateUiSize(20)
# Config Window
self.config_window.DEFAULT_WIDTH = self._calculateUiSize(1080)

View File

@@ -1,2 +1 @@
from .ui_utils import *
from .ui_utils import _setDefaultActiveTab
from .ui_utils import *

View File

@@ -88,7 +88,7 @@ def unbindEventFromActiveTabWidget(active_tab_widget):
active_tab_widget.unbind(event_name)
active_tab_widget.children["!ctklabel"].unbind(event_name)
def _setDefaultActiveTab(active_tab_widget, active_bg_color, active_text_color):
def setDefaultActiveTab(active_tab_widget, active_bg_color, active_text_color):
active_tab_widget.configure(fg_color=active_bg_color, cursor="")
active_tab_widget.children["!ctklabel"].configure(fg_color=active_bg_color, text_color=active_text_color)
unbindEventFromActiveTabWidget(active_tab_widget)

View File

@@ -2,7 +2,7 @@ from customtkinter import CTk, CTkImage
from ._CreateSelectableLanguagesWindow import _CreateSelectableLanguagesWindow
from ._CreateModalWindow import _CreateModalWindow
from ._CreateWindowCover import _CreateWindowCover
from ._CreateErrorWindow import _CreateErrorWindow
from ._CreateDropdownMenuWindow import _CreateDropdownMenuWindow
from ._changeMainWindowWidgetsStatus import _changeMainWindowWidgetsStatus
@@ -11,7 +11,7 @@ from ._printToTextbox import _printToTextbox
from .main_window import createMainWindowWidgets
from .config_window import ConfigWindow
from .ui_utils import _setDefaultActiveTab, getLatestHeight, setGeometryToCenterOfScreen, fadeInAnimation
from .ui_utils import setDefaultActiveTab, setGeometryToCenterOfScreen, fadeInAnimation
from utils import callFunctionIfCallable, makeEven
@@ -36,9 +36,9 @@ class VRCT_GUI(CTk):
self.window_state = self.new_window_state
if self.window_state == "iconic":
self.modal_window.withdraw()
self.main_window_cover.withdraw()
elif self.window_state == "normal":
self.modal_window.show()
self.main_window_cover.show()
@@ -93,14 +93,14 @@ class VRCT_GUI(CTk):
view_variable=self._view_variable
)
self.modal_window = _CreateModalWindow(
self.main_window_cover = _CreateWindowCover(
attach_window=self,
settings=self.settings.modal_window,
settings=self.settings.main_window_cover,
view_variable=self._view_variable
)
self.error_message_window = _CreateErrorWindow(
settings=self.settings.modal_window,
settings=self.settings.error_message_window,
view_variable=self._view_variable,
wrapper_widget=self.config_window.main_bg_container,
@@ -130,14 +130,14 @@ class VRCT_GUI(CTk):
callFunctionIfCallable(self._view_variable.CALLBACK_OPEN_CONFIG_WINDOW)
self._adjustToMainWindowGeometry()
self.modal_window.show()
self.main_window_cover.show()
self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID = self.bind("<Configure>", self._adjustToMainWindowGeometry, "+")
self.BIND_UNMAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID = self.bind("<Unmap>", self.detectMainWindowState, "+")
self.BIND_MAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID = self.bind("<Map>", self.detectMainWindowState, "+")
self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID = self.modal_window.bind("<FocusIn>", lambda _e: self.config_window.lift(), "+")
self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID = self.main_window_cover.bind("<FocusIn>", lambda _e: self.config_window.lift(), "+")
self.config_window.attributes("-alpha", 0)
self.config_window.deiconify()
@@ -153,11 +153,11 @@ class VRCT_GUI(CTk):
self.config_window.withdraw()
self.modal_window.withdraw()
self.main_window_cover.withdraw()
self.unbind("<Configure>", self.BIND_CONFIGURE_ADJUSTED_GEOMETRY_FUNC_ID)
self.unbind("<Unmap>", self.BIND_UNMAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID)
self.unbind("<Map>", self.BIND_MAP_DETECT_MAIN_WINDOW_STATE_FUNC_ID)
self.modal_window.unbind("<FocusIn>", self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID)
self.main_window_cover.unbind("<FocusIn>", self.BIND_FOCUS_IN_MODAL_WINDOW_LIFT_CONFIG_WINDOW_FUNC_ID)
self.adjusted_event=None
@@ -238,7 +238,7 @@ class VRCT_GUI(CTk):
def _setDefaultActiveLanguagePresetTab(self, tab_no:str):
self.current_active_preset_tab = getattr(self, f"sls__presets_button_{tab_no}")
_setDefaultActiveTab(
setDefaultActiveTab(
active_tab_widget=self.current_active_preset_tab,
active_bg_color=self.settings.main.ctm.SLS__PRESETS_TAB_BG_ACTIVE_COLOR,
active_text_color=self.settings.main.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR
@@ -263,9 +263,9 @@ class VRCT_GUI(CTk):
y_pos = self.winfo_rooty()
width_new = makeEven(self.winfo_width())
height_new = makeEven(self.winfo_height())
self.modal_window.geometry("{}x{}+{}+{}".format(width_new, height_new, x_pos, y_pos))
self.main_window_cover.geometry("{}x{}+{}+{}".format(width_new, height_new, x_pos, y_pos))
self.modal_window.lift()
self.main_window_cover.lift()
if self.adjusted_event == str(e):
self.after(150, lambda: self.config_window.lift())
elif self.adjusted_event is None: