xcore通讯协议完善

This commit is contained in:
2025-01-10 12:44:41 +08:00
parent 6a47310dec
commit 137122947c
2 changed files with 85 additions and 44 deletions

View File

@@ -76,7 +76,7 @@ class App:
self.om_sub_at = ctk.CTkOptionMenu(self.tabview_top.tab("自动测试"), width=160, dynamic_resizing=False, values=["tool33", "tool66", "tool100", "inertia"], font=self.f_common, text_color="#3C3C3C", button_color="#7B6B5B", fg_color="#8D8D8D")
self.label_ip_at = ctk.CTkLabel(self.tabview_top.tab("自动测试"), anchor="e", text="IP", font=self.f_common)
self.entry_ip_at = ctk.CTkEntry(self.tabview_top.tab("自动测试"), width=160, textvariable=self.entry_ip_atv, font=self.f_entry, text_color="#818181")
self.btn_conn = ctk.CTkButton(self.tabview_top.tab("自动测试"), text="连接", width=60, font=self.f_segbtn, fg_color="#979DA2", corner_radius=0)
self.btn_conn = ctk.CTkButton(self.tabview_top.tab("自动测试"), text="连接", width=60, font=self.f_segbtn, fg_color="#979DA2", corner_radius=0, cursor="hand2")
# self.progressbar_at = ctk.CTkProgressBar(self.tabview_top.tab("自动测试"), width=160, mode="indeterminate")
self.label_path_at = ctk.CTkLabel(self.tabview_top.tab("自动测试"), width=50, anchor="e", text="Path", font=self.f_common)
self.entry_path_at = ctk.CTkEntry(self.tabview_top.tab("自动测试"), width=80, state="disabled", textvariable=self.entry_path_atv, font=self.f_entry, text_color="#818181")
@@ -93,12 +93,12 @@ class App:
# ========================================================================
self.text_output = ctk.CTkTextbox(self.tabview_bottom.tab("输出"), height=10, corner_radius=0, wrap="none", font=self.f_text)
# ========================================================================
self.label_logs = ctk.CTkLabel(self.tabview_bottom.tab("日志"), width=80, font=self.f_pager, textvariable=self.label_pages_logs, text_color="blue", bg_color="#DCDCDC")
self.label_logs = ctk.CTkLabel(self.tabview_bottom.tab("日志"), width=80, font=self.f_pager, textvariable=self.label_pages_logs, text_color="blue", bg_color="#DCDCDC", cursor="hand2")
self.btn_previous = ctk.CTkButton(self.tabview_bottom.tab("日志"), width=60, text="上一页", font=self.f_segbtn, fg_color="#979DA2", corner_radius=0, command=self.__get_previous_log)
self.btn_realtime = ctk.CTkButton(self.tabview_bottom.tab("日志"), width=60, text="实时", font=self.f_segbtn, fg_color="#979DA2", corner_radius=0, command=self.__get_realtime_log)
self.btn_next = ctk.CTkButton(self.tabview_bottom.tab("日志"), width=60, text="下一页", font=self.f_segbtn, fg_color="#979DA2", corner_radius=0, command=self.__get_next_log)
self.btn_load = ctk.CTkButton(self.tabview_bottom.tab("日志"), width=60, text="加载", font=self.f_segbtn, fg_color="#979DA2", corner_radius=0, command=self.__load_log_db)
self.btn_find = ctk.CTkButton(self.tabview_bottom.tab("日志"), text="查找", width=60, font=self.f_segbtn, fg_color="#979DA2", corner_radius=0)
self.btn_find = ctk.CTkButton(self.tabview_bottom.tab("日志"), text="查找", width=60, font=self.f_segbtn, fg_color="#979DA2", corner_radius=0, cursor="hand2")
self.entry_keyword = ctk.CTkEntry(self.tabview_bottom.tab("日志"), placeholder_text="[id/level/module] 查找内容", width=60, font=self.f_entry)
self.treeview_logs = ttk.Treeview(self.tabview_bottom.tab("日志"), height=1, columns=("id", "time", "level", "module", "content"), style="tv.Treeview", show="headings")
self.y_scrollbar_logs = tk.Scrollbar(self.tabview_bottom.tab("日志"), width=30, command=self.treeview_logs.yview)
@@ -132,6 +132,10 @@ class App:
# ========================================================================
self.__draw()
@staticmethod
def __do_nothing(event):
...
def __detect_network(self):
while True:
try:
@@ -480,6 +484,7 @@ class App:
self.f_toplevel = ("Consolas", 14, "normal")
self.f_status = ("Consolas", 12, "bold")
@clibs.db_lock
def __quit_preparation(self):
os.chdir(clibs.log_path)
t = datetime.now().strftime("%Y%m%d%H%M%S")
@@ -868,11 +873,12 @@ class App:
except Exception as Err:
self.btn_conn.configure(state="normal", fg_color="#979DA2")
elif self.btn_conn.cget("fg_color") == "#2E8B57":
self.btn_conn.configure(state="disabled")
try:
# clibs.c_md.close()
clibs.c_hr.close()
finally:
self.btn_conn.configure(fg_color="#979DA2")
self.btn_conn.configure(state="normal", fg_color="#979DA2")
t = threading.Thread(target=conn_or_disconn)
t.daemon = True
t.start()
@@ -937,6 +943,7 @@ class App:
self.entry_path_at.bind("<Button-1>", select_path)
self.entry_ip_at.bind("<Button-3>", show_popupmenu_ip, add="+")
self.btn_conn.bind("<Button-1>", conn_change)
self.btn_conn.bind("<Double-1>", self.__do_nothing, add="+")
# ========================================================================
self.tabview_bottom.tab("输出").grid_rowconfigure(0, weight=1)
self.tabview_bottom.tab("输出").grid_columnconfigure(0, weight=1)
@@ -956,7 +963,7 @@ class App:
self.treeview_logs.configure(yscrollcommand=self.y_scrollbar_logs.set)
self.treeview_logs.tag_configure("DEBUG", background="#708090")
self.treeview_logs.tag_configure("INFO", background="#F5F5F5") # #43CD80
self.treeview_logs.tag_configure("INFO", background="#D8F9D2") # #43CD80 F5F5F5
self.treeview_logs.tag_configure("WARNING", background="#EEE8AA")
self.treeview_logs.tag_configure("ERROR", background="#CD5C5C")
for k, v in self.tv_cols.items():