5. 重新在write2textbox中添加exitcode参数,并补齐相关逻辑和修改brake中的调用方式
6. 修复参数检查无效的情况 7. 屏蔽电流相关的功能
This commit is contained in:
@@ -128,8 +128,6 @@ class App(customtkinter.CTk):
|
||||
cur_vers = self.label_version.cget("text").replace('\n', ' @ ').replace("Vers: ", '').replace("Date: ", '')
|
||||
try:
|
||||
new_vers = urlopen("https://www.rustle.cc/vers").read().decode('utf-8')
|
||||
print(f"{cur_vers}")
|
||||
print(f"{new_vers}")
|
||||
if cur_vers.strip() != new_vers.strip():
|
||||
msg = f"""当前版本:{cur_vers}\n更新版本:{new_vers}\n\n请及时更新 https://pan.rustle.cc/s/jRfM"""
|
||||
tkinter.messagebox.showwarning(title="版本更新", message=msg)
|
||||
@@ -214,11 +212,17 @@ class App(customtkinter.CTk):
|
||||
elif func_name == 'avg':
|
||||
pass
|
||||
|
||||
def write2textbox(self, text, wait=0):
|
||||
def write2textbox(self, text, wait=0, exitcode=0):
|
||||
if wait != 0:
|
||||
self.textbox.insert(index='end', text=text)
|
||||
self.textbox.update()
|
||||
self.textbox.see('end')
|
||||
elif exitcode != 0:
|
||||
self.textbox.configure(text_color='red')
|
||||
self.textbox.insert(index='end', text=text + '\n')
|
||||
self.textbox.update()
|
||||
self.textbox.see('end')
|
||||
raise Exception(f"Error code: {exitcode}")
|
||||
else:
|
||||
self.textbox.insert(index='end', text=text + '\n')
|
||||
self.textbox.update()
|
||||
@@ -249,8 +253,10 @@ class App(customtkinter.CTk):
|
||||
else:
|
||||
pass
|
||||
|
||||
flag = 1 if c1 and c2 and c3 and c4 and c5 else 0
|
||||
return flag, path, int(av), int(rr), int(rpm), int(axis), int(vel), int(trq)
|
||||
if c1 and c2 and c3 and c4 and c5:
|
||||
return 1, path, int(av), int(rr), int(rpm), int(axis), int(vel), int(trq)
|
||||
else:
|
||||
return 0, 0
|
||||
|
||||
elif func_name == 'current':
|
||||
path = self.entry_path.get()
|
||||
@@ -267,8 +273,10 @@ class App(customtkinter.CTk):
|
||||
except ValueError:
|
||||
c3 = False
|
||||
|
||||
flag = 2 if c1 and c2 and c3 else 0
|
||||
return flag, path, float(rc), int(vel), int(trq), sub_func
|
||||
if c1 and c2 and c3:
|
||||
return 2, path, float(rc), int(vel), int(trq), sub_func
|
||||
else:
|
||||
return 0, 0
|
||||
else:
|
||||
return 0, 0
|
||||
|
||||
@@ -283,7 +291,8 @@ class App(customtkinter.CTk):
|
||||
if flag == 1:
|
||||
func_dict[flag](path=args[0], av=args[1], rr=args[2], rpm=args[3], axis=args[4], vel=args[5], trq=args[6], w2t=self.write2textbox)
|
||||
elif flag == 2:
|
||||
func_dict[flag](path=args[0], rc=args[1], sub_func=args[2])
|
||||
tkinter.messagebox.showinfo(title="TBD", message="功能待实现......")
|
||||
# func_dict[flag](path=args[0], rc=args[1], sub_func=args[2])
|
||||
else:
|
||||
tkinter.messagebox.showerror(title="参数错误", message="请检查对应参数是否填写正确!", )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user