fix merge

This commit is contained in:
2024-07-15 13:42:10 +08:00
5 changed files with 46 additions and 60 deletions

View File

@ -9,8 +9,9 @@ from urllib.request import urlopen
from socket import setdefaulttimeout
from data_process import *
from automatic_test import *
import openapi
current_path = dirname(__file__)
heartbeat = f'{dirname(__file__)}/../assets/templates/heartbeat'
customtkinter.set_appearance_mode("System") # Modes: "System" (standard), "Dark", "Light"
customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"
customtkinter.set_widget_scaling(1.1) # widget dimensions and text size
@ -200,7 +201,7 @@ class App(customtkinter.CTk):
self.seg_button.configure(state='disabled')
# self.tabview.configure(state='disabled')
self.textbox.delete(index1='1.0', index2='end')
with open(f'{current_path}/../assets/templates/heartbeat', 'r', encoding='utf-8') as f_h:
with open(heartbeat, 'r', encoding='utf-8') as f_h:
c_state = f_h.read().strip()
if c_state == '0' and value != '功能切换':
@ -215,13 +216,13 @@ class App(customtkinter.CTk):
# self.tabview.configure(state='normal')
def detect_network(self):
with open(f"{current_path}/../assets/templates/heartbeat", "w", encoding='utf-8') as f_hb:
with open(heartbeat, "w", encoding='utf-8') as f_hb:
f_hb.write('0')
self.hr = openapi.HmiRequest(self.write2textbox)
self.md = openapi.ModbusRequest(self.write2textbox)
while True:
with open(f'{current_path}/../assets/templates/heartbeat', 'r', encoding='utf-8') as f_hb:
with open(heartbeat, 'r', encoding='utf-8') as f_hb:
c_state = f_hb.read().strip()
pb_color = 'green' if c_state == '1' else 'red'
self.progressbar.configure(progress_color=pb_color)
@ -368,7 +369,7 @@ class App(customtkinter.CTk):
self.textbox.tag_config(tagName=color, foreground=color)
tab_name_cur = self.tabview.get()
if tab_name == tab_name_cur:
if tab_name == 'openapi' and tab_name_cur == 'Automatic Test':
if wait != 0:
self.textbox.insert(index='end', text=text, tags=color)
self.textbox.update()
@ -382,7 +383,7 @@ 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':
elif tab_name == tab_name_cur:
if wait != 0:
self.textbox.insert(index='end', text=text, tags=color)
self.textbox.update()