Merge branch 'view' into UI_2.0

This commit is contained in:
Sakamoto Shiina
2023-09-02 05:34:46 +09:00
13 changed files with 366 additions and 349 deletions

59
main.py
View File

@@ -2,6 +2,8 @@ from threading import Thread
from config import config
from model import model
from view import view
from utils import get_key_by_value
from languages import selectable_languages
# func transcription send message
def sendMicMessage(message):
@@ -120,8 +122,8 @@ def setTargetLanguageAndCountry(select):
config.TARGET_COUNTRY = country
config.CHOICE_TRANSLATOR = model.findTranslationEngine(config.SOURCE_LANGUAGE, config.TARGET_LANGUAGE)
def callbackSelectedTabNo1():
config.SELECTED_TAB_NO = "1"
def callbackSelectedLanguagePresetTab(selected_tab_no):
config.SELECTED_TAB_NO = selected_tab_no
view.updateGuiVariableByPresetTabNo(config.SELECTED_TAB_NO)
languages = config.SELECTED_TAB_YOUR_LANGUAGES
select = languages[config.SELECTED_TAB_NO]
@@ -135,48 +137,17 @@ def callbackSelectedTabNo1():
config.TARGET_COUNTRY = country
config.CHOICE_TRANSLATOR = model.findTranslationEngine(config.SOURCE_LANGUAGE, config.TARGET_LANGUAGE)
def callbackSelectedTabNo2():
config.SELECTED_TAB_NO = "2"
view.updateGuiVariableByPresetTabNo(config.SELECTED_TAB_NO)
languages = config.SELECTED_TAB_YOUR_LANGUAGES
select = languages[config.SELECTED_TAB_NO]
language, country = model.getLanguageAndCountry(select)
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)
config.TARGET_LANGUAGE = language
config.TARGET_COUNTRY = country
config.CHOICE_TRANSLATOR = model.findTranslationEngine(config.SOURCE_LANGUAGE, config.TARGET_LANGUAGE)
def callbackSelectedTabNo3():
config.SELECTED_TAB_NO = "3"
view.updateGuiVariableByPresetTabNo(config.SELECTED_TAB_NO)
languages = config.SELECTED_TAB_YOUR_LANGUAGES
select = languages[config.SELECTED_TAB_NO]
language, country = model.getLanguageAndCountry(select)
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)
config.TARGET_LANGUAGE = language
config.TARGET_COUNTRY = country
config.CHOICE_TRANSLATOR = model.findTranslationEngine(config.SOURCE_LANGUAGE, config.TARGET_LANGUAGE)
# command func
def callbackToggleTranslation():
config.ENABLE_TRANSLATION = view.getTranslationButtonStatus()
def callbackToggleTranslation(is_turned_on):
config.ENABLE_TRANSLATION = is_turned_on
if config.ENABLE_TRANSLATION is True:
view.printToTextbox_enableTranslation()
else:
view.printToTextbox_disableTranslation()
def callbackToggleTranscriptionSend():
def callbackToggleTranscriptionSend(is_turned_on):
view.setMainWindowAllWidgetsStatusToDisabled()
config.ENABLE_TRANSCRIPTION_SEND = view.getTranscriptionSendButtonStatus()
config.ENABLE_TRANSCRIPTION_SEND = is_turned_on
if config.ENABLE_TRANSCRIPTION_SEND is True:
view.printToTextbox_enableTranscriptionSend()
th_startTranscriptionSendMessage = Thread(target=startTranscriptionSendMessage)
@@ -188,9 +159,9 @@ def callbackToggleTranscriptionSend():
th_stopTranscriptionSendMessage.daemon = True
th_stopTranscriptionSendMessage.start()
def callbackToggleTranscriptionReceive():
def callbackToggleTranscriptionReceive(is_turned_on):
view.setMainWindowAllWidgetsStatusToDisabled()
config.ENABLE_TRANSCRIPTION_RECEIVE = view.getTranscriptionReceiveButtonStatus()
config.ENABLE_TRANSCRIPTION_RECEIVE = is_turned_on
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
view.printToTextbox_enableTranscriptionReceive()
th_startTranscriptionReceiveMessage = Thread(target=startTranscriptionReceiveMessage)
@@ -202,8 +173,8 @@ def callbackToggleTranscriptionReceive():
th_stopTranscriptionReceiveMessage.daemon = True
th_stopTranscriptionReceiveMessage.start()
def callbackToggleForeground():
config.ENABLE_FOREGROUND = view.getForegroundButtonStatus()
def callbackToggleForeground(is_turned_on):
config.ENABLE_FOREGROUND = is_turned_on
if config.ENABLE_FOREGROUND is True:
view.printToTextbox_enableForeground()
view.foregroundOn()
@@ -244,6 +215,8 @@ def callbackSetFontFamily(value):
def callbackSetUiLanguage(value):
print("callbackSetUiLanguage", value)
value = get_key_by_value(selectable_languages, value)
print("callbackSetUiLanguage__after_get_key_by_value", value)
config.UI_LANGUAGE = value
# Translation Tab
@@ -400,9 +373,7 @@ view.register(
"callback_target_language": setTargetLanguageAndCountry,
"values": model.getListLanguageAndCountry(),
"callback_selected_tab_no_1": callbackSelectedTabNo1,
"callback_selected_tab_no_2": callbackSelectedTabNo2,
"callback_selected_tab_no_3": callbackSelectedTabNo3,
"callback_selected_language_preset_tab": callbackSelectedLanguagePresetTab,
},
entry_message_box_commands={

208
view.py
View File

@@ -1,6 +1,8 @@
from types import SimpleNamespace
from tkinter import font as tk_font
from languages import selectable_languages
from customtkinter import StringVar, END as CTK_END, get_appearance_mode
from customtkinter import StringVar, IntVar, BooleanVar, END as CTK_END, get_appearance_mode
from vrct_gui.ui_managers import ColorThemeManager, ImageFilenameManager, UiScalingManager
from vrct_gui import vrct_gui
@@ -34,6 +36,171 @@ class View():
**common_args
)
self.view_variable = SimpleNamespace(
# Main Window
# Sidebar Features
CALLBACK_TOGGLE_TRANSLATION=None,
CALLBACK_TOGGLE_TRANSCRIPTION_SEND=None,
CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE=None,
CALLBACK_TOGGLE_FOREGROUND=None,
# Language Settings
CALLBACK_SELECTED_LANGUAGE_PRESET_TAB=None,
VAR_YOUR_LANGUAGE = StringVar(value="Japanese\n(Japan)"),
VAR_TARGET_LANGUAGE = StringVar(value="English\n(United States)"),
# Config Window
# Appearance Tab
VAR_LABEL_TRANSPARENCY=StringVar(value="Transparency"),
VAR_DESC_TRANSPARENCY=StringVar(value="Change the window's transparency. 50% to 100%. (Default: 100%)"),
SLIDER_RANGE_TRANSPARENCY=(50, 100),
CALLBACK_SET_TRANSPARENCY=None,
VAR_TRANSPARENCY=IntVar(value=config.TRANSPARENCY),
VAR_LABEL_APPEARANCE_THEME=StringVar(value="Theme"),
VAR_DESC_APPEARANCE_THEME=StringVar(value="Change the color theme from \"Light\" and \"Dark\". If you select \"System\", It will adjust based on your Windows theme. (Default: System)"),
LIST_APPEARANCE_THEME=["Light", "Dark", "System"],
CALLBACK_SET_APPEARANCE_THEME=None,
VAR_APPEARANCE_THEME=StringVar(value=config.APPEARANCE_THEME),
VAR_LABEL_UI_SCALING=StringVar(value="UI Size"),
VAR_DESC_UI_SCALING=StringVar(value="(Default: 100%)"),
LIST_UI_SCALING=["80%", "90%", "100%", "110%", "120%"],
CALLBACK_SET_UI_SCALING=None,
VAR_UI_SCALING=StringVar(value=config.UI_SCALING),
VAR_LABEL_FONT_FAMILY=StringVar(value="Font Family"),
VAR_DESC_FONT_FAMILY=StringVar(value="(Default: Yu Gothic UI)"),
LIST_FONT_FAMILY=list(tk_font.families()),
CALLBACK_SET_FONT_FAMILY=None,
VAR_FONT_FAMILY=StringVar(value=config.FONT_FAMILY),
VAR_LABEL_UI_LANGUAGE=StringVar(value="UI Language"),
VAR_DESC_UI_LANGUAGE=StringVar(value="(Default: English)"),
LIST_UI_LANGUAGE=list(selectable_languages.values()),
CALLBACK_SET_UI_LANGUAGE=None,
VAR_UI_LANGUAGE=StringVar(value=selectable_languages[config.UI_LANGUAGE]),
# Translation Tab
VAR_LABEL_DEEPL_AUTH_KEY=StringVar(value="DeepL Auth Key"),
VAR_DESC_DEEPL_AUTH_KEY=None,
# VAR_DESC_DEEPL_AUTH_KEY=StringVar(value=""),
CALLBACK_SET_DEEPL_AUTH_KEY=None,
VAR_DEEPL_AUTH_KEY=StringVar(value=config.AUTH_KEYS["DeepL(auth)"]),
# Transcription Tab (Mic)
VAR_LABEL_MIC_HOST=StringVar(value="Mic Host"),
VAR_DESC_MIC_HOST=StringVar(value="Select the mic host. (Default: ?)"),
LIST_MIC_HOST=[], # model.getListInputHost(),
CALLBACK_SET_MIC_HOST=None,
VAR_MIC_HOST=StringVar(value=config.CHOICE_MIC_HOST),
VAR_LABEL_MIC_DEVICE=StringVar(value="Mic Device"),
VAR_DESC_MIC_DEVICE=StringVar(value="Select the mic devise. (Default: ?)"),
LIST_MIC_DEVICE=[], # model.getListInputDevice(),
CALLBACK_SET_MIC_DEVICE=None,
VAR_MIC_DEVICE=StringVar(value=config.CHOICE_MIC_DEVICE),
VAR_LABEL_MIC_ENERGY_THRESHOLD=StringVar(value="Mic Energy Threshold"),
VAR_DESC_MIC_ENERGY_THRESHOLD=StringVar(value="Slider to modify the threshold for activating voice input.\nPress the microphone button to start input and speak something, so you can adjust it while monitoring the actual volume. 0 to 2000 (Default: 300)"),
SLIDER_RANGE_MIC_ENERGY_THRESHOLD=(0, config.MAX_MIC_ENERGY_THRESHOLD),
CALLBACK_CHECK_MIC_THRESHOLD=None,
VAR_MIC_ENERGY_THRESHOLD=IntVar(value=config.INPUT_MIC_ENERGY_THRESHOLD),
VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value="Mic Dynamic Energy Threshold"),
VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value="When this feature is selected, it will automatically adjust in a way that works well, based on the set Mic Energy Threshold."),
CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD=None,
VAR_MIC_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD),
VAR_LABEL_MIC_RECORD_TIMEOUT=StringVar(value="Mic Record Timeout"),
VAR_DESC_MIC_RECORD_TIMEOUT=StringVar(value="(Default: 3)"),
CALLBACK_SET_MIC_RECORD_TIMEOUT=None,
VAR_MIC_RECORD_TIMEOUT=IntVar(value=config.INPUT_MIC_RECORD_TIMEOUT),
VAR_LABEL_MIC_PHRASE_TIMEOUT=StringVar(value="Mic Phrase Timeout"),
VAR_DESC_MIC_PHRASE_TIMEOUT=StringVar(value="(Default: 3)"),
CALLBACK_SET_MIC_PHRASE_TIMEOUT=None,
VAR_MIC_PHRASE_TIMEOUT=IntVar(value=config.INPUT_MIC_PHRASE_TIMEOUT),
VAR_LABEL_MIC_MAX_PHRASES=StringVar(value="Mic Max Phrases"),
VAR_DESC_MIC_MAX_PHRASES=StringVar(value="It will stop recording and send the recordings when the set count of phrase(s) is reached. (Default: 10)"),
CALLBACK_SET_MIC_MAX_PHRASES=None,
VAR_MIC_MAX_PHRASES=IntVar(value=config.INPUT_MIC_MAX_PHRASES),
VAR_LABEL_MIC_WORD_FILTER=StringVar(value="Mic Word Filter"),
VAR_DESC_MIC_WORD_FILTER=StringVar(value="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"),
CALLBACK_SET_MIC_WORD_FILTER=None,
VAR_MIC_WORD_FILTER=StringVar(value=",".join(config.INPUT_MIC_WORD_FILTER) if len(config.INPUT_MIC_WORD_FILTER) > 0 else ""),
# Transcription Tab (Speaker)
VAR_LABEL_SPEAKER_DEVICE=StringVar(value="Speaker Device"),
VAR_DESC_SPEAKER_DEVICE=StringVar(value="Select the speaker devise. (Default: ?)"),
LIST_SPEAKER_DEVICE=[], # model.getListOutputDevice(),
CALLBACK_SET_SPEAKER_DEVICE=None,
VAR_SPEAKER_DEVICE=StringVar(value=config.CHOICE_SPEAKER_DEVICE),
VAR_LABEL_SPEAKER_ENERGY_THRESHOLD=StringVar(value="Mic Energy Threshold"),
VAR_DESC_SPEAKER_ENERGY_THRESHOLD=StringVar(value="Slider to modify the threshold for activating voice input.\nPress the headphones mark button to start input and speak something, so you can adjust it while monitoring the actual volume. 0 to 4000 (Default: 300)"),
SLIDER_RANGE_SPEAKER_ENERGY_THRESHOLD=(0, config.MAX_SPEAKER_ENERGY_THRESHOLD),
CALLBACK_CHECK_SPEAKER_THRESHOLD=None,
VAR_SPEAKER_ENERGY_THRESHOLD=IntVar(value=config.INPUT_SPEAKER_ENERGY_THRESHOLD),
VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value="Speaker Dynamic Energy Threshold"),
VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value="When this feature is selected, it will automatically adjust in a way that works well, based on the set Speaker Energy Threshold."),
CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=None,
VAR_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD),
VAR_LABEL_SPEAKER_RECORD_TIMEOUT=StringVar(value="Speaker Record Timeout"),
VAR_DESC_SPEAKER_RECORD_TIMEOUT=StringVar(value="(Default: 3)"),
CALLBACK_SET_SPEAKER_RECORD_TIMEOUT=None,
VAR_SPEAKER_RECORD_TIMEOUT=IntVar(value=config.INPUT_SPEAKER_RECORD_TIMEOUT),
VAR_LABEL_SPEAKER_PHRASE_TIMEOUT=StringVar(value="Speaker Phrase Timeout"),
VAR_DESC_SPEAKER_PHRASE_TIMEOUT=StringVar(value="It will stop recording and receive the recordings when the set second(s) is reached. (Default: 3)"),
CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT=None,
VAR_SPEAKER_PHRASE_TIMEOUT=IntVar(value=config.INPUT_SPEAKER_PHRASE_TIMEOUT),
VAR_LABEL_SPEAKER_MAX_PHRASES=StringVar(value="Speaker Max Phrases"),
VAR_DESC_SPEAKER_MAX_PHRASES=StringVar(value="It will stop recording and receive the recordings when the set count of phrase(s) is reached. (Default: 10)"),
CALLBACK_SET_SPEAKER_MAX_PHRASES=None,
VAR_SPEAKER_MAX_PHRASES=IntVar(value=config.INPUT_SPEAKER_MAX_PHRASES),
# Others Tab
VAR_LABEL_ENABLE_AUTO_CLEAR_MESSAGE_BOX=StringVar(value="Auto Clear The Message Box"),
VAR_DESC_ENABLE_AUTO_CLEAR_MESSAGE_BOX=StringVar(value="Clear the message box after sending your message."),
CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX=None,
VAR_ENABLE_AUTO_CLEAR_MESSAGE_BOX=BooleanVar(value=config.ENABLE_AUTO_CLEAR_MESSAGE_BOX),
VAR_LABEL_ENABLE_NOTICE_XSOVERLAY=StringVar(value="Notification XSOverlay (VR Only)"),
VAR_DESC_ENABLE_NOTICE_XSOVERLAY=StringVar(value="Notify received messages by using XSOverlay's notification feature."),
CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY=None,
VAR_ENABLE_NOTICE_XSOVERLAY=BooleanVar(value=config.ENABLE_NOTICE_XSOVERLAY),
VAR_LABEL_MESSAGE_FORMAT=StringVar(value="Message Format"),
VAR_DESC_MESSAGE_FORMAT=StringVar(value="You can change the decoration of the message you want to send. (Default: \"[message]([translation])\" )"),
CALLBACK_SET_MESSAGE_FORMAT=None,
VAR_MESSAGE_FORMAT=StringVar(value=config.MESSAGE_FORMAT),
# Advanced Settings Tab
VAR_LABEL_OSC_IP_ADDRESS=StringVar(value="OSC IP Address"),
VAR_DESC_OSC_IP_ADDRESS=StringVar(value="(Default: 127.0.0.1)"),
CALLBACK_SET_OSC_IP_ADDRESS=None,
VAR_OSC_IP_ADDRESS=IntVar(value=config.OSC_IP_ADDRESS),
VAR_LABEL_OSC_PORT=StringVar(value="OSC Port"),
VAR_DESC_OSC_PORT=StringVar(value="(Default: 9000)"),
CALLBACK_SET_OSC_PORT=None,
VAR_OSC_PORT=IntVar(value=config.OSC_PORT),
)
def register(self, sidebar_features, language_presets, entry_message_box_commands, config_window):
@@ -50,9 +217,7 @@ class View():
vrct_gui.sqls__optionmenu_target_language.configure(command=language_presets["callback_target_language"])
vrct_gui.sqls__optionmenu_target_language.configure(variable=StringVar(value=config.SELECTED_TAB_TARGET_LANGUAGES[config.SELECTED_TAB_NO]))
vrct_gui.CALLBACK_SELECTED_TAB_NO_1 = language_presets["callback_selected_tab_no_1"]
vrct_gui.CALLBACK_SELECTED_TAB_NO_2 = language_presets["callback_selected_tab_no_2"]
vrct_gui.CALLBACK_SELECTED_TAB_NO_3 = language_presets["callback_selected_tab_no_3"]
vrct_gui.CALLBACK_SELECTED_LANGUAGE_PRESET_TAB = language_presets["callback_selected_language_preset_tab"]
vrct_gui.setDefaultActiveLanguagePresetTab(tab_no=config.SELECTED_TAB_NO)
@@ -72,9 +237,25 @@ class View():
# Appearance Tab
vrct_gui.config_window.CALLBACK_SET_TRANSPARENCY = config_window["callback_set_transparency"]
# vrct_gui.config_window.sb__transparency_slider.configure(variable=IntVar(value=config.TRANSPARENCY))
vrct_gui.config_window.CALLBACK_SET_APPEARANCE = config_window["callback_set_appearance"]
vrct_gui.config_window.CALLBACK_SET_UI_SCALING = config_window["callback_set_ui_scaling"]
vrct_gui.config_window.CALLBACK_SET_FONT_FAMILY = config_window["callback_set_font_family"]
self.view_variable.CALLBACK_SET_FONT_FAMILY = config_window["callback_set_font_family"]
# vrct_gui.config_window.sb__optionmenu_font_family.configure(values=self.view_variable.LIST_FONT_FAMILY)
# self.view_variable.VAR_FONT_FAMILY = StringVar(value=config.FONT_FAMILY)
# vrct_gui.config_window.sb__optionmenu_font_family.configure(variable=self.view_variable.VAR_FONT_FAMILY)
# vrct_gui.config_window.sb__optionmenu_font_family.configure(variable=StringVar(value=config.FONT_FAMILY))
# vrct_gui.config_window.sb__optionmenu_font_family.configure(values=["test", "from", "view.py"])
vrct_gui.config_window.CALLBACK_SET_UI_LANGUAGE = config_window["callback_set_ui_language"]
@@ -138,19 +319,8 @@ class View():
def updateGuiVariableByPresetTabNo(self, tab_no:str):
vrct_gui.YOUR_LANGUAGE = config.SELECTED_TAB_YOUR_LANGUAGES[tab_no]
vrct_gui.TARGET_LANGUAGE = config.SELECTED_TAB_TARGET_LANGUAGES[tab_no]
def getTranslationButtonStatus(self):
return vrct_gui.translation_switch_box.get()
def getTranscriptionSendButtonStatus(self):
return vrct_gui.transcription_send_switch_box.get()
def getTranscriptionReceiveButtonStatus(self):
return vrct_gui.transcription_receive_switch_box.get()
def getForegroundButtonStatus(self):
return vrct_gui.foreground_switch_box.get()
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])
def printToTextbox_enableTranslation(self):
@@ -216,7 +386,7 @@ class View():
def createGUI(self):
vrct_gui.createGUI(settings=self.settings)
vrct_gui.createGUI(settings=self.settings, view_variable=self.view_variable)
def startMainLoop(self):
vrct_gui.startMainLoop()

View File

@@ -4,7 +4,7 @@ from .widgets import createConfigWindowTitle, createSideMenuAndSettingsBoxContai
from customtkinter import CTkToplevel
class ConfigWindow(CTkToplevel):
def __init__(self, vrct_gui, settings):
def __init__(self, vrct_gui, settings, view_variable):
super().__init__()
self.withdraw()
@@ -18,47 +18,7 @@ class ConfigWindow(CTkToplevel):
self.protocol("WM_DELETE_WINDOW", vrct_gui.closeConfigWindow)
self.settings = settings
# Appearance Tab
self.CALLBACK_SET_TRANSPARENCY = None
self.CALLBACK_SET_APPEARANCE = None
self.CALLBACK_SET_UI_SCALING = None
self.CALLBACK_SET_FONT_FAMILY = None
self.CALLBACK_SET_UI_LANGUAGE = None
# Translation Tab
self.CALLBACK_SET_DEEPL_AUTHKEY = None
# Transcription Tab (Mic)
self.CALLBACK_SET_MIC_HOST = None
self.CALLBACK_SET_MIC_DEVICE = None
self.CALLBACK_SET_MIC_ENERGY_THRESHOLD = None
self.CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD = None
self.CALLBACK_CHECK_MIC_THRESHOLD = None
self.CALLBACK_SET_MIC_RECORD_TIMEOUT = None
self.CALLBACK_SET_MIC_PHRASE_TIMEOUT = None
self.CALLBACK_SET_MIC_MAX_PHRASES = None
self.CALLBACK_SET_MIC_WORD_FILTER = None
# Transcription Tab (Speaker)
self.CALLBACK_SET_SPEAKER_DEVICE = None
self.CALLBACK_SET_SPEAKER_ENERGY_THRESHOLD = None
self.CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = None
self.CALLBACK_CHECK_SPEAKER_THRESHOLD = None
self.CALLBACK_SET_SPEAKER_RECORD_TIMEOUT = None
self.CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT = None
self.CALLBACK_SET_SPEAKER_MAX_PHRASES = None
# Others Tab
self.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX = None
self.CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY = None
self.CALLBACK_SET_MESSAGE_FORMAT = None
# Advanced Settings Tab
self.CALLBACK_SET_OSC_IP_ADDRESS = None
self.CALLBACK_SET_OSC_PORT = None
self.view_variable = view_variable
createConfigWindowTitle(config_window=self, settings=settings)

View File

@@ -1,11 +1,9 @@
from customtkinter import CTkOptionMenu, CTkFont, CTkFrame, CTkLabel, CTkRadioButton, CTkEntry, CTkSlider, CTkSwitch, CTkCheckBox, CTkProgressBar, END as CTK_END
from ctk_scrollable_dropdown import CTkScrollableDropdown
from vrct_gui.ui_utils import createButtonWithImage
from typing import Union
class _SettingBoxGenerator():
def __init__(self, config_window, settings):
@@ -23,22 +21,22 @@ class _SettingBoxGenerator():
setting_box_frame_wrapper.grid_columnconfigure((0,1), weight=1, minsize=int(self.uism.SB__MAIN_WIDTH / 2))
return setting_box_frame_wrapper
def _createSettingBoxFrame(self, parent_widget, label_text, desc_text):
def _createSettingBoxFrame(self, parent_widget, for_var_label_text, for_var_desc_text):
setting_box_frame = CTkFrame(parent_widget, corner_radius=0, fg_color=self.ctm.SB__BG_COLOR, width=0, height=0)
setting_box_frame_wrapper = self._createSettingBoxFrameWrapper(setting_box_frame)
self._setSettingBoxLabels(setting_box_frame_wrapper, label_text, desc_text)
self._setSettingBoxLabels(setting_box_frame_wrapper, for_var_label_text, for_var_desc_text)
# "pady=(0,1)" is for bottom padding. It can be removed(override) when you do like "self.attr_name.grid(row=row, pady=0)"
setting_box_frame.grid(column=0, padx=0, pady=(0,1), sticky="ew")
return (setting_box_frame, setting_box_frame_wrapper)
def _setSettingBoxLabels(self, setting_box_frame, label_text, desc_text=False):
def _setSettingBoxLabels(self, setting_box_frame, for_var_label_text, for_var_desc_text=None):
setting_box_labels_frame = CTkFrame(setting_box_frame, corner_radius=0, fg_color=self.ctm.SB__BG_COLOR, width=0, height=0)
setting_box_label = CTkLabel(
setting_box_labels_frame,
text=label_text,
textvariable=for_var_label_text,
anchor="w",
# height=0,
font=CTkFont(family=self.FONT_FAMILY, size=self.uism.SB__LABEL_FONT_SIZE, weight="normal"),
@@ -46,12 +44,12 @@ class _SettingBoxGenerator():
)
setting_box_label.grid(row=0, column=0, padx=0, pady=0, sticky="ew")
if desc_text == False or self.IS_CONFIG_WINDOW_COMPACT_MODE is True:
if for_var_desc_text == None or self.IS_CONFIG_WINDOW_COMPACT_MODE is True:
pass
else:
self.setting_box_desc = CTkLabel(
setting_box_labels_frame,
text=desc_text,
textvariable=for_var_desc_text,
anchor="w",
justify="left",
# height=0,
@@ -65,8 +63,8 @@ class _SettingBoxGenerator():
def createSettingBoxDropdownMenu(self, parent_widget, label_text, desc_text, optionmenu_attr_name, dropdown_menu_attr_name, dropdown_menu_values, command, variable):
(setting_box_frame, setting_box_frame_wrapper) = self._createSettingBoxFrame(parent_widget, label_text, desc_text)
def createSettingBoxDropdownMenu(self, parent_widget, for_var_label_text, for_var_desc_text, optionmenu_attr_name, command, variable=None, dropdown_menu_attr_name=None, dropdown_menu_values=None):
(setting_box_frame, setting_box_frame_wrapper) = self._createSettingBoxFrame(parent_widget, for_var_label_text, for_var_desc_text)
setting_box_dropdown_menu_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color=self.ctm.SB__BG_COLOR)
setting_box_dropdown_menu_frame.grid(row=0, column=1, padx=0, sticky="e")
@@ -74,7 +72,6 @@ class _SettingBoxGenerator():
self.createOption_DropdownMenu(
setting_box_dropdown_menu_frame=setting_box_dropdown_menu_frame,
optionmenu_attr_name=optionmenu_attr_name,
dropdown_menu_attr_name=dropdown_menu_attr_name,
dropdown_menu_values=dropdown_menu_values,
command=command,
variable=variable,
@@ -85,8 +82,8 @@ class _SettingBoxGenerator():
def createSettingBoxSwitch(self, parent_widget, label_text, desc_text, switch_attr_name, is_checked, command):
(setting_box_frame, setting_box_frame_wrapper) = self._createSettingBoxFrame(parent_widget, label_text, desc_text)
def createSettingBoxSwitch(self, parent_widget, for_var_label_text, for_var_desc_text, switch_attr_name, is_checked, command):
(setting_box_frame, setting_box_frame_wrapper) = self._createSettingBoxFrame(parent_widget, for_var_label_text, for_var_desc_text)
setting_box_switch_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color=self.ctm.SB__BG_COLOR)
setting_box_switch_frame.grid(row=0, column=1, padx=0, sticky="e")
@@ -117,8 +114,8 @@ class _SettingBoxGenerator():
def createSettingBoxCheckbox(self, parent_widget, label_text, desc_text, checkbox_attr_name, is_checked, command):
(setting_box_frame, setting_box_frame_wrapper) = self._createSettingBoxFrame(parent_widget, label_text, desc_text)
def createSettingBoxCheckbox(self, parent_widget, for_var_label_text, for_var_desc_text, checkbox_attr_name, variable, command):
(setting_box_frame, setting_box_frame_wrapper) = self._createSettingBoxFrame(parent_widget, for_var_label_text, for_var_desc_text)
setting_box_checkbox_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color=self.ctm.SB__BG_COLOR)
setting_box_checkbox_frame.grid(row=0, column=1, padx=0, sticky="e")
@@ -131,6 +128,7 @@ class _SettingBoxGenerator():
checkbox_height=self.uism.SB__CHECKBOX_SIZE,
onvalue=True,
offvalue=False,
variable=variable,
command=command,
corner_radius=self.uism.SB__CHECKBOX_CORNER_RADIUS,
border_width=self.uism.SB__CHECKBOX_BORDER_WIDTH,
@@ -144,7 +142,7 @@ class _SettingBoxGenerator():
)
setattr(self.config_window, checkbox_attr_name, checkbox_widget)
checkbox_widget.select() if is_checked else checkbox_widget.deselect()
# checkbox_widget.select() if is_checked else checkbox_widget.deselect()
checkbox_widget.grid(row=0, column=0)
@@ -155,8 +153,8 @@ class _SettingBoxGenerator():
def createSettingBoxSlider(self, parent_widget, label_text, desc_text, slider_attr_name, slider_range, command, variable, slider_number_of_steps: Union[int, None] = None):
(setting_box_frame, setting_box_frame_wrapper) = self._createSettingBoxFrame(parent_widget, label_text, desc_text)
def createSettingBoxSlider(self, parent_widget, for_var_label_text, for_var_desc_text, slider_attr_name, slider_range, command, variable, slider_number_of_steps: Union[int, None] = None):
(setting_box_frame, setting_box_frame_wrapper) = self._createSettingBoxFrame(parent_widget, for_var_label_text, for_var_desc_text)
setting_box_slider_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color=self.ctm.SB__BG_COLOR)
setting_box_slider_frame.grid(row=0, column=1, padx=0, sticky="e")
@@ -181,18 +179,20 @@ class _SettingBoxGenerator():
def createSettingBoxProgressbarXSlider(self,
parent_widget, label_text, desc_text, command,
parent_widget, for_var_label_text, for_var_desc_text, command,
entry_attr_name,
slider_attr_name, slider_range, slider_number_of_steps,
slider_attr_name, slider_range,
progressbar_attr_name,
passive_button_attr_name, passive_button_command,
active_button_attr_name, active_button_command,
button_image_filename,
variable,
slider_number_of_steps: Union[int, None] = None,
):
(setting_box_frame, setting_box_frame_wrapper) = self._createSettingBoxFrame(parent_widget, label_text, desc_text)
(setting_box_frame, setting_box_frame_wrapper) = self._createSettingBoxFrame(parent_widget, for_var_label_text, for_var_desc_text)
setting_box_progressbar_x_slider_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color=self.ctm.SB__BG_COLOR)
setting_box_progressbar_x_slider_frame.grid(row=0, column=1, padx=0, sticky="e")
@@ -288,8 +288,8 @@ class _SettingBoxGenerator():
def createSettingBoxEntry(self, parent_widget, label_text, desc_text, entry_attr_name, entry_width, entry_bind__Any_KeyRelease, entry_textvariable):
(setting_box_frame, setting_box_frame_wrapper) = self._createSettingBoxFrame(parent_widget, label_text, desc_text)
def createSettingBoxEntry(self, parent_widget, for_var_label_text, for_var_desc_text, entry_attr_name, entry_width, entry_bind__Any_KeyRelease, entry_textvariable):
(setting_box_frame, setting_box_frame_wrapper) = self._createSettingBoxFrame(parent_widget, for_var_label_text, for_var_desc_text)
setting_box_entry_frame = CTkFrame(setting_box_frame_wrapper, corner_radius=0, width=0, height=0, fg_color=self.ctm.SB__BG_COLOR)
setting_box_entry_frame.grid(row=0, column=1, padx=0, sticky="e")
@@ -414,50 +414,54 @@ class _SettingBoxGenerator():
def createOption_DropdownMenu(self, setting_box_dropdown_menu_frame, optionmenu_attr_name, dropdown_menu_attr_name, dropdown_menu_values, command, variable):
def createOption_DropdownMenu(self, setting_box_dropdown_menu_frame, optionmenu_attr_name, command, variable, dropdown_menu_values):
# set the value to the option menu's variable automatically
# def adjustedCommand(selected_value):
# option_menu_widget.set(selected_value)
# command(selected_value)
option_menu_widget = CTkOptionMenu(
setting_box_dropdown_menu_frame,
height=self.uism.SB__OPTIONMENU_HEIGHT,
width=self.uism.SB__OPTIONMENU_WIDTH,
values=dropdown_menu_values,
button_color=self.ctm.SB__OPTIONMENU_BG_COLOR,
button_hover_color=self.ctm.SB__OPTIONMENU_HOVERED_BG_COLOR,
fg_color=self.ctm.SB__OPTIONMENU_BG_COLOR,
font=CTkFont(family=self.FONT_FAMILY, size=self.uism.SB__OPTION_MENU_FONT_SIZE, weight="normal"),
variable=variable,
command=command,
anchor="w",
)
option_menu_widget.grid(row=0, column=0, sticky="e")
setattr(self.config_window, optionmenu_attr_name, option_menu_widget)
# set the value to the option menu's variable automatically
def adjustedCommand(selected_value):
option_menu_widget.set(selected_value)
command(selected_value)
# option_menu_widget.configure(command=adjustedCommand)
dropdown_menu_widget = CTkScrollableDropdown(
option_menu_widget,
values=dropdown_menu_values,
justify="left",
width=self.uism.SB__DROPDOWN_MENU_WIDTH,
min_show_button_num=6,
button_pady=0,
frame_corner_radius=self.uism.SB__DROPDOWN_MENU_FRAME_CORNER_RADIUS,
max_button_height=self.uism.SB__DROPDOWN_MENU_MAX_BUTTON_HEIGHT,
max_height=self.uism.SB__DROPDOWN_MENU_FRAME_MAX_HEIGHT,
font=CTkFont(family=self.FONT_FAMILY, size=self.uism.SB__OPTION_MENU_FONT_SIZE, weight="normal"),
command=adjustedCommand,
)
# dropdown_menu_widget = CTkScrollableDropdown(
# option_menu_widget,
# justify="left",
# width=self.uism.SB__DROPDOWN_MENU_WIDTH,
# min_show_button_num=6,
# button_pady=0,
# frame_corner_radius=self.uism.SB__DROPDOWN_MENU_FRAME_CORNER_RADIUS,
# max_button_height=self.uism.SB__DROPDOWN_MENU_MAX_BUTTON_HEIGHT,
# max_height=self.uism.SB__DROPDOWN_MENU_FRAME_MAX_HEIGHT,
# font=CTkFont(family=self.FONT_FAMILY, size=self.uism.SB__OPTION_MENU_FONT_SIZE, weight="normal"),
# command=adjustedCommand,
# )
# dropdown_menu_widget.bind(
# "<Leave>",
# lambda e: dropdown_menu_widget._withdraw() if not str(e.widget).startswith(str(dropdown_menu_widget.frame._parent_frame)) else None,
# )
dropdown_menu_widget.bind(
"<Enter>",
lambda e: print(e),
)
# dropdown_menu_widget.bind(
# "<Enter>",
# lambda e: print(e),
# )
setattr(self.config_window, dropdown_menu_attr_name, dropdown_menu_widget)
# setattr(self.config_window, dropdown_menu_attr_name, dropdown_menu_widget)
return option_menu_widget

View File

@@ -1,11 +1,7 @@
from customtkinter import StringVar, IntVar
from utils import callFunctionIfCallable
from .._SettingBoxGenerator import _SettingBoxGenerator
from config import config
def createSettingBox_AdvancedSettings(setting_box_wrapper, config_window, settings):
sbg = _SettingBoxGenerator(config_window, settings)
createSettingBoxEntry = sbg.createSettingBoxEntry
@@ -20,12 +16,12 @@ def createSettingBox_AdvancedSettings(setting_box_wrapper, config_window, settin
row=0
config_window.sb__ip_address = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="OSC IP Address",
desc_text="(Default: 127.0.0.1)",
for_var_label_text=config_window.view_variable.VAR_LABEL_OSC_IP_ADDRESS,
for_var_desc_text=config_window.view_variable.VAR_DESC_OSC_IP_ADDRESS,
entry_attr_name="sb__entry_ip_address",
entry_width=settings.uism.SB__ENTRY_WIDTH_150,
entry_bind__Any_KeyRelease=lambda value: entry_ip_address_callback(value),
entry_textvariable=StringVar(value=config.OSC_IP_ADDRESS),
entry_textvariable=config_window.view_variable.VAR_OSC_IP_ADDRESS,
)
config_window.sb__ip_address.grid(row=row)
row+=1
@@ -33,12 +29,12 @@ def createSettingBox_AdvancedSettings(setting_box_wrapper, config_window, settin
config_window.sb__port = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="OSC Port",
desc_text="(Default: 9000)",
for_var_label_text=config_window.view_variable.VAR_LABEL_OSC_PORT,
for_var_desc_text=config_window.view_variable.VAR_DESC_OSC_PORT,
entry_attr_name="sb__entry_port",
entry_width=settings.uism.SB__ENTRY_WIDTH_150,
entry_bind__Any_KeyRelease=lambda value: entry_port_callback(value),
entry_textvariable=IntVar(value=config.OSC_PORT),
entry_textvariable=config_window.view_variable.VAR_OSC_PORT,
)
config_window.sb__port.grid(row=row)
row+=1
row+=1

View File

@@ -1,12 +1,7 @@
from customtkinter import StringVar, IntVar
from tkinter import font as tk_font
from languages import selectable_languages
from utils import get_key_by_value, callFunctionIfCallable
from utils import callFunctionIfCallable
from .._SettingBoxGenerator import _SettingBoxGenerator
from config import config
def createSettingBox_Appearance(setting_box_wrapper, config_window, settings):
sbg = _SettingBoxGenerator(config_window, settings)
createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu
@@ -24,22 +19,21 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings):
callFunctionIfCallable(config_window.CALLBACK_SET_UI_SCALING, value)
def optionmenu_font_family_callback(value):
callFunctionIfCallable(config_window.CALLBACK_SET_FONT_FAMILY, value)
callFunctionIfCallable(config_window.view_variable.CALLBACK_SET_FONT_FAMILY, value)
def optionmenu_ui_language_callback(value):
value = get_key_by_value(selectable_languages, value)
callFunctionIfCallable(config_window.CALLBACK_SET_UI_LANGUAGE, value)
row=0
config_window.sb__transparency = createSettingBoxSlider(
parent_widget=setting_box_wrapper,
label_text="Transparency",
desc_text="Change the window's transparency. 50% to 100%. (Default: 100%)",
for_var_label_text=config_window.view_variable.VAR_LABEL_TRANSPARENCY,
for_var_desc_text=config_window.view_variable.VAR_DESC_TRANSPARENCY,
slider_attr_name="sb__transparency_slider",
slider_range=(50, 100),
slider_range=config_window.view_variable.SLIDER_RANGE_TRANSPARENCY,
command=lambda value: slider_transparency_callback(value),
variable=IntVar(value=config.TRANSPARENCY),
variable=config_window.view_variable.VAR_TRANSPARENCY,
)
config_window.sb__transparency.grid(row=row)
row+=1
@@ -47,58 +41,55 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings):
config_window.sb__appearance_theme = createSettingBoxDropdownMenu(
parent_widget=setting_box_wrapper,
label_text="Theme",
desc_text="Change the color theme from \"Light\" and \"Dark\". If you select \"System\", It will adjust based on your Windows theme. (Default: System)",
for_var_label_text=config_window.view_variable.VAR_LABEL_APPEARANCE_THEME,
for_var_desc_text=config_window.view_variable.VAR_DESC_APPEARANCE_THEME,
optionmenu_attr_name="sb__optionmenu_appearance_theme",
dropdown_menu_attr_name="sb__dropdown_appearance_theme",
dropdown_menu_values=["Light", "Dark", "System"],
dropdown_menu_values=config_window.view_variable.LIST_APPEARANCE_THEME,
command=lambda value: optionmenu_appearance_theme_callback(value),
variable=StringVar(value=config.APPEARANCE_THEME)
variable=config_window.view_variable.VAR_APPEARANCE_THEME,
)
config_window.sb__appearance_theme.grid(row=row)
row+=1
config_window.sb__ui_scaling = createSettingBoxDropdownMenu(
parent_widget=setting_box_wrapper,
label_text="UI Size",
desc_text="(Default: 100%)",
for_var_label_text=config_window.view_variable.VAR_LABEL_UI_SCALING,
for_var_desc_text=config_window.view_variable.VAR_DESC_UI_SCALING,
optionmenu_attr_name="sb__optionmenu_ui_scaling",
dropdown_menu_attr_name="sb__dropdown_ui_scaling",
dropdown_menu_values=["80%", "90%", "100%", "110%", "120%"],
dropdown_menu_values=config_window.view_variable.LIST_UI_SCALING,
command=lambda value: optionmenu_ui_scaling_callback(value),
variable=StringVar(value=config.UI_SCALING)
variable=config_window.view_variable.VAR_UI_SCALING,
)
config_window.sb__ui_scaling.grid(row=row)
row+=1
# font_families = list(tk_font.families())
config_window.sb__font_family = createSettingBoxDropdownMenu(
parent_widget=setting_box_wrapper,
label_text="Font Family",
desc_text="(Default: Yu Gothic UI)",
for_var_label_text=config_window.view_variable.VAR_LABEL_FONT_FAMILY,
for_var_desc_text=config_window.view_variable.VAR_DESC_FONT_FAMILY,
optionmenu_attr_name="sb__optionmenu_font_family",
dropdown_menu_attr_name="sb__dropdown_font_family",
dropdown_menu_values=["Font A", "Font B"],
# dropdown_menu_values=font_families,
dropdown_menu_values=config_window.view_variable.LIST_FONT_FAMILY,
command=lambda value: optionmenu_font_family_callback(value),
variable=StringVar(value=config.FONT_FAMILY)
variable=config_window.view_variable.VAR_FONT_FAMILY,
)
config_window.sb__font_family.grid(row=row)
row+=1
selectable_languages_values = list(selectable_languages.values())
config_window.sb__ui_language = createSettingBoxDropdownMenu(
parent_widget=setting_box_wrapper,
label_text="UI Language",
desc_text="(Default: English)",
for_var_label_text=config_window.view_variable.VAR_LABEL_UI_LANGUAGE,
for_var_desc_text=config_window.view_variable.VAR_DESC_UI_LANGUAGE,
optionmenu_attr_name="sb__optionmenu_ui_language",
dropdown_menu_attr_name="sb__dropdown_ui_language",
dropdown_menu_values=selectable_languages_values,
dropdown_menu_values=config_window.view_variable.LIST_UI_LANGUAGE,
command=lambda value: optionmenu_ui_language_callback(value),
variable=StringVar(value=selectable_languages[config.UI_LANGUAGE]),
variable=config_window.view_variable.VAR_UI_LANGUAGE,
)
config_window.sb__ui_language.grid(row=row)
row+=1

View File

@@ -1,11 +1,7 @@
from customtkinter import StringVar, IntVar
from utils import callFunctionIfCallable
from .._SettingBoxGenerator import _SettingBoxGenerator
from config import config
def createSettingBox_Others(setting_box_wrapper, config_window, settings):
sbg = _SettingBoxGenerator(config_window, settings)
createSettingBoxCheckbox = sbg.createSettingBoxCheckbox
@@ -26,11 +22,11 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings):
row=0
config_window.sb__auto_clear_message_box = createSettingBoxCheckbox(
parent_widget=setting_box_wrapper,
label_text="Auto Clear The Message Box",
desc_text="Clear the message box after sending your message.",
for_var_label_text=config_window.view_variable.VAR_LABEL_ENABLE_AUTO_CLEAR_MESSAGE_BOX,
for_var_desc_text=config_window.view_variable.VAR_DESC_ENABLE_AUTO_CLEAR_MESSAGE_BOX,
checkbox_attr_name="sb__checkbox_auto_clear_message_box",
command=lambda: checkbox_auto_clear_message_box_callback(config_window.sb__checkbox_auto_clear_message_box),
is_checked=False
variable=config_window.view_variable.VAR_ENABLE_AUTO_CLEAR_MESSAGE_BOX,
)
config_window.sb__auto_clear_message_box.grid(row=row)
row+=1
@@ -38,11 +34,11 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings):
config_window.sb__notice_xsoverlay = createSettingBoxCheckbox(
parent_widget=setting_box_wrapper,
label_text="Notification XSOverlay (VR Only)",
desc_text="Notify received messages by using XSOverlay's notification feature.",
for_var_label_text=config_window.view_variable.VAR_LABEL_ENABLE_NOTICE_XSOVERLAY,
for_var_desc_text=config_window.view_variable.VAR_DESC_ENABLE_NOTICE_XSOVERLAY,
checkbox_attr_name="sb__checkbox_notice_xsoverlay",
command=lambda: checkbox_notice_xsoverlay_callback(config_window.sb__checkbox_notice_xsoverlay),
is_checked=False
variable=config_window.view_variable.VAR_ENABLE_NOTICE_XSOVERLAY,
)
config_window.sb__notice_xsoverlay.grid(row=row)
row+=1
@@ -50,12 +46,12 @@ def createSettingBox_Others(setting_box_wrapper, config_window, settings):
config_window.sb__message_format = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="Message Format",
desc_text="You can change the decoration of the message you want to send. (Default: \"[message]([translation])\" )",
for_var_label_text=config_window.view_variable.VAR_LABEL_MESSAGE_FORMAT,
for_var_desc_text=config_window.view_variable.VAR_DESC_MESSAGE_FORMAT,
entry_attr_name="sb__entry_message_format",
entry_width=settings.uism.SB__ENTRY_WIDTH_250,
entry_bind__Any_KeyRelease=lambda value: entry_message_format_callback(value),
entry_textvariable=StringVar(value=config.MESSAGE_FORMAT),
entry_textvariable=config_window.view_variable.VAR_MESSAGE_FORMAT,
)
config_window.sb__message_format.grid(row=row)
row+=1

View File

@@ -1,13 +1,9 @@
from time import sleep
from customtkinter import StringVar, IntVar
from utils import callFunctionIfCallable
from .._SettingBoxGenerator import _SettingBoxGenerator
from config import config
def createSettingBox_Mic(setting_box_wrapper, config_window, settings):
sbg = _SettingBoxGenerator(config_window, settings)
createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu
@@ -69,28 +65,25 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings):
# Mic Host と Mic Device は一つの項目として引っ付ける予定
config_window.sb__mic_host = createSettingBoxDropdownMenu(
parent_widget=setting_box_wrapper,
label_text="Mic Host",
desc_text="Select the mic host. (Default: ?)",
for_var_label_text=config_window.view_variable.VAR_LABEL_MIC_HOST,
for_var_desc_text=config_window.view_variable.VAR_DESC_MIC_HOST,
optionmenu_attr_name="sb__optionmenu_mic_host",
dropdown_menu_attr_name="sb__dropdown_mic_host",
# dropdown_menu_values=model.getListInputHost(),
dropdown_menu_values=["host1", "host2", "host3"],
dropdown_menu_values=config_window.view_variable.LIST_MIC_HOST,
command=lambda value: optionmenu_mic_host_callback(value),
variable=StringVar(value=config.CHOICE_MIC_HOST)
variable=config_window.view_variable.VAR_MIC_HOST,
)
config_window.sb__mic_host.grid(row=row)
row+=1
config_window.sb__mic_device = createSettingBoxDropdownMenu(
parent_widget=setting_box_wrapper,
label_text="Mic Device",
desc_text="Select the mic devise. (Default: ?)",
for_var_label_text=config_window.view_variable.VAR_LABEL_MIC_DEVICE,
for_var_desc_text=config_window.view_variable.VAR_DESC_MIC_DEVICE,
optionmenu_attr_name="sb__optionmenu_mic_device",
dropdown_menu_attr_name="sb__dropdown_mic_device",
# dropdown_menu_values=model.getListInputDevice(),
dropdown_menu_values=["device1", "device2", "device3"],
dropdown_menu_values=config_window.view_variable.LIST_MIC_DEVICE,
command=lambda value: optionmenu_input_mic_device_callback(value),
variable=StringVar(value=config.CHOICE_MIC_DEVICE)
variable=config_window.view_variable.VAR_MIC_DEVICE,
)
config_window.sb__mic_device.grid(row=row)
row+=1
@@ -98,16 +91,15 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings):
config_window.sb__mic_energy_threshold = createSettingBoxProgressbarXSlider(
parent_widget=setting_box_wrapper,
label_text="Mic Energy Threshold",
desc_text="Slider to modify the threshold for activating voice input.\nPress the microphone button to start input and speak something, so you can adjust it while monitoring the actual volume. 0 to 2000 (Default: 300)",
for_var_label_text=config_window.view_variable.VAR_LABEL_MIC_ENERGY_THRESHOLD,
for_var_desc_text=config_window.view_variable.VAR_DESC_MIC_ENERGY_THRESHOLD,
command=slider_input_mic_energy_threshold_callback,
variable=IntVar(value=config.INPUT_MIC_ENERGY_THRESHOLD),
variable=config_window.view_variable.VAR_MIC_ENERGY_THRESHOLD,
entry_attr_name="sb__progressbar_x_slider__entry_mic_energy_threshold",
slider_attr_name="progressbar_x_slider__slider_mic_energy_threshold",
slider_range=(0, config.MAX_MIC_ENERGY_THRESHOLD),
slider_number_of_steps=config.MAX_MIC_ENERGY_THRESHOLD,
slider_range=config_window.view_variable.SLIDER_RANGE_MIC_ENERGY_THRESHOLD,
progressbar_attr_name="sb__progressbar_x_slider__progressbar_mic_energy_threshold",
@@ -133,11 +125,11 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings):
# Mic Dynamic Energy Thresholdも上に引っ付ける予定
config_window.sb__mic_dynamic_energy_threshold = createSettingBoxCheckbox(
parent_widget=setting_box_wrapper,
label_text="Mic Dynamic Energy Threshold",
desc_text="When this feature is selected, it will automatically adjust in a way that works well, based on the set Mic Energy Threshold.",
for_var_label_text=config_window.view_variable.VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD,
for_var_desc_text=config_window.view_variable.VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD,
checkbox_attr_name="sb__checkbox_mic_dynamic_energy_threshold",
command=lambda: checkbox_input_mic_dynamic_energy_threshold_callback(config_window.sb__checkbox_mic_dynamic_energy_threshold),
is_checked=False
variable=config_window.view_variable.VAR_MIC_DYNAMIC_ENERGY_THRESHOLD
)
config_window.sb__mic_dynamic_energy_threshold.grid(row=row)
row+=1
@@ -146,55 +138,50 @@ def createSettingBox_Mic(setting_box_wrapper, config_window, settings):
# 以下3つも一つの項目にまとめるかもしれない
config_window.sb__mic_record_timeout = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="Mic Record Timeout",
desc_text="(Default: 3)",
for_var_label_text=config_window.view_variable.VAR_LABEL_MIC_RECORD_TIMEOUT,
for_var_desc_text=config_window.view_variable.VAR_DESC_MIC_RECORD_TIMEOUT,
entry_attr_name="sb__entry_mic_record_timeout",
entry_width=settings.uism.SB__ENTRY_WIDTH_100,
entry_bind__Any_KeyRelease=lambda value: entry_input_mic_record_timeout_callback(value),
entry_textvariable=IntVar(value=config.INPUT_MIC_RECORD_TIMEOUT),
entry_textvariable=config_window.view_variable.VAR_MIC_RECORD_TIMEOUT,
)
config_window.sb__mic_record_timeout.grid(row=row)
row+=1
config_window.sb__mic_phrase_timeout = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="Mic Phrase Timeout",
desc_text="It will stop recording and send the recordings when the set second(s) is reached. (Default: 3)",
for_var_label_text=config_window.view_variable.VAR_LABEL_MIC_PHRASE_TIMEOUT,
for_var_desc_text=config_window.view_variable.VAR_DESC_MIC_PHRASE_TIMEOUT,
entry_attr_name="sb__entry_mic_phrase_timeout",
entry_width=settings.uism.SB__ENTRY_WIDTH_100,
entry_bind__Any_KeyRelease=lambda value: entry_input_mic_phrase_timeout_callback(value),
entry_textvariable=IntVar(value=config.INPUT_MIC_PHRASE_TIMEOUT),
entry_textvariable=config_window.view_variable.VAR_MIC_PHRASE_TIMEOUT,
)
config_window.sb__mic_phrase_timeout.grid(row=row)
row+=1
config_window.sb__mic_max_phrases = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="Mic Max Phrases",
desc_text="It will stop recording and send the recordings when the set count of phrase(s) is reached. (Default: 10)",
for_var_label_text=config_window.view_variable.VAR_LABEL_MIC_MAX_PHRASES,
for_var_desc_text=config_window.view_variable.VAR_DESC_MIC_MAX_PHRASES,
entry_attr_name="sb__entry_mic_max_phrases",
entry_width=settings.uism.SB__ENTRY_WIDTH_100,
entry_bind__Any_KeyRelease=lambda value: entry_input_mic_max_phrases_callback(value),
entry_textvariable=IntVar(value=config.INPUT_MIC_MAX_PHRASES),
entry_textvariable=config_window.view_variable.VAR_MIC_MAX_PHRASES,
)
config_window.sb__mic_max_phrases.grid(row=row)
row+=1
# __________
# # __________
if len(config.INPUT_MIC_WORD_FILTER) > 0:
entry_textvariable=StringVar(value=",".join(config.INPUT_MIC_WORD_FILTER))
else:
entry_textvariable=None
config_window.sb__mic_word_filter = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="Mic Word Filter",
desc_text="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",
for_var_label_text=config_window.view_variable.VAR_LABEL_MIC_WORD_FILTER,
for_var_desc_text=config_window.view_variable.VAR_DESC_MIC_WORD_FILTER,
entry_attr_name="sb__entry_mic_word_filter",
entry_width=settings.uism.SB__ENTRY_WIDTH_100,
entry_width=settings.uism.SB__ENTRY_WIDTH_300,
entry_bind__Any_KeyRelease=lambda value: entry_input_mic_word_filters_callback(value),
entry_textvariable=entry_textvariable,
entry_textvariable=config_window.view_variable.VAR_MIC_WORD_FILTER,
)
config_window.sb__mic_word_filter.grid(row=row)
row+=1

View File

@@ -1,13 +1,9 @@
from time import sleep
from customtkinter import StringVar, IntVar
from utils import callFunctionIfCallable
from .._SettingBoxGenerator import _SettingBoxGenerator
from config import config
def createSettingBox_Speaker(setting_box_wrapper, config_window, settings):
sbg = _SettingBoxGenerator(config_window, settings)
createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu
@@ -63,14 +59,13 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings):
row=0
config_window.sb__speaker_device = createSettingBoxDropdownMenu(
parent_widget=setting_box_wrapper,
label_text="Speaker Device",
desc_text="Select the speaker devise. (Default: ?)",
for_var_label_text=config_window.view_variable.VAR_LABEL_SPEAKER_DEVICE,
for_var_desc_text=config_window.view_variable.VAR_DESC_SPEAKER_DEVICE,
optionmenu_attr_name="sb__optionmenu_speaker_device",
dropdown_menu_attr_name="sb__dropdown_speaker_device",
# dropdown_menu_values=model.getListOutputDevice(),
dropdown_menu_values=["device1", "device2", "device3"],
dropdown_menu_values=config_window.view_variable.LIST_SPEAKER_DEVICE,
command=lambda value: optionmenu_input_speaker_device_callback(value),
variable=StringVar(value=config.CHOICE_SPEAKER_DEVICE)
variable=config_window.view_variable.VAR_SPEAKER_DEVICE,
)
config_window.sb__speaker_device.grid(row=row)
row+=1
@@ -78,16 +73,15 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings):
config_window.sb__speaker_energy_threshold = createSettingBoxProgressbarXSlider(
parent_widget=setting_box_wrapper,
label_text="Speaker Energy Threshold",
desc_text="Slider to modify the threshold for activating voice input.\nPress the headphones mark button to start input and speak something, so you can adjust it while monitoring the actual volume. 0 to 4000 (Default: 300)",
for_var_label_text=config_window.view_variable.VAR_LABEL_SPEAKER_ENERGY_THRESHOLD,
for_var_desc_text=config_window.view_variable.VAR_DESC_SPEAKER_ENERGY_THRESHOLD,
command=slider_input_speaker_energy_threshold_callback,
variable=IntVar(value=config.INPUT_SPEAKER_ENERGY_THRESHOLD),
variable=config_window.view_variable.VAR_SPEAKER_ENERGY_THRESHOLD,
entry_attr_name="sb__progressbar_x_slider__entry_speaker_energy_threshold",
slider_attr_name="progressbar_x_slider__slider_speaker_energy_threshold",
slider_range=(0, config.MAX_SPEAKER_ENERGY_THRESHOLD),
slider_number_of_steps=config.MAX_SPEAKER_ENERGY_THRESHOLD,
slider_range=config_window.view_variable.SLIDER_RANGE_SPEAKER_ENERGY_THRESHOLD,
progressbar_attr_name="sb__progressbar_x_slider__progressbar_speaker_energy_threshold",
@@ -113,11 +107,11 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings):
# Speaker Dynamic Energy Thresholdも上に引っ付ける予定
config_window.sb__speaker_dynamic_energy_threshold = createSettingBoxCheckbox(
parent_widget=setting_box_wrapper,
label_text="Speaker Dynamic Energy Threshold",
desc_text="When this feature is selected, it will automatically adjust in a way that works well, based on the set Speaker Energy Threshold.",
for_var_label_text=config_window.view_variable.VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
for_var_desc_text=config_window.view_variable.VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
checkbox_attr_name="sb__checkbox_speaker_dynamic_energy_threshold",
command=lambda: checkbox_input_speaker_dynamic_energy_threshold_callback(config_window.sb__checkbox_speaker_dynamic_energy_threshold),
is_checked=False
variable=config_window.view_variable.VAR_MIC_DYNAMIC_ENERGY_THRESHOLD,
)
config_window.sb__speaker_dynamic_energy_threshold.grid(row=row)
row+=1
@@ -126,36 +120,36 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings):
# 以下3つも一つの項目にまとめるかもしれない
config_window.sb__speaker_record_timeout = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="Speaker Record Timeout",
desc_text="(Default: 3)",
for_var_label_text=config_window.view_variable.VAR_LABEL_SPEAKER_RECORD_TIMEOUT,
for_var_desc_text=config_window.view_variable.VAR_DESC_SPEAKER_RECORD_TIMEOUT,
entry_attr_name="sb__entry_speaker_record_timeout",
entry_width=settings.uism.SB__ENTRY_WIDTH_100,
entry_bind__Any_KeyRelease=lambda value: entry_input_speaker_record_timeout_callback(value),
entry_textvariable=IntVar(value=config.INPUT_SPEAKER_RECORD_TIMEOUT),
entry_textvariable=config_window.view_variable.VAR_SPEAKER_RECORD_TIMEOUT,
)
config_window.sb__speaker_record_timeout.grid(row=row)
row+=1
config_window.sb__speaker_phrase_timeout = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="Speaker Phrase Timeout",
desc_text="It will stop recording and receive the recordings when the set second(s) is reached. (Default: 3)",
for_var_label_text=config_window.view_variable.VAR_LABEL_SPEAKER_PHRASE_TIMEOUT,
for_var_desc_text=config_window.view_variable.VAR_DESC_SPEAKER_PHRASE_TIMEOUT,
entry_attr_name="sb__entry_speaker_phrase_timeout",
entry_width=settings.uism.SB__ENTRY_WIDTH_100,
entry_bind__Any_KeyRelease=lambda value: entry_input_speaker_phrase_timeout_callback(value),
entry_textvariable=IntVar(value=config.INPUT_SPEAKER_PHRASE_TIMEOUT),
entry_textvariable=config_window.view_variable.VAR_SPEAKER_PHRASE_TIMEOUT,
)
config_window.sb__speaker_phrase_timeout.grid(row=row)
row+=1
config_window.sb__speaker_max_phrases = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="Speaker Max Phrases",
desc_text="It will stop recording and receive the recordings when the set count of phrase(s) is reached. (Default: 10)",
for_var_label_text=config_window.view_variable.VAR_LABEL_SPEAKER_MAX_PHRASES,
for_var_desc_text=config_window.view_variable.VAR_DESC_SPEAKER_MAX_PHRASES,
entry_attr_name="sb__entry_speaker_max_phrases",
entry_width=settings.uism.SB__ENTRY_WIDTH_100,
entry_bind__Any_KeyRelease=lambda value: entry_input_speaker_max_phrases_callback(value),
entry_textvariable=IntVar(value=config.INPUT_SPEAKER_MAX_PHRASES),
entry_textvariable=config_window.view_variable.VAR_SPEAKER_MAX_PHRASES,
)
config_window.sb__speaker_max_phrases.grid(row=row)
row+=1

View File

@@ -1,11 +1,7 @@
from customtkinter import StringVar, IntVar
from utils import callFunctionIfCallable
from .._SettingBoxGenerator import _SettingBoxGenerator
from config import config
def createSettingBox_Translation(setting_box_wrapper, config_window, settings):
sbg = _SettingBoxGenerator(config_window, settings)
createSettingBoxEntry = sbg.createSettingBoxEntry
@@ -18,12 +14,12 @@ def createSettingBox_Translation(setting_box_wrapper, config_window, settings):
row=0
config_window.sb__deepl_authkey = createSettingBoxEntry(
parent_widget=setting_box_wrapper,
label_text="DeepL Auth Key",
desc_text="",
for_var_label_text=config_window.view_variable.VAR_LABEL_DEEPL_AUTH_KEY,
for_var_desc_text=config_window.view_variable.VAR_DESC_DEEPL_AUTH_KEY,
entry_attr_name="sb__deepl_authkey",
entry_width=settings.uism.SB__ENTRY_WIDTH_300,
entry_bind__Any_KeyRelease=lambda value: deepl_authkey_callback(value),
entry_textvariable=StringVar(value=config.AUTH_KEYS["DeepL(auth)"]),
entry_textvariable=config_window.view_variable.VAR_DEEPL_AUTH_KEY,
)
config_window.sb__deepl_authkey.grid(row=row)
row+=1

View File

@@ -8,14 +8,6 @@ from ..ui_utils import createButtonWithImage, getImagePath
def createMainWindowWidgets(vrct_gui, settings):
vrct_gui.protocol("WM_DELETE_WINDOW", vrct_gui.quitVRCT)
# self.IS_DEVELOPER_MODE = False
# self.IS_DEVELOPER_MODE = True
# self.YOUR_LANGUAGE = "Japanese\n(Japan)"
# self.TARGET_LANGUAGE = "English\n(United States)"
vrct_gui.iconbitmap(getImagePath("app.ico"))
vrct_gui.title("VRCT")
@@ -27,7 +19,6 @@ def createMainWindowWidgets(vrct_gui, settings):
vrct_gui.grid_columnconfigure(1, weight=1)
vrct_gui.configure(fg_color="#ff7f50")
# return
# Main Container

View File

@@ -2,48 +2,33 @@ from customtkinter import CTkOptionMenu, CTkFont, CTkFrame, CTkLabel, CTkSwitch,
from ...ui_utils import getImageFileFromUiUtils, openImageKeepAspectRatio, retag, getLatestHeight, bindEnterAndLeaveColor, bindButtonPressColor, bindEnterAndLeaveFunction, bindButtonReleaseFunction, bindButtonPressAndReleaseFunction, bindButtonFunctionAndColor, switchActiveTabAndPassiveTab, switchTabsColor
from time import sleep
from utils import callFunctionIfCallable
def createSidebar(settings, main_window):
from vrct_gui import vrct_gui
changeMainWindowWidgetsStatus = vrct_gui.changeMainWindowWidgetsStatus
def toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, mark):
mark.place(relx=0.85) if is_turned_on else mark.place(relx=-1)
def toggleTranslationFeature():
if callable(main_window.CALLBACK_TOGGLE_TRANSLATION) is True:
main_window.CALLBACK_TOGGLE_TRANSLATION()
is_turned_on = getattr(main_window, "translation_switch_box").get()
print(is_turned_on)
is_turned_on = main_window.translation_switch_box.get()
callFunctionIfCallable(main_window.CALLBACK_TOGGLE_TRANSLATION, is_turned_on)
toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.translation_selected_mark)
def toggleTranscriptionSendFeature():
if callable(main_window.CALLBACK_TOGGLE_TRANSCRIPTION_SEND) is True:
main_window.CALLBACK_TOGGLE_TRANSCRIPTION_SEND()
is_turned_on = getattr(main_window, "transcription_send_switch_box").get()
print(is_turned_on)
is_turned_on = main_window.transcription_send_switch_box.get()
callFunctionIfCallable(main_window.CALLBACK_TOGGLE_TRANSCRIPTION_SEND, is_turned_on)
toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.transcription_send_selected_mark)
def toggleTranscriptionReceiveFeature():
if callable(main_window.CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE) is True:
main_window.CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE()
is_turned_on = getattr(main_window, "transcription_receive_switch_box").get()
print(is_turned_on)
is_turned_on = main_window.transcription_receive_switch_box.get()
callFunctionIfCallable(main_window.CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE, is_turned_on)
toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.transcription_receive_selected_mark)
def toggleForegroundFeature():
if callable(main_window.CALLBACK_TOGGLE_FOREGROUND) is True:
main_window.CALLBACK_TOGGLE_FOREGROUND()
is_turned_on = getattr(main_window, "foreground_switch_box").get()
print(is_turned_on)
is_turned_on = main_window.foreground_switch_box.get()
callFunctionIfCallable(main_window.CALLBACK_TOGGLE_FOREGROUND, is_turned_on)
toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.foreground_selected_mark)
@@ -108,40 +93,27 @@ def createSidebar(settings, main_window):
switchActiveAndPassivePresetsTabsColor(target_active_widget)
switchActiveTabAndPassiveTab(target_active_widget, main_window.current_active_preset_tab, main_window.current_active_preset_tab.passive_function, settings.ctm.SQLS__PRESETS_TAB_BG_HOVERED_COLOR, settings.ctm.SQLS__PRESETS_TAB_BG_CLICKED_COLOR, settings.ctm.SQLS__PRESETS_TAB_BG_PASSIVE_COLOR)
main_window.sqls__optionmenu_your_language.configure(variable=StringVar(value=main_window.YOUR_LANGUAGE))
main_window.sqls__optionmenu_target_language.configure(variable=StringVar(value=main_window.TARGET_LANGUAGE))
main_window.sqls__optionmenu_your_language.set(main_window.view_variable.VAR_YOUR_LANGUAGE.get())
main_window.sqls__optionmenu_target_language.set(main_window.view_variable.VAR_TARGET_LANGUAGE.get())
main_window.current_active_preset_tab = target_active_widget
def switchToPreset1(e):
print("1")
if callable(main_window.CALLBACK_SELECTED_TAB_NO_1) is True:
main_window.CALLBACK_SELECTED_TAB_NO_1()
# main_window.YOUR_LANGUAGE = "Japanese\n(Japan)"
# main_window.TARGET_LANGUAGE = "English\n(United States)"
callFunctionIfCallable(main_window.CALLBACK_SELECTED_LANGUAGE_PRESET_TAB, "1")
target_active_widget = getattr(main_window, "sqls__presets_button_1")
switchPresetTabFunction(target_active_widget)
def switchToPreset2(e):
print("2")
if callable(main_window.CALLBACK_SELECTED_TAB_NO_2) is True:
main_window.CALLBACK_SELECTED_TAB_NO_2()
# main_window.YOUR_LANGUAGE = "English\n(United States)"
# main_window.TARGET_LANGUAGE = "Japanese\n(Japan)"
callFunctionIfCallable(main_window.CALLBACK_SELECTED_LANGUAGE_PRESET_TAB, "2")
target_active_widget = getattr(main_window, "sqls__presets_button_2")
switchPresetTabFunction(target_active_widget)
def switchToPreset3(e):
print("3")
if callable(main_window.CALLBACK_SELECTED_TAB_NO_3) is True:
main_window.CALLBACK_SELECTED_TAB_NO_3()
# main_window.YOUR_LANGUAGE = "Japanese\n(Japan)"
# main_window.TARGET_LANGUAGE = "Chinese, Cantonese\n(Traditional Hong Kong)"
callFunctionIfCallable(main_window.CALLBACK_SELECTED_LANGUAGE_PRESET_TAB, "3")
target_active_widget = getattr(main_window, "sqls__presets_button_3")
switchPresetTabFunction(target_active_widget)
@@ -527,7 +499,7 @@ def createSidebar(settings, main_window):
optionmenu_attr_name="sqls__optionmenu_your_language",
dropdown_menu_attr_name="sqls__dropdown_menu_your_language",
dropdown_menu_values=["1""2","pppp\npppp"],
variable=StringVar(value=main_window.YOUR_LANGUAGE)
variable=main_window.view_variable.VAR_YOUR_LANGUAGE
)
main_window.sqls__box_your_language.grid(row=2, column=0, padx=0, pady=(settings.uism.SQLS__BOX_TOP_PADY,0),sticky="ew")
@@ -577,7 +549,7 @@ def createSidebar(settings, main_window):
optionmenu_attr_name="sqls__optionmenu_target_language",
dropdown_menu_attr_name="sqls__dropdown_menu_target_language",
dropdown_menu_values=["1""2","pppp\npppp2"],
variable=StringVar(value=main_window.TARGET_LANGUAGE)
variable=main_window.view_variable.VAR_TARGET_LANGUAGE
)
main_window.sqls__box_target_language.grid(row=4, column=0, padx=0, pady=(0,0),sticky="ew")

View File

@@ -16,24 +16,13 @@ from .ui_utils import _setDefaultActiveTab
class VRCT_GUI(CTk):
def __init__(self):
super().__init__()
self.settings = SimpleNamespace()
self.YOUR_LANGUAGE = "Japanese\n(Japan)"
self.TARGET_LANGUAGE = "English\n(United States)"
self.CALLBACK_TOGGLE_TRANSLATION = None
self.CALLBACK_TOGGLE_TRANSCRIPTION_SEND = None
self.CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE = None
self.CALLBACK_TOGGLE_FOREGROUND = None
self.CALLBACK_SELECTED_TAB_NO_1 = None
self.CALLBACK_SELECTED_TAB_NO_2 = None
self.CALLBACK_SELECTED_TAB_NO_3 = None
def createGUI(self, settings):
def createGUI(self, settings, view_variable):
self.settings = settings
self.view_variable = view_variable
createMainWindowWidgets(vrct_gui=self, settings=self.settings.main)
self.config_window = ConfigWindow(vrct_gui=self, settings=self.settings.config_window)
self.config_window = ConfigWindow(vrct_gui=self, settings=self.settings.config_window, view_variable=self.view_variable)
# self.information_window = ToplevelWindowInformation(self)
def startMainLoop(self):