[Add] translation checkboxでconfig.ENABLE_TRANSLATIONがTrue/Flaseに変化するように実装

This commit is contained in:
misygauziya
2023-08-27 06:13:47 +09:00
parent d597032231
commit 0c81d65fe4
2 changed files with 25 additions and 5 deletions

28
main.py
View File

@@ -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()

View File

@@ -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):