Merge branch 'main' of gitea.rustle.cc:gitea/rokae into profile

fetch the newest codes of main
This commit is contained in:
2024-07-15 13:34:09 +08:00
11 changed files with 172 additions and 80 deletions

View File

@ -49,8 +49,7 @@ class App(customtkinter.CTk):
self.my_font = customtkinter.CTkFont(family="Consolas", size=16, weight="bold")
self.w_param = 84
self.hr = None
self.md_at = None
self.md_dp = None
self.md = None
# =====================================================================
# configure window
self.title("AIO - All in one automatic toolbox")
@ -77,7 +76,7 @@ class App(customtkinter.CTk):
btns_func['log']['btn'].configure(command=lambda: self.thread_it(self.func_log_callback))
btns_func['end']['btn'].configure(command=lambda: self.thread_it(self.func_end_callback))
# create version info
self.label_version = customtkinter.CTkLabel(self.frame_func, justify='left', text="Vers: 0.1.9.0\nDate: 07/10/2024", font=self.my_font, text_color="#4F4F4F")
self.label_version = customtkinter.CTkLabel(self.frame_func, justify='left', text="Vers: 0.1.9.2\nDate: 07/13/2024", font=self.my_font, text_color="#4F4F4F")
self.frame_func.rowconfigure(6, weight=1)
self.label_version.grid(row=6, column=0, padx=20, pady=20, sticky='s')
# =====================================================================
@ -209,7 +208,7 @@ class App(customtkinter.CTk):
else:
for _func in _btn_funcs:
if _btn_funcs[_func] == value:
btn_functions.main(self.hr, self.md_at, _func, self.write2textbox)
btn_functions.main(self.hr, self.md, _func, self.write2textbox)
break
self.seg_button.configure(state='normal')
@ -219,8 +218,7 @@ class App(customtkinter.CTk):
with open(f"{current_path}/../assets/templates/heartbeat", "w", encoding='utf-8') as f_hb:
f_hb.write('0')
self.hr = openapi.HmiRequest(self.write2textbox)
self.md_at = openapi.ModbusRequest(self, 'Automatic Test')
self.md_dp = openapi.ModbusRequest(self, 'Data Process')
self.md = openapi.ModbusRequest(self.write2textbox)
while True:
with open(f'{current_path}/../assets/templates/heartbeat', 'r', encoding='utf-8') as f_hb:
@ -229,7 +227,6 @@ class App(customtkinter.CTk):
self.progressbar.configure(progress_color=pb_color)
self.progressbar_pr.configure(progress_color=pb_color)
if c_state == '0':
# self.textbox.delete(index1='1.0', index2='end')
self.hr.t_bool = False
sleep(3)
del self.hr
@ -238,7 +235,6 @@ class App(customtkinter.CTk):
def tabview_click(self):
self.initialization()
# self.textbox.delete(index1='1.0', index2='end')
tab_name = self.tabview.get()
if tab_name == 'Data Process':
@ -386,7 +382,21 @@ class App(customtkinter.CTk):
self.textbox.insert(index='end', text=text + '\n', tags=color)
self.textbox.update()
self.textbox.see('end')
elif tab_name == 'openapi' and tab_name_cur == 'Automatic Test':
if wait != 0:
self.textbox.insert(index='end', text=text, tags=color)
self.textbox.update()
self.textbox.see('end')
elif exitcode != 0:
self.textbox.insert(index='end', text=text + '\n', tags=color)
self.textbox.update()
self.textbox.see('end')
raise Exception(f"Error code: {exitcode}")
else:
self.textbox.insert(index='end', text=text + '\n', tags=color)
self.textbox.update()
self.textbox.see('end')
def is_float(self, flag, *args):
for item in args:
try:
@ -494,10 +504,10 @@ class App(customtkinter.CTk):
func_dict[flag](path=args[0], w2t=self.write2textbox)
elif flag == 5:
self.pre_warning()
func_dict[flag](path=args[0], hr=self.hr, md=self.md_at, loadsel=args[1], w2t=self.write2textbox)
func_dict[flag](path=args[0], hr=self.hr, md=self.md, loadsel=args[1], w2t=self.write2textbox)
elif flag == 6:
self.pre_warning()
func_dict[flag](path=args[0], hr=self.hr, md=self.md_at, loadsel=args[1], w2t=self.write2textbox)
func_dict[flag](path=args[0], hr=self.hr, md=self.md, loadsel=args[1], w2t=self.write2textbox)
else:
tkinter.messagebox.showerror(title="参数错误", message="请检查对应参数是否填写正确!", )