def _build_subpanel(self, vbox_arg): # build a secondary information panel (sometimes hidden) # FIXME figure out how to have this be a subpanel that is always # created, but has its visibility controlled by foo.Show(True/False) if not (self.show_debug_info): return panel = self.panel vbox = vbox_arg myform = self.myform # panel = wx.Panel(self.panel, -1) # vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((5, 0), 0) myform["decim"] = form.static_float_field(parent=panel, sizer=hbox, label="Decim") hbox.Add((5, 0), 1) myform["fs@usb"] = form.static_float_field(parent=panel, sizer=hbox, label="Fs@USB") hbox.Add((5, 0), 1) myform["dbname"] = form.static_text_field(parent=panel, sizer=hbox) hbox.Add((5, 0), 1) myform["baseband"] = form.static_float_field(parent=panel, sizer=hbox, label="Analog BB") hbox.Add((5, 0), 1) myform["ddc"] = form.static_float_field(parent=panel, sizer=hbox, label="DDC") hbox.Add((5, 0), 0) vbox.Add(hbox, 0, wx.EXPAND)
def make_layout(self): bspace = 10 self.topbox.SetOrientation(wx.HORIZONTAL) self.SetPosition((200,100)) vbox = wx.BoxSizer(wx.VERTICAL) """ Title """ hbox = wx.BoxSizer(wx.VERTICAL) self.addrtitle = form.static_text_field(self, hbox) self.AddParam('title', self.SetAddrTitle) self.SetParam('title', "Address List : "+str(self.client.local) ) vbox.Add(hbox, 0, wx.ALIGN_LEFT|wx.ALL, border=0) """ AddressList """ hbox = wx.BoxSizer(wx.VERTICAL) self.refreshbox = form.button_with_callback(self, "Refresh", self.RefreshList) hbox.Add(self.refreshbox, wx.ALIGN_LEFT|wx.ALL, border=0) #self.optbox = form.static_text_field(self, hbox) self.optbox = wx.BoxSizer(wx.VERTICAL) hbox.Add(self.optbox, 0, wx.ALIGN_TOP|wx.ALIGN_BOTTOM, border=10) self.AddParam('refresh', self.RefreshList) self.SetParam('refresh') vbox.Add(hbox, 0, wx.ALIGN_LEFT|wx.ALL, border=0) vbox.AddSpacer( (10,10) ) self.topbox.Add(vbox, wx.GROW|wx.ALL, border=bspace)
def _build_subpanel(self, vbox_arg): # build a secondary information panel (sometimes hidden) # FIXME figure out how to have this be a subpanel that is always # created, but has its visibility controlled by foo.Show(True/False) def _form_set_decim(kv): return self.set_decim(kv['decim']) if not(self.show_debug_info): return panel = self.panel vbox = vbox_arg myform = self.myform #panel = wx.Panel(self.panel, -1) #vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((5,0), 0) myform['decim'] = form.int_field( parent=panel, sizer=hbox, label="Decim", callback=myform.check_input_and_call(_form_set_decim, self._set_status_msg)) hbox.Add((5,0), 1) myform['fs@usb'] = form.static_float_field( parent=panel, sizer=hbox, label="Fs@USB") hbox.Add((5,0), 1) myform['dbname'] = form.static_text_field( parent=panel, sizer=hbox) hbox.Add((5,0), 1) myform['baseband'] = form.static_float_field( parent=panel, sizer=hbox, label="Analog BB") hbox.Add((5,0), 1) myform['ddc'] = form.static_float_field( parent=panel, sizer=hbox, label="DDC") hbox.Add((5,0), 0) vbox.Add(hbox, 0, wx.EXPAND)
def _build_subpanel(self, vbox_arg): # build a secondary information panel (sometimes hidden) # FIXME figure out how to have this be a subpanel that is always # created, but has its visibility controlled by foo.Show(True/False) def _form_set_decim(kv): return self.set_decim(kv['decim']) if not (self.show_debug_info): return panel = self.panel vbox = vbox_arg myform = self.myform #panel = wx.Panel(self.panel, -1) #vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((5, 0), 0) myform['decim'] = form.int_field(parent=panel, sizer=hbox, label="Decim", callback=myform.check_input_and_call( _form_set_decim, self._set_status_msg)) hbox.Add((5, 0), 1) myform['fs@usb'] = form.static_float_field(parent=panel, sizer=hbox, label="Fs@USB") hbox.Add((5, 0), 1) myform['dbname'] = form.static_text_field(parent=panel, sizer=hbox) hbox.Add((5, 0), 1) myform['baseband'] = form.static_float_field(parent=panel, sizer=hbox, label="Analog BB") hbox.Add((5, 0), 1) myform['ddc'] = form.static_float_field(parent=panel, sizer=hbox, label="DDC") if self.num_inputs == 2: hbox.Add((1, 0), 1) myform['baseband2'] = form.static_float_field(parent=panel, sizer=hbox, label="BB2") hbox.Add((1, 0), 1) myform['ddc2'] = form.static_float_field(parent=panel, sizer=hbox, label="DDC2") hbox.Add((5, 0), 0) vbox.Add(hbox, 0, wx.EXPAND)
def make_debug(self): bspace = 20 nblank = 2 vbox = wx.BoxSizer(wx.VERTICAL) txbox = wx.BoxSizer(wx.VERTICAL) rxbox = wx.BoxSizer(wx.VERTICAL) self.txinfo = form.static_text_field(self, txbox, \ "Tx Info\n"+":::::::::::::"*4, "\n"*nblank) self.txinfo.f.Wrap(-1) self.AddParam('txinfo', self.SetTxInfo) self.rxinfo = form.static_text_field(self, rxbox, \ "Rx Info\n"+":::::::::::::"*4, "\n"*nblank) self.AddParam('rxinfo', self.SetRxInfo) txbox.SetItemMinSize(self.txinfo.f, (250,150) ) rxbox.SetItemMinSize(self.rxinfo.f, (250,150) ) vbox.Add(txbox, 0, wx.ALIGN_LEFT|wx.ALL, border=bspace) vbox.AddSpacer( (20,20) ) vbox.Add(rxbox, 0, wx.ALIGN_LEFT|wx.ALL, border=bspace) self.topbox.Add(vbox, wx.GROW|wx.ALL, border=bspace) self.dbox = vbox
def _build_subpanel(self, vbox_arg): # build a secondary information panel (sometimes hidden) # FIXME figure out how to have this be a subpanel that is always # created, but has its visibility controlled by foo.Show(True/False) if not (self.show_debug_info): return panel = self.panel vbox = vbox_arg myform = self.myform #panel = wx.Panel(self.panel, -1) #vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((5, 0), 0) myform['decim'] = form.static_float_field(parent=panel, sizer=hbox, label="Decim") hbox.Add((5, 0), 1) myform['fs@usb'] = form.static_float_field(parent=panel, sizer=hbox, label="Fs@USB") hbox.Add((5, 0), 1) myform['dbname'] = form.static_text_field(parent=panel, sizer=hbox) hbox.Add((5, 0), 1) myform['baseband'] = form.static_float_field(parent=panel, sizer=hbox, label="Analog BB") hbox.Add((5, 0), 1) myform['ddc'] = form.static_float_field(parent=panel, sizer=hbox, label="DDC") hbox.Add((5, 0), 0) vbox.Add(hbox, 0, wx.EXPAND)
def make_label(self, label, box, border=10, alignment=wx.HORIZONTAL): nbox = wx.BoxSizer(alignment) f = form.static_text_field(self, nbox, value=label) box.Add(nbox, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, border=border) return f
def __init__(self, frame, panel, vbox, argv, panel_info): stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv) signal_type = default_signal_type # not yet an option # command line options parser = OptionParser(option_class=eng_option) parser.add_option("-r", "--sample-rate",type="eng_float", default=default_rate, help="set flow graph sample rate [default=%s]" % default_rate) parser.add_option ("-f", "--freq", type="eng_float", default=default_freq, help="set signal frequency [default=%s]" % default_freq) parser.add_option ("-a", "--amplitude", type="eng_float", default=default_ampl, help="set signal amplitude [default %s]" % default_ampl) parser.add_option ("--gaussian", dest="noise_type", action="store_const", const=gr.GR_GAUSSIAN, help="generate Gaussian noise (-x is variance)", default=default_noise_type) parser.add_option ("--uniform", dest="noise_type", action="store_const", const=gr.GR_UNIFORM, help="generate Uniform noise (-x is peak-to-peak)") parser.add_option ("-x", "--noise_amplitude", type="eng_float", default=default_noise_ampl, help="set noise amplitude (variance or p-p) [default %s]" % default_noise_ampl) parser.add_option("-n", "--frame_decim", type="int", default=default_frame_decim, help="set oscope frame decimation factor to DECIM [default=%s]" % default_frame_decim) parser.add_option("-v", "--v_scale", type="eng_float", default=default_v_scale, help="set oscope initial V/div [default=%s]" % default_v_scale) parser.add_option("-t", "--t_scale", type="eng_float", default=default_t_scale, help="set oscope initial s/div [default=%s]" % default_t_scale) parser.add_option("-l", "--ref_level", type="eng_float", default=default_ref_level, help="set fft reference level [default=%sdB]" % default_ref_level) (options, args) = parser.parse_args () if len(args) != 0: parser.print_help() raise SystemExit, 1 # flow graph, including scope and fft frames sample_rate = int(options.sample_rate) # signal, noise sources need to be attributes so callbacks can get them self.signal = gr.sig_source_f(sample_rate, gr.GR_SIN_WAVE, options.freq, options.amplitude, 0.0) # Seed copied from example at cswiger/noise_source.html self.noise = gr.noise_source_f(options.noise_type, options.noise_amplitude, 2482) add = gr.add_ff() throttle = gr.throttle(gr.sizeof_float, sample_rate) (scope_title, scope_panel, scope_vbox) = panel_info[1] #0 is ctrl panel scope = scopesink2.scope_sink_f(scope_panel, sample_rate=sample_rate, frame_decim=options.frame_decim, v_scale=options.v_scale, t_scale=options.t_scale) scope_vbox.Add (scope.win, 1, wx.EXPAND) fft_size = 256 (fft_title, fft_panel, fft_vbox) = panel_info[2] # 0 is control panel fft = fftsink2.fft_sink_f (fft_panel,title=fft_title, fft_size=fft_size*2, sample_rate=sample_rate, baseband_freq=0, ref_level=options.ref_level, y_per_div=10) fft_vbox.Add (fft.win, 1, wx.EXPAND) self.connect (self.signal, (add,0)) self.connect (self.noise, (add,1)) self.connect (add, throttle) # self.connect (throttle, (scope, 0)) # self.connect (throttle, (scope, 1)) # can't leave scope in unconnected self.connect (throttle, scope) self.connect (throttle, fft) # control panel frame sliders = form.form() vbox.Add((0,10), 0) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((10,0), 0) sliders['signal_type'] = form.static_text_field(parent=panel,sizer=hbox) vbox.Add(hbox, 0, wx.EXPAND) vbox.Add((0,10), 0) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((10,0), 0) sliders['signal_freq'] = form.slider_field(parent=panel, sizer=hbox, label="Frequency", weight=3, min=0, max=2*options.freq, callback=self.set_signal_freq) vbox.Add(hbox, 0, wx.EXPAND) vbox.Add((0,10), 0) hbox = wx.BoxSizer(wx.HORIZONTAL) # apparently you can rebind hbox hbox.Add((10,0), 0) sliders['signal_ampl'] = form.slider_field(parent=panel, sizer=hbox, label="Amplitude", weight=3, min=0, max=usrp_full_scale, callback=self.set_signal_ampl) vbox.Add(hbox, 0, wx.EXPAND) vbox.Add((0,20), 0) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((10,0), 0) sliders['noise_type'] = form.static_text_field(parent=panel,sizer=hbox) vbox.Add(hbox, 0, wx.EXPAND) vbox.Add((0,10), 0) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((10,0), 0) sliders['noise_ampl'] = form.slider_field(parent=panel, sizer=hbox, label="Amplitude", weight=3, min=0, max=usrp_full_scale, callback=self.set_noise_ampl) vbox.Add(hbox, 0, wx.EXPAND) vbox.Add((0,10), 0) sliders['signal_type'].set_value("Signal: %s" % signal_string[signal_type]) sliders['noise_type'].set_value("Noise: %s" % noise_string[options.noise_type]) sliders['signal_freq'].set_value(options.freq) sliders['signal_ampl'].set_value(options.amplitude) sliders['noise_ampl'].set_value(options.noise_amplitude)
def _build_gui(self, vbox): def _form_set_freq(kv): return self.set_freq(kv['freq']) def _form_set_dm(kv): return self.set_dm(kv['DM']) def _form_set_doppler(kv): return self.set_doppler(kv['Doppler']) # Position the FFT or Waterfall vbox.Add(self.scope.win, 5, wx.EXPAND) vbox.Add(self.chart.win, 5, wx.EXPAND) # add control area at the bottom self.myform = myform = form.form() hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((7, 0), 0, wx.EXPAND) vbox1 = wx.BoxSizer(wx.VERTICAL) myform['freq'] = form.float_field(parent=self.panel, sizer=vbox1, label="Center freq", weight=1, callback=myform.check_input_and_call( _form_set_freq, self._set_status_msg)) vbox1.Add((3, 0), 0, 0) # To show current Local Mean Sidereal Time myform['lmst_high'] = form.static_text_field(parent=self.panel, sizer=vbox1, label="Current LMST", weight=1) vbox1.Add((3, 0), 0, 0) # To show current spectral cursor data myform['spec_data'] = form.static_text_field(parent=self.panel, sizer=vbox1, label="Pulse Freq", weight=1) vbox1.Add((3, 0), 0, 0) # To show best pulses found in FFT output myform['best_pulse'] = form.static_text_field(parent=self.panel, sizer=vbox1, label="Best freq", weight=1) vbox1.Add((3, 0), 0, 0) vboxBogus = wx.BoxSizer(wx.VERTICAL) vboxBogus.Add((2, 0), 0, wx.EXPAND) vbox2 = wx.BoxSizer(wx.VERTICAL) g = self.subdev.gain_range() myform['gain'] = form.slider_field(parent=self.panel, sizer=vbox2, label="RF Gain", weight=1, min=int(g[0]), max=int(g[1]), callback=self.set_gain) vbox2.Add((6, 0), 0, 0) myform['average'] = form.slider_field(parent=self.panel, sizer=vbox2, label="Spectral Averaging", weight=1, min=1, max=200, callback=self.set_averaging) vbox2.Add((6, 0), 0, 0) myform['foldavg'] = form.slider_field( parent=self.panel, sizer=vbox2, label="Folder Averaging", weight=1, min=1, max=20, callback=self.set_folder_averaging) vbox2.Add((6, 0), 0, 0) #myform['volume'] = form.quantized_slider_field(parent=self.panel, sizer=vbox2, #label="Audio Volume", weight=1, range=(-20, 0, 0.5), callback=self.set_volume) #vbox2.Add((6,0), 0, 0) myform['DM'] = form.float_field( parent=self.panel, sizer=vbox2, label="DM", weight=1, callback=myform.check_input_and_call(_form_set_dm)) vbox2.Add((6, 0), 0, 0) myform['Doppler'] = form.float_field( parent=self.panel, sizer=vbox2, label="Doppler", weight=1, callback=myform.check_input_and_call(_form_set_doppler)) vbox2.Add((6, 0), 0, 0) # Baseband recording control buttonbox = wx.BoxSizer(wx.HORIZONTAL) self.record_control = form.button_with_callback( self.panel, label="Recording baseband: Off ", callback=self.toggle_recording) self.record_pulse_control = form.button_with_callback( self.panel, label="Recording pulses: Off ", callback=self.toggle_pulse_recording) buttonbox.Add(self.record_control, 0, wx.CENTER) buttonbox.Add(self.record_pulse_control, 0, wx.CENTER) vbox.Add(buttonbox, 0, wx.CENTER) hbox.Add(vbox1, 0, 0) hbox.Add(vboxBogus, 0, 0) hbox.Add(vbox2, wx.ALIGN_RIGHT, 0) vbox.Add(hbox, 0, wx.EXPAND) self._build_subpanel(vbox) self.lmst_timer = wx.PyTimer(self.lmst_timeout) self.lmst_timeout()
def _build_gui(self, vbox): def _form_set_freq(kv): return self.set_freq(kv['freq']) def _form_set_dm(kv): return self.set_dm(kv['DM']) def _form_set_doppler(kv): return self.set_doppler(kv['Doppler']) # Position the FFT or Waterfall vbox.Add(self.scope.win, 5, wx.EXPAND) vbox.Add(self.chart.win, 5, wx.EXPAND) # add control area at the bottom self.myform = myform = form.form() hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((7,0), 0, wx.EXPAND) vbox1 = wx.BoxSizer(wx.VERTICAL) myform['freq'] = form.float_field( parent=self.panel, sizer=vbox1, label="Center freq", weight=1, callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg)) vbox1.Add((3,0), 0, 0) # To show current Local Mean Sidereal Time myform['lmst_high'] = form.static_text_field( parent=self.panel, sizer=vbox1, label="Current LMST", weight=1) vbox1.Add((3,0), 0, 0) # To show current spectral cursor data myform['spec_data'] = form.static_text_field( parent=self.panel, sizer=vbox1, label="Pulse Freq", weight=1) vbox1.Add((3,0), 0, 0) # To show best pulses found in FFT output myform['best_pulse'] = form.static_text_field( parent=self.panel, sizer=vbox1, label="Best freq", weight=1) vbox1.Add((3,0), 0, 0) vboxBogus = wx.BoxSizer(wx.VERTICAL) vboxBogus.Add ((2,0), 0, wx.EXPAND) vbox2 = wx.BoxSizer(wx.VERTICAL) g = self.subdev.gain_range() myform['gain'] = form.slider_field(parent=self.panel, sizer=vbox2, label="RF Gain", weight=1, min=int(g[0]), max=int(g[1]), callback=self.set_gain) vbox2.Add((6,0), 0, 0) myform['average'] = form.slider_field(parent=self.panel, sizer=vbox2, label="Spectral Averaging", weight=1, min=1, max=200, callback=self.set_averaging) vbox2.Add((6,0), 0, 0) myform['foldavg'] = form.slider_field(parent=self.panel, sizer=vbox2, label="Folder Averaging", weight=1, min=1, max=20, callback=self.set_folder_averaging) vbox2.Add((6,0), 0, 0) #myform['volume'] = form.quantized_slider_field(parent=self.panel, sizer=vbox2, #label="Audio Volume", weight=1, range=(-20, 0, 0.5), callback=self.set_volume) #vbox2.Add((6,0), 0, 0) myform['DM'] = form.float_field( parent=self.panel, sizer=vbox2, label="DM", weight=1, callback=myform.check_input_and_call(_form_set_dm)) vbox2.Add((6,0), 0, 0) myform['Doppler'] = form.float_field( parent=self.panel, sizer=vbox2, label="Doppler", weight=1, callback=myform.check_input_and_call(_form_set_doppler)) vbox2.Add((6,0), 0, 0) # Baseband recording control buttonbox = wx.BoxSizer(wx.HORIZONTAL) self.record_control = form.button_with_callback(self.panel, label="Recording baseband: Off ", callback=self.toggle_recording) self.record_pulse_control = form.button_with_callback(self.panel, label="Recording pulses: Off ", callback=self.toggle_pulse_recording) buttonbox.Add(self.record_control, 0, wx.CENTER) buttonbox.Add(self.record_pulse_control, 0, wx.CENTER) vbox.Add(buttonbox, 0, wx.CENTER) hbox.Add(vbox1, 0, 0) hbox.Add(vboxBogus, 0, 0) hbox.Add(vbox2, wx.ALIGN_RIGHT, 0) vbox.Add(hbox, 0, wx.EXPAND) self._build_subpanel(vbox) self.lmst_timer = wx.PyTimer(self.lmst_timeout) self.lmst_timeout()
def build_gui(self): self.myform = myform = form.form() # Baseband controls bb_sbox = wx.StaticBox(parent=self.panel, label="Baseband Modulation") bb_vbox = wx.StaticBoxSizer( bb_sbox, wx.VERTICAL) # Holds all baseband controls as unit # First row of baseband controls (modulation type) mod_hbox = wx.BoxSizer(wx.HORIZONTAL) mod_hbox.Add((10, 0), 0, 0) myform['type'] = form.radiobox_field( parent=self.panel, label="Type", sizer=mod_hbox, value=None, callback=self.evt_set_waveform_type, weight=1, major_dimension=0, choices=usrp2_siggen.waveforms.values()) bb_vbox.Add((0, 10), 0, 0) bb_vbox.Add(mod_hbox, 0, wx.EXPAND) # Second row of baseband controls (frequencies) bbf_hbox = wx.BoxSizer(wx.HORIZONTAL) bbf_hbox.Add((10, 0), 0, 0) myform['w1freq'] = form.float_field( parent=self.panel, sizer=bbf_hbox, label="Frequency 1 (Hz)", weight=1, callback=myform.check_input_and_call(self.evt_set_freq1, self.evt_set_status_msg)) bbf_hbox.Add((10, 0), 0, 0) myform['w2freq'] = form.float_field( parent=self.panel, sizer=bbf_hbox, label="Frequency 2 (Hz)", weight=1, callback=myform.check_input_and_call(self.evt_set_freq2, self.evt_set_status_msg)) bbf_hbox.Add((10, 0), 0, 0) bb_vbox.Add((0, 10), 0, 0) bb_vbox.Add(bbf_hbox, 0, wx.EXPAND) # Add baseband controls to top window sizer self.vbox.Add((0, 10), 0, 0) self.vbox.Add(bb_vbox, 0, wx.EXPAND) # Frequency controls fc_sbox = wx.StaticBox(parent=self.panel, label="Center Frequency") fc_vbox = wx.StaticBoxSizer( fc_sbox, wx.VERTICAL) # Holds all frequency controls as unit # First row of frequency controls (center frequency) freq_hbox = wx.BoxSizer(wx.HORIZONTAL) freq_hbox.Add((10, 0), 0, 0) myform['freq'] = form.float_field(parent=self.panel, sizer=freq_hbox, label=None, weight=1, callback=myform.check_input_and_call( self.evt_set_freq, self.evt_set_status_msg)) freq_hbox.Add((10, 0), 0, 0) myform['freq_slider'] = form.quantized_slider_field( parent=self.panel, sizer=freq_hbox, label="Min-Max", weight=4, range=(self.min_freq, self.max_freq, self.freq_step), callback=self.evt_set_freq) freq_hbox.Add((10, 0), 0, 0) fc_vbox.Add((10, 0), 0, 0) fc_vbox.Add(freq_hbox, 0, wx.EXPAND) # Second row of frequency controls (results) tr_hbox = wx.BoxSizer(wx.HORIZONTAL) tr_hbox.Add((10, 0), 0, 0) myform['analog'] = form.static_float_field(parent=self.panel, sizer=tr_hbox, label="Daughterboard: (Hz)", weight=1) tr_hbox.Add((10, 0), 0, 0) myform['DDC'] = form.static_float_field(parent=self.panel, sizer=tr_hbox, label="USRP2 DDC (Hz)", weight=1) tr_hbox.Add((10, 0), 0, 0) fc_vbox.Add(tr_hbox, 0, wx.EXPAND) # Add frequency controls to top window sizer self.vbox.Add((0, 10), 0, 0) self.vbox.Add(fc_vbox, 0, wx.EXPAND) # Amplitude row amp_sbox = wx.StaticBox(parent=self.panel, label="Amplitude") amp_hbox = wx.StaticBoxSizer(amp_sbox, wx.HORIZONTAL) amp_hbox.Add((10, 0), 0, 0) myform['amp'] = form.float_field(parent=self.panel, sizer=amp_hbox, label="Linear\n(0.0-1.0)", weight=1, callback=myform.check_input_and_call( self.evt_set_amplitude, self.evt_set_status_msg)) amp_hbox.Add((10, 0), 0, 0) myform['amp_slider'] = form.quantized_slider_field( parent=self.panel, sizer=amp_hbox, label="dB Full Scale\n(-100-0)", weight=4, range=(-100.0, 0.0, 1), callback=self.evt_set_amplitude) amp_hbox.Add((10, 0), 0, 0) self.vbox.Add((0, 10), 0, 0) self.vbox.Add(amp_hbox, 0, wx.EXPAND) # Sample rate row sam_sbox = wx.StaticBox(parent=self.panel, label="Sample Rate") sam_hbox = wx.StaticBoxSizer(sam_sbox, wx.HORIZONTAL) sam_hbox.Add((10, 0), 0, 0) myform['interp'] = form.int_field(parent=self.panel, sizer=sam_hbox, label="Interpolation", weight=1, callback=self.evt_set_interp) sam_hbox.Add((10, 0), 0, 0) myform['eth'] = form.static_float_field(parent=self.panel, sizer=sam_hbox, label="Sample Rate (sps)", weight=1) sam_hbox.Add((10, 0), 0, 0) myform['gbe'] = form.static_float_field(parent=self.panel, sizer=sam_hbox, label="GbE Rate (bits/sec)", weight=1) sam_hbox.Add((10, 0), 0, 0) self.vbox.Add((0, 10), 0, 0) self.vbox.Add(sam_hbox, 0, wx.EXPAND) # USRP2 row u2_sbox = wx.StaticBox(parent=self.panel, label="USRP2 Hardware") u2_hbox = wx.StaticBoxSizer(u2_sbox, wx.HORIZONTAL) u2_hbox.Add((10, 0), 0, 0) myform['ifc'] = form.static_text_field(parent=self.panel, sizer=u2_hbox, label="Interface", weight=2) u2_hbox.Add((10, 0), 0, 0) myform['mac'] = form.static_text_field(parent=self.panel, sizer=u2_hbox, label="MAC Address", weight=2) u2_hbox.Add((10, 0), 0, 0) myform['dbid'] = form.static_text_field(parent=self.panel, sizer=u2_hbox, label="Daughterboard ID", weight=1) self.vbox.Add((0, 10), 0, 0) self.vbox.Add(u2_hbox, 0, wx.EXPAND) self.vbox.Add((0, 20), 0, 0)
def _build_gui(self, vbox): def _form_set_freq(kv): # Adjust current SETI frequency, and limits self.setifreq_lower = kv['freq'] - (self.seti_freq_range/2) self.setifreq_current = kv['freq'] self.setifreq_upper = kv['freq'] + (self.seti_freq_range/2) # Reset SETI analysis timer self.seti_then = time.time() # Zero-out hits array when changing frequency self.hits_array[:,:] = 0.0 self.hit_intensities[:,:] = -60.0 return self.set_freq(kv['freq']) def _form_set_decln(kv): return self.set_decln(kv['decln']) # Position the FFT display vbox.Add(self.scope.win, 15, wx.EXPAND) if self.setimode == False: # Position the Total-power stripchart vbox.Add(self.chart.win, 15, wx.EXPAND) # add control area at the bottom self.myform = myform = form.form() hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((7,0), 0, wx.EXPAND) vbox1 = wx.BoxSizer(wx.VERTICAL) myform['freq'] = form.float_field( parent=self.panel, sizer=vbox1, label="Center freq", weight=1, callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg)) vbox1.Add((4,0), 0, 0) myform['lmst_high'] = form.static_text_field( parent=self.panel, sizer=vbox1, label="Current LMST", weight=1) vbox1.Add((4,0), 0, 0) if self.setimode == False: myform['spec_data'] = form.static_text_field( parent=self.panel, sizer=vbox1, label="Spectral Cursor", weight=1) vbox1.Add((4,0), 0, 0) vbox2 = wx.BoxSizer(wx.VERTICAL) if self.setimode == False: vbox3 = wx.BoxSizer(wx.VERTICAL) g = self.subdev[0].gain_range() myform['gain'] = form.slider_field(parent=self.panel, sizer=vbox2, label="RF Gain", weight=1, min=int(g[0]), max=int(g[1]), callback=self.set_gain) vbox2.Add((4,0), 0, 0) if self.setimode == True: max_savg = 100 else: max_savg = 3000 myform['average'] = form.slider_field(parent=self.panel, sizer=vbox2, label="Spectral Averaging (FFT frames)", weight=1, min=1, max=max_savg, callback=self.set_averaging) # Set up scan control button when in SETI mode if (self.setimode == True): # SETI scanning control buttonbox = wx.BoxSizer(wx.HORIZONTAL) self.scan_control = form.button_with_callback(self.panel, label="Scan: On ", callback=self.toggle_scanning) buttonbox.Add(self.scan_control, 0, wx.CENTER) vbox2.Add(buttonbox, 0, wx.CENTER) vbox2.Add((4,0), 0, 0) if self.setimode == False: myform['integration'] = form.slider_field(parent=self.panel, sizer=vbox2, label="Continuum Integration Time (sec)", weight=1, min=1, max=180, callback=self.set_integration) vbox2.Add((4,0), 0, 0) myform['decln'] = form.float_field( parent=self.panel, sizer=vbox2, label="Current Declination", weight=1, callback=myform.check_input_and_call(_form_set_decln)) vbox2.Add((4,0), 0, 0) if self.setimode == False: myform['offset'] = form.slider_field(parent=self.panel, sizer=vbox3, label="Post-Detector Offset", weight=1, min=-750, max=750, callback=self.set_pd_offset) vbox3.Add((2,0), 0, 0) myform['dcgain'] = form.slider_field(parent=self.panel, sizer=vbox3, label="Post-Detector Gain", weight=1, min=1, max=100, callback=self.set_pd_gain) vbox3.Add((2,0), 0, 0) hbox.Add(vbox1, 0, 0) hbox.Add(vbox2, wx.ALIGN_RIGHT, 0) if self.setimode == False: hbox.Add(vbox3, wx.ALIGN_RIGHT, 0) vbox.Add(hbox, 0, wx.EXPAND) self._build_subpanel(vbox) self.lmst_timer = wx.PyTimer(self.lmst_timeout) self.other_timer = wx.PyTimer(self.other_timeout)
def build_gui(self): self.myform = myform = form.form() # Baseband controls bb_sbox = wx.StaticBox(parent=self.panel, label="Baseband Modulation") bb_vbox = wx.StaticBoxSizer(bb_sbox, wx.VERTICAL) # Holds all baseband controls as unit # First row of baseband controls (modulation type) mod_hbox = wx.BoxSizer(wx.HORIZONTAL) mod_hbox.Add((10,0), 0, 0) myform['type'] = form.radiobox_field( parent=self.panel, label="Type", sizer=mod_hbox, value=None, callback=self.evt_set_waveform_type, weight=1, major_dimension=0, choices=usrp2_siggen.waveforms.values() ) bb_vbox.Add((0,10), 0, 0) bb_vbox.Add(mod_hbox, 0, wx.EXPAND) # Second row of baseband controls (frequencies) bbf_hbox = wx.BoxSizer(wx.HORIZONTAL) bbf_hbox.Add((10,0), 0, 0) myform['w1freq'] = form.float_field( parent=self.panel, sizer=bbf_hbox, label="Frequency 1 (Hz)", weight=1, callback=myform.check_input_and_call(self.evt_set_freq1, self.evt_set_status_msg) ) bbf_hbox.Add((10,0), 0, 0) myform['w2freq'] = form.float_field( parent=self.panel, sizer=bbf_hbox, label="Frequency 2 (Hz)", weight=1, callback=myform.check_input_and_call(self.evt_set_freq2, self.evt_set_status_msg) ) bbf_hbox.Add((10,0), 0, 0) bb_vbox.Add((0,10), 0, 0) bb_vbox.Add(bbf_hbox, 0, wx.EXPAND) # Add baseband controls to top window sizer self.vbox.Add((0,10), 0, 0) self.vbox.Add(bb_vbox, 0, wx.EXPAND) # Frequency controls fc_sbox = wx.StaticBox(parent=self.panel, label="Center Frequency") fc_vbox = wx.StaticBoxSizer(fc_sbox, wx.VERTICAL) # Holds all frequency controls as unit # First row of frequency controls (center frequency) freq_hbox = wx.BoxSizer(wx.HORIZONTAL) freq_hbox.Add((10,0), 0, 0) myform['freq'] = form.float_field( parent=self.panel, sizer=freq_hbox, label=None, weight=1, callback=myform.check_input_and_call(self.evt_set_freq, self.evt_set_status_msg) ) freq_hbox.Add((10,0), 0, 0) myform['freq_slider'] = form.quantized_slider_field( parent=self.panel, sizer=freq_hbox, label="Min-Max", weight=4, range = (self.min_freq, self.max_freq, self.freq_step), callback=self.evt_set_freq) freq_hbox.Add((10,0), 0, 0) fc_vbox.Add((10,0), 0, 0) fc_vbox.Add(freq_hbox, 0, wx.EXPAND) # Second row of frequency controls (results) tr_hbox = wx.BoxSizer(wx.HORIZONTAL) tr_hbox.Add((10,0), 0, 0) myform['analog'] = form.static_float_field( parent=self.panel, sizer=tr_hbox, label="Daughterboard: (Hz)", weight=1) tr_hbox.Add((10,0), 0, 0) myform['DDC'] = form.static_float_field( parent=self.panel, sizer=tr_hbox, label="USRP2 DDC (Hz)", weight=1) tr_hbox.Add((10,0), 0, 0) fc_vbox.Add(tr_hbox, 0, wx.EXPAND) # Add frequency controls to top window sizer self.vbox.Add((0,10), 0, 0) self.vbox.Add(fc_vbox, 0, wx.EXPAND) # Amplitude row amp_sbox = wx.StaticBox(parent=self.panel, label="Amplitude") amp_hbox = wx.StaticBoxSizer(amp_sbox, wx.HORIZONTAL) amp_hbox.Add((10,0), 0, 0) myform['amp'] = form.float_field( parent=self.panel, sizer=amp_hbox, label="Linear\n(0.0-1.0)", weight=1, callback=myform.check_input_and_call(self.evt_set_amplitude, self.evt_set_status_msg) ) amp_hbox.Add((10,0), 0, 0) myform['amp_slider'] = form.quantized_slider_field( parent=self.panel, sizer=amp_hbox, label="dB Full Scale\n(-100-0)", weight=4, range=(-100.0, 0.0, 1), callback=self.evt_set_amplitude) amp_hbox.Add((10,0), 0, 0) self.vbox.Add((0,10), 0, 0) self.vbox.Add(amp_hbox, 0, wx.EXPAND) # Sample rate row sam_sbox = wx.StaticBox(parent=self.panel, label="Sample Rate") sam_hbox = wx.StaticBoxSizer(sam_sbox, wx.HORIZONTAL) sam_hbox.Add((10,0), 0, 0) myform['interp'] = form.int_field( parent=self.panel, sizer=sam_hbox, label="Interpolation", weight=1, callback=self.evt_set_interp) sam_hbox.Add((10,0), 0, 0) myform['eth'] = form.static_float_field( parent=self.panel, sizer=sam_hbox, label="Sample Rate (sps)", weight=1) sam_hbox.Add((10,0), 0, 0) myform['gbe'] = form.static_float_field( parent=self.panel, sizer=sam_hbox, label="GbE Rate (bits/sec)", weight=1) sam_hbox.Add((10,0), 0, 0) self.vbox.Add((0,10), 0, 0) self.vbox.Add(sam_hbox, 0, wx.EXPAND) # USRP2 row u2_sbox = wx.StaticBox(parent=self.panel, label="USRP2 Hardware") u2_hbox = wx.StaticBoxSizer(u2_sbox, wx.HORIZONTAL) u2_hbox.Add((10,0), 0, 0) myform['ifc'] = form.static_text_field(parent=self.panel, sizer=u2_hbox, label="Interface", weight=2) u2_hbox.Add((10,0), 0, 0) myform['mac'] = form.static_text_field(parent=self.panel, sizer=u2_hbox, label="MAC Address", weight=2) u2_hbox.Add((10,0), 0, 0) myform['dbid'] = form.static_text_field(parent=self.panel, sizer=u2_hbox, label="Daughterboard ID", weight=1) self.vbox.Add((0,10), 0, 0) self.vbox.Add(u2_hbox, 0, wx.EXPAND) self.vbox.Add((0,20), 0, 0)
def make_control(self): bspace = 10 PyHydra.control.make_control(self) self.AddLocalMacAddress() """ Create MCS choicebox_field """ box = wx.BoxSizer(wx.HORIZONTAL) self.make_label("MCS", box, 35) self.mcsfield = PyHydra.choicebox_field(self, box, \ value="Auto", callback = self.SetMCS, \ choices = MimoControl.MCS_CHOICES) self.mcsfield.f.SetToolTipString("Select Modulation and Coding Scheme") self.AddParam('rate', self.SetMCS) self.AddParam('mcs', self.SetMCS) if self.options.rate<0: self.SetParam('mcs', "Auto") else: self.SetParam('mcs', self.options.rate) self.cbox.Add (box, 0, wx.ALIGN_LEFT|wx.ALL, border = bspace) ## Create divider divider = PyHydra.Divider(self) divider.SetBackgroundColour(wx.Colour(200,200,200) ) self.cbox.AddSpacer((10,10)) self.cbox.Add(divider, 0, wx.EXPAND|wx.GROW) self.cbox.AddSpacer((10,10)) """ Packet Detector Threshold """ box = wx.BoxSizer(wx.VERTICAL) self.pd_threshold = form.slider_field(self, box, \ "Packet Detector Threshold (%)", value=self.options.pd_threshold, callback=self.SetPacketDetectorThreshold, min=20, max=100) self.AddParam('pd_threshold', self.SetPacketDetectorThreshold) self.SetParam('pd_threshold', self.options.pd_threshold) self.cbox.Add(box, 0, wx.ALIGN_LEFT|wx.ALL, border=bspace) """ Enable Beamforming """ box = wx.BoxSizer(wx.HORIZONTAL) self.make_label("Enable Beamforming: ", box, 20) self.enable_beamforming = form.radiobox_field(self, box, label="", \ value = MimoControl.ENABLE_CHOICES[self.options.enable_beamforming], \ callback=self.SetEnableBeamforming, \ choices = MimoControl.ENABLE_CHOICES, major_dimension=0) #box.Hide(1, recursive=True), box.Remove(1) # Remove default form label self.enable_beamforming.f.SetLabel("") self.AddParam('enable_beamforming', self.SetEnableBeamforming) self.SetParam('enable_beamforming', self.options.enable_beamforming) self.cbox.Add(box, 0, wx.ALIGN_LEFT|wx.ALL, border=bspace) """ MAC Monitor Address """ vbox = wx.BoxSizer(wx.VERTICAL) self.monitor = MimoControl.BROADCAST_ADDR f = form.static_text_field(self, vbox, value="Monitoring MAC Address: ") vbox.AddSpacer((10,10) ) box = wx.BoxSizer(wx.HORIZONTAL) self.fmonitor = form.text_field(self, box, \ value="FF:"*(mimo.mac_monitor.MAC_ADDR_SIZE-1)+"FF", \ callback=self.SetMonitor, weight=1) self.AddParam('mac_monitor', self.SetMonitor) box.AddSpacer((10,10) ) self.enable_monitor = form.checkbox_field(self, box, "monitor?", \ value=False, callback=self.SetEnableMonitor, \ weight=0) box.AddSpacer((100,10) ) vbox.Add(box, 0, wx.EXPAND) self.cbox.Add(vbox, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL, border=bspace) self.Fit()