From 0780c7d75fd7506955d66812115f9bbd8dfd5d60 Mon Sep 17 00:00:00 2001 From: misygauziya Date: Sun, 27 Aug 2023 05:09:55 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[Update]=20gui=E3=81=AE=E8=B5=B7=E5=8B=95?= =?UTF-8?q?=E9=96=A2=E6=95=B0=E3=82=92=E5=88=86=E5=89=B2/model,config?= =?UTF-8?q?=E3=82=92import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 6 ++++-- vrct_gui/vrct_gui.py | 10 +++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index ac80e5f5..71e2c4ce 100644 --- a/main.py +++ b/main.py @@ -1,8 +1,10 @@ from vrct_gui import vrct_gui +from config import config +from model import model class VRCT(): def __init__(self): pass if __name__ == "__main__": - # vrct_gui = VRCT_GUI() - vrct_gui.start() \ No newline at end of file + 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 795f1b94..07cede7d 100644 --- a/vrct_gui/vrct_gui.py +++ b/vrct_gui/vrct_gui.py @@ -53,14 +53,10 @@ class VRCT_GUI(CTk): # self.information_window = ToplevelWindowInformation(self) - - - def start(self): + def createUI(self): createMainWindowWidgets(vrct_gui=self, settings=self.settings.main) - # self.printToTextbox(self.textbox_all, "Translation started. You: Japanese (japan). Target: English (American english)", "", "INFO") - # self.printToTextbox(self.textbox_all, "テキスト送信テスト", "Test send text", "SEND") - # self.printToTextbox(self.textbox_all, "こんにちは、こんにちは。", "Hi hi hello.", "SEND") - # self.printToTextbox(self.textbox_all, "Hi~ how are you doing.", "やあ~、元気かい?", "RECEIVE") + + def startMainLoop(self): self.mainloop() From d59703223183206c8b68b3bdb90ad20fbb4b8284 Mon Sep 17 00:00:00 2001 From: misygauziya Date: Sun, 27 Aug 2023 05:13:02 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[bugfix]=20=E3=83=86=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vrct_gui/main_window/widgets/create_sidebar.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vrct_gui/main_window/widgets/create_sidebar.py b/vrct_gui/main_window/widgets/create_sidebar.py index 1b290954..f58ecb8f 100644 --- a/vrct_gui/main_window/widgets/create_sidebar.py +++ b/vrct_gui/main_window/widgets/create_sidebar.py @@ -21,7 +21,6 @@ def createSidebar(settings, main_window): is_turned_on = getattr(main_window, "translation_switch_box").get() print(is_turned_on) toggleSidebarFeatureSelectedMarkIfTurnedOn(is_turned_on, main_window.translation_selected_mark) - toggleTranslationFeatures = [toggleTranslationFeature] def toggleTranscriptionSendFeature(): is_turned_on = getattr(main_window, "transcription_send_switch_box").get() @@ -254,7 +253,7 @@ def createSidebar(settings, main_window): sidebar_features_settings = [ { "frame_attr_name": "translation_frame", - "command": lambda:[func() for func in toggleTranslationFeatures], + "command": toggleTranslationFeature, "switch_box_attr_name": "translation_switch_box", "toggle_switch_box_command": toggleTranslationSwitchBox, "label_attr_name": "label_translation", From 0c81d65fe434eb3fb8b387add16d73a14808ffa1 Mon Sep 17 00:00:00 2001 From: misygauziya Date: Sun, 27 Aug 2023 06:13:47 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[Add]=20translation=20checkbox=E3=81=A7conf?= =?UTF-8?q?ig.ENABLE=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):