From 0c81d65fe434eb3fb8b387add16d73a14808ffa1 Mon Sep 17 00:00:00 2001 From: misygauziya Date: Sun, 27 Aug 2023 06:13:47 +0900 Subject: [PATCH] =?UTF-8?q?[Add]=20translation=20checkbox=E3=81=A7config.E?= =?UTF-8?q?NABLE=5FTRANSLATION=E3=81=8CTrue/Flase=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E5=8C=96=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 28 ++++++++++++++++++++++++---- vrct_gui/vrct_gui.py | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 71e2c4ce..c4770f22 100644 --- a/main.py +++ b/main.py @@ -2,9 +2,29 @@ from vrct_gui import vrct_gui from config import config from model import model -class VRCT(): - def __init__(self): - pass +# func print textbox +def logTranslationStatusChange(): + textbox_all = getattr(vrct_gui, "textbox_all") + textbox_system = getattr(vrct_gui, "textbox_system") + if config.ENABLE_TRANSLATION: + vrct_gui.printToTextbox(textbox_all, "翻訳機能をONにしました", "", "INFO") + vrct_gui.printToTextbox(textbox_system, "翻訳機能をONにしました", "", "INFO") + else: + vrct_gui.printToTextbox(textbox_all, "翻訳機能をOFFにしました", "", "INFO") + vrct_gui.printToTextbox(textbox_system, "翻訳機能をOFFにしました", "", "INFO") + +# command func +def toggleTranslationFeature(): + config.ENABLE_TRANSLATION = getattr(vrct_gui, "translation_switch_box").get() + logTranslationStatusChange() + +# create GUI +vrct_gui.createGUI() + +# set commands +widget = getattr(vrct_gui, "translation_switch_box") +widget.configure(command=toggleTranslationFeature) + + if __name__ == "__main__": - vrct_gui.createUI() vrct_gui.startMainLoop() \ No newline at end of file diff --git a/vrct_gui/vrct_gui.py b/vrct_gui/vrct_gui.py index 07cede7d..6bcb7198 100644 --- a/vrct_gui/vrct_gui.py +++ b/vrct_gui/vrct_gui.py @@ -53,7 +53,7 @@ class VRCT_GUI(CTk): # self.information_window = ToplevelWindowInformation(self) - def createUI(self): + def createGUI(self): createMainWindowWidgets(vrct_gui=self, settings=self.settings.main) def startMainLoop(self):