Merge branch 'view' into UI_2.0

This commit is contained in:
Sakamoto Shiina
2023-09-17 15:07:00 +09:00
8 changed files with 24 additions and 11 deletions

View File

@@ -164,6 +164,7 @@ def setYourLanguageAndCountry(select):
config.SOURCE_COUNTRY = country
config.CHOICE_TRANSLATOR = model.findTranslationEngine(config.SOURCE_LANGUAGE, config.TARGET_LANGUAGE)
model.authenticationTranslator(callbackSetAuthKeys)
view.printToTextbox_selectedYourLanguages(select)
def setTargetLanguageAndCountry(select):
languages = config.SELECTED_TAB_TARGET_LANGUAGES
@@ -174,6 +175,7 @@ def setTargetLanguageAndCountry(select):
config.TARGET_COUNTRY = country
config.CHOICE_TRANSLATOR = model.findTranslationEngine(config.SOURCE_LANGUAGE, config.TARGET_LANGUAGE)
model.authenticationTranslator(callbackSetAuthKeys)
view.printToTextbox_selectedTargetLanguages(select)
def callbackSelectedLanguagePresetTab(selected_tab_no):
config.SELECTED_TAB_NO = selected_tab_no
@@ -190,6 +192,7 @@ def callbackSelectedLanguagePresetTab(selected_tab_no):
config.TARGET_COUNTRY = country
config.CHOICE_TRANSLATOR = model.findTranslationEngine(config.SOURCE_LANGUAGE, config.TARGET_LANGUAGE)
model.authenticationTranslator(callbackSetAuthKeys)
view.printToTextbox_changedLanguagePresetTab(config.SELECTED_TAB_NO)
def callbackSetAuthKeys(keys):
config.AUTH_KEYS = keys

20
view.py
View File

@@ -471,6 +471,26 @@ class View():
self._printToTextbox_Info(f"Detect WordFilter :{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}")
def printToTextbox_selectedTargetLanguages(self, selected_target_language):
target_language = selected_target_language.replace("\n", " ")
self._printToTextbox_Info(f"Target Language has changed : {target_language}")
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}")
@staticmethod
def _printToTextbox_Info(info_message):
vrct_gui.printToTextbox(

View File

@@ -62,8 +62,8 @@ class _CreateSelectableLanguagesWindow(CTkToplevel):
callback = self._view_variable.CALLBACK_SELECTED_TARGET_LANGUAGE
target_variable = self._view_variable.VAR_TARGET_LANGUAGE
callFunctionIfCallable(callback, value)
target_variable.set(value)
callFunctionIfCallable(callback, value)
self.vrct_gui.closeSelectableLanguagesWindow()

View File

@@ -3,7 +3,6 @@ from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkSwitch
def _createSettingBoxCompactModeButton(parent_widget, config_window, settings, view_variable):
def switchConfigWindowCompactMode():
print(config_window.setting_box_compact_mode_switch_box.get())
if config_window.setting_box_compact_mode_switch_box.get() is True:
if callable(view_variable.CALLBACK_ENABLE_CONFIG_WINDOW_COMPACT_MODE) is True:
view_variable.CALLBACK_ENABLE_CONFIG_WINDOW_COMPACT_MODE()

View File

@@ -32,19 +32,16 @@ def createSidebarLanguagesSettings(settings, main_window, view_variable):
def switchToPreset1(e):
print("1")
callFunctionIfCallable(view_variable.CALLBACK_SELECTED_LANGUAGE_PRESET_TAB, "1")
target_active_widget = getattr(main_window, "sls__presets_button_1")
switchPresetTabFunction(target_active_widget)
def switchToPreset2(e):
print("2")
callFunctionIfCallable(view_variable.CALLBACK_SELECTED_LANGUAGE_PRESET_TAB, "2")
target_active_widget = getattr(main_window, "sls__presets_button_2")
switchPresetTabFunction(target_active_widget)
def switchToPreset3(e):
print("3")
callFunctionIfCallable(view_variable.CALLBACK_SELECTED_LANGUAGE_PRESET_TAB, "3")
target_active_widget = getattr(main_window, "sls__presets_button_3")
switchPresetTabFunction(target_active_widget)

View File

@@ -11,25 +11,21 @@ def createTextbox(settings, main_window, view_variable):
main_window.current_active_textbox.grid()
def switchToTextboxAll(e):
print("switchToTextboxAll")
target_active_widget = getattr(main_window, "textbox_tab_all")
switchTextboxTabFunction(target_active_widget)
switchTextbox("textbox_all")
def switchToTextboxSent(e):
print("switchToTextboxSent")
target_active_widget = getattr(main_window, "textbox_tab_sent")
switchTextboxTabFunction(target_active_widget)
switchTextbox("textbox_sent")
def switchToTextboxReceived(e):
print("switchToTextboxReceived")
target_active_widget = getattr(main_window, "textbox_tab_received")
switchTextboxTabFunction(target_active_widget)
switchTextbox("textbox_received")
def switchToTextboxSystem(e):
print("switchToTextboxSystem")
target_active_widget = getattr(main_window, "textbox_tab_system")
switchTextboxTabFunction(target_active_widget)
switchTextbox("textbox_system")

View File

@@ -2,7 +2,6 @@ from types import SimpleNamespace
class ColorThemeManager():
def __init__(self, theme):
print(theme)
self.main = SimpleNamespace()
self.config_window = SimpleNamespace()
self.selectable_language_window = SimpleNamespace()

View File

@@ -3,7 +3,6 @@ from types import SimpleNamespace
class UiScalingManager():
def __init__(self, scaling_percentage):
scaling_float = int(scaling_percentage.replace("%", "")) / 100
print(scaling_float)
self.SCALING_FLOAT = max(scaling_float, 0.4)
self.main = SimpleNamespace()
self.config_window = SimpleNamespace()