diff --git a/vrct_gui/_printToTextbox.py b/vrct_gui/_printToTextbox.py index 9becc64d..41258793 100644 --- a/vrct_gui/_printToTextbox.py +++ b/vrct_gui/_printToTextbox.py @@ -1,7 +1,20 @@ from datetime import datetime from customtkinter import CTkFont -def _printToTextbox(settings, target_textbox, original_message=None, translated_message=None, tags=None): +def _printToTextbox(vrct_gui, settings, target_type, original_message=None, translated_message=None, tags=None): + match (target_type): + case "ALL": + target_textbox = vrct_gui.textbox_all + case "INFO": + target_textbox = vrct_gui.textbox_system + case "SEND": + target_textbox = vrct_gui.textbox_sent + case "RECEIVE": + target_textbox = vrct_gui.textbox_received + case (_): + raise ValueError(f"No matching case for target_type: {target_type}") + + now_raw_data = datetime.now() now = now_raw_data.strftime('%H:%M:%S') now_hm = now_raw_data.strftime('%H:%M') diff --git a/vrct_gui/vrct_gui.py b/vrct_gui/vrct_gui.py index f525ff4a..f181115f 100644 --- a/vrct_gui/vrct_gui.py +++ b/vrct_gui/vrct_gui.py @@ -126,26 +126,19 @@ class VRCT_GUI(CTk): ) def printToTextbox(self, target_type, original_message=None, translated_message=None): - match (target_type): - case "INFO": - target_textbox = self.textbox_system - case "SEND": - target_textbox = self.textbox_sent - case "RECEIVE": - target_textbox = self.textbox_received - case (_): - raise ValueError(f"No matching case for target_type: {target_type}") _printToTextbox( + vrct_gui=self, settings=self.settings.main, - target_textbox=target_textbox, + target_type=target_type, original_message=original_message, translated_message=translated_message, tags=target_type, ) # To automatically print the same log to the textbox_all widget as well. _printToTextbox( + vrct_gui=self, settings=self.settings.main, - target_textbox=self.textbox_all, + target_type="ALL", original_message=original_message, translated_message=translated_message, tags=target_type,