#!/usr/bin/python #_*_ coding: utf-8 _*_ from Tkinter import * import sys import os import subprocess import time import ttk import tkMessageBox import threading import csv import subprocess from datetime import datetime # declaring global variables script_ver='C180-C-C7-v1.2' log_file='./Logs/temp.txt' log1_buffer = "" step_status = ['x', 'ns', 'ns'] result_msg = [] # 'x' = don't care # 'ns' = not started # 'p' = passed # 'f' = failed # 'r' = running test_channel = ['1', '6', '11'] device_info={} params_dict = {} params_dict['path_loss'] = '25' params_dict['wave_file'] = './11b_waveforms/wave11rc_1000.mod' params_dict['per_limit'] = '92' params_dict['SA_RSSI'] = '-80' params_dict['BTOn_RSSI']='-30' ########################################################################### class IO_process: def __init__(self, log_file_path): # log_file_path is the absolute path of the log file self.log_file = log_file_path self.line_count = 0 def read_file(self): try: f = open(self.log_file,'r') # open file to read flag = 0 for i, line in enumerate(f): if i == self.line_count: # if reached the correct line self.line_count += 1 flag = 1 #print self.line_count break f.close() if flag == 1: return line.rstrip('\r') # get rid of the newline character else: return "" except: return "" def empty_file(self): f = open(self.log_file,'w') f.close() def reset_counter(self): self.line_count = 0 ########################################################################### def write_log_to_file(content): curr_time=time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime()) log_dir = "./Logs/" log_file = "log_" + curr_time + ".txt" log_file_location = log_dir + log_file file = open(log_file_location,'a') # open file to append file.write(str(content) + '\n') file.close() ########################################################################### def print1(string,newline=0): global log1_buffer if newline == 0: # if user doesn't want to insert a line feed log1_buffer += "\n" + str(string) elif newline == 1: # if user wants to insert a line feed log1_buffer += "\n" + str(string) + "\n" ########################################################################### def step1_routine(): # bios_version global step_status global result_msg step_num = 1 step_status[step_num] = 'r' # running print1("\nstep1----------------------------------------------------") print1("Step " + str(step_num) + " Started...") time.sleep(1) a = os.popen("sh os-ver.sh bios").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() if len(a) == 0: print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed else: print1("Success! Device found! Rsync completed!") print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a ########################################################################### def step2_routine(): # bios release date global step_status global device_info global result_msg step_num = 2 step_status[step_num] = 'r' # running print1("\nstep2----------------------------------------------------") print1("Step " + str(step_num) + " Started...") #tkMessageBox.showinfo("Message Box", "PS2 keyboard/mouse test! Make sure PS2 keyboard and mouse are connected.") # read the data and analysis it. #a = os.popen('sh bios-release-date.sh').read() a = os.popen('sh os-ver.sh ec').read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() #a = os.system(r'./usb-location.sh') #a = subprocess.call(['./usb-location.sh']) print1("Step " + str(a) + " End...") if len(a) == 0: print1("Error! Standalone Sensitivity Fails!") print1("Please check the cable and antenna connection and try again!") step_status[step_num] = 'f' # failed else: step_status[step_num] = 'p' result_msg[step_num] = a ########################################################################### def step3_routine(): # CPU type global step_status global result_msg step_num = 3 step_status[step_num] = 'r' # running print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") #step_status[step_num] = 'p' # passed #result_msg[step_num] = 'AAPASS' #return; a = os.popen("cat /proc/cpuinfo | grep \"model name\" | awk '{print $5}' | head -1").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() if len(a) == 0: print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed else: print1("Error! No Device found!") print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a ########################################################################### def step4_routine(): # memory_version global step_status global result_msg step_num = 4 step_status[step_num] = 'r' # running print1("\nFT----------------------------------------------------") print1("Step " + str(step_num) + " Started...") a = os.popen("sh mem-ver.sh").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() if len(a) == 0: print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed else: step_status[step_num] = 'p' # passed result_msg[step_num] = a ########################################################################### def step5_routine(): # hdd_version global step_status global result_msg step_num = 5 step_status[step_num] = 'r' # running print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") a = os.popen("sh hdd-ver.sh").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() if len(a) == 0: print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed else: step_status[step_num] = 'p' # passed result_msg[step_num] = a ########################################################################### def step6_routine(): # os_version global step_status global result_msg step_num = 6 step_status[step_num] = 'r' # running time.sleep(3) print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") a = os.popen("sh os-ver.sh os").read() if str == "os": a = os.popen("sh os-ver.sh os").read() if str == "tpm": a = os.popen("sh os-ver.sh tpm").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() if len(a) == 0: print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed else: print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a ########################################################################### def step7_routine(): # cpu_version global step_status global result_msg step_num = 7 step_status[step_num] = 'r' # running print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") tkMessageBox.showinfo("Message Box", "HDMI test! HDMI测试,如果没有插上HDMI cable,请插上HDMI查看显示器及edp显示状况.") #a = os.popen("sh cpu-ver.sh").read() a = os.popen('sh os-ver.sh HDMI').read() if tkMessageBox.askokcancel("PASS?", "确定HDMI及edp显示是否正常?"): step_status[step_num] = 'p' # passed result_msg[step_num] = 'PASS' return; a = a.replace('\n','') a = a.replace('\r','') a = a.strip() print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed ########################################################################### def step8_routine(): # camera function global step_status global result_msg step_num = 8 step_status[step_num] = 'r' # running #step_status[step_num] = 'p' # passed #result_msg[step_num] = 'AAPASS' #return; tkMessageBox.showinfo("Message Box", "camera test! 相机测试,将弹出相机软件guvcview,手动测试相机是否正常.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") a = os.popen("/usr/bin/guvcview &").read() if tkMessageBox.askokcancel("PASS?", "确定测试相机是否正常?"): print1("camera Test! device test pass!") step_status[step_num] = 'p' # passed result_msg[step_num] = 'PASS' return; a = a.replace('\n','') a = a.replace('\r','') a = a.strip() print1("camera Test Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed def step9_routine(): # speaker-test global step_status global result_msg #tkMessageBox.showinfo("Message Box", "Error on Step " + str(i) + "! See Log for details.") step_num = 9 step_status[step_num] = 'r' # running #step_status[step_num] = 'p' # passed #result_msg[step_num] = 'AAPASS' #return; tkMessageBox.showinfo("Message Box", "test speaker test! 喇叭测试,如果没有喇叭,请插上耳机确定是否有声音.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") a = os.popen("sh os-ver.sh speaker").read() if tkMessageBox.askokcancel("PASS?", "确定测试机器是否有声音?"): step_status[step_num] = 'p' # passed result_msg[step_num] = 'PASS' return; a = a.replace('\n','') a = a.replace('\r','') a = a.strip() print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed def step10_routine(): # arecord global step_status global result_msg step_num = 10 step_status[step_num] = 'r' # running #step_status[step_num] = 'p' # passed #result_msg[step_num] = 'AAPASS' #return; tkMessageBox.showinfo("Message Box", "arecord test! 录音测试,将弹出录音软件Audacity,手动测试录音是否正常.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") a = os.popen("sh os-ver.sh arecord").read() if tkMessageBox.askokcancel("PASS?", "确定测试机器录音是否正常?"): step_status[step_num] = 'p' # passed result_msg[step_num] = 'PASS' return; a = a.replace('\n','') a = a.replace('\r','') a = a.strip() #print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed def step11_routine(): global step_status global result_msg step_num = 11 step_status[step_num] = 'r' # running step_status[step_num] = 'p' # passed result_msg[step_num] = 'AAPASS' return; os.system("sh os-ver.sh USB211 &") time.sleep(1) tkMessageBox.showinfo("Message Box", "USB2.0 test! 请插入U盘到后端usb2.0接口1号位置.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") a = os.popen("sh os-ver.sh USB21").read() print1(a) a = a.replace('\n','') a = a.replace('\r','') a = a.strip() if a == "0": print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed result_msg[step_num] = a else: print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a def step12_routine(): global step_status global result_msg step_num = 12 step_status[step_num] = 'r' # running step_status[step_num] = 'p' # passed result_msg[step_num] = 'AAPASS' return; os.system("sh os-ver.sh USB211 &") time.sleep(1) tkMessageBox.showinfo("Message Box", "USB2.0 test! 请插入U盘到后端usb2.0接口2号位置.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") a = os.popen("sh os-ver.sh USB22").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() if a == "0": print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed result_msg[step_num] = a else: print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a def step13_routine(): global step_status global result_msg step_num = 13 step_status[step_num] = 'r' # running print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started USB3.0 test 1...") os.system("sh os-ver.sh USB211 &") time.sleep(1) tkMessageBox.showinfo("Message Box", "USB3.0 test! 请插入U盘到整个hub全usb3.0接口1号位置-靠近主板.") a = os.popen("sh os-ver.sh USB391").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() print1("\n----------------------------------------------------") #tkMessageBox.showinfo("Message Box", "USB3.0 test! 请插入U盘到后端usb3.0接口4号指定位置.") if a == "0": print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed result_msg[step_num] = a else: print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a def step14_routine(): global step_status global result_msg step_num = 14 step_status[step_num] = 'r' # running print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started USB3.0 test 1...") os.system("sh os-ver.sh USB211 &") time.sleep(1) tkMessageBox.showinfo("Message Box", "USB3.0 test! 请插入U盘到整个hub全usb3.0接口2号位置-靠近主板.") a = os.popen("sh os-ver.sh USB392").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() print1("\n----------------------------------------------------") if a == "0": print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed result_msg[step_num] = a else: print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a def step15_routine(): global step_status global result_msg step_num = 15 step_status[step_num] = 'r' # running print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started USB3.0 test 1...") os.system("sh os-ver.sh USB211 &") time.sleep(1) tkMessageBox.showinfo("Message Box", "USB3.0 test! 请插入U盘到整个hub全usb3.0接口3号位置-靠近主板.") a = os.popen("sh os-ver.sh USB393").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() print1("\n----------------------------------------------------") if a == "0": print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed result_msg[step_num] = a else: print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a def step16_routine(): global step_status global result_msg step_num = 16 step_status[step_num] = 'r' # running print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started USB3.0 test 1...") os.system("sh os-ver.sh USB211 &") time.sleep(1) tkMessageBox.showinfo("Message Box", "USB3.0 test! 请插入U盘到整个hub全usb3.0接口4号位置-靠近主板.") a = os.popen("sh os-ver.sh USB394").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() print1("\n----------------------------------------------------") if a == "0": print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed result_msg[step_num] = a else: print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a def step17_routine(): # network speed cli global step_status global result_msg step_num = 17 step_status[step_num] = 'r' # running step_status[step_num] = 'p' # passed result_msg[step_num] = 'AAPASS' return; tkMessageBox.showinfo("Message Box", "RJ45网口 test! 请插入网线到指定RJ45网口中,再点确定开始测试!.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") step_status[step_num] = 'p' # passed result_msg[step_num] = 'AAPASS' return; a = os.popen("sh os-ver.sh speedcliDownload").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() if len(a) == 0: print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed elif a == "Download: Upload:": print1("Error! no ethernet!") print1(a) step_status[step_num] = 'f' # failed result_msg[step_num] = a else: print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a def step18_routine(): # serial global step_status global result_msg step_num = 18 step_status[step_num] = 'r' # running #tkMessageBox.showinfo("Message Box", "Serial test! 串口基本功能测试是否AAPASS.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") if tkMessageBox.askokcancel("PASS?", "串口基本功能测试是否AAPASS."): step_status[step_num] = 'p' # passed result_msg[step_num] = 'PASS' return; a = os.popen("sh os-ver.sh tpm").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() if len(a) == 0: print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed else: print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a def step19_routine(): # battery global step_status global result_msg step_num = 19 step_status[step_num] = 'r' # running #tkMessageBox.showinfo("Message Box", "battery test! 电池包测试(C180)是否AAPASS.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") step_status[step_num] = 'p' # passed result_msg[step_num] = 'AAPASS' return; tkMessageBox.showinfo("Message Box", "battery test! 电池包测试(C180)是否能正常工作!") a = os.popen("sh os-ver.sh ps2").read() if tkMessageBox.askokcancel("PASS?", "电池包测试(C180)是否正常."): step_status[step_num] = 'p' # passed result_msg[step_num] = 'PASS' return; a = a.replace('\n','') a = a.replace('\r','') a = a.strip() print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed def step20_routine(): global step_status global result_msg step_num = 20 step_status[step_num] = 'r' # running #step_status[step_num] = 'p' # passed #result_msg[step_num] = 'AAPASS' #return; #tkMessageBox.showinfo("Message Box", "play video test! 视频测试,播放720p视频.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") print1("Step " + str(step_num) + " 开始播放720p视频") #a = os.popen("sh os-ver.sh 720p").read() #subprocess.run('sh os-ver.sh 720p',stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) #os.system("sudo setenforce 0") time.sleep(1) os.system("sh os-ver.sh 720p &") time.sleep(2) #os.system("sudo setenforce 1") if not tkMessageBox.askokcancel("PASS?", "视频播放器要关-确定测试机器播放720p视频正常吗?"): os.system("sh os-ver.sh exit &") time.sleep(1) print1("Error! No Device found!") print1("The video is playing abnormally! - 720p video") step_status[step_num] = 'f' # failed return; """ #os.system("systemctl suspend &") #os.system("sh os-ver.sh suspend &") os.system("sh os-ver.sh sudo &") time.sleep(10) if not tkMessageBox.askokcancel("PASS?", "视频播放器不要关-睡眠之后再确定测试机器播放720p视频正常吗?"): print1("Error! No Device found!") print1("The video is playing abnormally! - 720p suspend") step_status[step_num] = 'f' # failed return; print1("Step " + str(step_num) + " 开始是休眠再播放720p视频") #os.system("systemctl hibernate &") #os.system("sh os-ver.sh hibernate &") #os.system("sh os-ver.sh sudo &") #time.sleep(30) if not tkMessageBox.askokcancel("PASS?", "视频播放器要关-休眠之后再确定测试机器播放720p视频正常吗?"): os.system("sh os-ver.sh exit &") time.sleep(1) print1("Error! No Device found!") print1("The video is playing abnormally! - 720p hibernate") step_status[step_num] = 'f' # failed return; """ os.system("sh os-ver.sh exit &") time.sleep(1) print1("The video is playing normally! - 720p") step_status[step_num] = 'p' # passed result_msg[step_num] = 'PASS' def step21_routine(): global step_status global result_msg #tkMessageBox.showinfo("Message Box", "Error on Step " + str(i) + "! See Log for details.") step_num = 21 step_status[step_num] = 'r' # running #step_status[step_num] = 'p' # passed #result_msg[step_num] = 'AAPASS' #return; #tkMessageBox.showinfo("Message Box", "play video test! 视频测试,播放1080p视频.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") print1("Step " + str(step_num) + " 开始播放1080p视频") #a = os.popen("sh os-ver.sh 720p").read() #subprocess.run('sh os-ver.sh 720p',stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) time.sleep(1) os.system("sh os-ver.sh 1080p &") time.sleep(2) if not tkMessageBox.askokcancel("PASS?", "视频播放器要关-确定测试机器播放1080p视频正常吗?"): os.system("sh os-ver.sh exit &") time.sleep(1) print1("Error! No Device found!") print1("The video is playing abnormally! - 1080p video") step_status[step_num] = 'f' # failed return; """ #os.system("sh os-ver.sh suspend &") os.system("sh os-ver.sh sudo &") time.sleep(10) if not tkMessageBox.askokcancel("PASS?", "视频播放器不要关-睡眠之后再确定测试机器播放1080p视频正常吗?"): print1("Error! No Device found!") print1("The video is playing abnormally! - 1080p suspend") step_status[step_num] = 'f' # failed return; print1("Step " + str(step_num) + " 开始是休眠再播放1080p视频") #os.system("sh os-ver.sh hibernate &") #os.system("sh os-ver.sh sudo &") #time.sleep(30) if not tkMessageBox.askokcancel("PASS?", "视频播放器要关-休眠之后再确定测试机器播放1080p视频正常吗?"): os.system("sh os-ver.sh exit &") time.sleep(1) print1("Error! No Device found!") print1("The video is playing abnormally! - 1080p hibernate") step_status[step_num] = 'f' # failed return; """ os.system("sh os-ver.sh exit &") time.sleep(1) print1("The video is playing normally! - 1080p") step_status[step_num] = 'p' # passed result_msg[step_num] = 'PASS' def step22_routine(): global step_status global result_msg #tkMessageBox.showinfo("Message Box", "Error on Step " + str(i) + "! See Log for details.") step_num = 22 step_status[step_num] = 'r' # running #step_status[step_num] = 'p' # passed #result_msg[step_num] = 'AAPASS' #return; #tkMessageBox.showinfo("Message Box", "play video test! 视频测试,播放4K视频.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") print1("Step " + str(step_num) + " 开始播放4K视频") #a = os.popen("sh os-ver.sh 720p").read() #subprocess.run('sh os-ver.sh 720p',stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) time.sleep(1) os.system("sh os-ver.sh 4K &") time.sleep(1) if not tkMessageBox.askokcancel("PASS?", "视频播放器要关-确定测试机器播放4K视频正常吗?"): os.system("sh os-ver.sh exit &") time.sleep(1) print1("Error! No Device found!") print1("The video is playing abnormally! - 4K suspend") step_status[step_num] = 'f' # failed return; """ #os.system("sh os-ver.sh suspend &") os.system("sh os-ver.sh sudo &") #a = os.popen("sh os-ver.sh suspend").read() time.sleep(10) if not tkMessageBox.askokcancel("PASS?", "视频播放器不要关-睡眠之后再确定测试机器播放4K视频正常吗?"): print1("Error! No Device found!") print1("The video is playing abnormally! - 4K hibernate") step_status[step_num] = 'f' # failed return; print1("Step " + str(step_num) + " 开始是休眠再播放4K视频") #os.system("sh os-ver.sh hibernate &") #os.system("sh os-ver.sh sudo &") #time.sleep(30) #a = os.popen("sh os-ver.sh hibernate").read() if not tkMessageBox.askokcancel("PASS?", "视频播放器要关-休眠之后再确定测试机器播放4K视频正常吗?"): os.system("sh os-ver.sh exit &") time.sleep(1) print1("Error! No Device found!") print1("The video is playing abnormally! - 4K hibernate") step_status[step_num] = 'f' # failed return; """ os.system("sh os-ver.sh exit &") time.sleep(1) print1("The video is playing normally! - 4K") step_status[step_num] = 'p' # passed result_msg[step_num] = 'PASS' ######################################################################### def step23_routine(): global step_status global result_msg step_num = 23 step_status[step_num] = 'r' # running os.system("sh os-ver.sh USB211 &") time.sleep(1) tkMessageBox.showinfo("Message Box", "USB3.0 test! 请插入U盘到带网口hub的usb3.0接口1号位置-靠近主板.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") a = os.popen("sh os-ver.sh USB381").read() print1(a) a = a.replace('\n','') a = a.replace('\r','') a = a.strip() if a == "0": print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed result_msg[step_num] = a else: print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a def step24_routine(): global step_status global result_msg step_num = 24 step_status[step_num] = 'r' # running os.system("sh os-ver.sh USB211 &") time.sleep(1) tkMessageBox.showinfo("Message Box", "USB3.0 test! 请插入U盘到带网口hub的usb3.0接口2号位置-靠近主板.") print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started...") a = os.popen("sh os-ver.sh USB382").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() if a == "0": print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed result_msg[step_num] = a else: print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a def step25_routine(): global step_status global result_msg step_num = 25 step_status[step_num] = 'r' # running print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started USB3.0 test 1...") #step_status[step_num] = 'p' # passed #result_msg[step_num] = 'AAPASS' #return; tkMessageBox.showinfo("Message Box", "LED test! 电池健康指示灯/充电指示灯/心跳灯.") time.sleep(1) #os.system("sh os-ver.sh 4K &") time.sleep(1) if not tkMessageBox.askokcancel("PASS?", "LED test-确定电池健康指示灯/充电指示灯/心跳灯正常吗?"): time.sleep(1) print1("Error! No Device found!") print1("The video is playing abnormally! - 4K suspend") step_status[step_num] = 'f' # failed return; time.sleep(1) print1("Battery health indicator/charging indicator/heartbeat light test normally!") step_status[step_num] = 'p' # passed result_msg[step_num] = 'PASS' def step26_routine(): global step_status global result_msg step_num = 26 step_status[step_num] = 'r' # running print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started keyboard test...") step_status[step_num] = 'p' # passed result_msg[step_num] = 'AAPASS' return; #os.system("sh os-ver.sh keyboard") #time.sleep(1) a = os.popen('sh os-ver.sh keyboard').read() if tkMessageBox.askokcancel("PASS?", "确定键盘测试是否正常?"): step_status[step_num] = 'p' # passed result_msg[step_num] = 'PASS' return; a = a.replace('\n','') a = a.replace('\r','') a = a.strip() print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed def step27_routine(): global step_status global result_msg step_num = 27 step_status[step_num] = 'r' # running print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started touchpad test 1...") step_status[step_num] = 'p' # passed result_msg[step_num] = 'AAPASS' return; a = os.popen('sh os-ver.sh TP').read() if tkMessageBox.askokcancel("PASS?", "确定触摸板测试是否正常?"): step_status[step_num] = 'p' # passed result_msg[step_num] = 'PASS' return; a = a.replace('\n','') a = a.replace('\r','') a = a.strip() print1("Error! No Device found!") print1(a) step_status[step_num] = 'f' # failed def step28_routine(): global step_status global result_msg step_num = 28 step_status[step_num] = 'r' # running print1("\n----------------------------------------------------") print1("Step " + str(step_num) + " Started RTC test 1...") #step_status[step_num] = 'p' # passed #result_msg[step_num] = 'AAPASS' #return; time.sleep(1) #tkMessageBox.showinfo("Message Box", "RTC test! RTC电池测试.") a = os.popen("sh os-ver.sh RTCBATTERY").read() a = a.replace('\n','') a = a.replace('\r','') a = a.strip() print1("\n----------------------------------------------------") try: a_int = int(a) if 3000 <= a_int <= 4000: #print1("Error! No Device found!") print1(a) step_status[step_num] = 'p' # passed result_msg[step_num] = a else: print1(a) print1("Error! No Device found!") step_status[step_num] = 'f' # failed result_msg[step_num] = a except ValueError: step_status[step_num] = 'f' # failed result_msg[step_num] = "Invalid output: {a}" #else: # print1("Error! No Device found!") # print1(a) # step_status[step_num] = 'f' # failed # result_msg[step_num] = a #$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ class MasterThread(threading.Thread): def __init__(self, guiobj): super(MasterThread, self).__init__() def run(self): global step_status global script_ver print1("X86 C180####################################################",1) print1(script_ver) step1_routine() if step_status[1] == 'p' or step_status[1] == 'f': # if step 1 passed step2_routine() if step_status[2] == 'p' or step_status[2] == 'f': step3_routine() if step_status[3] == 'p' or step_status[3] == 'f': step4_routine() if step_status[4] == 'p' or step_status[4] == 'f': step5_routine() if step_status[5] == 'p' or step_status[5] == 'f': step6_routine() if step_status[6] == 'p' or step_status[6] == 'f': step7_routine() if step_status[7] == 'p' or step_status[7] == 'f': step8_routine() if step_status[8] == 'p' or step_status[8] == 'f': step9_routine() if step_status[9] == 'p' or step_status[9] == 'f': step10_routine() if step_status[10] == 'p' or step_status[10] == 'f': step11_routine() if step_status[11] == 'p' or step_status[11] == 'f': step12_routine() if step_status[12] == 'p' or step_status[12] == 'f': step13_routine() if step_status[13] == 'p' or step_status[13] == 'f': step14_routine() if step_status[14] == 'p' or step_status[14] == 'f': step15_routine() if step_status[15] == 'p' or step_status[15] == 'f': step16_routine() if step_status[16] == 'p' or step_status[16] == 'f': step17_routine() if step_status[17] == 'p' or step_status[17] == 'f': step18_routine() if step_status[18] == 'p' or step_status[18] == 'f': step19_routine() if step_status[19] == 'p' or step_status[19] == 'f': step20_routine() if step_status[20] == 'p' or step_status[20] == 'f': step21_routine() if step_status[21] == 'p' or step_status[21] == 'f': step22_routine() if step_status[22] == 'p' or step_status[22] == 'f': step23_routine() if step_status[23] == 'p' or step_status[23] == 'f': step24_routine() if step_status[24] == 'p' or step_status[24] == 'f': step25_routine() if step_status[25] == 'p' or step_status[25] == 'f': step26_routine() if step_status[26] == 'p' or step_status[26] == 'f': step27_routine() if step_status[27] == 'p' or step_status[27] == 'f': step28_routine() print1("\n----------------------------------------------------") print1("Test concluded!") #$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ class GuiThread(object): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def __init__(self): global log_file global result_msg self.thread_list = {} self.running=False self.counter=0 self.root = Tk() self.root.geometry("1800x1200") self.root.protocol("WM_DELETE_WINDOW", self.destroy) # when user closes the window self.root.title("WiPER: FT Simular Test") self.note1 = Label(self.root, text="Please press 'Start Test' to begin...", fg='blue') self.button1 = Button(self.root, text="Start Test", command=self.start) self.lbl = Label(self.root, text="NOT STARTED", width=15, bg='gray') self.lbl2 = Label(self.root, text="Device: ",width=20,bg="#C6EBFF") self.nb = ttk.Notebook(self.root, name='notebook') self.textframe1 = Frame(self.root) self.text1 = Text(self.textframe1) self.scrollbar1 = Scrollbar(self.textframe1) self.paramframe = Frame(self.root) self.lblframe = Frame(self.root) #self.step1_lbl1 = Label(self.lblframe, text="Step1: Check BIOS Version ", width=50) self.step1_lbl1 = Label(self.lblframe, text="Step1: 检查BIOS版本号 ", width=50) self.step2_lbl1 = Label(self.lblframe, text="Step2: 检查EC版本号 ", width=50) self.step3_lbl1 = Label(self.lblframe, text="Step3: 检查CPU测试 ", width=50) self.step4_lbl1 = Label(self.lblframe, text="Step4: 检查Memory内存版本号 ", width=50) self.step5_lbl1 = Label(self.lblframe, text="Step5: 检查HDD硬盘版本号 ", width=50) self.step6_lbl1 = Label(self.lblframe, text="Step6: 检查OS操作系统版本号 ", width=50) self.step7_lbl1 = Label(self.lblframe, text="Step7: HDMI功能测试 ", width=50) self.step8_lbl1 = Label(self.lblframe, text="Step8: 相机功能测试 ", width=50) self.step9_lbl1 = Label(self.lblframe, text="Step9: 检查SPEAKER耳机测试 ", width=50) self.step10_lbl1 = Label(self.lblframe, text="Step10: 检查耳机录音测试 ", width=50) self.step11_lbl1 = Label(self.lblframe, text="Step11: 检查usb2.0后接口1U盘基本功能测试 ", width=50) self.step12_lbl1 = Label(self.lblframe, text="Step12: 检查usb2.0后接口2U盘基本功能测试 ", width=50) self.step13_lbl1 = Label(self.lblframe, text="Step13: 检查整个hub全usb3.0接口1号位置基本功能测试 ", width=50) self.step14_lbl1 = Label(self.lblframe, text="Step14: 检查整个hub全usb3.0接口2号位置基本功能测试 ", width=50) self.step15_lbl1 = Label(self.lblframe, text="Step15: 检查整个hub全usb3.0接口3号位置基本功能测试 ", width=50) self.step16_lbl1 = Label(self.lblframe, text="Step16: 检查整个hub全usb3.0接口4号位置基本功能测试 ", width=50) self.step17_lbl1 = Label(self.lblframe, text="Step17: 检查网络在线速度测试 ", width=50) self.step18_lbl1 = Label(self.lblframe, text="Step18: 串口基本功能测试 ", width=50) self.step19_lbl1 = Label(self.lblframe, text="Step19: 电池包测试 ", width=50) self.step20_lbl1 = Label(self.lblframe, text="Step20: 720p视频测试 ", width=50) self.step21_lbl1 = Label(self.lblframe, text="Step21: 1080p视频测试 检查HDD硬盘版本号 ", width=50) self.step22_lbl1 = Label(self.lblframe, text="Step22: 4K视频测试 检查Memory内存版本号 ", width=50) self.step23_lbl1 = Label(self.lblframe, text="Step23: 检查带网口hub的usb3.0接口1号基本功能测试 ", width=50) self.step24_lbl1 = Label(self.lblframe, text="Step24: 检查带网口hub的usb3.0接口2号基本功能测试 ", width=50) self.step25_lbl1 = Label(self.lblframe, text="Step25: 电池健康指示灯/充电指示灯/心跳灯 ", width=50) self.step26_lbl1 = Label(self.lblframe, text="Step26: 外置键盘测试C180 ", width=50) self.step27_lbl1 = Label(self.lblframe, text="Step27: 触摸板测试C180 ", width=50) self.step28_lbl1 = Label(self.lblframe, text="Step28: RTC电池 ", width=50) self.step1_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step2_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step3_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step4_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step5_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step6_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step7_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step8_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step9_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step10_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step11_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step12_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step13_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step14_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step15_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step16_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step17_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step18_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step19_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step20_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step21_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step22_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step23_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step24_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step25_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step26_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step27_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step28_lbl2 = Label(self.lblframe, text="NOT STARTED", bg='gray', width=50) self.step_lbl_list = [] self.step_lbl_list.append('x') # don't care self.step_lbl_list.append(self.step1_lbl2) self.step_lbl_list.append(self.step2_lbl2) self.step_lbl_list.append(self.step3_lbl2) self.step_lbl_list.append(self.step4_lbl2) self.step_lbl_list.append(self.step5_lbl2) self.step_lbl_list.append(self.step6_lbl2) self.step_lbl_list.append(self.step7_lbl2) self.step_lbl_list.append(self.step8_lbl2) self.step_lbl_list.append(self.step9_lbl2) self.step_lbl_list.append(self.step10_lbl2) self.step_lbl_list.append(self.step11_lbl2) self.step_lbl_list.append(self.step12_lbl2) self.step_lbl_list.append(self.step13_lbl2) self.step_lbl_list.append(self.step14_lbl2) self.step_lbl_list.append(self.step15_lbl2) self.step_lbl_list.append(self.step16_lbl2) self.step_lbl_list.append(self.step17_lbl2) self.step_lbl_list.append(self.step18_lbl2) self.step_lbl_list.append(self.step19_lbl2) self.step_lbl_list.append(self.step20_lbl2) self.step_lbl_list.append(self.step21_lbl2) self.step_lbl_list.append(self.step22_lbl2) self.step_lbl_list.append(self.step23_lbl2) self.step_lbl_list.append(self.step24_lbl2) self.step_lbl_list.append(self.step25_lbl2) self.step_lbl_list.append(self.step26_lbl2) self.step_lbl_list.append(self.step27_lbl2) self.step_lbl_list.append(self.step28_lbl2) result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') result_msg.append('P') self.my_io_process = IO_process(log_file) self.readLog1() self.set_param_frame() # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def destroy(self): if tkMessageBox.askokcancel("Quit?", "Are you sure you want to quit?"): self.root.quit() def counter_label(self): def count(): if self.running: global counter if self.counter==0: #66600 display="Starting..." else: tt=datetime.fromtimestamp(self.counter) string=tt.strftime("%H:%M:%S") display=string self.note1.config(text=display) self.note1.after(1000, count) self.counter+=1 count() # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def run(self): self.note1.pack() self.button1.pack(side=TOP, padx = 10, pady = 3) self.lbl.pack() self.lbl2.pack(fill=BOTH,expand=Y) self.scrollbar1.config(command=self.text1.yview) self.text1.config(yscrollcommand=self.scrollbar1.set) self.text1.pack(side=LEFT, fill=Y) self.scrollbar1.pack(side=RIGHT, fill=Y) self.step1_lbl1.grid(row=0,column=0,sticky=W) self.step2_lbl1.grid(row=1,column=0,sticky=W) self.step3_lbl1.grid(row=2,column=0,sticky=W) self.step4_lbl1.grid(row=3,column=0,sticky=W) self.step5_lbl1.grid(row=4,column=0,sticky=W) self.step6_lbl1.grid(row=5,column=0,sticky=W) self.step7_lbl1.grid(row=6,column=0,sticky=W) self.step8_lbl1.grid(row=7,column=0,sticky=W) self.step9_lbl1.grid(row=8,column=0,sticky=W) self.step10_lbl1.grid(row=9,column=0,sticky=W) self.step11_lbl1.grid(row=10,column=0,sticky=W) self.step12_lbl1.grid(row=11,column=0,sticky=W) self.step13_lbl1.grid(row=12,column=0,sticky=W) self.step14_lbl1.grid(row=13,column=0,sticky=W) self.step15_lbl1.grid(row=14,column=0,sticky=W) self.step16_lbl1.grid(row=15,column=0,sticky=W) self.step17_lbl1.grid(row=16,column=0,sticky=W) self.step18_lbl1.grid(row=17,column=0,sticky=W) self.step19_lbl1.grid(row=18,column=0,sticky=W) self.step20_lbl1.grid(row=19,column=0,sticky=W) self.step21_lbl1.grid(row=20,column=0,sticky=W) self.step22_lbl1.grid(row=21,column=0,sticky=W) self.step23_lbl1.grid(row=22,column=0,sticky=W) self.step24_lbl1.grid(row=23,column=0,sticky=W) self.step25_lbl1.grid(row=24,column=0,sticky=W) self.step26_lbl1.grid(row=25,column=0,sticky=W) self.step27_lbl1.grid(row=26,column=0,sticky=W) self.step28_lbl1.grid(row=27,column=0,sticky=W) self.step1_lbl2.grid(row=0,column=1,sticky=W) self.step2_lbl2.grid(row=1,column=1,sticky=W) self.step3_lbl2.grid(row=2,column=1,sticky=W) self.step4_lbl2.grid(row=3,column=1,sticky=W) self.step5_lbl2.grid(row=4,column=1,sticky=W) self.step6_lbl2.grid(row=5,column=1,sticky=W) self.step7_lbl2.grid(row=6,column=1,sticky=W) self.step8_lbl2.grid(row=7,column=1,sticky=W) self.step9_lbl2.grid(row=8,column=1,sticky=W) self.step10_lbl2.grid(row=9,column=1,sticky=W) self.step11_lbl2.grid(row=10,column=1,sticky=W) self.step12_lbl2.grid(row=11,column=1,sticky=W) self.step13_lbl2.grid(row=12,column=1,sticky=W) self.step14_lbl2.grid(row=13,column=1,sticky=W) self.step15_lbl2.grid(row=14,column=1,sticky=W) self.step16_lbl2.grid(row=15,column=1,sticky=W) self.step17_lbl2.grid(row=16,column=1,sticky=W) self.step18_lbl2.grid(row=17,column=1,sticky=W) self.step19_lbl2.grid(row=18,column=1,sticky=W) self.step20_lbl2.grid(row=19,column=1,sticky=W) self.step21_lbl2.grid(row=20,column=1,sticky=W) self.step22_lbl2.grid(row=21,column=1,sticky=W) self.step23_lbl2.grid(row=22,column=1,sticky=W) self.step24_lbl2.grid(row=23,column=1,sticky=W) self.step25_lbl2.grid(row=24,column=1,sticky=W) self.step26_lbl2.grid(row=25,column=1,sticky=W) self.step27_lbl2.grid(row=26,column=1,sticky=W) self.step28_lbl2.grid(row=27,column=1,sticky=W) self.lblframe.pack() self.textframe1.pack() self.paramframe.pack() self.nb.add(self.lblframe, text='Status') self.nb.add(self.textframe1, text='Log') self.nb.add(self.paramframe, text='Parameters') self.nb.enable_traversal() # enable keyboard traversal using Ctrl+Tab self.nb.pack(fill=BOTH, expand="true", padx=5, pady=1) self.root.mainloop() # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def readLog1(self): # This function periodically reads and empties the log buffer global log1_buffer if log1_buffer != "": self.text1.insert(END, log1_buffer) text = self.my_io_process.read_file() if text != "": self.text1.insert(END, text) if log1_buffer != "" or text != "": # if log buffer was populated self.text1.yview_pickplace("end") # move the scrollbar to the bottom log1_buffer = "" # empty the log buffer self.root.update() # update the screen self.root.after(100, self.readLog1) ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def set_param_frame(self): global params_dict self.L = [] self.E = [] count = 1 for key,value in params_dict.iteritems(): lbl = Label(self.paramframe, text=key) enty = Entry(self.paramframe, bd = 4) enty.delete(0, END) enty.insert(0,value) enty.config(state=DISABLED) lbl.grid(row=count, sticky=W) enty.grid(row=count, column=1) self.L.append(lbl) self.E.append(enty) count = count + 1 ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def start(self): global step_status running=True #self.counter_label() #step_status = ['x', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns'] # step_status = ['x', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns', 'ns'] # self.button1.config(state=DISABLED) # disable the start button self.text1.delete('1.0', 'end') # delete the log self.my_io_process.reset_counter() self.thread_list['thread'] = MasterThread(self) self.thread_list['thread'].start() self.manage() self.manage_lblframe() ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def manage(self): # manage the pop-up dialog boxes global step_status total_no_of_steps = len(step_status) - 1 flag = 0 count = 0 for i in range(1,total_no_of_steps+1): if step_status[i] == 'f': # if failed #tkMessageBox.showinfo("Message Box", "Error on Step " + str(i) + "! See Log for details.") print1("Error on Step " + str(i) + "! See Log for details.") flag = 1 time.sleep(1) write_log_to_file(self.text1.get('1.0', 'end')) print1("Log written to the external txt file under ./Logs/") if step_status[i] == 'p' or step_status[i] == 'f': # if passed count = count + 1 if count == total_no_of_steps: # if all the steps were successful flag = 1 tkMessageBox.showinfo("Message Box", "Test succesfully done!") #Please safely remove the device from the chamber. print1("Test succesfully done! Please safely remove the device from the chamber.") time.sleep(1) write_log_to_file(self.text1.get('1.0', 'end')) print1("Log written to the external txt file under ./Logs/") self.running=False self.counter=0 if flag == 0: # if not(any step failed or all steps passed) self.root.after(500, self.manage) else: # if any step has failed or if all the steps have passed self.button1.config(state=NORMAL) # enable the start button self.my_io_process.empty_file() return 0 ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def manage_lblframe(self): # manage the frame that displays the step-by-step status # manage the top-level status Label global step_status global device_info global result_msg total_no_of_steps = len(step_status) - 1 try: SrNo = device_info['SrNo'] string = "Device: " + SrNo self.lbl2.config(text=string) except: string = "Device: " self.lbl2.config(text=string) flag = 0 count1 = 0 count2 = 0 count3 = 0 #self.counter_label() for i in range (1,total_no_of_steps + 1): if step_status[i] == 'r': # if running self.step_lbl_list[i]["text"] = "RUNNING..." self.step_lbl_list[i]["bg"] = 'yellow' self.lbl.config(bg='yellow') self.lbl.config(text='RUNNING...') self.running=True #self.counter_label() if step_status[i] == 'p': # if passed self.step_lbl_list[i]["text"] = result_msg[i] self.step_lbl_list[i]["bg"] = 'green' count2 = count2 + 1 if step_status[i] == 'f': # if failed self.step_lbl_list[i]["text"] = "ERROR!" self.step_lbl_list[i]["bg"] = 'red' self.lbl.config(bg='red') self.lbl.config(text='ERROR!') #flag = 1 count3 = count3 + 1 if step_status[i] == 'ns': # if not started self.step_lbl_list[i]["text"] = "NOT STARTED" self.step_lbl_list[i]["bg"] = 'gray' count1 = count1 + 1 if count1 == total_no_of_steps: # if none of the steps have started self.lbl.config(bg='gray') self.lbl.config(text='NOT STARTED') if count2 == total_no_of_steps: # if all the steps are done self.lbl.config(bg='green') self.lbl.config(text='DONE!') flag = 1 if flag == 0: # if there is no error and all the steps aren't done yet self.root.after(200, self.manage_lblframe) else: # if there is an error or if all the steps are done already device_info['SrNo'] = "" return 0 ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ if __name__ == "__main__": g = GuiThread() g.run()