From: Utkarsh Tiwari Date: Mon, 14 Oct 2024 05:13:27 +0000 (+0530) Subject: [TCT][Tool][Non-ACR] Restructuring function for reuse X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc2c587a9b58d0892897e2838fcee61f55ab5ca0;p=test%2Ftct%2Fnative%2Fapi.git [TCT][Tool][Non-ACR] Restructuring function for reuse Change-Id: I649e3ffdd2df31b424bd6b46049424ea87fb8fee Signed-off-by: Utkarsh Tiwari --- diff --git a/tool/TC_Assistant_Tool/tct_assistance.py b/tool/TC_Assistant_Tool/tct_assistance.py index 10ccabf4f..35ec9443f 100644 --- a/tool/TC_Assistant_Tool/tct_assistance.py +++ b/tool/TC_Assistant_Tool/tct_assistance.py @@ -1111,17 +1111,27 @@ def on_closing(): if response=="Yes": base.destroy() +def create_label(welcomeText): + Bot_ko = customtkinter.CTkLabel(ChatLog,text=welcomeText+"\n", justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10, padx=10, pady=5, font=("Malgun Gothic", 13),wraplength=500, cursor="hand2") + WhiteSpace = customtkinter.CTkLabel(ChatLog,text="This is a empty line label", justify='left',text_color='#d3d3d3',corner_radius=10, padx=10, pady=5, font=("Malgun Gothic", 13),wraplength=500, cursor="hand2") + ChatLog.insert('0.0', '\n') + ChatLog.window_create('0.0', window=WhiteSpace) + ChatLog.insert(END, '\n') + ChatLog.window_create('end', window=Bot_ko) + ChatLog.insert(END, '\n') + ChatLog.see("1.0") + ChatLog.tag_add("no_padding", "end-1c linestart", "end-1c lineend") + ChatLog.tag_configure("no_padding", lmargin1=0, lmargin2=0, rmargin=0) + ChatLog.insert(END, "") + def radiobutton_event(): global toggle - print("radiobutton toggled, current value:", radio_var.get()) - print("ChatLog.winfo_children()", ChatLog.winfo_children()) - # get yes/no answers whether user want to change language or not msg = CTkMessagebox(title="Exit?", message="Your current progress will be lost. Do you want to switch language?", icon="question", option_1="No", option_2="Yes", option_3="",option_focus=2) response = msg.get() - + welcomeText = "Assistant: Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n > Remove Deprecated APIs\n" if response=="Yes": ChatLog.mark_set("end", "1.0") if toggle != radio_var.get(): @@ -1129,36 +1139,14 @@ def radiobutton_event(): if child.widgetName == "frame": child.destroy() ChatLog.delete(0, END) + Bot.destroy() if radio_var.get() == 2: - Bot.destroy() - welcomeText = "Assistant: Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n > Remove Deprecated APIs\n" welcomeText = translate_to_ko(welcomeText) - Bot_ko = customtkinter.CTkLabel(ChatLog,text=welcomeText+"\n\n", justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10, padx=10, pady=5, font=("Malgun Gothic", 13),wraplength=500, cursor="hand2") - WhiteSpace = customtkinter.CTkLabel(ChatLog,text="This is a empty line label", justify='left',text_color='#d3d3d3',corner_radius=10, padx=10, pady=5, font=("Malgun Gothic", 13),wraplength=500, cursor="hand2") - ChatLog.insert('0.0', '\n') - ChatLog.window_create('0.0', window=WhiteSpace) - ChatLog.insert(END, '\n') - ChatLog.window_create('end', window=Bot_ko) - ChatLog.insert(END, '\n') - ChatLog.see("1.0") - ChatLog.tag_add("no_padding", "end-1c linestart", "end-1c lineend") - ChatLog.tag_configure("no_padding", lmargin1=0, lmargin2=0, rmargin=0) - ChatLog.insert(END, "") + create_label(welcomeText) elif radio_var.get() == 1: - Bot.destroy() - welcomeText = "Assistant: Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n > Remove Deprecated APIs\n" - Bot_ko = customtkinter.CTkLabel(ChatLog,text=welcomeText+"\n", justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10, padx=10, pady=5, font=("Malgun Gothic", 13),wraplength=500, cursor="hand2") - WhiteSpace = customtkinter.CTkLabel(ChatLog,text="This is a empty line label", justify='left',text_color='#d3d3d3',corner_radius=10, padx=10, pady=5, font=("Malgun Gothic", 13),wraplength=500, cursor="hand2") - ChatLog.insert('0.0', '\n') - ChatLog.window_create('0.0', window=WhiteSpace) - ChatLog.insert(END, '\n') - ChatLog.window_create('end', window=Bot_ko) - ChatLog.insert(END, '\n') - ChatLog.see("1.0") - ChatLog.tag_add("no_padding", "end-1c linestart", "end-1c lineend") - ChatLog.tag_configure("no_padding", lmargin1=0, lmargin2=0, rmargin=0) - ChatLog.insert(END, "") + create_label(welcomeText) + toggle = radio_var.get() return radio_var.get() else: