def run_expt(expt): global w if os.name == 'nt': # For windows OS w.eye.fd.close() # Close hardware port cmd = sys.executable + ' ' + eyeplot.abs_path() + expt+'.py' os.system(cmd) w.eye = eyes.open() # Open hardware port again showhelp('Finished ' + expt) else: #print abs_path() + expt+'.py' stat,out = subprocess.getstatusoutput('python '+ eyeplot.abs_path() + expt+'.py') if stat != 0: showhelp(out) else: showhelp('Finished "'+expt+'.py"') w.eye.disable_actions()
def run_expt(expt): global w w.eye.fd.close() # Close hardware port if os.name == 'nt': # For windows OS cmd = sys.executable + ' ' + eyeplot.abs_path() + expt+'.py' os.system(cmd) showhelp(_('Finished ') + expt) else: #print abs_path() + expt+'.py' stat,out = commands.getstatusoutput('python '+ eyeplot.abs_path() + expt+'.py') if stat != 0: showhelp(out) else: showhelp(_('Finished "')+expt+'.py"') w.eye = eyes.open() # Open hardware port again w.eye.disable_actions()
def run_expt(expt): global w w.eye.fd.close() # Close hardware port if os.name == "nt": # For windows OS cmd = sys.executable + " " + eyeplot.abs_path() + expt + ".py" os.system(cmd) showhelp(_("Finished ") + expt) else: # print abs_path() + expt+'.py' stat, out = commands.getstatusoutput("python " + eyeplot.abs_path() + expt + ".py") if stat != 0: showhelp(out) else: showhelp(_('Finished "') + expt + '.py"') w.eye = eyes.open() # Open hardware port again w.eye.disable_actions()
def run_expt(expt): global w w.eye.fd.close() # Close hardware port cmd = sys.executable + ' ' + eyeplot.abs_path() + expt+'.py' os.system(cmd) showhelp(_('Finished ') + expt) w.eye = eyes.open() # Open hardware port again w.eye.disable_actions()
def run_expt(expt): global p if expt == '': return p.fd.close() # Free the device from this program, the child will open it cmd = sys.executable + ' ' + eyeplot.abs_path() + expt+'.py' os.system(cmd) msg(_('Finished "')+expt+'.py"') p = eyes.open() # Establish hardware communication again, for the parent p.disable_actions()
def __init__(self, parent, handle, width=WIDTH, height = HEIGHT): self.eye = handle self.parent = parent self.width = width self.height = height self.border = BORDER # Top and bottom self.border self.fw = float(width)/12.7 # field width self.fh = float(height - 2 * self.border)/16 # field height im = Image.open(eyeplot.abs_path()+ picture) im = im.resize((int(width),int(height))) self.image = ImageTk.PhotoImage(im) self.panel = Canvas(parent, width = width, height = height) self.panel.create_image(0,0,image = self.image, anchor = NW) self.popup = Button(text = _('EXPERIMENTS'), bg=pgreen) self.popup.bind("<ButtonRelease-1>", self.pop_expt_menu) self.panel.create_window(width/2, height-20, window = self.popup, anchor = CENTER) self.panel.bind("<ButtonRelease-1>", self.clicked) self.panel.bind("<ButtonRelease-3>", self.pop_expt_menu) self.panel.pack(side=TOP, anchor=SW) for i in self.LE: # Text Entry Fields on left x,y = self.xyfromi(i) self.tw[i] = Entry(width = 8, bg = 'white', fg='blue') self.tw[i].bind("<Return>", self.process) self.tw[i].bind("<KP_Enter>", self.process) self.panel.create_window(3.5*self.fw, y, window = self.tw[i], anchor = W) for i in self.LL: # Label widgets on left x,y = self.xyfromi(i) self.tw[i] = Label(width = 8, bg = pgreen, fg='blue', bd=1) self.tw[i].bind("<Return>", self.process) self.tw[i].bind("<KP_Enter>", self.process) if i == 8: y -= 12 self.panel.create_window(3.5*self.fw, y, window = self.tw[i], anchor = W) for i in self.RE: # Text Entry Fields on right x,y = self.xyfromi(i) self.tw[i] = Entry(width = 8, bg = 'white', fg='blue') self.tw[i].bind("<Return>", self.process) self.tw[i].bind("<KP_Enter>", self.process) self.panel.create_window(width-3*self.fw, y, window = self.tw[i], anchor = E) for i in self.RL: # Text Entry Fields on right x,y = self.xyfromi(i) self.tw[i] = Label(width = 8, bg = pgreen, fg='blue', bd=1) self.tw[i].bind("<Return>", self.process) self.tw[i].bind("<KP_Enter>", self.process) if i == 27 or i == 22: y -= 12 self.panel.create_window(width-3*self.fw, y, window = self.tw[i], anchor = E) for i in range(2): x,y = self.xyfromi(i+3) self.doutval[i] = IntVar() self.doutCB[i] = Checkbutton(bg = 'red', variable = self.doutval[i], \ command = lambda i=i : self.checked(i)) self.panel.create_window(3.5*self.fw, y, window = self.doutCB[i], anchor = W) self.doutCB[i].config(text=_('LO'),bg='gray') x,y = self.xyfromi(28) self.panel.create_line([width-self.fw, y, width-3*self.fw, y+self.fh/2], fill= pgreen) x,y = self.xyfromi(23) self.panel.create_line([width-self.fw, y, width-3*self.fw, y+self.fh/2], fill= pgreen) x,y = self.xyfromi(7) self.panel.create_line([self.fw, y, 3.5*self.fw, y+self.fh/2], fill= pgreen) x,y = self.xyfromi(1) self.FRB = Button(bg = 'gray', text ='F', padx=0, pady=0, command = self.freq_id0) self.panel.create_window(3.0*self.fw, y, window = self.FRB, anchor = W) self.DCB = Button(bg = 'gray', text ='%', padx=0, pady=0, command = self.duty_cycle) self.panel.create_window(5.5*self.fw, y, window = self.DCB, anchor = W) x,y = self.xyfromi(15) self.FRB = Button(bg = 'gray', text ='F', padx=0, pady=0, command = self.freq_ampin) self.panel.create_window(3.0*self.fw, y, window = self.FRB, anchor = W) x,y = self.xyfromi(22) self.FRB = Button(bg = 'gray', text ='F', padx=0, pady=0, command = self.freq_adc5) self.panel.create_window(width-6.2*self.fw, y, window = self.FRB, anchor = SW) self.looping = True
NC =2 else: NC = 1 def lissa_mode(): global lissa,delay, NP, NC, VPERDIV lissa = LIZ.get() if lissa == 1: lissa = True else: g.setWorld(0,-5*VPERDIV, NP * delay * 0.001, 5*VPERDIV,_('mS'),'V') # Restore old scale lissa = False #-----------------------------main program starts here----------------------------- for k in range(10): # Test the hardware availability by by running another program. stat,out = commands.getstatusoutput('python '+ eyeplot.abs_path() + 'hwtest.py') if stat == 0: break pe = eyes.open() # Try several times to make a connection root = Tk() left = Frame(root) # Divide root window into Left and Right left.pack(side=LEFT, anchor = S) right = Frame(root) right.pack(side = LEFT, anchor = S, fill = Y), w=eyePanel(left, pe, WIDTH, HEIGHT) # Panel photograph to the Left Panel g = eyeplot.graph(right, WIDTH*1.05, HEIGHT*2./3,color = 'white', labels=False) # Plot window g.setWorld(0,-5*VPERDIV, NP * delay * 0.001, 5*VPERDIV,_('mS'),'V')
os.system(cmd) w.eye = eyes.open() # Open hardware port again showhelp('Finished ' + expt) else: #print abs_path() + expt+'.py' stat,out = subprocess.getstatusoutput('python '+ eyeplot.abs_path() + expt+'.py') if stat != 0: showhelp(out) else: showhelp('Finished "'+expt+'.py"') w.eye.disable_actions() #-----------------------------main program starts here----------------------------- if __name__=="__main__": for k in range(20): # Test the hardware availability by by running another program. stat,out = subprocess.getstatusoutput('python '+ eyeplot.abs_path() + 'hwtest.py') print(stat) if stat == 0: break pe = eyes.open() # Try several times to make a connection root = Tk() left = Frame(root) # Divide root window into Left and Right left.pack(side=LEFT, anchor = S) right = Frame(root) right.pack(side = LEFT, anchor = S, fill = Y) w=eyePanel(left, pe, WIDTH, HEIGHT) # Panel photograph to the Left Panel g = eyeplot.graph(right, WIDTH*1.05, HEIGHT*2./3,color = 'white', labels=False) # Plot window g.setWorld(0,-5*VPERDIV, NP * delay * 0.001, 5*VPERDIV,'mS','V')
#print abs_path() + expt+'.py' stat, out = subprocess.getstatusoutput('python ' + eyeplot.abs_path() + expt + '.py') if stat != 0: showhelp(out) else: showhelp('Finished "' + expt + '.py"') w.eye.disable_actions() #-----------------------------main program starts here----------------------------- if __name__ == "__main__": for k in range( 20 ): # Test the hardware availability by by running another program. stat, out = subprocess.getstatusoutput('python ' + eyeplot.abs_path() + 'hwtest.py') print(stat) if stat == 0: break pe = eyes.open() # Try several times to make a connection root = Tk() left = Frame(root) # Divide root window into Left and Right left.pack(side=LEFT, anchor=S) right = Frame(root) right.pack(side=LEFT, anchor=S, fill=Y) w = eyePanel(left, pe, WIDTH, HEIGHT) # Panel photograph to the Left Panel g = eyeplot.graph(right,
def __init__(self, parent, handle, width=WIDTH, height = HEIGHT): self.eye = handle self.parent = parent self.width = width self.height = height self.border = BORDER # Top and bottom self.border self.fw = float(width)/12.7 # field width self.fh = float(height - 2 * self.border)/16 # field height im = Image.open(eyeplot.abs_path()+ picture) im = im.resize((int(width),int(height))) self.image = ImageTk.PhotoImage(im) self.panel = Canvas(parent, width = width, height = height) self.panel.create_image(0,0,image = self.image, anchor = NW) self.popup = Button(text = _('EXPERIMENTS'), bg=pgreen) self.popup.bind("<ButtonRelease-1>", self.pop_expt_menu) self.panel.create_window(width/2, height-20, window = self.popup, anchor = CENTER) self.panel.bind("<ButtonRelease-1>", self.clicked) self.panel.bind("<ButtonRelease-3>", self.pop_expt_menu) self.panel.pack(side=TOP, anchor=SW) for i in self.LE: # Text Entry Fields on left x,y = self.xyfromi(i) self.tw[i] = Entry(width = 8, bg = 'white', fg='blue') self.tw[i].bind("<Return>", self.process) self.tw[i].bind("<KP_Enter>", self.process) self.panel.create_window(3.5*self.fw, y, window = self.tw[i], anchor = W) for i in self.LL: # Label widgets on left x,y = self.xyfromi(i) self.tw[i] = Label(width = 8, bg = pgreen, fg='blue', bd=1) self.tw[i].bind("<Return>", self.process) self.tw[i].bind("<KP_Enter>", self.process) if i == 8: y -= 12 self.panel.create_window(3.5*self.fw, y, window = self.tw[i], anchor = W) for i in self.RE: # Text Entry Fields on right x,y = self.xyfromi(i) self.tw[i] = Entry(width = 8, bg = 'white', fg='blue') self.tw[i].bind("<Return>", self.process) self.tw[i].bind("<KP_Enter>", self.process) self.panel.create_window(width-3*self.fw, y, window = self.tw[i], anchor = E) for i in self.RL: # Text Entry Fields on right x,y = self.xyfromi(i) self.tw[i] = Label(width = 8, bg = pgreen, fg='blue', bd=1) self.tw[i].bind("<Return>", self.process) self.tw[i].bind("<KP_Enter>", self.process) if i == 27 or i == 22: y -= 12 self.panel.create_window(width-3*self.fw, y, window = self.tw[i], anchor = E) for i in range(2): x,y = self.xyfromi(i+3) self.doutval[i] = IntVar() self.doutCB[i] = Checkbutton(bg = 'red', variable = self.doutval[i], \ command = lambda i=i : self.checked(i)) self.panel.create_window(3.5*self.fw, y, window = self.doutCB[i], anchor = W) self.doutCB[i].config(text=_('LO'),bg='gray') x,y = self.xyfromi(28) self.panel.create_line([width-self.fw, y, width-3*self.fw, y+self.fh/2], fill= pgreen) x,y = self.xyfromi(23) self.panel.create_line([width-self.fw, y, width-3*self.fw, y+self.fh/2], fill= pgreen) x,y = self.xyfromi(7) self.panel.create_line([self.fw, y, 3.5*self.fw, y+self.fh/2], fill= pgreen) x,y = self.xyfromi(1) self.FRB = Button(bg = 'gray', text =_('F'), padx=0, pady=0, command = self.freq_id0) self.panel.create_window(3.0*self.fw, y, window = self.FRB, anchor = W) self.DCB = Button(bg = 'gray', text ='%', padx=0, pady=0, command = self.duty_cycle) self.panel.create_window(5.5*self.fw, y, window = self.DCB, anchor = W) x,y = self.xyfromi(15) self.FRB = Button(bg = 'gray', text =_('F'), padx=0, pady=0, command = self.freq_ampin) self.panel.create_window(3.0*self.fw, y, window = self.FRB, anchor = W) x,y = self.xyfromi(22) self.FRB = Button(bg = 'gray', text =_('F'), padx=0, pady=0, command = self.freq_adc5) self.panel.create_window(width-6.2*self.fw, y, window = self.FRB, anchor = SW) self.looping = True
NC =2 else: NC = 1 def lissa_mode(): global lissa,delay, NP, NC, VPERDIV lissa = LIZ.get() if lissa == 1: lissa = True else: g.setWorld(0,-5*VPERDIV, NP * delay * 0.001, 5*VPERDIV,_('mS'),_('V')) # Restore old scale lissa = False #-----------------------------main program starts here----------------------------- for k in range(10): # Test the hardware availability by by running another program. stat,out = commands.getstatusoutput('python '+ eyeplot.abs_path() + 'hwtest.py') if stat == 0: break pe = eyes.open() # Try several times to make a connection root = Tk() left = Frame(root) # Divide root window into Left and Right left.pack(side=LEFT, anchor = S) right = Frame(root) right.pack(side = LEFT, anchor = S, fill = Y), w=eyePanel(left, pe, WIDTH, HEIGHT) # Panel photograph to the Left Panel g = eyeplot.graph(right, WIDTH*1.05, HEIGHT*2./3,color = 'white', labels=False) # Plot window g.setWorld(0,-5*VPERDIV, NP * delay * 0.001, 5*VPERDIV,_('mS'),_('V'))
NC = 1 def lissa_mode(): global lissa, delay, NP, NC, VPERDIV lissa = LIZ.get() if lissa == 1: lissa = True else: g.setWorld(0, -5 * VPERDIV, NP * delay * 0.001, 5 * VPERDIV, _("mS"), _("V")) # Restore old scale lissa = False # -----------------------------main program starts here----------------------------- for k in range(10): # Test the hardware availability by by running another program. stat, out = commands.getstatusoutput("python " + eyeplot.abs_path() + "hwtest.py") if stat == 0: break pe = eyes.open() # Try several times to make a connection root = Tk() left = Frame(root) # Divide root window into Left and Right left.pack(side=LEFT, anchor=S) right = Frame(root) right.pack(side=LEFT, anchor=S, fill=Y), w = eyePanel(left, pe, WIDTH, HEIGHT) # Panel photograph to the Left Panel g = eyeplot.graph(right, WIDTH * 1.05, HEIGHT * 2.0 / 3, color="white", labels=False) # Plot window g.setWorld(0, -5 * VPERDIV, NP * delay * 0.001, 5 * VPERDIV, _("mS"), _("V"))