def _build_gui(self, vbox): def _form_set_freq(kv): return self.set_freq(kv['freq']) vbox.Add(self.scope.win, 10, wx.EXPAND) # add control area at the bottom self.myform = myform = form.form() hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((5,0), 0, 0) myform['freq'] = form.float_field( parent=self.panel, sizer=hbox, label="Center freq", weight=1, callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg)) hbox.Add((5,0), 0, 0) g = self.subdevm.gain_range() myform['gain'] = form.slider_field(parent=self.panel, sizer=hbox, label="Gain", weight=3, min=int(g[0]), max=int(g[1]), callback=self.set_gain) hbox.Add((5,0), 0, 0) buttonSync = form.button_with_callback(parent=self.panel, label='sync',callback=self.sync_usrps) hbox.Add(buttonSync,0,wx.EXPAND) hbox.Add((5,0), 0, 0) vbox.Add(hbox, 0, wx.EXPAND) self._build_subpanel(vbox)
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 make_layout(self): self.topbox.SetOrientation(wx.HORIZONTAL) self.button = form.button_with_callback(self, "Add Plot", self.AddPlot) self.topbox.Add(self.button, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, border=20) self.AddPlot() self.AddParam("format", self.SetFormat) self.AddParam("color", self.SetColor) self.AddParam("shape", self.SetShape) self.AddParam("data", self.SetData) self.Fit()
def _create_set_freq(self): def _set_freq(kv): return self.flexrf.set_freq(kv['freq'])[0] sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.HORIZONTAL) sbs.Add((5,0), 0.1) # stretchy space #sbs.Add(wx.StaticText(self.panel, -1, "set_freq "), 0, 0) #sbs.Add((5,0), 0.1) # stretchy space myform = form.form() myform['freq'] = form.float_field(self.panel, sbs, "Set Frequency") sbs.Add((5,0), 0.1) # stretchy space sbs.Add(form.button_with_callback(self.panel, "Do It!", self._generic_doit(_set_freq, myform)), 1, wx.EXPAND) sbs.Add((5,0), 0.1) # stretchy space self.vbox.Add(sbs, 0, wx.EXPAND)
def _create_write_it(self): def _write_it(kv): self.flexrf._write_it(kv['v']) # void return True sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.HORIZONTAL) sbs.Add((5,0), 0.1) # stretchy space sbs.Add(wx.StaticText(self.panel, -1, "write_it "), 0, 0) sbs.Add((5,0), 0.1) # stretchy space myform = form.form() myform['v'] = form.int_field(self.panel, sbs, "24-bit value") sbs.Add((5,0), 0.1) # stretchy space sbs.Add(form.button_with_callback(self.panel, "Do It!", self._generic_doit(_write_it, myform)), 1, wx.EXPAND) sbs.Add((5,0), 0.1) # stretchy space self.vbox.Add(sbs, 0, wx.EXPAND)
def _create_set_freq(self): def _set_freq(kv): return self.flexrf.set_freq(kv['freq'])[0] sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.HORIZONTAL) sbs.Add((5, 0), 0.1) # stretchy space #sbs.Add(wx.StaticText(self.panel, -1, "set_freq "), 0, 0) #sbs.Add((5,0), 0.1) # stretchy space myform = form.form() myform['freq'] = form.float_field(self.panel, sbs, "Set Frequency") sbs.Add((5, 0), 0.1) # stretchy space sbs.Add( form.button_with_callback(self.panel, "Do It!", self._generic_doit(_set_freq, myform)), 1, wx.EXPAND) sbs.Add((5, 0), 0.1) # stretchy space self.vbox.Add(sbs, 0, wx.EXPAND)
def _create_write_fpga(self): def _write_fpga(kv): return self.flexrf._u._write_fpga_reg(kv['regno'], kv['value']) sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.HORIZONTAL) sbs.Add((5,0), 0.1) # stretchy space sbs.Add(wx.StaticText(self.panel, -1, "write_fpga_reg "), 0, 0) sbs.Add((5,0), 0.1) # stretchy space myform = form.form() myform['regno'] = form.int_field(self.panel, sbs, "regno") sbs.Add((5,0), 0.1) # stretchy space myform['value'] = form.int_field(self.panel, sbs, "value") sbs.Add((5,0), 0.1) # stretchy space sbs.Add(form.button_with_callback(self.panel, "Do It!", self._generic_doit(_write_fpga, myform)), 1, wx.EXPAND) sbs.Add((5,0), 0.1) # stretchy space self.vbox.Add(sbs, 0, wx.EXPAND)
def _create_write_it(self): def _write_it(kv): self.flexrf._write_it(kv['v']) # void return True sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.HORIZONTAL) sbs.Add((5, 0), 0.1) # stretchy space sbs.Add(wx.StaticText(self.panel, -1, "write_it "), 0, 0) sbs.Add((5, 0), 0.1) # stretchy space myform = form.form() myform['v'] = form.int_field(self.panel, sbs, "24-bit value") sbs.Add((5, 0), 0.1) # stretchy space sbs.Add( form.button_with_callback(self.panel, "Do It!", self._generic_doit(_write_it, myform)), 1, wx.EXPAND) sbs.Add((5, 0), 0.1) # stretchy space self.vbox.Add(sbs, 0, wx.EXPAND)
def _create_write_fpga(self): def _write_fpga(kv): return self.flexrf._u._write_fpga_reg(kv['regno'], kv['value']) sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.HORIZONTAL) sbs.Add((5, 0), 0.1) # stretchy space sbs.Add(wx.StaticText(self.panel, -1, "write_fpga_reg "), 0, 0) sbs.Add((5, 0), 0.1) # stretchy space myform = form.form() myform['regno'] = form.int_field(self.panel, sbs, "regno") sbs.Add((5, 0), 0.1) # stretchy space myform['value'] = form.int_field(self.panel, sbs, "value") sbs.Add((5, 0), 0.1) # stretchy space sbs.Add( form.button_with_callback(self.panel, "Do It!", self._generic_doit(_write_fpga, myform)), 1, wx.EXPAND) sbs.Add((5, 0), 0.1) # stretchy space self.vbox.Add(sbs, 0, wx.EXPAND)
def make_layout(self): self.button = form.button_with_callback(self, "MyButton", self.OnClick) self.topbox.Add(self.button, 0, wx.ALL, border=20)
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, 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 CreateOpt(self, addr): aspace = 10 newopt = form.button_with_callback(self, \ " "*aspace + "%s"%(str(addr) ) + " "*aspace, \ lambda *args: self.SetDest(addr) ) return newopt