1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
import sys
import Tkinter
import TestingToolsLib
#Librairie de test C/C++
libtest = TestingToolsLib.TestingToolsLib()
#Classe GUI pour le test audio
class GUI_Audio(Tkinter.Tk):
def __init__(self,parent):
Tkinter.Tk.__init__(self,parent)
self.parent = parent
self.initialize()
def initialize(self):
self.grid()
#DISPLAYED MESSAGE TO USER
w = Tkinter.Label(self, text="Did you hear any sound ?", font=("Helvetica", 16),height=3, width=50)
w.grid(column=0,row=0, columnspan=2, sticky='EW')
button = Tkinter.Button(self,text=u"Yes",font=("Helvetica", 16),
command=self.OnButtonClickYes)
button.grid(column=0,row=1, sticky='EW')
button = Tkinter.Button(self,text=u"No",font=("Helvetica", 16),
command=self.OnButtonClickNo)
button.grid(column=1,row=1, sticky='EW')
self.bind_all('<Return>',self.OnKeyYes)
self.bind_all('o',self.OnKeyYes)
self.bind_all('y',self.OnKeyYes)
self.bind_all('n',self.OnKeyNo)
self.protocol("WM_DELETE_WINDOW", self.Myquit)
self.resizable(False,False)
#Center window
self.update()
sw = self.winfo_screenwidth()
sh = self.winfo_screenheight()
w = self.winfo_width()
h = self.winfo_height()
x = (sw - w)/2
y = (sh - h)/2
geom = '%dx%d+%d+%d' % (w, h, x, y)
self.geometry(geom)
self.title('Audio Test')
#RUN TEST
libtest.runTest("Audio")
self.focus_force()
def Myquit(self):
print ""
def OnKeyYes(self, event):
self.OnButtonClickYes()
def OnKeyNo(self, event):
self.OnButtonClickNo()
def OnButtonClickYes(self):
#TEST OK
libtest.addTestResult("Audio","OK")
self.MyExit()
def OnButtonClickNo(self):
#TEST ERROR
libtest.addTestResult("Audio","ERROR")
libtest.notifyError()
self.MyExit()
def MyExit(self):
libtest.reinitDevice()
Tkinter.Tk.destroy(self) |
Partager