diff --git a/aio/assets/layout.xlsx b/aio/assets/layout.xlsx index c80baa4..c7934ce 100644 Binary files a/aio/assets/layout.xlsx and b/aio/assets/layout.xlsx differ diff --git a/aio/code/aio.py b/aio/code/aio.py index 165966c..5b55662 100644 --- a/aio/code/aio.py +++ b/aio/code/aio.py @@ -35,6 +35,12 @@ widgits_at = { 'path': {'label': '', 'entry': '', 'row': 2, 'col': 2, 'text': '数据文件夹路径'}, 'loadsel': {'label': '', 'optionmenu': '', 'row': 2, 'col': 1, 'text': '负载信息'}, } +widgits_pr = { + 'path': {'label': '', 'entry': '', 'row': 1, 'col': 2, 'text': '数据文件夹路径'}, + 'loadsel': {'label': '', 'optionmenu': '', 'row': 2, 'col': 1, 'text': '负载选择'}, + 'actionsel': {'label': '', 'optionmenu': '', 'row': 3, 'col': 1, 'text': '动作选择'}, + 'inertiasel': {'label': '', 'optionmenu': '', 'row': 4, 'col': 1, 'text': '惯量选择'}, +} class App(customtkinter.CTk): @@ -80,6 +86,7 @@ class App(customtkinter.CTk): self.tabview.grid(row=0, column=1, padx=10, pady=5, sticky="nsew") self.tabview.add("Data Process") self.tabview.add("Automatic Test") + self.tabview.add("Profile Test") # create main menu for data process self.menu_main_dp = customtkinter.CTkOptionMenu(self.tabview.tab('Data Process'), values=["init", "brake", "current", "iso", "wavelogger"], font=self.my_font, text_color='yellow', button_color='red', fg_color='green', command=self.func_main_callback) self.menu_main_dp.grid(row=1, column=1, sticky='we', padx=5, pady=10) @@ -137,6 +144,33 @@ class App(customtkinter.CTk): widgits_at[widgit]['optionmenu'].set(widgits_at[widgit]['text']) widgits_at[widgit]['optionmenu'].configure(state='disabled') # For automatic test tab END ===================================================================== + # For profile tab START ===================================================================== + for widgit in widgits_pr: + if widgit == 'path': + widgits_pr[widgit]['label'] = customtkinter.CTkLabel(self.tabview.tab('Profile Test'), text=f'{widgit.upper()}', font=self.my_font) + widgits_pr[widgit]['label'].grid(row=widgits_pr[widgit]['row'], column=widgits_pr[widgit]['col'], sticky='e', pady=5) + widgits_pr[widgit]['entry'] = customtkinter.CTkEntry(self.tabview.tab('Profile Test'), width=670, placeholder_text=widgits_pr[widgit]['text'], font=self.my_font) + widgits_pr[widgit]['entry'].grid(row=widgits_pr[widgit]['row'], column=widgits_pr[widgit]['col']+1, columnspan=11, padx=(5, 10), pady=5, sticky='we') + # widgits_pr[widgit]['entry'].configure(state='disabled') + elif widgit in ['loadsel', 'actionsel', 'inertiasel']: + match widgit: + case 'loadsel': + values = ["tool100", "inertia"] + case 'actionsel': + values = ["signle", "box", "cart"] + case 'inertiasel': + values = ["high", "middle", "low"] + + widgits_pr[widgit]['optionmenu'] = customtkinter.CTkOptionMenu(self.tabview.tab('Profile Test'), button_color='#708090', fg_color='#778899', values=values, width=self.w_param, font=self.my_font) + widgits_pr[widgit]['optionmenu'].grid(row=widgits_pr[widgit]['row'], column=widgits_pr[widgit]['col'], padx=5, pady=5, sticky='we') + widgits_pr[widgit]['optionmenu'].set(widgits_pr[widgit]['text']) + # widgits_pr[widgit]['optionmenu'].configure(state='disabled') + # create progress bar + self.progressbar_pr = customtkinter.CTkProgressBar(self.tabview.tab('Profile Test')) + self.progressbar_pr.grid(row=5, column=1, padx=5, pady=5, sticky="ew") + self.progressbar_pr.configure(mode="determinnate", width=10) + self.progressbar_pr.start() + # For profile tab END ===================================================================== # create textbox self.textbox = customtkinter.CTkTextbox(self, wrap='none', font=customtkinter.CTkFont(family="consolas", size=14), text_color="blue", fg_color='#E9E9E9', border_width=2, border_color='#CDCDCD', border_spacing=5) self.textbox.grid(row=6, column=1, columnspan=13, ipadx=10, ipady=10, padx=10, pady=(5, 10), sticky='nsew') @@ -193,6 +227,7 @@ class App(customtkinter.CTk): c_state = f_hb.read().strip() pb_color = 'green' if c_state == '1' else 'red' 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 diff --git a/aio/code/automatic_test/openapi.py b/aio/code/automatic_test/openapi.py index 703e9c7..bfac80b 100644 --- a/aio/code/automatic_test/openapi.py +++ b/aio/code/automatic_test/openapi.py @@ -216,7 +216,7 @@ class HmiRequest(object): # self.c_xs.connect(('192.168.84.129', 6666)) self.c_xs.setblocking(False) - self.w2t("Connection success", 0, 0, 'green', tab_name=self.tab_name) + # self.w2t("Connection success", 0, 0, 'green', tab_name=self.tab_name) with open(f"{current_path}/../../assets/templates/heartbeat", "w", encoding='utf-8') as f_hb: f_hb.write('1') md = ModbusRequest(self.w2t, self.tab_name) @@ -226,7 +226,7 @@ class HmiRequest(object): md.write_probe(False) md.write_axis(1) except Exception as Err: - self.w2t("Connection failed...", 0, 0, 'red', tab_name=self.tab_name) + # self.w2t("Connection failed...", 0, 0, 'red', tab_name=self.tab_name) with open(f"{current_path}/../../assets/templates/heartbeat", "w", encoding='utf-8') as f_hb: f_hb.write('0') @@ -268,7 +268,8 @@ class HmiRequest(object): with open(f"{current_path}/../../assets/templates/heartbeat", "w", encoding='utf-8') as f_hb: f_hb.write(_flag) if _flag == '0': - self.w2t(f"{_id} 心跳丢失,连接失败,重新连接中...", 0, 7, 'red', tab_name=self.tab_name) + # self.w2t(f"{_id} 心跳丢失,连接失败,重新连接中...", 0, 7, 'red', tab_name=self.tab_name) + self.w2t(f"", 0, 7, 'red', tab_name=self.tab_name) sleep(1.5) # with open(f"{current_path}/../../assets/templates/c_msg.log", "w", encoding='utf-8') as f: # for msg in self.c_msg: @@ -619,7 +620,8 @@ class HmiRequest(object): self.c.send(self.package(cmd)) sleep(0.5) except Exception as Err: - self.w2t(f"{cmd}\n请求发送失败...{Err}", 0, 0, 'red', tab_name=self.tab_name) + # self.w2t(f"{cmd}\n请求发送失败...{Err}", 0, 0, 'red', tab_name=self.tab_name) + self.w2t(f"", 0, 0, 'red', tab_name=self.tab_name) return req['id'] diff --git a/aio/code/profile/__init__.py b/aio/code/profile/__init__.py new file mode 100644 index 0000000..7824c48 --- /dev/null +++ b/aio/code/profile/__init__.py @@ -0,0 +1 @@ +__all__ = ['do_profile'] \ No newline at end of file diff --git a/aio/code/profile/do_profile.py b/aio/code/profile/do_profile.py new file mode 100644 index 0000000..e69de29