| 
									
										
										
										
											2007-06-12 14:29:01 +00:00
										 |  |  | #----------------------------------------------------- SpecJT | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | from Tkinter import * | 
					
						
							|  |  |  | from tkMessageBox import showwarning | 
					
						
							|  |  |  | import time | 
					
						
							|  |  |  | import os | 
					
						
							|  |  |  | import Pmw | 
					
						
							|  |  |  | import Audio | 
					
						
							|  |  |  | import g | 
					
						
							|  |  |  | import string | 
					
						
							|  |  |  | import cPickle | 
					
						
							|  |  |  | #import Numeric | 
					
						
							|  |  |  | from Numeric import zeros, multiarray | 
					
						
							|  |  |  | import Image, ImageTk, ImageDraw | 
					
						
							|  |  |  | from palettes import colormapblue, colormapgray0, colormapHot, \ | 
					
						
							|  |  |  |      colormapAFMHot, colormapgray1, colormapLinrad, Colormap2Palette | 
					
						
							|  |  |  | #import wsjt                         #Is this OK to do? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def hidespecjt(): | 
					
						
							|  |  |  |     root.withdraw() | 
					
						
							| 
									
										
										
										
											2006-01-11 19:04:51 +00:00
										 |  |  |     g.showspecjt=0 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | def showspecjt(): | 
					
						
							|  |  |  |     root.deiconify() | 
					
						
							| 
									
										
										
										
											2006-01-11 19:04:51 +00:00
										 |  |  |     g.showspecjt=2 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | if(__name__=="__main__"): | 
					
						
							|  |  |  |     root = Tk() | 
					
						
							|  |  |  | else: | 
					
						
							|  |  |  |     root=Toplevel() | 
					
						
							|  |  |  |     root.protocol('WM_DELETE_WINDOW',hidespecjt) | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  | root.withdraw() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #-------------------------------------------  Define globals and initialize. | 
					
						
							|  |  |  | b0=0 | 
					
						
							|  |  |  | c0=0 | 
					
						
							|  |  |  | g0=0 | 
					
						
							|  |  |  | g.cmap="Linrad" | 
					
						
							|  |  |  | df=2.69165 | 
					
						
							| 
									
										
										
										
											2006-08-18 19:25:52 +00:00
										 |  |  | fmid=1500 | 
					
						
							|  |  |  | fmid0=1500 | 
					
						
							|  |  |  | frange=2000 | 
					
						
							|  |  |  | frange0=2000 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | isec0=-99 | 
					
						
							|  |  |  | mode0="" | 
					
						
							|  |  |  | mousedf0=0 | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  | mousefqso0=0 | 
					
						
							| 
									
										
										
										
											2007-06-28 18:52:11 +00:00
										 |  |  | dftolerance0=500 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | naxis=IntVar() | 
					
						
							|  |  |  | ncall=0 | 
					
						
							|  |  |  | newMinute=0 | 
					
						
							|  |  |  | nflat=IntVar() | 
					
						
							| 
									
										
										
										
											2006-08-18 19:25:52 +00:00
										 |  |  | nfr=IntVar() | 
					
						
							|  |  |  | nfr.set(1) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | nfreeze0=0 | 
					
						
							|  |  |  | nmark=IntVar() | 
					
						
							|  |  |  | nmark0=0 | 
					
						
							|  |  |  | nn=0 | 
					
						
							|  |  |  | npal=IntVar() | 
					
						
							|  |  |  | npal.set(2) | 
					
						
							|  |  |  | nscroll=0 | 
					
						
							|  |  |  | nspeed0=IntVar() | 
					
						
							|  |  |  | root_geom="" | 
					
						
							|  |  |  | t0="" | 
					
						
							|  |  |  | tol0=400 | 
					
						
							|  |  |  | ttot=0.0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | c=Canvas() | 
					
						
							| 
									
										
										
										
											2007-01-11 17:03:39 +00:00
										 |  |  | NX=750 | 
					
						
							|  |  |  | NY=130 | 
					
						
							|  |  |  | a=zeros(NX*NY,'s') | 
					
						
							|  |  |  | im=Image.new('P',(NX,NY)) | 
					
						
							|  |  |  | line0=Image.new('P',(NX,1))  #Image fragment for top line of waterfall | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | draw=ImageDraw.Draw(im) | 
					
						
							|  |  |  | pim=ImageTk.PhotoImage(im) | 
					
						
							| 
									
										
										
										
											2007-01-09 17:46:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-01-11 17:03:39 +00:00
										 |  |  | a2=zeros(NX*NY,'s') | 
					
						
							|  |  |  | im2=Image.new('P',(NX,NY)) | 
					
						
							|  |  |  | line02=Image.new('P',(NX,1)) #Image fragment for top line of zoomed waterfall | 
					
						
							| 
									
										
										
										
											2007-01-09 17:46:02 +00:00
										 |  |  | draw2=ImageDraw.Draw(im2) | 
					
						
							|  |  |  | pim2=ImageTk.PhotoImage(im2) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | balloon=Pmw.Balloon(root) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def pal_gray0(): | 
					
						
							|  |  |  |     g.cmap="gray0" | 
					
						
							|  |  |  |     im.putpalette(Colormap2Palette(colormapgray0),"RGB") | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |     im2.putpalette(Colormap2Palette(colormapgray0),"RGB") | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | def pal_gray1(): | 
					
						
							|  |  |  |     g.cmap="gray1" | 
					
						
							|  |  |  |     im.putpalette(Colormap2Palette(colormapgray1),"RGB") | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |     im2.putpalette(Colormap2Palette(colormapgray1),"RGB") | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | def pal_linrad(): | 
					
						
							|  |  |  |     g.cmap="Linrad" | 
					
						
							|  |  |  |     im.putpalette(Colormap2Palette(colormapLinrad),"RGB") | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |     im2.putpalette(Colormap2Palette(colormapLinrad),"RGB") | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | def pal_blue(): | 
					
						
							|  |  |  |     g.cmap="blue" | 
					
						
							|  |  |  |     im.putpalette(Colormap2Palette(colormapblue),"RGB") | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |     im2.putpalette(Colormap2Palette(colormapblue),"RGB") | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | def pal_Hot(): | 
					
						
							|  |  |  |     g.cmap="Hot" | 
					
						
							|  |  |  |     im.putpalette(Colormap2Palette(colormapHot),"RGB") | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |     im2.putpalette(Colormap2Palette(colormapHot),"RGB") | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | def pal_AFMHot(): | 
					
						
							|  |  |  |     g.cmap="AFMHot" | 
					
						
							|  |  |  |     im.putpalette(Colormap2Palette(colormapAFMHot),"RGB") | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |     im2.putpalette(Colormap2Palette(colormapAFMHot),"RGB") | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #--------------------------------------------------- Command button routines | 
					
						
							| 
									
										
										
										
											2007-06-22 20:32:58 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | #---------------------------------------------------- fdf_change | 
					
						
							|  |  |  | # Readout of graphical cursor location | 
					
						
							|  |  |  | def fdf_change(event): | 
					
						
							| 
									
										
										
										
											2007-06-22 20:32:58 +00:00
										 |  |  |     df=96.0/750.0 | 
					
						
							|  |  |  |     fmid=122.8                                # empirical | 
					
						
							|  |  |  |     g.Freq=df*(event.x-375) + fmid | 
					
						
							| 
									
										
										
										
											2007-07-04 11:58:39 +00:00
										 |  |  |     n=int(g.Freq+0.5) | 
					
						
							| 
									
										
										
										
											2007-07-04 01:58:22 +00:00
										 |  |  |     t="%d" % (n,) | 
					
						
							|  |  |  |     if g.fc[n] != "": | 
					
						
							|  |  |  |         t=t + ":  " + g.fc[n] | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |     fdf.configure(text=t) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-22 20:32:58 +00:00
										 |  |  | def fdf_change2(event): | 
					
						
							| 
									
										
										
										
											2007-07-09 19:32:50 +00:00
										 |  |  |     g.DFreq=(2200.0/750.0)*(event.x-375) | 
					
						
							| 
									
										
										
										
											2007-06-22 20:32:58 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #---------------------------------------------------- set_fqso | 
					
						
							|  |  |  | def set_fqso(event): | 
					
						
							|  |  |  |     n=int(g.Freq + 0.5) | 
					
						
							|  |  |  |     Audio.gcom2.mousefqso=n | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  |     df_mark() | 
					
						
							| 
									
										
										
										
											2007-06-22 20:32:58 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | #---------------------------------------------------- set_freezedf | 
					
						
							|  |  |  | def set_freezedf(event): | 
					
						
							| 
									
										
										
										
											2007-06-22 20:32:58 +00:00
										 |  |  |     n=int(g.DFreq + 0.5) | 
					
						
							| 
									
										
										
										
											2007-01-08 21:19:41 +00:00
										 |  |  |     Audio.gcom2.mousedf=n | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  |     df_mark() | 
					
						
							| 
									
										
										
										
											2007-07-09 19:32:50 +00:00
										 |  |  |     print 'B',n | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #------------------------------------------------------ ftnstr | 
					
						
							|  |  |  | def ftnstr(x): | 
					
						
							|  |  |  |     y="" | 
					
						
							|  |  |  |     for i in range(len(x)): | 
					
						
							|  |  |  |         y=y+x[i] | 
					
						
							|  |  |  |     return y | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #---------------------------------------------------- df_mark | 
					
						
							|  |  |  | def df_mark(): | 
					
						
							|  |  |  |     draw_axis() | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  | # Mark QSO freq in top graph | 
					
						
							|  |  |  |     color='green' | 
					
						
							|  |  |  |     df=96.0/750.0 | 
					
						
							|  |  |  |     x1=393.0 + (Audio.gcom2.mousefqso-125)/df | 
					
						
							| 
									
										
										
										
											2007-06-28 18:52:11 +00:00
										 |  |  |     c.create_line(x1,25,x1,12,fill=color,width=2) | 
					
						
							| 
									
										
										
										
											2007-07-10 16:02:04 +00:00
										 |  |  |     x1=393.0 + (Audio.gcom2.nfa-125)/df | 
					
						
							|  |  |  |     x2=393.0 + (Audio.gcom2.nfb-125)/df | 
					
						
							|  |  |  |     c.create_line(x1,25,x2,25,fill=color,width=2) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  |     df=96000.0/32768.0 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | # Mark sync tone and top JT65 tone (green) and shorthand tones (red) | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  |     fstep=20.0*11025.0/4096.0 | 
					
						
							|  |  |  |     x1=375.0 + (Audio.gcom2.mousedf + 6.6*fstep)/df | 
					
						
							| 
									
										
										
										
											2007-06-28 18:52:11 +00:00
										 |  |  |     c2.create_line(x1,25,x1,12,fill=color,width=2) | 
					
						
							|  |  |  |     x1=375.0 + (Audio.gcom2.mousedf - Audio.gcom2.dftolerance)/df | 
					
						
							|  |  |  |     x2=375.0 + (Audio.gcom2.mousedf + Audio.gcom2.dftolerance)/df | 
					
						
							|  |  |  |     c2.create_line(x1,25,x2,25,fill=color,width=2) | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  |     for i in range(5): | 
					
						
							|  |  |  |         x1=375.0 + (Audio.gcom2.mousedf + i*fstep)/df | 
					
						
							|  |  |  |         j=12 | 
					
						
							|  |  |  |         if i>0: j=15 | 
					
						
							| 
									
										
										
										
											2007-06-28 18:52:11 +00:00
										 |  |  |         if i!=1: c2.create_line(x1,25,x1,j,fill=color,width=2) | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  |         color='red' | 
					
						
							| 
									
										
										
										
											2006-08-18 19:25:52 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #---------------------------------------------------- freq_range | 
					
						
							|  |  |  | def freq_range(event): | 
					
						
							|  |  |  | # Move frequency scale left or right in 100 Hz increments | 
					
						
							|  |  |  |     global fmid | 
					
						
							|  |  |  |     if event.num==1: | 
					
						
							|  |  |  |         fmid=fmid+100 | 
					
						
							|  |  |  |     else: | 
					
						
							|  |  |  |         if event.num==3: | 
					
						
							|  |  |  |             fmid=fmid-100 | 
					
						
							|  |  |  |     if fmid<1000*nfr.get(): fmid=1000*nfr.get() | 
					
						
							|  |  |  |     if fmid>5000-1000*nfr.get(): fmid=5000-1000*nfr.get() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-28 18:34:13 +00:00
										 |  |  | #---------------------------------------------------- freeze_decode1 | 
					
						
							|  |  |  | def freeze_decode1(event): | 
					
						
							|  |  |  | # If decoder is busy or we are not monitoring, ignore request | 
					
						
							|  |  |  |     if Audio.gcom2.ndecoding==0 or Audio.gcom2.monitoring==0: | 
					
						
							|  |  |  |         set_fqso(event) | 
					
						
							|  |  |  |         g.freeze_decode=1 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #---------------------------------------------------- freeze_decode2 | 
					
						
							|  |  |  | def freeze_decode2(event): | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | # If decoder is busy or we are not monitoring, ignore request | 
					
						
							| 
									
										
										
										
											2007-01-08 21:19:41 +00:00
										 |  |  |     if Audio.gcom2.ndecoding==0 or Audio.gcom2.monitoring==0: | 
					
						
							|  |  |  |         set_freezedf(event) | 
					
						
							|  |  |  |         g.freeze_decode=1 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #---------------------------------------------------- update | 
					
						
							|  |  |  | def update(): | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |     global a,a2,b0,c0,g0,im,im2,isec0,line0,line02,newMinute,\ | 
					
						
							| 
									
										
										
										
											2007-07-10 16:02:04 +00:00
										 |  |  |            nscroll,pim,pim2,nfa0,nfb0, \ | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  |            root_geom,t0,mousedf0,mousefqso0,nfreeze0,tol0,mode0,nmark0, \ | 
					
						
							| 
									
										
										
										
											2007-06-28 18:52:11 +00:00
										 |  |  |            fmid,fmid0,frange,frange0,dftolerance0 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |      | 
					
						
							|  |  |  |     utc=time.gmtime(time.time()+0.1*Audio.gcom1.ndsec) | 
					
						
							|  |  |  |     isec=utc[5] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if isec != isec0:                           #Do once per second | 
					
						
							|  |  |  |         isec0=isec | 
					
						
							|  |  |  |         t0=time.strftime('%H:%M:%S',utc) | 
					
						
							|  |  |  |         ltime.configure(text=t0) | 
					
						
							|  |  |  |         root_geom=root.geometry() | 
					
						
							|  |  |  |         g.rms=Audio.gcom1.rms | 
					
						
							|  |  |  |         if isec==0: nscroll=0 | 
					
						
							|  |  |  |         if isec==59: newMinute=1 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-01-11 19:04:51 +00:00
										 |  |  |     if g.showspecjt==1: | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |         showspecjt() | 
					
						
							|  |  |  |     nspeed=nspeed0.get()                        #Waterfall update rate | 
					
						
							|  |  |  |     brightness=sc1.get() | 
					
						
							|  |  |  |     contrast=sc2.get() | 
					
						
							|  |  |  |     g0=sc3.get() | 
					
						
							| 
									
										
										
										
											2007-01-12 17:57:41 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     newspec=Audio.gcom2.newspec                   #True if new data available | 
					
						
							|  |  |  |     if newspec: | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |         Audio.spec(brightness,contrast,g0,nspeed,a,a2) #Call Fortran routine spec | 
					
						
							| 
									
										
										
										
											2007-07-03 18:58:29 +00:00
										 |  |  |         n=Audio.gcom2.nlines | 
					
						
							|  |  |  |         box=(0,0,NX,130-n)                  #Define region | 
					
						
							|  |  |  |         region=im.crop(box)                 #Get all but last line(s) | 
					
						
							|  |  |  |         region2=im2.crop(box)               #Get all but last line(s) | 
					
						
							|  |  |  |         box=(125,0,624,120) | 
					
						
							|  |  |  |         try: | 
					
						
							|  |  |  |             im.paste(region,(0,n))          #Move waterfall down | 
					
						
							|  |  |  |             im2.paste(region2,(0,n))        #Move waterfall down | 
					
						
							|  |  |  |         except: | 
					
						
							|  |  |  |             print "Images did not match, continuing anyway." | 
					
						
							|  |  |  |         for i in range(n): | 
					
						
							|  |  |  |             line0.putdata(a[NX*i:NX*(i+1)]) #One row of pixels to line0 | 
					
						
							|  |  |  |             im.paste(line0,(0,i))           #Paste in new top line(s) | 
					
						
							|  |  |  |             line02.putdata(a2[NX*i:NX*(i+1)])#One row of pixels to line0 | 
					
						
							|  |  |  |             im2.paste(line02,(0,i))         #Paste in new top line(s) | 
					
						
							|  |  |  |         nscroll=nscroll+n | 
					
						
							| 
									
										
										
										
											2007-07-04 18:44:10 +00:00
										 |  |  |         b0=brightness                       #Save scale values | 
					
						
							|  |  |  |         c0=contrast | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-01-12 17:57:41 +00:00
										 |  |  |     if newspec: | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |         if Audio.gcom2.monitoring: | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |             if newMinute: | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |                 draw.line((0,0,749,0),fill=128)     #Draw the minute separator | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |                 draw2.line((0,0,749,0),fill=128)    #Draw the minute separator | 
					
						
							| 
									
										
										
										
											2007-01-14 16:53:10 +00:00
										 |  |  | #            if nscroll == 13: | 
					
						
							|  |  |  | #                draw.text((5,2),t0[0:5],fill=253)   #Insert time label | 
					
						
							|  |  |  | #                draw2.text((5,2),t0[0:5],fill=253)  #Insert time label | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |             draw.line((0,0,749,0),fill=128)     #Draw the minute separator | 
					
						
							|  |  |  |             draw2.line((0,0,749,0),fill=128)    #Draw the minute separator | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-01-14 16:53:10 +00:00
										 |  |  |         t=g.ftnstr(Audio.gcom2.utcdata) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-28 20:03:52 +00:00
										 |  |  | # This test shouldn.t be needed, but ... | 
					
						
							|  |  |  |         try: | 
					
						
							|  |  |  |             draw.text((4,1),t[0:5],fill=253)   #Insert time label | 
					
						
							|  |  |  |             draw2.text((4,1),t[0:5],fill=253)  #Insert time label | 
					
						
							|  |  |  |         except: | 
					
						
							|  |  |  |             pass | 
					
						
							| 
									
										
										
										
											2007-01-14 16:53:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-27 14:11:33 +00:00
										 |  |  |         pim=ImageTk.PhotoImage(im)              #Convert Image to PhotoImage | 
					
						
							|  |  |  |         graph1.delete(ALL) | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |         pim2=ImageTk.PhotoImage(im2)            #Convert Image to PhotoImage | 
					
						
							|  |  |  |         graph2.delete(ALL) | 
					
						
							| 
									
										
										
										
											2005-12-27 14:11:33 +00:00
										 |  |  |         #For some reason, top two lines are invisible, so we move down 2 | 
					
						
							|  |  |  |         graph1.create_image(0,0+2,anchor='nw',image=pim) | 
					
						
							| 
									
										
										
										
											2007-01-15 02:28:58 +00:00
										 |  |  |         graph2.create_image(0,0+2,anchor='nw',image=pim2)         | 
					
						
							| 
									
										
										
										
											2007-01-14 00:44:34 +00:00
										 |  |  |         g.ndecphase=2 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |         newMinute=0 | 
					
						
							| 
									
										
										
										
											2007-01-12 17:57:41 +00:00
										 |  |  |         Audio.gcom2.newspec=0 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  |     if (Audio.gcom2.mousedf != mousedf0 or | 
					
						
							| 
									
										
										
										
											2007-06-28 18:52:11 +00:00
										 |  |  |             Audio.gcom2.mousefqso != mousefqso0 or | 
					
						
							| 
									
										
										
										
											2007-07-10 16:02:04 +00:00
										 |  |  |             Audio.gcom2.dftolerance != dftolerance0 or | 
					
						
							|  |  |  |             Audio.gcom2.nfa != nfa0 or Audio.gcom2.nfb != nfb0):  | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |         df_mark() | 
					
						
							|  |  |  | # The following int() calls are to ensure that the values copied to | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  | # mousedf0 and mousefqso0 are static. | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |         mousedf0=int(Audio.gcom2.mousedf) | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  |         mousefqso0=int(Audio.gcom2.mousefqso) | 
					
						
							| 
									
										
										
										
											2007-06-28 18:52:11 +00:00
										 |  |  |         dftolerance0=int(Audio.gcom2.dftolerance) | 
					
						
							| 
									
										
										
										
											2007-07-10 16:02:04 +00:00
										 |  |  |         nfa0=int(Audio.gcom2.nfa) | 
					
						
							|  |  |  |         nfb0=int(Audio.gcom2.nfb) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if Audio.gcom2.nfreeze != nfreeze0: | 
					
						
							|  |  |  |         if not Audio.gcom2.nfreeze: draw_axis() | 
					
						
							|  |  |  |         if Audio.gcom2.nfreeze: df_mark() | 
					
						
							|  |  |  |         nfreeze0=int(Audio.gcom2.nfreeze) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if g.mode!=mode0: | 
					
						
							| 
									
										
										
										
											2007-07-10 00:15:11 +00:00
										 |  |  |         df_mark()                        ### was draw_axis() | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |         mode0=g.mode | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if nmark.get()!=nmark0: | 
					
						
							|  |  |  |         df_mark() | 
					
						
							|  |  |  |         nmark0=nmark.get() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-30 14:28:31 +00:00
										 |  |  | #    if newspec: Audio.gcom2.ndiskdat=0 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |     Audio.gcom2.nlines=0 | 
					
						
							|  |  |  |     Audio.gcom2.nflat=nflat.get() | 
					
						
							| 
									
										
										
										
											2006-08-18 19:25:52 +00:00
										 |  |  |     frange=nfr.get()*2000 | 
					
						
							|  |  |  |     if(fmid<>fmid0 or frange<>frange0): | 
					
						
							|  |  |  |         if fmid<1000*nfr.get(): fmid=1000*nfr.get() | 
					
						
							|  |  |  |         if fmid>5000-1000*nfr.get(): fmid=5000-1000*nfr.get() | 
					
						
							| 
									
										
										
										
											2006-09-19 18:55:21 +00:00
										 |  |  |         df_mark() | 
					
						
							| 
									
										
										
										
											2006-08-18 19:25:52 +00:00
										 |  |  |         fmid0=fmid | 
					
						
							|  |  |  |         frange0=frange | 
					
						
							|  |  |  |     Audio.gcom2.nfmid=int(fmid) | 
					
						
							|  |  |  |     Audio.gcom2.nfrange=int(frange) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |     ltime.after(200,update)                      #Reset the timer | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #-------------------------------------------------------- draw_axis | 
					
						
							|  |  |  | def draw_axis(): | 
					
						
							|  |  |  |     c.delete(ALL) | 
					
						
							| 
									
										
										
										
											2007-01-14 16:53:10 +00:00
										 |  |  |     xmid=125.0 - 2.3                            #Empirical | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |     bw=96.0 | 
					
						
							| 
									
										
										
										
											2007-01-14 16:53:10 +00:00
										 |  |  |     x1=int(xmid-0.6*bw) | 
					
						
							|  |  |  |     x2=int(xmid+0.6*bw) | 
					
						
							| 
									
										
										
										
											2007-01-14 01:44:13 +00:00
										 |  |  |     xdf=bw/NX                                    #128 Hz | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |     for ix in range(x1,x2,1): | 
					
						
							|  |  |  |         i=0.5*NX + (ix-xmid)/xdf | 
					
						
							|  |  |  |         j=20 | 
					
						
							|  |  |  |         if (ix%5)==0: j=16 | 
					
						
							|  |  |  |         if (ix%10)==0 : | 
					
						
							|  |  |  |             j=16 | 
					
						
							|  |  |  |             x=i-1 | 
					
						
							|  |  |  |             if ix<100: x=x+1 | 
					
						
							|  |  |  |             y=8 | 
					
						
							|  |  |  |             c.create_text(x,y,text=str(ix)) | 
					
						
							|  |  |  |         c.create_line(i,25,i,j,fill='black') | 
					
						
							| 
									
										
										
										
											2007-01-11 17:03:39 +00:00
										 |  |  |              | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  |     c2.delete(ALL) | 
					
						
							|  |  |  |     xmid2=0 | 
					
						
							|  |  |  |     bw2=750.0*96000.0/32768.0                     #approx 2197.27 Hz | 
					
						
							|  |  |  |     x1=int(xmid-0.5*bw2)/100 - 1 | 
					
						
							|  |  |  |     x1=100*x1 | 
					
						
							|  |  |  |     x2=int(xmid+0.5*bw2) | 
					
						
							|  |  |  |     xdf2=bw2/NX | 
					
						
							|  |  |  |     for ix in range(x1,x2,20): | 
					
						
							|  |  |  |         i=0.5*NX + (ix-xmid2)/xdf2 | 
					
						
							|  |  |  |         j=20 | 
					
						
							|  |  |  | #        if (ix%5)==0: j=16 | 
					
						
							|  |  |  |         if (ix%100)==0 : | 
					
						
							|  |  |  |             j=16 | 
					
						
							|  |  |  |             x=i-1 | 
					
						
							|  |  |  |             if ix<1000: x=x+2 | 
					
						
							|  |  |  |             if ix<0: x=x-2 | 
					
						
							|  |  |  |             y=8 | 
					
						
							|  |  |  |             c2.create_text(x,y,text=str(ix)) | 
					
						
							|  |  |  |         c2.create_line(i,25,i,j,fill='black') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | #-------------------------------------------------------- Create GUI widgets | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #-------------------------------------------------------- Menu bar | 
					
						
							|  |  |  | frame = Frame(root) | 
					
						
							|  |  |  | frame.pack() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | mbar = Frame(frame) | 
					
						
							|  |  |  | mbar.pack(fill=X) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-25 20:18:43 +00:00
										 |  |  | #--------------------------------------------------------- Palette menu | 
					
						
							|  |  |  | setupbutton = Menubutton(mbar, text = 'Palette', ) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | setupbutton.pack(side = LEFT) | 
					
						
							| 
									
										
										
										
											2007-06-25 20:18:43 +00:00
										 |  |  | setupmenu = Menu(setupbutton,tearoff=0) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | setupbutton['menu'] = setupmenu | 
					
						
							| 
									
										
										
										
											2007-06-25 20:18:43 +00:00
										 |  |  | setupmenu.add_radiobutton(label='Gray0',command=pal_gray0, | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |             value=0,variable=npal) | 
					
						
							| 
									
										
										
										
											2007-06-25 20:18:43 +00:00
										 |  |  | setupmenu.add_radiobutton(label='Gray1',command=pal_gray1, | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |             value=1,variable=npal) | 
					
						
							| 
									
										
										
										
											2007-06-25 20:18:43 +00:00
										 |  |  | setupmenu.add_radiobutton(label='Linrad',command=pal_linrad, | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |             value=2,variable=npal) | 
					
						
							| 
									
										
										
										
											2007-06-25 20:18:43 +00:00
										 |  |  | setupmenu.add_radiobutton(label='Blue',command=pal_blue, | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |             value=3,variable=npal) | 
					
						
							| 
									
										
										
										
											2007-06-25 20:18:43 +00:00
										 |  |  | setupmenu.add_radiobutton(label='Hot',command=pal_Hot, | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |             value=4,variable=npal) | 
					
						
							| 
									
										
										
										
											2007-06-25 20:18:43 +00:00
										 |  |  | setupmenu.add_radiobutton(label='AFMHot',command=pal_AFMHot, | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |             value=5,variable=npal) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-04 17:44:39 +00:00
										 |  |  | lab1=Label(mbar,width=20,padx=20,bd=0) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | lab1.pack(side=LEFT) | 
					
						
							| 
									
										
										
										
											2007-07-04 17:44:39 +00:00
										 |  |  | fdf=Label(mbar,width=30,bd=0,anchor=W) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | fdf.pack(side=LEFT) | 
					
						
							| 
									
										
										
										
											2007-06-22 20:32:58 +00:00
										 |  |  | fdf2=Label(mbar,width=15,bd=0) | 
					
						
							|  |  |  | fdf2.pack(side=LEFT) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-08-18 19:25:52 +00:00
										 |  |  | lab3=Label(mbar,padx=13,bd=0) | 
					
						
							|  |  |  | lab3.pack(side=LEFT) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-08-19 14:56:56 +00:00
										 |  |  | lab0=Label(mbar,padx=10,bd=0) | 
					
						
							| 
									
										
										
										
											2006-08-18 19:25:52 +00:00
										 |  |  | lab0.pack(side=LEFT) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | #------------------------------------------------- Speed selection buttons | 
					
						
							| 
									
										
										
										
											2007-01-13 20:21:32 +00:00
										 |  |  | for i in (5, 4, 3, 2, 1): | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |     t=str(i) | 
					
						
							|  |  |  |     Radiobutton(mbar,text=t,value=i,variable=nspeed0).pack(side=RIGHT) | 
					
						
							| 
									
										
										
										
											2007-01-12 19:56:45 +00:00
										 |  |  | nspeed0.set(1) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | lab2=Label(mbar,text='Speed: ',bd=0) | 
					
						
							|  |  |  | lab2.pack(side=RIGHT) | 
					
						
							|  |  |  | #------------------------------------------------- Graphics frame | 
					
						
							|  |  |  | iframe1 = Frame(frame, bd=1, relief=SUNKEN) | 
					
						
							| 
									
										
										
										
											2007-01-11 17:03:39 +00:00
										 |  |  | c=Canvas(iframe1, bg='white', width=NX, height=25,bd=0) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | c.pack(side=TOP) | 
					
						
							| 
									
										
										
										
											2006-08-18 19:25:52 +00:00
										 |  |  | Widget.bind(c,"<Shift-Button-1>",freq_range) | 
					
						
							|  |  |  | Widget.bind(c,"<Shift-Button-2>",freq_range) | 
					
						
							|  |  |  | Widget.bind(c,"<Shift-Button-3>",freq_range) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-01-11 17:03:39 +00:00
										 |  |  | graph1=Canvas(iframe1, bg='black', width=NX, height=NY,bd=0,cursor='crosshair') | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | graph1.pack(side=TOP) | 
					
						
							|  |  |  | Widget.bind(graph1,"<Motion>",fdf_change) | 
					
						
							| 
									
										
										
										
											2007-06-22 20:32:58 +00:00
										 |  |  | Widget.bind(graph1,"<Button-1>",set_fqso) | 
					
						
							| 
									
										
										
										
											2007-06-28 18:34:13 +00:00
										 |  |  | Widget.bind(graph1,"<Double-Button-1>",freeze_decode1) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | iframe1.pack(expand=1, fill=X) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-01-11 17:03:39 +00:00
										 |  |  | c2=Canvas(iframe1, bg='white', width=NX, height=25,bd=0) | 
					
						
							| 
									
										
										
										
											2007-01-09 14:40:24 +00:00
										 |  |  | c2.pack(side=TOP) | 
					
						
							|  |  |  | Widget.bind(c2,"<Shift-Button-1>",freq_range) | 
					
						
							|  |  |  | Widget.bind(c2,"<Shift-Button-2>",freq_range) | 
					
						
							|  |  |  | Widget.bind(c2,"<Shift-Button-3>",freq_range) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-01-11 17:03:39 +00:00
										 |  |  | graph2=Canvas(iframe1, bg='black', width=NX, height=NY,bd=0,cursor='crosshair') | 
					
						
							| 
									
										
										
										
											2007-01-09 14:40:24 +00:00
										 |  |  | graph2.pack(side=TOP) | 
					
						
							| 
									
										
										
										
											2007-06-22 20:32:58 +00:00
										 |  |  | Widget.bind(graph2,"<Motion>",fdf_change2) | 
					
						
							| 
									
										
										
										
											2007-01-09 14:40:24 +00:00
										 |  |  | Widget.bind(graph2,"<Button-1>",set_freezedf) | 
					
						
							| 
									
										
										
										
											2007-06-28 18:34:13 +00:00
										 |  |  | Widget.bind(graph2,"<Double-Button-1>",freeze_decode2) | 
					
						
							| 
									
										
										
										
											2007-01-09 14:40:24 +00:00
										 |  |  | iframe1.pack(expand=1, fill=X) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | #-------------------------------------------------- Status frame | 
					
						
							|  |  |  | iframe2 = Frame(frame, bd=1, relief=SUNKEN) | 
					
						
							|  |  |  | status=Pmw.MessageBar(iframe2,entry_width=17,entry_relief=GROOVE) | 
					
						
							|  |  |  | status.pack(side=LEFT) | 
					
						
							|  |  |  | sc1=Scale(iframe2,from_=-100.0,to_=100.0,orient='horizontal', | 
					
						
							|  |  |  |     showvalue=0,sliderlength=5) | 
					
						
							|  |  |  | sc1.pack(side=LEFT) | 
					
						
							|  |  |  | sc2=Scale(iframe2,from_=-100.0,to_=100.0,orient='horizontal', | 
					
						
							|  |  |  |     showvalue=0,sliderlength=5) | 
					
						
							|  |  |  | sc2.pack(side=LEFT) | 
					
						
							|  |  |  | balloon.bind(sc1,"Brightness", "Brightness") | 
					
						
							|  |  |  | balloon.bind(sc2,"Contrast", "Contrast") | 
					
						
							|  |  |  | balloon.configure(statuscommand=status.helpmessage) | 
					
						
							| 
									
										
										
										
											2006-01-06 16:06:57 +00:00
										 |  |  | ltime=Label(iframe2,bg='black',fg='yellow',width=8,bd=2,font=('Helvetica',16)) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | ltime.pack(side=LEFT) | 
					
						
							|  |  |  | msg1=Label(iframe2,padx=2,bd=2,text=" ") | 
					
						
							|  |  |  | msg1.pack(side=LEFT) | 
					
						
							|  |  |  | sc3=Scale(iframe2,from_=-100.0,to_=100.0,orient='horizontal', | 
					
						
							|  |  |  |     showvalue=0,sliderlength=5) | 
					
						
							|  |  |  | sc3.pack(side=LEFT) | 
					
						
							|  |  |  | balloon.bind(sc3,"Gain", "Digital Gain") | 
					
						
							|  |  |  | iframe2.pack(expand=1, fill=X) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #----------------------------------------------- Restore params from INI file | 
					
						
							|  |  |  | try: | 
					
						
							| 
									
										
										
										
											2007-01-08 20:54:34 +00:00
										 |  |  |     f=open('MAP65.INI',mode='r') | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |     params=f.readlines() | 
					
						
							|  |  |  | except: | 
					
						
							|  |  |  |     params="" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | try: | 
					
						
							|  |  |  |     for i in range(len(params)): | 
					
						
							|  |  |  |         key,value=params[i].split() | 
					
						
							|  |  |  |         if   key == 'SpecJTGeometry': root.geometry(value) | 
					
						
							|  |  |  |         elif key == 'UpdateInterval': nspeed0.set(value) | 
					
						
							|  |  |  |         elif key == 'Brightness': sc1.set(value) | 
					
						
							|  |  |  |         elif key == 'Contrast': sc2.set(value) | 
					
						
							|  |  |  |         elif key == 'DigitalGain': sc3.set(value) | 
					
						
							|  |  |  |         elif key == 'AxisLabel': naxis.set(value) | 
					
						
							|  |  |  |         elif key == 'MarkTones': nmark.set(value) | 
					
						
							|  |  |  |         elif key == 'Flatten': nflat.set(value) | 
					
						
							|  |  |  |         elif key == 'Palette': g.cmap=value | 
					
						
							| 
									
										
										
										
											2006-08-18 19:25:52 +00:00
										 |  |  |         elif key == 'Frange': nfr.set(value) | 
					
						
							|  |  |  |         elif key == 'Fmid': fmid=int(value) | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |         else: pass | 
					
						
							|  |  |  | except: | 
					
						
							| 
									
										
										
										
											2007-01-08 20:54:34 +00:00
										 |  |  |     print 'Error reading MAP65.INI, continuing with defaults.' | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  |     print key,value | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  | #------------------------------------------------------  Select palette | 
					
						
							|  |  |  | if g.cmap == "gray0": | 
					
						
							|  |  |  |     pal_gray0() | 
					
						
							|  |  |  |     npal.set(0) | 
					
						
							|  |  |  | if g.cmap == "gray1": | 
					
						
							|  |  |  |     pal_gray1() | 
					
						
							|  |  |  |     npal.set(1) | 
					
						
							|  |  |  | if g.cmap == "Linrad": | 
					
						
							|  |  |  |     pal_linrad() | 
					
						
							|  |  |  |     npal.set(2) | 
					
						
							|  |  |  | if g.cmap == "blue": | 
					
						
							|  |  |  |     pal_blue() | 
					
						
							|  |  |  |     npal.set(3) | 
					
						
							|  |  |  | if g.cmap == "Hot": | 
					
						
							|  |  |  |     pal_Hot() | 
					
						
							|  |  |  |     npal.set(4) | 
					
						
							|  |  |  | if g.cmap == "AFMHot": | 
					
						
							|  |  |  |     pal_AFMHot() | 
					
						
							|  |  |  |     npal.set(5) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #---------------------------------------------- Display GUI and start mainloop | 
					
						
							| 
									
										
										
										
											2007-06-24 23:26:17 +00:00
										 |  |  | #draw_axis() | 
					
						
							|  |  |  | df_mark() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-07-05 03:49:02 +00:00
										 |  |  | try: | 
					
						
							|  |  |  |     ndevin=g.ndevin.get() | 
					
						
							|  |  |  | except: | 
					
						
							|  |  |  |     ndevin=0 | 
					
						
							|  |  |  | Audio.gcom1.ndevin=ndevin | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | try: | 
					
						
							|  |  |  |     ndevout=g.ndevout.get() | 
					
						
							|  |  |  | except: | 
					
						
							|  |  |  |     ndevout=0 | 
					
						
							|  |  |  | Audio.gcom1.ndevout=ndevout | 
					
						
							|  |  |  | 						# Only valid for windows | 
					
						
							|  |  |  |                                                 # for now | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | Audio.audio_init(ndevin,ndevout)                #Start the audio stream | 
					
						
							| 
									
										
										
										
											2006-07-05 03:49:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | ltime.after(200,update) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | root.deiconify() | 
					
						
							| 
									
										
										
										
											2006-01-11 19:04:51 +00:00
										 |  |  | g.showspecjt=2 | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | if g.Win32: root.iconbitmap("wsjt.ico") | 
					
						
							| 
									
										
										
										
											2007-06-26 14:20:11 +00:00
										 |  |  | root.title('Waterfall') | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | if(__name__=="__main__"): | 
					
						
							|  |  |  |     Audio.gcom2.monitoring=1 | 
					
						
							|  |  |  | root.mainloop() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #-------------------------------------------------- Save user params and quit | 
					
						
							| 
									
										
										
										
											2007-01-08 20:54:34 +00:00
										 |  |  | f=open('MAP65.INI',mode='w') | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | f.write("UpdateInterval " + str(nspeed0.get()) + "\n") | 
					
						
							|  |  |  | f.write("Brightness " + str(b0)+ "\n") | 
					
						
							|  |  |  | f.write("Contrast " + str(c0)+ "\n") | 
					
						
							|  |  |  | f.write("DigitalGain " + str(g0)+ "\n") | 
					
						
							|  |  |  | f.write("AxisLabel " + str(naxis.get()) + "\n") | 
					
						
							|  |  |  | f.write("MarkTones " + str(nmark.get()) + "\n") | 
					
						
							|  |  |  | f.write("Flatten " + str(nflat.get()) + "\n") | 
					
						
							|  |  |  | f.write("Palette " + g.cmap + "\n") | 
					
						
							| 
									
										
										
										
											2006-08-18 19:25:52 +00:00
										 |  |  | f.write("Frange " + str(nfr.get()) + "\n") | 
					
						
							|  |  |  | f.write("Fmid " + str(fmid) + "\n") | 
					
						
							| 
									
										
										
										
											2005-12-22 16:40:53 +00:00
										 |  |  | root_geom=root_geom[root_geom.index("+"):] | 
					
						
							|  |  |  | f.write("SpecJTGeometry " + root_geom + "\n") | 
					
						
							|  |  |  | f.close() | 
					
						
							|  |  |  | 
 |