minor modifications

This commit is contained in:
2024-07-18 14:59:20 +08:00
parent dd0873637f
commit 1cefe4a16b
5 changed files with 37 additions and 48 deletions

View File

@ -13,13 +13,13 @@ from automatic_test import *
from durable_action import *
import openapi
import matplotlib.pyplot as plt
import matplotlib
import pandas as pd
from matplotlib import use
from pandas import DataFrame, read_excel
matplotlib.use('Agg')
use('Agg')
heartbeat = f'{dirname(__file__)}/../assets/templates/heartbeat'
durable_data_current_xlsx = f'{dirname(__file__)}/../assets/templates/durable/durable_data_current.xlsx'
durable_data_velocity_xlsx = f'{dirname(__file__)}/../assets/templates/durable/durable_data_velocity.xlsx'
durable_data_current_max_xlsx = f'{dirname(__file__)}/../assets/templates/durable/durable_data_current_max.xlsx'
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
@ -35,7 +35,7 @@ durable_data_current = {
'axis5': [0 for _ in range(25)],
'axis6': [0 for _ in range(25)],
}
durable_data_velocity = {
durable_data_current_max = {
'time': list(range(1, 26)),
'axis1': [0 for _ in range(25)],
'axis2': [0 for _ in range(25)],
@ -64,7 +64,7 @@ widgits_at = {
}
widgits_da = {
'path': {'label': '', 'entry': '', 'row': 1, 'col': 2, 'text': '数据文件夹路径'},
'curvesel': {'label': '', 'optionmenu': '', 'row': 1, 'col': 1, 'text': '曲线选择'},
'curvesel': {'label': '', 'optionmenu': '', 'row': 1, 'col': 1, 'text': '指标选择'},
}
@ -185,7 +185,7 @@ class App(customtkinter.CTk):
widgits_da[widgit]['entry'] = customtkinter.CTkEntry(self.tabview.tab('Durable Action'), width=670, placeholder_text=widgits_da[widgit]['text'], font=self.my_font)
widgits_da[widgit]['entry'].grid(row=widgits_da[widgit]['row'], column=widgits_da[widgit]['col']+1, columnspan=11, padx=(5, 10), pady=10, sticky='we')
elif widgit in ['curvesel']:
widgits_da[widgit]['optionmenu'] = customtkinter.CTkOptionMenu(self.tabview.tab('Durable Action'), dynamic_resizing=False, button_color='#708090', fg_color='#778899', values=["device_servo_trq_feedback", "hw_joint_vel_feedback"], font=self.my_font)
widgits_da[widgit]['optionmenu'] = customtkinter.CTkOptionMenu(self.tabview.tab('Durable Action'), dynamic_resizing=False, button_color='#708090', fg_color='#778899', values=['device_servo_trq_feedback', '[max] device_servo_trq_feedback'], font=self.my_font)
widgits_da[widgit]['optionmenu'].grid(row=widgits_da[widgit]['row'], column=widgits_da[widgit]['col'], padx=5, pady=10, sticky='we')
widgits_da[widgit]['optionmenu'].set(widgits_da[widgit]['text'])
# For durable_action tab END =====================================================================
@ -224,14 +224,14 @@ class App(customtkinter.CTk):
if not self.hr.durable_lock:
self.hr.durable_lock = 1
if curvesel == 'device_servo_trq_feedback':
df = pd.read_excel(durable_data_current_xlsx)
df = read_excel(durable_data_current_xlsx)
_title = 'device_servo_trq_feedback'
elif curvesel == 'hw_joint_vel_feedback':
_title = 'hw_joint_vel_feedback'
df = pd.read_excel(durable_data_velocity_xlsx)
elif curvesel == '[max] device_servo_trq_feedback':
_title = '[max] device_servo_trq_feedback'
df = read_excel(durable_data_current_max_xlsx)
else:
_title = 'device_servo_trq_feedback'
df = pd.read_excel(durable_data_current_xlsx)
df = read_excel(durable_data_current_xlsx)
self.hr.durable_lock = 0
break
else:
@ -281,10 +281,10 @@ class App(customtkinter.CTk):
# self.tabview.configure(state='normal')
def detect_network(self):
df = pd.DataFrame(durable_data_current)
df = DataFrame(durable_data_current)
df.to_excel(durable_data_current_xlsx, index=False)
df = pd.DataFrame(durable_data_velocity)
df.to_excel(durable_data_velocity_xlsx, index=False)
df = DataFrame(durable_data_current_max)
df.to_excel(durable_data_current_max_xlsx, index=False)
with open(heartbeat, "w", encoding='utf-8') as f_hb:
f_hb.write('0')
@ -578,7 +578,7 @@ class App(customtkinter.CTk):
path = widgits_da['path']['entry'].get().strip()
curvesel = widgits_da['curvesel']['optionmenu'].get()
c1 = exists(path)
c2 = curvesel in ['device_servo_trq_feedback', 'hw_joint_vel_feedback']
c2 = curvesel in ['device_servo_trq_feedback', '[max] device_servo_trq_feedback']
if c1 and c2:
return 7, path, curvesel
else: