v0.1.9.3(2024/07/15)
1. [APIs: openapi.py] - иÄodbusl½Ó§°ܱ¨´í³ö½£¬ʹֻ֮Ôautomatic testҳÃÏʾ - 将该文件移动至toplevel,为后面扩展做准备 - 修改heartbeat文件路径,使后续打包的时候更方便 2. [APIs: aio.py]: - 修改heartbeat文件路径,使后续打包的时候更方便 - 修改write2textbox函数的打印逻辑,先判断网络相关
This commit is contained in:
@ -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
|
||||
@ -166,7 +167,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 != '功能切换':
|
||||
@ -181,13 +182,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)
|
||||
@ -333,7 +334,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()
|
||||
@ -347,7 +348,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()
|
||||
|
Reference in New Issue
Block a user